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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux