Re: linux-next: build failure after merge of the leds tree

Jacek Anaszewski
2019-07-25T18:44:44Z

On 7/25/19 4:31 AM, Stephen Rothwell wrote:
> Hi all,
>
> After merging the leds tree, today's linux-next build (x86_64
> allmodconfig) failed like this:
>
> drivers/leds/leds-max77650.c: In function 'max77650_led_probe':
> drivers/leds/leds-max77650.c:121:8: error: implicit declaration of function 'devm_of_led_classdev_register'; did you mean 'devm_led_classdev_register'? [-Werror=implicit-function-declaration]
> rv = devm_of_led_classdev_register(dev, child, &led->cdev);
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> devm_led_classdev_register
>
> Caused by commit
>
> 4eba5b82096e ("leds: class: Improve LED and LED flash class registration API")
>
> interacting with commit
>
> 5be102eb161a ("leds: max77650: Add LEDs support")
>
> I have used the leds tree from next-20190724 for today.
>

I forgot about this driver jumping in lately.

But here is the fixup and the rationale:

devm_of_led_classdev_register() API has been useless from the beginning,
since it was just an initial portion of work aiming at adding some
generic DT parser. The actual parser had not been added up to this
commit which also switches the API:

devm_of_led_classdev_register(struct device *parent,
struct device_node *np,
struct led_classdev *led_cdev);

to:

devm_led_classdev_register_ext(struct device *parent,
struct led_classdev *led_cdev,
struct led_init_data *init_data)

To not break the bisectibility The remaining users of
devm_of_led_classdev_register are being fixed by this commit to use the
wrapper:

+#define devm_led_classdev_register(parent, led_cdev) \
+ devm_led_classdev_register_ext(parent, led_cdev, NULL)

leds-max77650.c is the one that was omitted, so I've just applied
the following fix to this commit:

diff --git a/drivers/leds/leds-max77650.c b/drivers/leds/leds-max77650.c
index 04738324b3e6..5a14f9775b0e 100644
--- a/drivers/leds/leds-max77650.c
+++ b/drivers/leds/leds-max77650.c
@@ -118,7 +118,7 @@ static int max77650_led_probe(struct platform_device
*pdev)
of_property_read_string(child, "linux,default-trigger",
&led->cdev.default_trigger);

- rv = devm_of_led_classdev_register(dev, child, &led->cdev);
+ rv = devm_led_classdev_register(dev, &led->cdev);
if (rv)
goto err_node_put;

and melded it with the original one to not break the bisect.

If you have any doubts please let me know.

Best regards,
Jacek Anaszewski