[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200917223338.14164-31-marek.behun@nic.cz>
Date: Fri, 18 Sep 2020 00:33:18 +0200
From: Marek Behún <marek.behun@....cz>
To: linux-leds@...r.kernel.org
Cc: Pavel Machek <pavel@....cz>, Dan Murphy <dmurphy@...com>,
Ondřej Jirman <megous@...ous.com>,
linux-kernel@...r.kernel.org, Rob Herring <robh+dt@...nel.org>,
devicetree@...r.kernel.org,
Marek Behún <marek.behun@....cz>,
"H . Nikolaus Schaller" <hns@...delico.com>,
Grant Feng <von81@....com>
Subject: [PATCH leds v2 30/50] leds: is31fl319x: use struct led_init_data when registering
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@....cz>
Cc: H. Nikolaus Schaller <hns@...delico.com>
Cc: Grant Feng <von81@....com>
---
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
Powered by blists - more mailing lists