[PATCH leds v2 30/50] leds: is31fl319x: use struct led_init_data when registering

From: Marek Behún
Date: Thu Sep 17 2020 - 18:35:55 EST


By using struct led_init_data when registering we do not need to parse
`label` DT property. Moreover `label` is deprecated and if it is not
present but `color` and `function` are, LED core will compose a name
from these properties instead.

Signed-off-by: Marek Behún <marek.behun@xxxxxx>
Cc: H. Nikolaus Schaller <hns@xxxxxxxxxxxxx>
Cc: Grant Feng <von81@xxxxxxx>
---
drivers/leds/leds-is31fl319x.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/leds/leds-is31fl319x.c b/drivers/leds/leds-is31fl319x.c
index 15bdbc6378d93..ef5b3e08c7313 100644
--- a/drivers/leds/leds-is31fl319x.c
+++ b/drivers/leds/leds-is31fl319x.c
@@ -269,6 +269,7 @@ static int is31fl319x_led_register(struct device *dev,
struct is31fl319x_chip *is31,
struct device_node *np)
{
+ struct led_init_data init_data = {};
struct is31fl319x_led *led;
u32 reg;
int ret;
@@ -292,9 +293,6 @@ static int is31fl319x_led_register(struct device *dev,
return -EEXIST;
}

- if (of_property_read_string(np, "label", &led->cdev.name))
- led->cdev.name = np->name;
-
ret = of_property_read_string(np, "linux,default-trigger",
&led->cdev.default_trigger);
if (ret < 0 && ret != -EINVAL) /* is optional */
@@ -303,8 +301,9 @@ static int is31fl319x_led_register(struct device *dev,
led->configured = true;
led->chip = is31;
led->cdev.brightness_set_blocking = is31fl319x_brightness_set;
+ init_data.fwnode = of_fwnode_handle(np);

- ret = devm_led_classdev_register(dev, &led->cdev);
+ ret = devm_led_classdev_register_ext(dev, &led->cdev, &init_data);
if (ret)
dev_err(dev, "Failed to register LED for node %pOF\n", np);

--
2.26.2