summaryrefslogtreecommitdiff
path: root/include/linux/leds.h
diff options
context:
space:
mode:
authorJean-Jacques Hiblot <jjhiblot@traphandler.com>2023-07-28 17:37:28 +0200
committerLee Jones <lee@kernel.org>2023-08-17 09:00:06 +0100
commitafb48153220d35f330d0d979792920a31f7d9a81 (patch)
tree54ce29822b21abc872002ab3ac0d4b96bc312965 /include/linux/leds.h
parent179507fcd5e448eaecae9b69f0fb30965c3c4466 (diff)
leds: Provide devm_of_led_get_optional()
Add an optional variant of devm_of_led_get(). It behaves the same as devm_of_led_get() except where the LED doesn't exist. In this case, instead of returning -ENOENT, the function returns NULL. Signed-off-by: Jean-Jacques Hiblot <jjhiblot@traphandler.com> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Link: https://lore.kernel.org/r/20230728153731.3742339-2-jjhiblot@traphandler.com Signed-off-by: Lee Jones <lee@kernel.org>
Diffstat (limited to 'include/linux/leds.h')
-rw-r--r--include/linux/leds.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/include/linux/leds.h b/include/linux/leds.h
index 7d428100b42b..8740b4e47f88 100644
--- a/include/linux/leds.h
+++ b/include/linux/leds.h
@@ -313,6 +313,8 @@ extern struct led_classdev *of_led_get(struct device_node *np, int index);
extern void led_put(struct led_classdev *led_cdev);
struct led_classdev *__must_check devm_of_led_get(struct device *dev,
int index);
+struct led_classdev *__must_check devm_of_led_get_optional(struct device *dev,
+ int index);
/**
* led_blink_set - set blinking with software fallback