Hi Marek,
On 9/20/20 12:15 AM, Marek Behún wrote:
By using struct led_init_data when registering we do not need to parse
`label` nor `linux,default-trigger` 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: NeilBrown <neilb@xxxxxxx>
Cc: Linus Walleij <linus.walleij@xxxxxxxxxx>
Cc: H. Nikolaus Schaller <hns@xxxxxxxxxxxxx>
---
drivers/leds/leds-tca6507.c | 17 +++++++----------
1 file changed, 7 insertions(+), 10 deletions(-)
diff --git a/drivers/leds/leds-tca6507.c b/drivers/leds/leds-tca6507.c
index ad4af6b6e94c7..362dc9b3d97d0 100644
--- a/drivers/leds/leds-tca6507.c
+++ b/drivers/leds/leds-tca6507.c
@@ -654,6 +654,7 @@ static int tca6507_register_leds_and_gpios(struct device *dev,
return -EINVAL;
device_for_each_child_node(dev, child) {
+ struct led_init_data init_data = {};
struct tca6507_led *led;
u32 reg;
@@ -679,18 +680,14 @@ static int tca6507_register_leds_and_gpios(struct device *dev,
led = &tca->leds[reg];
led->chip = tca;
led->num = reg;
-
- if (fwnode_property_read_string(child, "label",
- &led->led_cdev.name))
- led->led_cdev.name = fwnode_get_name(child);
-
- fwnode_property_read_string(child, "linux,default-trigger",
- &led->led_cdev.default_trigger);
-
+ led->bank = -1;
led->led_cdev.brightness_set = tca6507_brightness_set;
led->led_cdev.blink_set = tca6507_blink_set;
- led->bank = -1;
- ret = devm_led_classdev_register(dev, &led->led_cdev);
+
+ init_data.fwnode = child;
+
+ ret = devm_led_classdev_register_ext(dev, &led->led_cdev,
+ &init_data);
if (ret) {
dev_err(dev, "Failed to register LED for node %pfw\n",
child);
For all drivers you switch to using *ext() API DT bindings should be
updated as well to let people know that they can now use 'function'
and 'color' properties.
--
Best regards,
Jacek Anaszewski