summaryrefslogtreecommitdiff
path: root/drivers/core
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2016-10-05 20:42:13 -0600
committerBin Meng <bmeng.cn@gmail.com>2016-10-11 11:55:33 +0800
commit0a5f6f869f1c2c6e9f75d83203754937014cbe47 (patch)
tree998b48a943323c397a2c1b856672b77841858039 /drivers/core
parent5023bd7a804e09d0bf4937d8fecb5d85af6dba3c (diff)
dm: core: Add a function to get a uclass name
It is useful in debug() statements to display the name of the uclass for a device. Add a simple function to provide this. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Diffstat (limited to 'drivers/core')
-rw-r--r--drivers/core/uclass.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/core/uclass.c b/drivers/core/uclass.c
index de602ae52d..60610e5a1f 100644
--- a/drivers/core/uclass.c
+++ b/drivers/core/uclass.c
@@ -148,6 +148,15 @@ int uclass_get(enum uclass_id id, struct uclass **ucp)
return 0;
}
+const char *uclass_get_name(enum uclass_id id)
+{
+ struct uclass *uc;
+
+ if (uclass_get(id, &uc))
+ return NULL;
+ return uc->uc_drv->name;
+}
+
int uclass_find_device(enum uclass_id id, int index, struct udevice **devp)
{
struct uclass *uc;