159fae84f45d9a7ea978cc71cc66ab57f8bc1f5c
[openwrt/staging/ansuel.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 @@ -87,7 +87,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 @@ -143,7 +143,7 @@ static int create_gpio_led(const struct
31
32 INIT_WORK(&led_dat->work, gpio_led_work);
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 static void delete_gpio_led(struct gpio_led_data *led)
39 @@ -219,7 +219,7 @@ static struct gpio_leds_priv *gpio_leds_
40 if (fwnode_property_present(child, "retain-state-suspended"))
41 led.retain_state_suspended = 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 goto err;
48 @@ -256,9 +256,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 }