[U-Boot] [PATCH V4 09/10] dm: core: device: add function: dev_get_uclass_name()
Przemyslaw Marczak
p.marczak at samsung.com
Wed Apr 15 13:07:25 CEST 2015
This commit extends the driver model device's API by function:
- dev_get_uclass_name()
And this function returns the device's uclass driver name if:
- given dev pointer, is non_NULL
otherwise, the NULL pointer is returned.
Signed-off-by: Przemyslaw Marczak <p.marczak at samsung.com>
Cc: Simon Glass <sjg at chromium.org>
---
Changes V4:
- new commit
---
drivers/core/device.c | 8 ++++++++
include/dm/device.h | 10 ++++++++++
2 files changed, 18 insertions(+)
diff --git a/drivers/core/device.c b/drivers/core/device.c
index d024abb..df81b8e 100644
--- a/drivers/core/device.c
+++ b/drivers/core/device.c
@@ -512,6 +512,14 @@ enum uclass_id device_get_uclass_id(struct udevice *dev)
return dev->uclass->uc_drv->id;
}
+const char *dev_get_uclass_name(struct udevice *dev)
+{
+ if (!dev)
+ return NULL;
+
+ return dev->uclass->uc_drv->name;
+}
+
#ifdef CONFIG_OF_CONTROL
fdt_addr_t dev_get_addr(struct udevice *dev)
{
diff --git a/include/dm/device.h b/include/dm/device.h
index 049cb2f..18296bb 100644
--- a/include/dm/device.h
+++ b/include/dm/device.h
@@ -299,6 +299,16 @@ const void *dev_get_driver_ops(struct udevice *dev);
*/
enum uclass_id device_get_uclass_id(struct udevice *dev);
+/*
+ * dev_get_uclass_name() - return the uclass name of a device
+ *
+ * This checks that dev is not NULL.
+ *
+ * @dev: Device to check
+ * @return pointer to the uclass name for the device
+ */
+const char *dev_get_uclass_name(struct udevice *dev);
+
/**
* device_get_child() - Get the child of a device by index
*
--
1.9.1
More information about the U-Boot
mailing list