1
0

085-0005-leds-gpio-use-OF-variant-of-LED-registering-function.patch 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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. In leds-gpio we support LEDs specified in DT so we should use
  8. (devm_)of_led_classdev_register. This allows passing DT node as argument
  9. for use by the LED subsystem.
  10. Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
  11. Acked-by: Pavel Machek <pavel@ucw.cz>
  12. Signed-off-by: Jacek Anaszewski <jacek.anaszewski@gmail.com>
  13. ---
  14. drivers/leds/leds-gpio.c | 12 ++++++------
  15. 1 file changed, 6 insertions(+), 6 deletions(-)
  16. --- a/drivers/leds/leds-gpio.c
  17. +++ b/drivers/leds/leds-gpio.c
  18. @@ -87,7 +87,7 @@ static int gpio_blink_set(struct led_cla
  19. static int create_gpio_led(const struct gpio_led *template,
  20. struct gpio_led_data *led_dat, struct device *parent,
  21. - gpio_blink_set_t blink_set)
  22. + struct device_node *np, gpio_blink_set_t blink_set)
  23. {
  24. int ret, state;
  25. @@ -143,7 +143,7 @@ static int create_gpio_led(const struct
  26. INIT_WORK(&led_dat->work, gpio_led_work);
  27. - return devm_led_classdev_register(parent, &led_dat->cdev);
  28. + return devm_of_led_classdev_register(parent, np, &led_dat->cdev);
  29. }
  30. static void delete_gpio_led(struct gpio_led_data *led)
  31. @@ -219,7 +219,7 @@ static struct gpio_leds_priv *gpio_leds_
  32. if (fwnode_property_present(child, "retain-state-suspended"))
  33. led.retain_state_suspended = 1;
  34. - ret = create_gpio_led(&led, led_dat, dev, NULL);
  35. + ret = create_gpio_led(&led, led_dat, dev, np, NULL);
  36. if (ret < 0) {
  37. fwnode_handle_put(child);
  38. goto err;
  39. @@ -256,9 +256,9 @@ static int gpio_led_probe(struct platfor
  40. priv->num_leds = pdata->num_leds;
  41. for (i = 0; i < priv->num_leds; i++) {
  42. - ret = create_gpio_led(&pdata->leds[i],
  43. - &priv->leds[i],
  44. - &pdev->dev, pdata->gpio_blink_set);
  45. + ret = create_gpio_led(&pdata->leds[i], &priv->leds[i],
  46. + &pdev->dev, NULL,
  47. + pdata->gpio_blink_set);
  48. if (ret < 0)
  49. return ret;
  50. }