summaryrefslogtreecommitdiffstats
path: root/drivers/base
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2012-09-09 11:37:16 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2012-09-14 11:47:42 +0200
commit08a7d5a6251ba433c9443ad9e439af96ee4eed40 (patch)
treecadbb54400c7119317a208d831c9f80871a87719 /drivers/base
parent75265ae5272213afeebcc06aea66a37a63d10686 (diff)
downloadbarebox-08a7d5a6251ba433c9443ad9e439af96ee4eed40.tar.gz
barebox-08a7d5a6251ba433c9443ad9e439af96ee4eed40.tar.xz
driver: rewrite dev_printf as a function
Printing device context normally should be "driver instance:", but instead we printed the device name twice. This patch fixes this and as a bonus makes the binary a bit smaller. Instead of a '@' between driver and instance this function now prints a whitespace which is a bit more like Linux. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers/base')
-rw-r--r--drivers/base/driver.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/drivers/base/driver.c b/drivers/base/driver.c
index 6cd428681f..47d3803035 100644
--- a/drivers/base/driver.c
+++ b/drivers/base/driver.c
@@ -313,6 +313,25 @@ const char *dev_id(const struct device_d *dev)
return buf;
}
+int dev_printf(const struct device_d *dev, const char *format, ...)
+{
+ va_list args;
+ int ret = 0;
+
+ if (dev->driver && dev->driver->name)
+ ret += printf("%s ", dev->driver->name);
+
+ ret += printf("%s: ", dev_name(dev));
+
+ va_start(args, format);
+
+ ret += vprintf(format, args);
+
+ va_end(args);
+
+ return ret;
+}
+
void devices_shutdown(void)
{
struct device_d *dev;