[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200917223338.14164-25-marek.behun@nic.cz>
Date: Fri, 18 Sep 2020 00:33:12 +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>,
David Rivshin <drivshin@...worx.com>
Subject: [PATCH leds v2 24/50] leds: is31fl32xx: 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: David Rivshin <drivshin@...worx.com>
---
drivers/leds/leds-is31fl32xx.c | 19 +++++++++----------
1 file changed, 9 insertions(+), 10 deletions(-)
diff --git a/drivers/leds/leds-is31fl32xx.c b/drivers/leds/leds-is31fl32xx.c
index 7bacd01289770..279f52931a177 100644
--- a/drivers/leds/leds-is31fl32xx.c
+++ b/drivers/leds/leds-is31fl32xx.c
@@ -332,9 +332,6 @@ static int is31fl32xx_parse_child_dt(const struct device *dev,
int ret = 0;
u32 reg;
- if (of_property_read_string(child, "label", &cdev->name))
- cdev->name = child->name;
-
ret = of_property_read_u32(child, "reg", ®);
if (ret || reg < 1 || reg > led_data->priv->cdef->channels) {
dev_err(dev,
@@ -373,6 +370,7 @@ static int is31fl32xx_parse_dt(struct device *dev,
int ret = 0;
for_each_available_child_of_node(dev_of_node(dev), child) {
+ struct led_init_data init_data = {};
struct is31fl32xx_led_data *led_data =
&priv->leds[priv->num_leds];
const struct is31fl32xx_led_data *other_led_data;
@@ -388,17 +386,18 @@ static int is31fl32xx_parse_dt(struct device *dev,
led_data->channel);
if (other_led_data) {
dev_err(dev,
- "%s and %s both attempting to use channel %d\n",
- led_data->cdev.name,
- other_led_data->cdev.name,
- led_data->channel);
+ "Node %pOF 'reg' conflicts with another LED\n",
+ child);
goto err;
}
- ret = devm_led_classdev_register(dev, &led_data->cdev);
+ init_data.fwnode = of_fwnode_handle(child);
+
+ ret = devm_led_classdev_register_ext(dev, &led_data->cdev,
+ &init_data);
if (ret) {
- dev_err(dev, "failed to register PWM led for %s: %d\n",
- led_data->cdev.name, ret);
+ dev_err(dev, "Failed to register LED for %pOF: %d\n",
+ child, ret);
goto err;
}
--
2.26.2
Powered by blists - more mailing lists