0247fffb2afc73c45e188096041e998394217b1b
[openwrt/staging/yousong.git] /
1 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
2 Date: Mon, 6 Mar 2017 06:19:45 +0100
3 Subject: [PATCH] leds: gpio: use OF variant of LED registering function
4 MIME-Version: 1.0
5 Content-Type: text/plain; charset=UTF-8
6 Content-Transfer-Encoding: 8bit
7
8 In leds-gpio we support LEDs specified in DT so we should use
9 (devm_)of_led_classdev_register. This allows passing DT node as argument
10 for use by the LED subsystem.
11
12 Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
13 Acked-by: Pavel Machek <pavel@ucw.cz>
14 Signed-off-by: Jacek Anaszewski <jacek.anaszewski@gmail.com>
15 ---
16 drivers/leds/leds-gpio.c | 12 ++++++------
17 1 file changed, 6 insertions(+), 6 deletions(-)
18
19 --- a/drivers/leds/leds-gpio.c
20 +++ b/drivers/leds/leds-gpio.c
21 @@ -77,7 +77,7 @@ static int gpio_blink_set(struct led_cla
22
23 static int create_gpio_led(const struct gpio_led *template,
24 struct gpio_led_data *led_dat, struct device *parent,
25 - gpio_blink_set_t blink_set)
26 + struct device_node *np, gpio_blink_set_t blink_set)
27 {
28 int ret, state;
29
30 @@ -139,7 +139,7 @@ static int create_gpio_led(const struct
31 if (ret < 0)
32 return ret;
33
34 - return devm_led_classdev_register(parent, &led_dat->cdev);
35 + return devm_of_led_classdev_register(parent, np, &led_dat->cdev);
36 }
37
38 struct gpio_leds_priv {
39 @@ -206,7 +206,7 @@ static struct gpio_leds_priv *gpio_leds_
40 if (fwnode_property_present(child, "panic-indicator"))
41 led.panic_indicator = 1;
42
43 - ret = create_gpio_led(&led, led_dat, dev, NULL);
44 + ret = create_gpio_led(&led, led_dat, dev, np, NULL);
45 if (ret < 0) {
46 fwnode_handle_put(child);
47 return ERR_PTR(ret);
48 @@ -240,9 +240,9 @@ static int gpio_led_probe(struct platfor
49
50 priv->num_leds = pdata->num_leds;
51 for (i = 0; i < priv->num_leds; i++) {
52 - ret = create_gpio_led(&pdata->leds[i],
53 - &priv->leds[i],
54 - &pdev->dev, pdata->gpio_blink_set);
55 + ret = create_gpio_led(&pdata->leds[i], &priv->leds[i],
56 + &pdev->dev, NULL,
57 + pdata->gpio_blink_set);
58 if (ret < 0)
59 return ret;
60 }