RE: [PATCH v1 1/1] leds: Unexport of_led_get()
From: Jonathan Brophy
Date: Wed Dec 10 2025 - 13:31:22 EST
> Can you elaborate? I think your downstream code (I have no other ideas where you Q came from)
> uses some outdated approaches. Try to look at the problem from the level of the existing APIs and
> frameworks. We shouldn't really have such an issue (but it might be some special use case, I admit).
I'm trying to create a virtual led driver but with the removal of of_led_get() im struggling to find a way to make it work.
I investigated alternative approaches to avoid of_led_get() dependency, including:
Direct class_find_device(led_class, ...) calls - Failed because led_class is not exported (static in led-class.c)
bus_find_device_by_fwnode() - Failed because LED devices are class devices, not bus devices
Manual iteration via class_dev_iter_init() - Failed because I cannot obtain the led_class pointer
of_led_get() appears to be the only viable solution because:
It's the only exported function with access to the non-exported leds_class
It handles GPIO LED matching quirks (parent node vs child node)
It provides proper reference counting via led_put()
Should led_class be exported, or is there a planned fwnode-based alternative to of_led_get?
With Best Regards,
Jonathan brophy