diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2008-10-31 14:02:25 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2008-10-31 14:02:25 +0100 |
commit | c3fc1364d9ed508a59bc2127c04d7239e30d148a (patch) | |
tree | 44b43ff8a77ae69ff4ec98e3216de54d79dec6c8 /lib | |
parent | dff84a542281c46076a0c8c5f589b1df4777ade8 (diff) | |
download | barebox-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.c | 12 |
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[]) |