Re: [PATCH v7 1/3] leds: Init leds class earlier

Lukas Wunner
2024-09-09T20:28:18Z

On Mon, Sep 09, 2024 at 10:03:40AM +0100, Lee Jones wrote:
> On Wed, 04 Sep 2024, Mariusz Tkaczyk wrote:
> > NPEM driver will require leds class, there is an init-order conflict.
> > Make sure that LEDs initialization happens first and add comment.
[...]
> > --- a/drivers/Makefile
> > +++ b/drivers/Makefile
> > @@ -17,6 +17,9 @@ obj-$(CONFIG_PINCTRL) += pinctrl/
> > obj-$(CONFIG_GPIOLIB) += gpio/
> > obj-y += pwm/
> >
> > +# LEDs must come before PCI, it is needed by NPEM driver
> > +obj-y += leds/
> > +
> > obj-y += pci/
> >
> > obj-$(CONFIG_PARISC) += parisc/
> > @@ -130,7 +133,6 @@ obj-$(CONFIG_CPU_IDLE) += cpuidle/
> > obj-y += mmc/
> > obj-y += ufs/
> > obj-$(CONFIG_MEMSTICK) += memstick/
> > -obj-y += leds/
> > obj-$(CONFIG_INFINIBAND) += infiniband/
> > obj-y += firmware/
> > obj-$(CONFIG_CRYPTO) += crypto/
>
> This seems very fragile.
>
> Isn't there a better way to describe the dependency in Kconfig etc?

In v2 of this series, the correct init order was ensured by
running leds_init() at "arch" initcall level, instead of "subsys":

https://lore.kernel.org/linux-pci/20240528131940.16924-2-mariusz.tkaczyk@linux.intel.com/

If you prefer this alternative approach, then Bjorn or Krzysztof
can probably replace the commit on the pci.git/npem branch.

AFAIK, all topic branches in pci.git are to be considered drafts
that can be amended until the pull request is sent.

Thanks,

Lukas