From 0a5f6f869f1c2c6e9f75d83203754937014cbe47 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Wed, 5 Oct 2016 20:42:13 -0600 Subject: 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 Reviewed-by: Bin Meng --- drivers/core/uclass.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'drivers/core') 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; -- cgit