All of lore.kernel.org
 help / color / mirror / Atom feed
From: Simon Glass <sjg@chromium.org>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v2 05/12] dm: core: Add a function to get a uclass name
Date: Wed,  5 Oct 2016 20:42:13 -0600	[thread overview]
Message-ID: <1475721740-15124-6-git-send-email-sjg@chromium.org> (raw)
In-Reply-To: <1475721740-15124-1-git-send-email-sjg@chromium.org>

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>
---

Changes in v2:
- Fix typo drive -> driver

 drivers/core/uclass.c | 9 +++++++++
 include/dm/uclass.h   | 8 ++++++++
 2 files changed, 17 insertions(+)

diff --git a/drivers/core/uclass.c b/drivers/core/uclass.c
index de602ae..60610e5 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;
diff --git a/include/dm/uclass.h b/include/dm/uclass.h
index 84f05bc..b583aa8 100644
--- a/include/dm/uclass.h
+++ b/include/dm/uclass.h
@@ -119,6 +119,14 @@ struct uclass_driver {
 int uclass_get(enum uclass_id key, struct uclass **ucp);
 
 /**
+ * uclass_get_name() - Get the name of a uclass driver
+ *
+ * @id: ID to look up
+ * @returns the name of the uclass driver for that ID, or NULL if none
+ */
+const char *uclass_get_name(enum uclass_id id);
+
+/**
  * uclass_get_device() - Get a uclass device based on an ID and index
  *
  * The device is probed to activate it ready for use.
-- 
2.8.0.rc3.226.g39d4020

  parent reply	other threads:[~2016-10-06  2:42 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-06  2:42 [U-Boot] [PATCH v2 00/12] dm: x86: Improve vesa driver-model support Simon Glass
2016-10-06  2:42 ` [U-Boot] [PATCH v2 01/12] Revert "x86: broadwell: gpio: Remove the codes to set up pin control" Simon Glass
2016-10-08  4:23   ` Bin Meng
2016-10-06  2:42 ` [U-Boot] [PATCH v2 02/12] x86: Add an accelerated memmove() function Simon Glass
2016-10-08  2:25   ` Bin Meng
2016-10-08  4:23     ` Bin Meng
2016-10-08  5:53     ` Bin Meng
2016-10-10  2:05       ` Bin Meng
2016-10-13  0:03         ` Simon Glass
2016-10-06  2:42 ` [U-Boot] [PATCH v2 03/12] Fix return value in trailing_strtoln() Simon Glass
2016-10-08  4:23   ` Bin Meng
2016-10-06  2:42 ` [U-Boot] [PATCH v2 04/12] list: Add list_last_entry() to find the last entry Simon Glass
2016-10-08  4:23   ` Bin Meng
2016-10-06  2:42 ` Simon Glass [this message]
2016-10-08  4:23   ` [U-Boot] [PATCH v2 05/12] dm: core: Add a function to get a uclass name Bin Meng
2016-10-06  2:42 ` [U-Boot] [PATCH v2 06/12] x86: video: Fix typo in broadwell Kconfig Simon Glass
2016-10-08  4:23   ` Bin Meng
2016-10-06  2:42 ` [U-Boot] [PATCH v2 07/12] dm: x86: video: Add a driver-model driver for ivybridge graphics Simon Glass
2016-10-08  2:33   ` Bin Meng
2016-10-08  4:23     ` Bin Meng
2016-10-06  2:42 ` [U-Boot] [PATCH v2 08/12] dm: stdio: Allow lazy probing of video devices Simon Glass
2016-10-08  2:32   ` Bin Meng
2016-10-08  4:23     ` Bin Meng
2016-10-06  2:42 ` [U-Boot] [PATCH v2 09/12] dm: video: Add driver-model support to vesa graphics Simon Glass
2016-10-08  4:24   ` Bin Meng
2016-10-06  2:42 ` [U-Boot] [PATCH v2 10/12] x86: Adjust config to support DM_VIDEO Simon Glass
2016-10-08  4:24   ` Bin Meng
2016-10-06  2:42 ` [U-Boot] [PATCH v2 11/12] dm: x86: Move samus to use new driver model support Simon Glass
2016-10-08  4:24   ` Bin Meng
2016-10-06  2:42 ` [U-Boot] [PATCH v2 12/12] dm: x86: Move link to use driver model for video Simon Glass
2016-10-08  4:24   ` Bin Meng

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1475721740-15124-6-git-send-email-sjg@chromium.org \
    --to=sjg@chromium.org \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.