@@ -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);
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@nic.cz> Cc: H. Nikolaus Schaller <hns@goldelico.com> Cc: Grant Feng <von81@163.com> --- drivers/leds/leds-is31fl319x.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)