[U-Boot] [PATCH17/23] LED: add function to retrieve a device's label
Benjamin Tietz
uboot at dresden.micronet24.de
Sat Jun 18 14:56:52 CEST 2016
From: Benjamin Tietz <benjamin at micronet24.de>
---
drivers/led/led-uclass.c | 6 ++++++
include/led.h | 8 ++++++++
2 files changed, 14 insertions(+)
-------------- next part --------------
From: Benjamin Tietz <benjamin at micronet24.de>
---
drivers/led/led-uclass.c | 6 ++++++
include/led.h | 8 ++++++++
2 files changed, 14 insertions(+)
diff --git a/drivers/led/led-uclass.c b/drivers/led/led-uclass.c
index 784ac87..f5fbbcb 100644
--- a/drivers/led/led-uclass.c
+++ b/drivers/led/led-uclass.c
@@ -32,6 +32,12 @@ int led_get_by_label(const char *label, struct udevice **devp)
return -ENODEV;
}
+const char *led_get_label(struct udevice *dev)
+{
+ struct led_uclass_plat *uc_plat = dev_get_uclass_platdata(dev);
+ return uc_plat->label;
+}
+
int led_set_on(struct udevice *dev, int on)
{
struct led_ops *ops = led_get_ops(dev);
diff --git a/include/led.h b/include/led.h
index b929d0c..32e0dec 100644
--- a/include/led.h
+++ b/include/led.h
@@ -40,6 +40,14 @@ struct led_ops {
int led_get_by_label(const char *label, struct udevice **devp);
/**
+ * led_get_label() - get the label of a given led-device
+ *
+ * @dev: led device
+ * @return the name of the led
+ */
+const char *led_get_label(struct udevice *dev);
+
+/**
* led_set_on() - set the state of an LED
*
* @dev: LED device to change
More information about the U-Boot
mailing list