bc905b4468c1b25dc4abeb6928f8172ef905c4c9
[openwrt/staging/thess.git] /
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
5 disabled
6
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.
13
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>
18 ---
19 include/linux/leds.h | 18 ++++++++++++++++++
20 1 file changed, 18 insertions(+)
21
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;
26 };
27
28 +#if IS_ENABLED(CONFIG_NEW_LEDS)
29 enum led_default_state led_init_default_state_get(struct fwnode_handle *fwnode);
30 +#else
31 +static inline enum led_default_state
32 +led_init_default_state_get(struct fwnode_handle *fwnode)
33 +{
34 + return LEDS_DEFSTATE_OFF;
35 +}
36 +#endif
37
38 struct led_hw_trigger_type {
39 int dummy;
40 @@ -198,9 +206,19 @@ static inline int led_classdev_register(
41 return led_classdev_register_ext(parent, led_cdev, NULL);
42 }
43
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);
48 +#else
49 +static inline int
50 +devm_led_classdev_register_ext(struct device *parent,
51 + struct led_classdev *led_cdev,
52 + struct led_init_data *init_data)
53 +{
54 + return 0;
55 +}
56 +#endif
57
58 static inline int devm_led_classdev_register(struct device *parent,
59 struct led_classdev *led_cdev)