summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2008-10-31 14:02:25 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2008-10-31 14:02:25 +0100
commitc3fc1364d9ed508a59bc2127c04d7239e30d148a (patch)
tree44b43ff8a77ae69ff4ec98e3216de54d79dec6c8 /lib
parentdff84a542281c46076a0c8c5f589b1df4777ade8 (diff)
downloadbarebox-c3fc1364d9ed508a59bc2127c04d7239e30d148a.tar.gz
barebox-c3fc1364d9ed508a59bc2127c04d7239e30d148a.tar.xz
Introduce dev_* and pr_* functions
Proven to be useful in linux kernel, U-Boot should have such a thing aswell. We do not distinguish between the various print levels others than debug and not debug. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'lib')
-rw-r--r--lib/driver.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/driver.c b/lib/driver.c
index eea2c74d22..5aa643d03c 100644
--- a/lib/driver.c
+++ b/lib/driver.c
@@ -314,6 +314,18 @@ static int do_devinfo_subtree(struct device_d *dev, int depth, char edge)
return 0;
}
+const char *dev_id(const struct device_d *dev)
+{
+ static char buf[sizeof(unsigned long) * 2];
+
+ if (strlen(dev->id))
+ return dev->id;
+
+ sprintf(buf, "0x%08x", dev->map_base);
+
+ return buf;
+}
+
#ifdef CONFIG_CMD_DEVINFO
static int do_devinfo ( cmd_tbl_t *cmdtp, int argc, char *argv[])