aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorJean-Jacques Hiblot <jjhiblot@ti.com>2019-09-20 13:58:06 +0200
committerPavel <pavel@ucw.cz>2019-11-03 17:37:35 +0100
commit5b4b723c483f5027da77409f34b8b4602ee1e557 (patch)
treee4b94aa7db17f860d7ad80781ec52bd88ec7d674 /drivers
parentleds: tlc591xx: simplify driver by using the managed led API (diff)
downloadlinux-dev-5b4b723c483f5027da77409f34b8b4602ee1e557.tar.xz
linux-dev-5b4b723c483f5027da77409f34b8b4602ee1e557.zip
leds: tlc591xx: use devm_led_classdev_register_ext()
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> Signed-off-by: Pavel Machek <pavel@ucw.cz>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/leds/leds-tlc591xx.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/leds/leds-tlc591xx.c b/drivers/leds/leds-tlc591xx.c
index bbdaa3148317..8eadb673dc2e 100644
--- a/drivers/leds/leds-tlc591xx.c
+++ b/drivers/leds/leds-tlc591xx.c
@@ -186,6 +186,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) {
@@ -200,8 +203,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);
@@ -209,7 +210,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);