Commit 7ea79ae8 authored by Rafał Miłecki's avatar Rafał Miłecki Committed by Jacek Anaszewski

leds: gpio: use OF variant of LED registering function

In leds-gpio we support LEDs specified in DT so we should use
(devm_)of_led_classdev_register. This allows passing DT node as argument
for use by the LED subsystem.
Signed-off-by: default avatarRafał Miłecki <rafal@milecki.pl>
Acked-by: default avatarPavel Machek <pavel@ucw.cz>
Signed-off-by: default avatarJacek Anaszewski <jacek.anaszewski@gmail.com>
parent 442c6098
...@@ -77,7 +77,7 @@ static int gpio_blink_set(struct led_classdev *led_cdev, ...@@ -77,7 +77,7 @@ static int gpio_blink_set(struct led_classdev *led_cdev,
static int create_gpio_led(const struct gpio_led *template, static int create_gpio_led(const struct gpio_led *template,
struct gpio_led_data *led_dat, struct device *parent, struct gpio_led_data *led_dat, struct device *parent,
gpio_blink_set_t blink_set) struct device_node *np, gpio_blink_set_t blink_set)
{ {
int ret, state; int ret, state;
...@@ -139,7 +139,7 @@ static int create_gpio_led(const struct gpio_led *template, ...@@ -139,7 +139,7 @@ static int create_gpio_led(const struct gpio_led *template,
if (ret < 0) if (ret < 0)
return ret; return ret;
return devm_led_classdev_register(parent, &led_dat->cdev); return devm_of_led_classdev_register(parent, np, &led_dat->cdev);
} }
struct gpio_leds_priv { struct gpio_leds_priv {
...@@ -208,7 +208,7 @@ static struct gpio_leds_priv *gpio_leds_create(struct platform_device *pdev) ...@@ -208,7 +208,7 @@ static struct gpio_leds_priv *gpio_leds_create(struct platform_device *pdev)
if (fwnode_property_present(child, "panic-indicator")) if (fwnode_property_present(child, "panic-indicator"))
led.panic_indicator = 1; led.panic_indicator = 1;
ret = create_gpio_led(&led, led_dat, dev, NULL); ret = create_gpio_led(&led, led_dat, dev, np, NULL);
if (ret < 0) { if (ret < 0) {
fwnode_handle_put(child); fwnode_handle_put(child);
return ERR_PTR(ret); return ERR_PTR(ret);
...@@ -242,9 +242,9 @@ static int gpio_led_probe(struct platform_device *pdev) ...@@ -242,9 +242,9 @@ static int gpio_led_probe(struct platform_device *pdev)
priv->num_leds = pdata->num_leds; priv->num_leds = pdata->num_leds;
for (i = 0; i < priv->num_leds; i++) { for (i = 0; i < priv->num_leds; i++) {
ret = create_gpio_led(&pdata->leds[i], ret = create_gpio_led(&pdata->leds[i], &priv->leds[i],
&priv->leds[i], &pdev->dev, NULL,
&pdev->dev, pdata->gpio_blink_set); pdata->gpio_blink_set);
if (ret < 0) if (ret < 0)
return ret; return ret;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment