On Tue, 25 May 2021, Min Li wrote: > > Why do you need to track how many there are? > > > > We don't usually do that at all. You've cut away all of the context. Please keep all the context so that we and others know what we're referencing. > It is used to index the mfd_cell array, rsmu_cdev[RSMU_MAX_MFD_DEV] Why do you need to index the array? The devices look identical to me. Just have one entry for each type and register them in a for() loop. > The index is also used to enumerate the rsmu character device, say /dev/rsmu[0/1/2/3] You should be able to use platform_id or a similar built-in counting mechanism. There shouldn't be any requirement for you to hand-roll your own device counting solution. -- Lee Jones [李琼斯] Senior Technical Lead - Developer Services Linaro.org │ Open source software for Arm SoCs Follow Linaro: Facebook | Twitter | Blog