801-v6.4-04-leds-Provide-stubs-for-when-CLASS_LED-NEW_LEDS-are-d.patch 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. From e5029edd53937a29801ef507cee12e657ff31ea9 Mon Sep 17 00:00:00 2001
  2. From: Andrew Lunn <[email protected]>
  3. Date: Mon, 17 Apr 2023 17:17:26 +0200
  4. Subject: [PATCH 4/9] leds: Provide stubs for when CLASS_LED & NEW_LEDS are
  5. disabled
  6. Provide stubs for devm_led_classdev_register_ext() and
  7. led_init_default_state_get() so that LED drivers embedded within other
  8. drivers such as PHYs and Ethernet switches still build when LEDS_CLASS
  9. or NEW_LEDS are disabled. This also helps with Kconfig dependencies,
  10. which are somewhat hairy for phylib and mdio and only get worse when
  11. adding a dependency on LED_CLASS.
  12. Signed-off-by: Andrew Lunn <[email protected]>
  13. Signed-off-by: Christian Marangi <[email protected]>
  14. Reviewed-by: Florian Fainelli <[email protected]>
  15. Signed-off-by: David S. Miller <[email protected]>
  16. ---
  17. include/linux/leds.h | 18 ++++++++++++++++++
  18. 1 file changed, 18 insertions(+)
  19. --- a/include/linux/leds.h
  20. +++ b/include/linux/leds.h
  21. @@ -63,7 +63,15 @@ struct led_init_data {
  22. bool devname_mandatory;
  23. };
  24. +#if IS_ENABLED(CONFIG_NEW_LEDS)
  25. enum led_default_state led_init_default_state_get(struct fwnode_handle *fwnode);
  26. +#else
  27. +static inline enum led_default_state
  28. +led_init_default_state_get(struct fwnode_handle *fwnode)
  29. +{
  30. + return LEDS_DEFSTATE_OFF;
  31. +}
  32. +#endif
  33. struct led_hw_trigger_type {
  34. int dummy;
  35. @@ -198,9 +206,19 @@ static inline int led_classdev_register(
  36. return led_classdev_register_ext(parent, led_cdev, NULL);
  37. }
  38. +#if IS_ENABLED(CONFIG_LEDS_CLASS)
  39. int devm_led_classdev_register_ext(struct device *parent,
  40. struct led_classdev *led_cdev,
  41. struct led_init_data *init_data);
  42. +#else
  43. +static inline int
  44. +devm_led_classdev_register_ext(struct device *parent,
  45. + struct led_classdev *led_cdev,
  46. + struct led_init_data *init_data)
  47. +{
  48. + return 0;
  49. +}
  50. +#endif
  51. static inline int devm_led_classdev_register(struct device *parent,
  52. struct led_classdev *led_cdev)