Skip to content

Commit e5029ed

Browse files
lunndavem330
authored andcommitted
leds: Provide stubs for when CLASS_LED & NEW_LEDS are disabled
Provide stubs for devm_led_classdev_register_ext() and led_init_default_state_get() so that LED drivers embedded within other drivers such as PHYs and Ethernet switches still build when LEDS_CLASS or NEW_LEDS are disabled. This also helps with Kconfig dependencies, which are somewhat hairy for phylib and mdio and only get worse when adding a dependency on LED_CLASS. Signed-off-by: Andrew Lunn <[email protected]> Signed-off-by: Christian Marangi <[email protected]> Reviewed-by: Florian Fainelli <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 91acadc commit e5029ed

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

include/linux/leds.h

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,15 @@ struct led_init_data {
8282
bool devname_mandatory;
8383
};
8484

85+
#if IS_ENABLED(CONFIG_NEW_LEDS)
8586
enum led_default_state led_init_default_state_get(struct fwnode_handle *fwnode);
87+
#else
88+
static inline enum led_default_state
89+
led_init_default_state_get(struct fwnode_handle *fwnode)
90+
{
91+
return LEDS_DEFSTATE_OFF;
92+
}
93+
#endif
8694

8795
struct led_hw_trigger_type {
8896
int dummy;
@@ -217,9 +225,19 @@ static inline int led_classdev_register(struct device *parent,
217225
return led_classdev_register_ext(parent, led_cdev, NULL);
218226
}
219227

228+
#if IS_ENABLED(CONFIG_LEDS_CLASS)
220229
int devm_led_classdev_register_ext(struct device *parent,
221230
struct led_classdev *led_cdev,
222231
struct led_init_data *init_data);
232+
#else
233+
static inline int
234+
devm_led_classdev_register_ext(struct device *parent,
235+
struct led_classdev *led_cdev,
236+
struct led_init_data *init_data)
237+
{
238+
return 0;
239+
}
240+
#endif
223241

224242
static inline int devm_led_classdev_register(struct device *parent,
225243
struct led_classdev *led_cdev)

0 commit comments

Comments
 (0)