aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/leds
diff options
context:
space:
mode:
authorMarek BehĂșn <marek.behun@nic.cz>2020-09-18 00:33:37 +0200
committerPavel Machek <pavel@ucw.cz>2020-09-26 21:56:42 +0200
commitf847ef543ce45c917bcbcafb2555aa9e5968c385 (patch)
tree41c8f48a3fff247fe03e1b8a687d057947e4af84 /drivers/leds
parentleds: ns2: remove unneeded variable (diff)
downloadlinux-dev-f847ef543ce45c917bcbcafb2555aa9e5968c385.tar.xz
linux-dev-f847ef543ce45c917bcbcafb2555aa9e5968c385.zip
leds: ns2: 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@nic.cz> Cc: Simon Guinot <simon.guinot@sequanux.org> Cc: Simon Guinot <sguinot@lacie.com> Cc: Vincent Donnefort <vdonnefort@gmail.com> Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Cc: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Pavel Machek <pavel@ucw.cz>
Diffstat (limited to 'drivers/leds')
-rw-r--r--drivers/leds/leds-ns2.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/drivers/leds/leds-ns2.c b/drivers/leds/leds-ns2.c
index e94bb8535f0a..030f426af3d7 100644
--- a/drivers/leds/leds-ns2.c
+++ b/drivers/leds/leds-ns2.c
@@ -170,14 +170,11 @@ ATTRIBUTE_GROUPS(ns2_led);
static int ns2_led_register(struct device *dev, struct device_node *np,
struct ns2_led *led)
{
+ struct led_init_data init_data = {};
struct ns2_led_modval *modval;
enum ns2_led_modes mode;
int nmodes, ret, i;
- ret = of_property_read_string(np, "label", &led->cdev.name);
- if (ret)
- led->cdev.name = np->name;
-
led->cmd = devm_gpiod_get_from_of_node(dev, np, "cmd-gpio", 0,
GPIOD_ASIS, np->name);
if (IS_ERR(led->cmd))
@@ -234,7 +231,9 @@ static int ns2_led_register(struct device *dev, struct device_node *np,
led->sata = (mode == NS_V2_LED_SATA) ? 1 : 0;
led->cdev.brightness = (mode == NS_V2_LED_OFF) ? LED_OFF : LED_FULL;
- ret = devm_led_classdev_register(dev, &led->cdev);
+ init_data.fwnode = of_fwnode_handle(np);
+
+ 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);