lkml.org 
[lkml]   [2019]   [Sep]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH v3 2/2] leds: tlc591xx: use devm_led_classdev_register_ext()
Date
Use devm_led_classdev_register_ext() to pass the fwnode to the LED core.
The fwnode can then be used by the firmware core to create meaningful
names.

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
---
drivers/leds/leds-tlc591xx.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/leds/leds-tlc591xx.c b/drivers/leds/leds-tlc591xx.c
index 3d5a4b92f016..bab792ed59c3 100644
--- a/drivers/leds/leds-tlc591xx.c
+++ b/drivers/leds/leds-tlc591xx.c
@@ -184,6 +184,9 @@ tlc591xx_probe(struct i2c_client *client,

for_each_child_of_node(np, child) {
struct tlc591xx_led *led;
+ struct led_init_data init_data = {};
+
+ init_data.fwnode = of_fwnode_handle(child);

err = of_property_read_u32(child, "reg", &reg);
if (err) {
@@ -198,8 +201,6 @@ tlc591xx_probe(struct i2c_client *client,
led = &priv->leds[reg];

led->active = true;
- led->ldev.name =
- of_get_property(child, "label", NULL) ? : child->name;
led->ldev.default_trigger =
of_get_property(child, "linux,default-trigger", NULL);

@@ -207,7 +208,8 @@ tlc591xx_probe(struct i2c_client *client,
led->led_no = reg;
led->ldev.brightness_set_blocking = tlc591xx_brightness_set;
led->ldev.max_brightness = LED_FULL;
- err = devm_led_classdev_register(dev, &led->ldev);
+ err = devm_led_classdev_register_ext(dev, &led->ldev,
+ &init_data);
if (err < 0) {
dev_err(dev, "couldn't register LED %s\n",
led->ldev.name);
--
2.17.1
\
 
 \ /
  Last update: 2019-09-18 17:27    [W:0.077 / U:1.880 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site