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

Dan Williams
2024-05-29T04:22:30Z

Mariusz Tkaczyk wrote:
> PCI subsystem is registered on subsys_initcall() same as leds class.
> NPEM driver will require leds class, there is race possibility.

s/race possibility/an init-order conflict/

> Register led class on arch_initcall() to avoid it.

I assume a later patch selects CONFIG_LEDS_CLASS from CONFIG_PCI?
Otherwise this change will not help.

Another way to solve this without changing initcall levels is to just
make sure that the leds subsys initcall happens first, i.e.:

diff --git a/drivers/Makefile b/drivers/Makefile
index fe9ceb0d2288..d47b4186108a 100644
--- a/drivers/Makefile
+++ b/drivers/Makefile
@@ -16,6 +16,7 @@ obj-$(CONFIG_GENERIC_PHY) += phy/
obj-$(CONFIG_PINCTRL) += pinctrl/
obj-$(CONFIG_GPIOLIB) += gpio/
obj-y += pwm/
+obj-y += leds/

obj-y += pci/

@@ -130,7 +131,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/

...which may be more appropriate.