Re: [PATCH v5 6/7] leds: Add fwnode_led_get() for firmware-agnostic LED resolution

From: Andriy Shevencho

Date: Tue Dec 30 2025 - 07:00:53 EST


On Tue, Dec 30, 2025 at 09:23:19PM +1300, Jonathan Brophy wrote:

> Add fwnode_led_get() to resolve LED class devices from firmware node
> references, providing a firmware-agnostic alternative to of_led_get().
>
> The function supports:
> - Device Tree and ACPI systems

...and software nodes (board files) I think also fall into this category.

> - GPIO LEDs (which may lack struct device)
> - Platform LED controllers
> - Deferred probing via -EPROBE_DEFER
> - Reference counting via led_module_get()
>
> Implementation details:
> - Uses fwnode_property_get_reference_args() for property traversal
> - Falls back to of_led_get() for Device Tree GPIO LEDs
> - Returns optional parent device reference for power management
> - Handles NULL parent devices gracefully (common for GPIO LEDs)
>
> This enables LED resolution using generic firmware APIs while
> maintaining compatibility with existing OF-specific LED drivers.
> Future migration to full fwnode support in LED core will be
> straightforward.

...

> - return sysfs_emit(buf, "%u\n", brightness);
> + return sprintf(buf, "%u\n", brightness);

Huh?!

This seems like indeliberate revert. Otherwise it's so wrong.

Ditto. for all same issues.

...

> -static const BIN_ATTR(trigger, 0644, led_trigger_read, led_trigger_write, 0);
> -static const struct bin_attribute *const led_trigger_bin_attrs[] = {
> +static BIN_ATTR(trigger, 0644, led_trigger_read, led_trigger_write, 0);

Why?! Don't we have a mechanism to add more groups on-the-fly?

...

> +#define LED_BLINK_BRIGHTNESS_CHANGE 4

Mixed TABs and spaces.

...

> + unsigned gpio;

Ditto.
Besides we should get rid of this completely (it's deprecated APIs that is on
removal stage).

...

> + int num_leds;

TABs/spaces mix.

...

I have a felling that this patch is doing too many things at once. Please, try
to split (my brief look suggests that 3+ patches should come out of this one).

--
With Best Regards,
Andy Shevchenko