Hi Pavel, On 9/17/19 2:42 PM, Pavel Machek wrote: > Hi! > >>>>> +++ b/drivers/leds/leds-lm3532.c >>>>> @@ -629,7 +629,7 @@ static int lm3532_parse_node(struct lm3532_data *priv) >>>>> >>>>> lm3532_init_registers(led); >>>>> >>>>> - ret = devm_led_classdev_register(priv->dev, &led->led_dev); >>>>> + ret = devm_of_led_classdev_register(priv->dev, >>>>> to_of_node(child), &led->led_dev); >>>> >>>> We no longer have devm_of_led_classdev_register(). You must use >>>> devm_led_classdev_register_ext(). >>> >>> Something like this (untested)? > >> If you want to properly switch to the new extended LED registration >> API, then you need: >> >> .default_label = ":", >> .devicename = led->client->name; >> >> and in addition to that you need to remove old way of composing >> the LED name. Something like patch [0] for leds-lm3692x.c. >> And also patch for DT for consistency would be needed (like [1]). >> >> However it will not change anything in LED naming in comparison >> to the existing code, except that it will enable the possibility >> of using 'function' and 'color' DT properties instead of deprecated >> 'label'. >> >> I suppose that you expected some extra bonus by passing >> DT node, but I'm not sure what exactly. Possibly you confused >> this with the patch set [2] that allows for instantiating >> backlight device on top of LED class device (it has been forgotten >> btw and will miss 5.4). > > Yes, it is for LED backlight. Thanks for hints, you have corrected > version in your inbox.
You need also below cleanups. Please compare my patches reworking existing drivers in the for-next branch. diff --git a/drivers/leds/leds-lm3532.c b/drivers/leds/leds-lm3532.c index 0507c6575c08..fc166f1a1789 100644 --- a/drivers/leds/leds-lm3532.c +++ b/drivers/leds/leds-lm3532.c @@ -9,7 +9,6 @@ #include <linux/types.h> #include <linux/regulator/consumer.h> #include <linux/module.h> -#include <uapi/linux/uleds.h> #include <linux/gpio/consumer.h> #define LM3532_NAME "lm3532-led" @@ -128,7 +127,6 @@ struct lm3532_als_data { * @full_scale_current - The full-scale current setting for the current sink. * @led_strings - The LED strings supported in this array * @enabled - Enabled status - * @label - LED label */ struct lm3532_led { struct led_classdev led_dev; @@ -141,7 +139,6 @@ struct lm3532_led { int full_scale_current; int enabled:1; u32 led_strings[LM3532_MAX_CONTROL_BANKS]; - char label[LED_MAX_NAME_SIZE]; }; /** @@ -639,16 +636,7 @@ static int lm3532_parse_node(struct lm3532_data *priv) fwnode_property_read_string(child, "linux,default-trigger", &led->led_dev.default_trigger); - ret = fwnode_property_read_string(child, "label", &name); - if (ret) - snprintf(led->label, sizeof(led->label), - "%s::", priv->client->name); - else - snprintf(led->label, sizeof(led->label), - "%s:%s", priv->client->name, name); - led->priv = priv; - led->led_dev.name = led->label; led->led_dev.brightness_set_blocking = lm3532_brightness_set; ret = devm_led_classdev_register(priv->dev, &led->led_dev); -- Best regards, Jacek Anaszewski