1 From e5029edd53937a29801ef507cee12e657ff31ea9 Mon Sep 17 00:00:00 2001
2 From: Andrew Lunn <andrew@lunn.ch>
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
7 Provide stubs for devm_led_classdev_register_ext() and
8 led_init_default_state_get() so that LED drivers embedded within other
9 drivers such as PHYs and Ethernet switches still build when LEDS_CLASS
10 or NEW_LEDS are disabled. This also helps with Kconfig dependencies,
11 which are somewhat hairy for phylib and mdio and only get worse when
12 adding a dependency on LED_CLASS.
14 Signed-off-by: Andrew Lunn <andrew@lunn.ch>
15 Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
16 Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
17 Signed-off-by: David S. Miller <davem@davemloft.net>
19 include/linux/leds.h | 18 ++++++++++++++++++
20 1 file changed, 18 insertions(+)
22 --- a/include/linux/leds.h
23 +++ b/include/linux/leds.h
24 @@ -63,7 +63,15 @@ struct led_init_data {
25 bool devname_mandatory;
28 +#if IS_ENABLED(CONFIG_NEW_LEDS)
29 enum led_default_state led_init_default_state_get(struct fwnode_handle *fwnode);
31 +static inline enum led_default_state
32 +led_init_default_state_get(struct fwnode_handle *fwnode)
34 + return LEDS_DEFSTATE_OFF;
38 struct led_hw_trigger_type {
40 @@ -198,9 +206,19 @@ static inline int led_classdev_register(
41 return led_classdev_register_ext(parent, led_cdev, NULL);
44 +#if IS_ENABLED(CONFIG_LEDS_CLASS)
45 int devm_led_classdev_register_ext(struct device *parent,
46 struct led_classdev *led_cdev,
47 struct led_init_data *init_data);
50 +devm_led_classdev_register_ext(struct device *parent,
51 + struct led_classdev *led_cdev,
52 + struct led_init_data *init_data)
58 static inline int devm_led_classdev_register(struct device *parent,
59 struct led_classdev *led_cdev)