diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2013-02-07 13:47:26 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2013-09-29 12:15:40 +0200 |
commit | 666f12e0c19a19f4431e05f6e5b37e657a62038f (patch) | |
tree | ba5a20de0da52c1651184e080440462f97c8305a /drivers/base | |
parent | 61694c93cd9e47e2ea72d9095817040a4c0c2cee (diff) | |
download | barebox-666f12e0c19a19f4431e05f6e5b37e657a62038f.tar.gz barebox-666f12e0c19a19f4431e05f6e5b37e657a62038f.tar.xz |
introduce runtime loglevel
With this the verbosity of barebox can be controlled during runtime
using the 'loglevel' globalvar.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers/base')
-rw-r--r-- | drivers/base/driver.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/base/driver.c b/drivers/base/driver.c index 16b7f06c4a..e587e3acc1 100644 --- a/drivers/base/driver.c +++ b/drivers/base/driver.c @@ -26,6 +26,7 @@ #include <command.h> #include <driver.h> #include <malloc.h> +#include <console.h> #include <linux/ctype.h> #include <errno.h> #include <fs.h> @@ -370,11 +371,14 @@ const char *dev_id(const struct device_d *dev) return buf; } -int dev_printf(const struct device_d *dev, const char *format, ...) +int dev_printf(int level, const struct device_d *dev, const char *format, ...) { va_list args; int ret = 0; + if (level > barebox_loglevel) + return 0; + if (dev->driver && dev->driver->name) ret += printf("%s ", dev->driver->name); |