085-0002-leds-gpio-introduce-gpio_blink_set_t.patch 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. From 68620e594c250ba8c43a78e77f5296cb9952582e Mon Sep 17 00:00:00 2001
  2. From: Heiner Kallweit <hkallweit1@gmail.com>
  3. Date: Wed, 14 Sep 2016 20:54:12 +0200
  4. Subject: [PATCH] leds: gpio: introduce gpio_blink_set_t
  5. Introduce a typedef gpio_blink_set_t to improve readability of the code.
  6. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
  7. Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com>
  8. ---
  9. drivers/leds/leds-gpio.c | 6 ++----
  10. include/linux/leds.h | 9 ++++++---
  11. 2 files changed, 8 insertions(+), 7 deletions(-)
  12. --- a/drivers/leds/leds-gpio.c
  13. +++ b/drivers/leds/leds-gpio.c
  14. @@ -29,8 +29,7 @@ struct gpio_led_data {
  15. u8 new_level;
  16. u8 can_sleep;
  17. u8 blinking;
  18. - int (*platform_gpio_blink_set)(struct gpio_desc *desc, int state,
  19. - unsigned long *delay_on, unsigned long *delay_off);
  20. + gpio_blink_set_t platform_gpio_blink_set;
  21. };
  22. static void gpio_led_work(struct work_struct *work)
  23. @@ -88,8 +87,7 @@ static int gpio_blink_set(struct led_cla
  24. static int create_gpio_led(const struct gpio_led *template,
  25. struct gpio_led_data *led_dat, struct device *parent,
  26. - int (*blink_set)(struct gpio_desc *, int, unsigned long *,
  27. - unsigned long *))
  28. + gpio_blink_set_t blink_set)
  29. {
  30. int ret, state;
  31. --- a/include/linux/leds.h
  32. +++ b/include/linux/leds.h
  33. @@ -330,6 +330,11 @@ struct led_platform_data {
  34. struct led_info *leds;
  35. };
  36. +struct gpio_desc;
  37. +typedef int (*gpio_blink_set_t)(struct gpio_desc *desc, int state,
  38. + unsigned long *delay_on,
  39. + unsigned long *delay_off);
  40. +
  41. /* For the leds-gpio driver */
  42. struct gpio_led {
  43. const char *name;
  44. @@ -352,9 +357,7 @@ struct gpio_led_platform_data {
  45. #define GPIO_LED_NO_BLINK_LOW 0 /* No blink GPIO state low */
  46. #define GPIO_LED_NO_BLINK_HIGH 1 /* No blink GPIO state high */
  47. #define GPIO_LED_BLINK 2 /* Please, blink */
  48. - int (*gpio_blink_set)(struct gpio_desc *desc, int state,
  49. - unsigned long *delay_on,
  50. - unsigned long *delay_off);
  51. + gpio_blink_set_t gpio_blink_set;
  52. };
  53. struct platform_device *gpio_led_register_device(