mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 00/11 v6] introduction of dmesg support
@ 2013-03-07 21:54 Jean-Christophe PLAGNIOL-VILLARD
  2013-03-08  8:05 ` Jan Lübbe
  2013-03-08 11:59 ` [PATCH 01/11] kfifo: introduce kfifo_dump_str to dump the fifo Jean-Christophe PLAGNIOL-VILLARD
  0 siblings, 2 replies; 17+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2013-03-07 21:54 UTC (permalink / raw)
  To: barebox

HI,

	v6: more switch
	    use kfifo_put instead of kfifo_putc
	    as we already now the size to copy

	v5: rebase on master
	   add missing kern_levels.h

	v4: remove a debug info

	v3: add more swtich

	we currently have 2 fifo at comsole level one for input one for output
	we fill the output fifo before any console is registered and then
	empty it

	Now we introduce a new mecanism as in the kernel dmesg

	we will always fill the dmesg kfifo with drivers output

	as in barebox we have 2 world

	device/drivers and applicaiotn (commands)

	the verbositty of the printk can be selected at runtime and
	compilation

	so for now on drivers will have to use pr_xxx and dev_xxx and
	application will use printf

	dmesg will print the kfifo at any time

	we will extend this later with more control of what the drivers output
	on the console or just in the fifo

	This new feature is optionnal if dmes is disable we continue as before

The following changes since commit 092bfd5eb55d1b2d7ed098aa9723a2fa63b86192:

  fix another brown paper bag bug introduced with compile time loglevel (2013-03-06 23:53:04 +0100)

are available in the git repository at:

  git://git.jcrosoft.org/barebox.git delivery/dmesg

for you to fetch changes up to 1ca2fe80fdcb5c73ffbb95246666060f45c0bfe8:

  ext4: switch debug and printf to dev_xxx (2013-03-08 05:48:48 +0800)

----------------------------------------------------------------
Jean-Christophe PLAGNIOL-VILLARD (11):
      kfifo: introduce kfifo_dump_str to dump the fifo
      console: switch to kfifo_dump_str
      intoduce dmesg to print the barebox printk to dmesg ring buffer
      startup: switch to pr_xxx
      at91: clock switch to pr_info
      meminfo: switch to pr_xxx
      net/console: switch to pr_xxx
      startup: switch to pr_xxx
      barebox_banner: switch to pr_info
      net/phy: convert to pr_info
      ext4: switch debug and printf to dev_xxx

 arch/arm/mach-at91/clock.c      |    2 +-
 commands/Kconfig                |   19 +++++++++++++++++++
 common/console.c                |  116 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---
 common/meminfo.c                |    6 +++---
 common/startup.c                |   12 ++++++------
 common/version.c                |    4 ++--
 drivers/base/driver.c           |   16 ++++++++++------
 drivers/net/phy/phy.c           |    2 +-
 fs/ext4/ext4_common.c           |   12 ++++++------
 include/kfifo.h                 |    2 ++
 include/linux/barebox-wrapper.h |   11 -----------
 include/linux/kern_levels.h     |   25 +++++++++++++++++++++++++
 include/printk.h                |   59 ++++++++++++++++++++++++++++++++++++++++++-----------------
 lib/kfifo.c                     |   21 +++++++++++++++++++++
 net/netconsole.c                |    4 ++--
 15 files changed, 253 insertions(+), 58 deletions(-)
 create mode 100644 include/linux/kern_levels.h

Best Regards,
J.

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 00/11 v6] introduction of dmesg support
  2013-03-07 21:54 [PATCH 00/11 v6] introduction of dmesg support Jean-Christophe PLAGNIOL-VILLARD
@ 2013-03-08  8:05 ` Jan Lübbe
  2013-03-08 11:59 ` [PATCH 01/11] kfifo: introduce kfifo_dump_str to dump the fifo Jean-Christophe PLAGNIOL-VILLARD
  1 sibling, 0 replies; 17+ messages in thread
From: Jan Lübbe @ 2013-03-08  8:05 UTC (permalink / raw)
  To: Jean-Christophe PLAGNIOL-VILLARD; +Cc: barebox

You sent these patches to linux-arm-kernel@lists.infradead.org (again).

Regards,
Jan
-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH 01/11] kfifo: introduce kfifo_dump_str to dump the fifo
  2013-03-07 21:54 [PATCH 00/11 v6] introduction of dmesg support Jean-Christophe PLAGNIOL-VILLARD
  2013-03-08  8:05 ` Jan Lübbe
@ 2013-03-08 11:59 ` Jean-Christophe PLAGNIOL-VILLARD
  2013-03-08 11:59   ` [PATCH 02/11] console: switch to kfifo_dump_str Jean-Christophe PLAGNIOL-VILLARD
                     ` (9 more replies)
  1 sibling, 10 replies; 17+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2013-03-08 11:59 UTC (permalink / raw)
  To: barebox

This will allow to implement a dmesg mecanism in barebox

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
 include/kfifo.h |    2 ++
 lib/kfifo.c     |   21 +++++++++++++++++++++
 2 files changed, 23 insertions(+)

diff --git a/include/kfifo.h b/include/kfifo.h
index 25880f4..9dbbe0d 100644
--- a/include/kfifo.h
+++ b/include/kfifo.h
@@ -74,5 +74,7 @@ static inline unsigned int kfifo_len(struct kfifo *fifo)
 void kfifo_putc(struct kfifo *fifo, unsigned char c);
 unsigned int kfifo_getc(struct kfifo *fifo, unsigned char *c);
 
+void kfifo_dump_str(struct kfifo *fifo, void (*dump)(unsigned char c));
+
 #endif
 
diff --git a/lib/kfifo.c b/lib/kfifo.c
index afd3894..7892aed 100644
--- a/lib/kfifo.c
+++ b/lib/kfifo.c
@@ -154,3 +154,24 @@ unsigned int kfifo_getc(struct kfifo *fifo, unsigned char *c)
 	return 0;
 }
 
+void kfifo_dump_str(struct kfifo *fifo, void (*dump)(unsigned char c))
+{
+	int i;
+	unsigned char *c;
+	unsigned int l;
+	unsigned int len;
+
+	len = fifo->in - fifo->out;
+
+	/* first get the data from fifo->out until the end of the buffer */
+	l = min(len, fifo->size - (fifo->out & (fifo->size - 1)));
+	c = fifo->buffer + (fifo->out & (fifo->size - 1));
+	for (i = 0; i < l; i++)
+		dump(c[i]);
+
+	/* then get the rest (if any) from the beginning of the buffer */
+	c = fifo->buffer;
+	l = len - l;
+	for (i = 0; i < l; i++)
+		dump(c[i]);
+}
-- 
1.7.10.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH 02/11] console: switch to kfifo_dump_str
  2013-03-08 11:59 ` [PATCH 01/11] kfifo: introduce kfifo_dump_str to dump the fifo Jean-Christophe PLAGNIOL-VILLARD
@ 2013-03-08 11:59   ` Jean-Christophe PLAGNIOL-VILLARD
  2013-03-08 11:59   ` [PATCH 03/11] intoduce dmesg to print the barebox printk to dmesg ring buffer Jean-Christophe PLAGNIOL-VILLARD
                     ` (8 subsequent siblings)
  9 siblings, 0 replies; 17+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2013-03-08 11:59 UTC (permalink / raw)
  To: barebox

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
 common/console.c |    9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/common/console.c b/common/console.c
index beb37bd..243d402 100644
--- a/common/console.c
+++ b/common/console.c
@@ -55,6 +55,11 @@ static struct kfifo __console_output_fifo;
 static struct kfifo *console_input_fifo = &__console_input_fifo;
 static struct kfifo *console_output_fifo = &__console_output_fifo;
 
+static void console_output_dump(unsigned char ch)
+{
+	console_putc(CONSOLE_STDOUT, ch);
+}
+
 static int console_std_set(struct device_d *dev, struct param_d *param,
 		const char *val)
 {
@@ -86,14 +91,12 @@ static int console_std_set(struct device_d *dev, struct param_d *param,
 	dev_param_set_generic(dev, param, active);
 
 	if (initialized < CONSOLE_INIT_FULL) {
-		char ch;
 		initialized = CONSOLE_INIT_FULL;
 		PUTS_LL("Switch to console [");
 		PUTS_LL(dev_name(dev));
 		PUTS_LL("]\n");
 		barebox_banner();
-		while (kfifo_getc(console_output_fifo, &ch) == 0)
-			console_putc(CONSOLE_STDOUT, ch);
+		kfifo_dump_str(console_output_fifo, console_output_dump);
 	}
 
 	return 0;
-- 
1.7.10.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH 03/11] intoduce dmesg to print the barebox printk to dmesg ring buffer
  2013-03-08 11:59 ` [PATCH 01/11] kfifo: introduce kfifo_dump_str to dump the fifo Jean-Christophe PLAGNIOL-VILLARD
  2013-03-08 11:59   ` [PATCH 02/11] console: switch to kfifo_dump_str Jean-Christophe PLAGNIOL-VILLARD
@ 2013-03-08 11:59   ` Jean-Christophe PLAGNIOL-VILLARD
  2013-03-09 10:25     ` Sascha Hauer
  2013-03-08 11:59   ` [PATCH 04/11] startup: switch to pr_xxx Jean-Christophe PLAGNIOL-VILLARD
                     ` (7 subsequent siblings)
  9 siblings, 1 reply; 17+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2013-03-08 11:59 UTC (permalink / raw)
  To: barebox

the size can be configured vai DMESG_KFIFO_OSIZE

1024 by default
4096 if DEBUG_INFO

the verbosity of the printk can now be change at runtime and default via
PRINTK_LEVEL

rename dev_printf to dev_printk and update to printk

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
 commands/Kconfig                |   19 +++++++
 common/console.c                |  107 +++++++++++++++++++++++++++++++++++++++
 drivers/base/driver.c           |   16 +++---
 include/linux/barebox-wrapper.h |   11 ----
 include/linux/kern_levels.h     |   25 +++++++++
 include/printk.h                |   59 ++++++++++++++-------
 6 files changed, 203 insertions(+), 34 deletions(-)
 create mode 100644 include/linux/kern_levels.h

diff --git a/commands/Kconfig b/commands/Kconfig
index c1454c7..7412257 100644
--- a/commands/Kconfig
+++ b/commands/Kconfig
@@ -122,6 +122,25 @@ config CMD_TIME
 	  checking for ctrl-c, so the time command can be used with commands
 	  which are interruptible with ctrl-c.
 
+config CMD_DMESG
+	bool "dmesg"
+	depends on CONSOLE_FULL
+	  help
+	  print the barebox output ring buffer
+
+if CMD_DMESG
+config PRINTK_LEVEL
+	int "printk level"
+	range 0 7
+	default 7
+
+config DMESG_KFIFO_SIZE
+	prompt "kfifo dmesg size"
+	int
+	default 4096 if DEBUG_INFO
+	default 1024
+endif
+
 config CMD_LINUX_EXEC
 	bool "linux exec"
 	depends on LINUX
diff --git a/common/console.c b/common/console.c
index 243d402..c707c9d 100644
--- a/common/console.c
+++ b/common/console.c
@@ -349,3 +349,110 @@ int ctrlc (void)
 }
 EXPORT_SYMBOL(ctrlc);
 #endif /* ARCH_HAS_CTRC */
+
+#ifdef CONFIG_CMD_DMESG
+#include <command.h>
+#include <complete.h>
+#include <init.h>
+#include <globalvar.h>
+
+static char dmesg_output_buffer[CONFIG_DMESG_KFIFO_SIZE];
+static struct kfifo __dmesg_output_fifo;
+static struct kfifo *dmesg_output_fifo = &__dmesg_output_fifo;
+static int printk_level = CONFIG_PRINTK_LEVEL;
+static char printk_level_str[2] = __stringify(CONFIG_PRINTK_LEVEL);
+
+static int printk_level_set(struct device_d *dev, struct param_d *p, const char *val)
+{
+	unsigned long level = simple_strtoul(val, NULL, 10);
+
+	if (level > 7)
+		return -EINVAL;
+
+	printk_level = level;
+	printk_level_str[0] = level + '0';
+
+	return 0;
+}
+
+const char *printk_level_get(struct device_d *d, struct param_d *p)
+{
+	return printk_level_str;
+}
+
+static int printk_init(void)
+{
+	return globalvar_add("printk_level", printk_level_set, printk_level_get, 0);
+}
+coredevice_initcall(printk_init);
+
+static int printk_fifo_init(void)
+{
+	kfifo_init(dmesg_output_fifo, dmesg_output_buffer,
+			CONFIG_DMESG_KFIFO_SIZE);
+
+	return 0;
+}
+pure_initcall(printk_fifo_init);
+
+static int do_dmesg(int argc, char *argv[])
+{
+	kfifo_dump_str(dmesg_output_fifo, console_output_dump);
+
+	return 0;
+}
+
+static const __maybe_unused char cmd_dmesg_help[] =
+"print the barebox output ring buffer\n";
+
+BAREBOX_CMD_START(dmesg)
+	.cmd		= do_dmesg,
+	.usage		= "dmesg",
+	BAREBOX_CMD_HELP(cmd_dmesg_help)
+	BAREBOX_CMD_COMPLETE(empty_complete)
+BAREBOX_CMD_END
+
+int vprintk(const char *fmt, va_list args)
+{
+	uint i, fi;
+	char printbuffer[CFG_PBSIZE];
+	char *s = printbuffer;
+	int level;
+
+	/* For this to work, printbuffer must be larger than
+	 * anything we ever want to print.
+	 */
+	fi = i = vsprintf(printbuffer, fmt, args);
+
+	level = printk_get_level(printbuffer);
+	if (level) {
+		s += 2;
+		fi -= 2;
+		kfifo_putc(dmesg_output_fifo, '<');
+		kfifo_putc(dmesg_output_fifo, level);
+		kfifo_putc(dmesg_output_fifo, '>');
+	}
+
+	/* Print the string */
+	if (level <= printk_level + '0')
+		puts(s);
+
+	kfifo_put(dmesg_output_fifo, s, fi);
+
+	return i;
+}
+EXPORT_SYMBOL(vprintk);
+
+int printk(const char *fmt, ...)
+{
+	va_list args;
+	uint i;
+
+	va_start (args, fmt);
+	i = vprintk(fmt, args);
+	va_end (args);
+
+	return i;
+}
+EXPORT_SYMBOL(printk);
+#endif
diff --git a/drivers/base/driver.c b/drivers/base/driver.c
index fa30c68..04b9451 100644
--- a/drivers/base/driver.c
+++ b/drivers/base/driver.c
@@ -364,23 +364,27 @@ const char *dev_id(const struct device_d *dev)
 	return buf;
 }
 
-int dev_printf(const struct device_d *dev, const char *format, ...)
+int dev_printk(const struct device_d *dev, int level, const char *format, ...)
 {
 	va_list args;
-	int ret = 0;
+	char printbuffer[CFG_PBSIZE];
+	char *s = printbuffer;
 
 	if (dev->driver && dev->driver->name)
-		ret += printf("%s ", dev->driver->name);
+		s += sprintf(s, "%s ", dev->driver->name);
 
-	ret += printf("%s: ", dev_name(dev));
+	s += sprintf(s, "%s: ", dev_name(dev));
 
 	va_start(args, format);
 
-	ret += vprintf(format, args);
+	vsprintf(s, format, args);
 
 	va_end(args);
 
-	return ret;
+	if (IS_ENABLED(CONFIG_CMD_DMESG))
+		return printk(KERN_SOH "%d%s", level, printbuffer);
+	else
+		return printk("%s", printbuffer);
 }
 
 void devices_shutdown(void)
diff --git a/include/linux/barebox-wrapper.h b/include/linux/barebox-wrapper.h
index 1d1f846..ce68060 100644
--- a/include/linux/barebox-wrapper.h
+++ b/include/linux/barebox-wrapper.h
@@ -9,17 +9,6 @@
 #define kfree(ptr)		free(ptr)
 #define vfree(ptr)		free(ptr)
 
-#define KERN_EMERG      ""   /* system is unusable                   */
-#define KERN_ALERT      ""   /* action must be taken immediately     */
-#define KERN_CRIT       ""   /* critical conditions                  */
-#define KERN_ERR        ""   /* error conditions                     */
-#define KERN_WARNING    ""   /* warning conditions                   */
-#define KERN_NOTICE     ""   /* normal but significant condition     */
-#define KERN_INFO       ""   /* informational                        */
-#define KERN_DEBUG      ""   /* debug-level messages                 */
-
-#define printk			printf
-
 #define pr_warn			pr_warning
 
 #define __init
diff --git a/include/linux/kern_levels.h b/include/linux/kern_levels.h
new file mode 100644
index 0000000..866caaa
--- /dev/null
+++ b/include/linux/kern_levels.h
@@ -0,0 +1,25 @@
+#ifndef __KERN_LEVELS_H__
+#define __KERN_LEVELS_H__
+
+#define KERN_SOH	"\001"		/* ASCII Start Of Header */
+#define KERN_SOH_ASCII	'\001'
+
+#define KERN_EMERG	KERN_SOH "0"	/* system is unusable */
+#define KERN_ALERT	KERN_SOH "1"	/* action must be taken immediately */
+#define KERN_CRIT	KERN_SOH "2"	/* critical conditions */
+#define KERN_ERR	KERN_SOH "3"	/* error conditions */
+#define KERN_WARNING	KERN_SOH "4"	/* warning conditions */
+#define KERN_NOTICE	KERN_SOH "5"	/* normal but significant condition */
+#define KERN_INFO	KERN_SOH "6"	/* informational */
+#define KERN_DEBUG	KERN_SOH "7"	/* debug-level messages */
+
+#define KERN_DEFAULT	KERN_SOH "d"	/* the default kernel loglevel */
+
+/*
+ * Annotation for a "continued" line of log printout (only done after a
+ * line that had no enclosing \n). Only to be used by core/arch code
+ * during early bootup (a continued line is not SMP-safe otherwise).
+ */
+#define KERN_CONT	""
+
+#endif
diff --git a/include/printk.h b/include/printk.h
index 3cd7335..fb0dba0 100644
--- a/include/printk.h
+++ b/include/printk.h
@@ -1,6 +1,8 @@
 #ifndef __PRINTK_H
 #define __PRINTK_H
 
+#include <linux/kern_levels.h>
+
 #define MSG_EMERG      0    /* system is unusable */
 #define MSG_ALERT      1    /* action must be taken immediately */
 #define MSG_CRIT       2    /* critical conditions */
@@ -16,38 +18,61 @@
 #define LOGLEVEL	CONFIG_COMPILE_LOGLEVEL
 #endif
 
+#ifdef CONFIG_CMD_DMESG
+int	printk(const char *fmt, ...) __attribute__ ((format(__printf__, 1, 2)));
+int	vprintk(const char *fmt, va_list args);
+#define __pr_printk(level, format, args...) \
+	({	\
+		(level) <= LOGLEVEL ? printk(KERN_SOH "%d" format, level, ##args) : 0; \
+	 })
+#else
+#define printk			printf
+#define vprintk			vprintf
+#define __pr_printk(level, format, args...) \
+	({	\
+		(level) <= LOGLEVEL ? printk(format, ##args) : 0; \
+	 })
+#endif
+
+static inline int printk_get_level(const char *buffer)
+{
+	if (buffer[0] == KERN_SOH_ASCII && buffer[1]) {
+		switch (buffer[1]) {
+		case '0' ... '7':
+		case 'd':	/* KERN_DEFAULT */
+			return buffer[1];
+		}
+	}
+	return 0;
+}
+
 /* debugging and troubleshooting/diagnostic helpers. */
 
-int dev_printf(const struct device_d *dev, const char *format, ...)
-	__attribute__ ((format(__printf__, 2, 3)));
+int dev_printk(const struct device_d *dev, int level, const char *format, ...)
+	__attribute__ ((format(__printf__, 3, 4)));
 
-#define __dev_printf(level, dev, format, args...) \
+#define __dev_printk(level, dev, format, args...) \
 	({	\
-		(level) <= LOGLEVEL ? dev_printf((dev), (format), ##args) : 0; \
+		(level) <= LOGLEVEL ? dev_printk((dev), level, format, ##args) : 0; \
 	 })
 
 
 #define dev_emerg(dev, format, arg...)		\
-	__dev_printf(0, (dev) , format , ## arg)
+	__dev_printk(0, (dev) , format , ## arg)
 #define dev_alert(dev, format, arg...)		\
-	__dev_printf(1, (dev) , format , ## arg)
+	__dev_printk(1, (dev) , format , ## arg)
 #define dev_crit(dev, format, arg...)		\
-	__dev_printf(2, (dev) , format , ## arg)
+	__dev_printk(2, (dev) , format , ## arg)
 #define dev_err(dev, format, arg...)		\
-	__dev_printf(3, (dev) , format , ## arg)
+	__dev_printk(3, (dev) , format , ## arg)
 #define dev_warn(dev, format, arg...)		\
-	__dev_printf(4, (dev) , format , ## arg)
+	__dev_printk(4, (dev) , format , ## arg)
 #define dev_notice(dev, format, arg...)		\
-	__dev_printf(5, (dev) , format , ## arg)
+	__dev_printk(5, (dev) , format , ## arg)
 #define dev_info(dev, format, arg...)		\
-	__dev_printf(6, (dev) , format , ## arg)
+	__dev_printk(6, (dev) , format , ## arg)
 #define dev_dbg(dev, format, arg...)		\
-	__dev_printf(7, (dev) , format , ## arg)
-
-#define __pr_printk(level, format, args...) \
-	({	\
-		(level) <= LOGLEVEL ? printk((format), ##args) : 0; \
-	 })
+	__dev_printk(7, (dev) , format , ## arg)
 
 #ifndef pr_fmt
 #define pr_fmt(fmt) fmt
-- 
1.7.10.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH 04/11] startup: switch to pr_xxx
  2013-03-08 11:59 ` [PATCH 01/11] kfifo: introduce kfifo_dump_str to dump the fifo Jean-Christophe PLAGNIOL-VILLARD
  2013-03-08 11:59   ` [PATCH 02/11] console: switch to kfifo_dump_str Jean-Christophe PLAGNIOL-VILLARD
  2013-03-08 11:59   ` [PATCH 03/11] intoduce dmesg to print the barebox printk to dmesg ring buffer Jean-Christophe PLAGNIOL-VILLARD
@ 2013-03-08 11:59   ` Jean-Christophe PLAGNIOL-VILLARD
  2013-03-08 11:59   ` [PATCH 05/11] at91: clock switch to pr_info Jean-Christophe PLAGNIOL-VILLARD
                     ` (6 subsequent siblings)
  9 siblings, 0 replies; 17+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2013-03-08 11:59 UTC (permalink / raw)
  To: barebox

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
 common/startup.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/common/startup.c b/common/startup.c
index 52a8996..e49cc4c 100644
--- a/common/startup.c
+++ b/common/startup.c
@@ -105,14 +105,14 @@ void __noreturn start_barebox(void)
 
 	for (initcall = __barebox_initcalls_start;
 			initcall < __barebox_initcalls_end; initcall++) {
-		debug("initcall-> %pS\n", *initcall);
+		pr_debug("initcall-> %pS\n", *initcall);
 		result = (*initcall)();
 		if (result)
 			pr_err("initcall %pS failed: %s\n", *initcall,
 					strerror(-result));
 	}
 
-	debug("initcalls done\n");
+	pr_debug("initcalls done\n");
 
 	if (IS_ENABLED(CONFIG_ENV_HANDLING)) {
 		int ret;
-- 
1.7.10.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH 05/11] at91: clock switch to pr_info
  2013-03-08 11:59 ` [PATCH 01/11] kfifo: introduce kfifo_dump_str to dump the fifo Jean-Christophe PLAGNIOL-VILLARD
                     ` (2 preceding siblings ...)
  2013-03-08 11:59   ` [PATCH 04/11] startup: switch to pr_xxx Jean-Christophe PLAGNIOL-VILLARD
@ 2013-03-08 11:59   ` Jean-Christophe PLAGNIOL-VILLARD
  2013-03-08 11:59   ` [PATCH 06/11] meminfo: switch to pr_xxx Jean-Christophe PLAGNIOL-VILLARD
                     ` (5 subsequent siblings)
  9 siblings, 0 replies; 17+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2013-03-08 11:59 UTC (permalink / raw)
  To: barebox

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
 arch/arm/mach-at91/clock.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/mach-at91/clock.c b/arch/arm/mach-at91/clock.c
index 2dde632..296f5d5 100644
--- a/arch/arm/mach-at91/clock.c
+++ b/arch/arm/mach-at91/clock.c
@@ -756,7 +756,7 @@ static int at91_clock_display(void)
 	if (pll_overclock)
 		pr_info("Clocks: PLLA overclocked, %ld MHz\n", plla.rate_hz / 1000000);
 
-	printf("Clocks: CPU %u MHz, master %u MHz, main %u.%03u MHz\n",
+	pr_info("Clocks: CPU %u MHz, master %u MHz, main %u.%03u MHz\n",
 		cpu_freq / 1000000, (unsigned) mck.rate_hz / 1000000,
 		(unsigned) main_clk.rate_hz / 1000000,
 		((unsigned) main_clk.rate_hz % 1000000) / 1000);
-- 
1.7.10.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH 06/11] meminfo: switch to pr_xxx
  2013-03-08 11:59 ` [PATCH 01/11] kfifo: introduce kfifo_dump_str to dump the fifo Jean-Christophe PLAGNIOL-VILLARD
                     ` (3 preceding siblings ...)
  2013-03-08 11:59   ` [PATCH 05/11] at91: clock switch to pr_info Jean-Christophe PLAGNIOL-VILLARD
@ 2013-03-08 11:59   ` Jean-Christophe PLAGNIOL-VILLARD
  2013-03-08 11:59   ` [PATCH 07/11] net/console: " Jean-Christophe PLAGNIOL-VILLARD
                     ` (4 subsequent siblings)
  9 siblings, 0 replies; 17+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2013-03-08 11:59 UTC (permalink / raw)
  To: barebox

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
 common/meminfo.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/common/meminfo.c b/common/meminfo.c
index 5e3ff71..45733da 100644
--- a/common/meminfo.c
+++ b/common/meminfo.c
@@ -10,9 +10,9 @@ static int display_meminfo(void)
 	ulong mend   = mem_malloc_end();
 	ulong msize  = mend - mstart + 1;
 
-	debug("barebox code: 0x%p -> 0x%p\n", _stext, _etext - 1);
-	debug("bss segment:  0x%p -> 0x%p\n", __bss_start, __bss_stop - 1);
-	printf("malloc space: 0x%08lx -> 0x%08lx (size %s)\n",
+	pr_debug("barebox code: 0x%p -> 0x%p\n", _stext, _etext - 1);
+	pr_debug("bss segment:  0x%p -> 0x%p\n", __bss_start, __bss_stop - 1);
+	pr_info("malloc space: 0x%08lx -> 0x%08lx (size %s)\n",
 		mstart, mend, size_human_readable(msize));
 	return 0;
 }
-- 
1.7.10.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH 07/11] net/console: switch to pr_xxx
  2013-03-08 11:59 ` [PATCH 01/11] kfifo: introduce kfifo_dump_str to dump the fifo Jean-Christophe PLAGNIOL-VILLARD
                     ` (4 preceding siblings ...)
  2013-03-08 11:59   ` [PATCH 06/11] meminfo: switch to pr_xxx Jean-Christophe PLAGNIOL-VILLARD
@ 2013-03-08 11:59   ` Jean-Christophe PLAGNIOL-VILLARD
  2013-03-08 17:25     ` Sascha Hauer
  2013-03-08 11:59   ` [PATCH 08/11] startup: " Jean-Christophe PLAGNIOL-VILLARD
                     ` (3 subsequent siblings)
  9 siblings, 1 reply; 17+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2013-03-08 11:59 UTC (permalink / raw)
  To: barebox

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
 net/netconsole.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/netconsole.c b/net/netconsole.c
index 7d0f3f4..8db8356 100644
--- a/net/netconsole.c
+++ b/net/netconsole.c
@@ -185,7 +185,7 @@ static int netconsole_init(void)
 
 	ret = console_register(cdev);
 	if (ret) {
-		printf("netconsole: registering failed with %s\n", strerror(-ret));
+		pr_err("netconsole: registering failed with %s\n", strerror(-ret));
 		kfree(priv);
 		return ret;
 	}
@@ -194,7 +194,7 @@ static int netconsole_init(void)
 	dev_add_param(&cdev->class_dev, "port", nc_port_set, NULL, 0);
 	dev_set_param(&cdev->class_dev, "port", "6666");
 
-	printf("registered netconsole as %s%d\n", cdev->class_dev.name, cdev->class_dev.id);
+	pr_info("registered netconsole as %s%d\n", cdev->class_dev.name, cdev->class_dev.id);
 
 	return 0;
 }
-- 
1.7.10.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH 08/11] startup: switch to pr_xxx
  2013-03-08 11:59 ` [PATCH 01/11] kfifo: introduce kfifo_dump_str to dump the fifo Jean-Christophe PLAGNIOL-VILLARD
                     ` (5 preceding siblings ...)
  2013-03-08 11:59   ` [PATCH 07/11] net/console: " Jean-Christophe PLAGNIOL-VILLARD
@ 2013-03-08 11:59   ` Jean-Christophe PLAGNIOL-VILLARD
  2013-03-08 11:59   ` [PATCH 09/11] barebox_banner: switch to pr_info Jean-Christophe PLAGNIOL-VILLARD
                     ` (2 subsequent siblings)
  9 siblings, 0 replies; 17+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2013-03-08 11:59 UTC (permalink / raw)
  To: barebox

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
 common/startup.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/common/startup.c b/common/startup.c
index e49cc4c..ff00ca7 100644
--- a/common/startup.c
+++ b/common/startup.c
@@ -120,7 +120,7 @@ void __noreturn start_barebox(void)
 		ret = envfs_load(default_environment_path, "/env", 0);
 
 		if (ret && IS_ENABLED(CONFIG_DEFAULT_ENVIRONMENT)) {
-			printf("no valid environment found on %s. "
+			pr_err("no valid environment found on %s. "
 				"Using default environment\n",
 				default_environment_path);
 			envfs_load("/dev/defaultenv", "/env", 0);
@@ -128,17 +128,17 @@ void __noreturn start_barebox(void)
 	}
 
 	if (IS_ENABLED(CONFIG_COMMAND_SUPPORT)) {
-		printf("running /env/bin/init...\n");
+		pr_info("running /env/bin/init...\n");
 
 		if (!stat("/env/bin/init", &s)) {
 			run_command("source /env/bin/init", 0);
 		} else {
-			printf("not found\n");
+			pr_err("/env/bin/init not found\n");
 		}
 	}
 
 	if (!barebox_main) {
-		printf("No main function! aborting.\n");
+		pr_err("No main function! aborting.\n");
 		hang();
 	}
 
-- 
1.7.10.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH 09/11] barebox_banner: switch to pr_info
  2013-03-08 11:59 ` [PATCH 01/11] kfifo: introduce kfifo_dump_str to dump the fifo Jean-Christophe PLAGNIOL-VILLARD
                     ` (6 preceding siblings ...)
  2013-03-08 11:59   ` [PATCH 08/11] startup: " Jean-Christophe PLAGNIOL-VILLARD
@ 2013-03-08 11:59   ` Jean-Christophe PLAGNIOL-VILLARD
  2013-03-08 11:59   ` [PATCH 10/11] net/phy: convert " Jean-Christophe PLAGNIOL-VILLARD
  2013-03-08 11:59   ` [PATCH 11/11] ext4: switch debug and printf to dev_xxx Jean-Christophe PLAGNIOL-VILLARD
  9 siblings, 0 replies; 17+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2013-03-08 11:59 UTC (permalink / raw)
  To: barebox

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
 common/version.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/common/version.c b/common/version.c
index 22e111a..d33f4d0 100644
--- a/common/version.c
+++ b/common/version.c
@@ -16,6 +16,6 @@ void barebox_banner (void)
 	if (!board)
 		board = CONFIG_BOARDINFO;
 
-	printf("\n\n%s\n\n", version_string);
-	printf("Board: %s\n", board);
+	pr_info("\n\n%s\n\n", version_string);
+	pr_info("Board: %s\n", board);
 }
-- 
1.7.10.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH 10/11] net/phy: convert to pr_info
  2013-03-08 11:59 ` [PATCH 01/11] kfifo: introduce kfifo_dump_str to dump the fifo Jean-Christophe PLAGNIOL-VILLARD
                     ` (7 preceding siblings ...)
  2013-03-08 11:59   ` [PATCH 09/11] barebox_banner: switch to pr_info Jean-Christophe PLAGNIOL-VILLARD
@ 2013-03-08 11:59   ` Jean-Christophe PLAGNIOL-VILLARD
  2013-03-08 11:59   ` [PATCH 11/11] ext4: switch debug and printf to dev_xxx Jean-Christophe PLAGNIOL-VILLARD
  9 siblings, 0 replies; 17+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2013-03-08 11:59 UTC (permalink / raw)
  To: barebox

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
 drivers/net/phy/phy.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index 12739ff..112ff13 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -49,7 +49,7 @@ int phy_update_status(struct phy_device *dev)
 		dev->adjust_link(edev);
 
 	if (dev->link)
-		printf("%dMbps %s duplex link detected\n", dev->speed,
+		pr_info("%dMbps %s duplex link detected\n", dev->speed,
 			dev->duplex ? "full" : "half");
 
 	return 0;
-- 
1.7.10.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH 11/11] ext4: switch debug and printf to dev_xxx
  2013-03-08 11:59 ` [PATCH 01/11] kfifo: introduce kfifo_dump_str to dump the fifo Jean-Christophe PLAGNIOL-VILLARD
                     ` (8 preceding siblings ...)
  2013-03-08 11:59   ` [PATCH 10/11] net/phy: convert " Jean-Christophe PLAGNIOL-VILLARD
@ 2013-03-08 11:59   ` Jean-Christophe PLAGNIOL-VILLARD
  9 siblings, 0 replies; 17+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2013-03-08 11:59 UTC (permalink / raw)
  To: barebox

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
 fs/ext4/ext4_common.c |   12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/fs/ext4/ext4_common.c b/fs/ext4/ext4_common.c
index f426118..ceb965f 100644
--- a/fs/ext4/ext4_common.c
+++ b/fs/ext4/ext4_common.c
@@ -89,7 +89,7 @@ static int ext4fs_blockgroup(struct ext2_data *data, int group,
 			group / desc_per_blk;
 	blkoff = (group % desc_per_blk) * sizeof(struct ext2_block_group);
 
-	debug("ext4fs read %d group descriptor (blkno %ld blkoff %u)\n",
+	dev_dbg(fs->dev, "read %d group descriptor (blkno %ld blkoff %u)\n",
 	      group, blkno, blkoff);
 
 	return ext4fs_devread(fs, blkno << LOG2_EXT2_BLOCK_SIZE(data),
@@ -139,7 +139,7 @@ int ext4fs_get_indir_block(struct ext2fs_node *node, struct ext4fs_indir_block *
 
 	ret = ext4fs_devread(fs, blkno, 0, blksz, (void *)indir->data);
 	if (ret) {
-		printf("** SI ext2fs read block (indir 1)"
+		dev_err(fs->dev, "** SI ext2fs read block (indir 1)"
 			"failed. **\n");
 		return ret;
 	}
@@ -177,7 +177,7 @@ long int read_allocated_block(struct ext2fs_node *node, int fileblock)
 				(struct ext4_extent_header *)inode->b.blocks.dir_blocks,
 				fileblock, log2_blksz);
 		if (!ext_block) {
-			printf("invalid extent block\n");
+			pr_err("invalid extent block\n");
 			free(buf);
 			return -EINVAL;
 		}
@@ -269,10 +269,10 @@ int ext4fs_iterate_dir(struct ext2fs_node *dir, char *name,
 	unsigned int fpos = 0;
 	int status, ret;
 	struct ext2fs_node *diro = (struct ext2fs_node *) dir;
-
+	struct ext_filesystem *fs = dir->data->fs;
 
 	if (name != NULL)
-		debug("Iterate dir %s\n", name);
+		dev_dbg(fs->dev, "Iterate dir %s\n", name);
 
 	if (!diro->inode_read) {
 		ret = ext4fs_read_inode(diro->data, diro->ino, &diro->inode);
@@ -345,7 +345,7 @@ int ext4fs_iterate_dir(struct ext2fs_node *dir, char *name,
 				}
 			}
 
-			debug("iterate >%s<\n", filename);
+			dev_dbg(fs->dev, "iterate >%s<\n", filename);
 
 			if (strcmp(filename, name) == 0) {
 				*ftype = type;
-- 
1.7.10.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 07/11] net/console: switch to pr_xxx
  2013-03-08 11:59   ` [PATCH 07/11] net/console: " Jean-Christophe PLAGNIOL-VILLARD
@ 2013-03-08 17:25     ` Sascha Hauer
  2013-03-08 17:43       ` Jean-Christophe PLAGNIOL-VILLARD
  0 siblings, 1 reply; 17+ messages in thread
From: Sascha Hauer @ 2013-03-08 17:25 UTC (permalink / raw)
  To: Jean-Christophe PLAGNIOL-VILLARD; +Cc: barebox

On Fri, Mar 08, 2013 at 12:59:39PM +0100, Jean-Christophe PLAGNIOL-VILLARD wrote:
> Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> ---
>  net/netconsole.c |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/net/netconsole.c b/net/netconsole.c
> index 7d0f3f4..8db8356 100644
> --- a/net/netconsole.c
> +++ b/net/netconsole.c
> @@ -185,7 +185,7 @@ static int netconsole_init(void)
>  
>  	ret = console_register(cdev);
>  	if (ret) {
> -		printf("netconsole: registering failed with %s\n", strerror(-ret));
> +		pr_err("netconsole: registering failed with %s\n", strerror(-ret));

Same comment as I already made: Please use pr_fmt

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 07/11] net/console: switch to pr_xxx
  2013-03-08 17:25     ` Sascha Hauer
@ 2013-03-08 17:43       ` Jean-Christophe PLAGNIOL-VILLARD
  2013-03-09 10:19         ` Sascha Hauer
  0 siblings, 1 reply; 17+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2013-03-08 17:43 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: barebox

On 18:25 Fri 08 Mar     , Sascha Hauer wrote:
> On Fri, Mar 08, 2013 at 12:59:39PM +0100, Jean-Christophe PLAGNIOL-VILLARD wrote:
> > Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> > ---
> >  net/netconsole.c |    4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/net/netconsole.c b/net/netconsole.c
> > index 7d0f3f4..8db8356 100644
> > --- a/net/netconsole.c
> > +++ b/net/netconsole.c
> > @@ -185,7 +185,7 @@ static int netconsole_init(void)
> >  
> >  	ret = console_register(cdev);
> >  	if (ret) {
> > -		printf("netconsole: registering failed with %s\n", strerror(-ret));
> > +		pr_err("netconsole: registering failed with %s\n", strerror(-ret));
> 
> Same comment as I already made: Please use pr_fmt
can you apply the other one

I'll resend just this one

Best Regards,
J.
> 
> Sascha
> 
> -- 
> Pengutronix e.K.                           |                             |
> Industrial Linux Solutions                 | http://www.pengutronix.de/  |
> Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
> Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 07/11] net/console: switch to pr_xxx
  2013-03-08 17:43       ` Jean-Christophe PLAGNIOL-VILLARD
@ 2013-03-09 10:19         ` Sascha Hauer
  0 siblings, 0 replies; 17+ messages in thread
From: Sascha Hauer @ 2013-03-09 10:19 UTC (permalink / raw)
  To: Jean-Christophe PLAGNIOL-VILLARD; +Cc: barebox

On Fri, Mar 08, 2013 at 06:43:49PM +0100, Jean-Christophe PLAGNIOL-VILLARD wrote:
> On 18:25 Fri 08 Mar     , Sascha Hauer wrote:
> > On Fri, Mar 08, 2013 at 12:59:39PM +0100, Jean-Christophe PLAGNIOL-VILLARD wrote:
> > > Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> > > ---
> > >  net/netconsole.c |    4 ++--
> > >  1 file changed, 2 insertions(+), 2 deletions(-)
> > > 
> > > diff --git a/net/netconsole.c b/net/netconsole.c
> > > index 7d0f3f4..8db8356 100644
> > > --- a/net/netconsole.c
> > > +++ b/net/netconsole.c
> > > @@ -185,7 +185,7 @@ static int netconsole_init(void)
> > >  
> > >  	ret = console_register(cdev);
> > >  	if (ret) {
> > > -		printf("netconsole: registering failed with %s\n", strerror(-ret));
> > > +		pr_err("netconsole: registering failed with %s\n", strerror(-ret));
> > 
> > Same comment as I already made: Please use pr_fmt
> can you apply the other one
> 
> I'll resend just this one

Fixed this myself.

Sascha

> 
> Best Regards,
> J.
> > 
> > Sascha
> > 
> > -- 
> > Pengutronix e.K.                           |                             |
> > Industrial Linux Solutions                 | http://www.pengutronix.de/  |
> > Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
> > Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
> 

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 03/11] intoduce dmesg to print the barebox printk to dmesg ring buffer
  2013-03-08 11:59   ` [PATCH 03/11] intoduce dmesg to print the barebox printk to dmesg ring buffer Jean-Christophe PLAGNIOL-VILLARD
@ 2013-03-09 10:25     ` Sascha Hauer
  0 siblings, 0 replies; 17+ messages in thread
From: Sascha Hauer @ 2013-03-09 10:25 UTC (permalink / raw)
  To: Jean-Christophe PLAGNIOL-VILLARD; +Cc: barebox

On Fri, Mar 08, 2013 at 12:59:35PM +0100, Jean-Christophe PLAGNIOL-VILLARD wrote:
> the size can be configured vai DMESG_KFIFO_OSIZE
> 
> +int vprintk(const char *fmt, va_list args)
> +{
> +	uint i, fi;
> +	char printbuffer[CFG_PBSIZE];
> +	char *s = printbuffer;
> +	int level;
> +
> +	/* For this to work, printbuffer must be larger than
> +	 * anything we ever want to print.
> +	 */
> +	fi = i = vsprintf(printbuffer, fmt, args);
> +
> +	level = printk_get_level(printbuffer);
> +	if (level) {
> +		s += 2;
> +		fi -= 2;
> +		kfifo_putc(dmesg_output_fifo, '<');
> +		kfifo_putc(dmesg_output_fifo, level);
> +		kfifo_putc(dmesg_output_fifo, '>');
> +	}
> +
> +	/* Print the string */
> +	if (level <= printk_level + '0')
> +		puts(s);
> +
> +	kfifo_put(dmesg_output_fifo, s, fi);

When the buffer is full this drops the current message instead of the
oldest.

Sascha


-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2013-03-09 10:26 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-07 21:54 [PATCH 00/11 v6] introduction of dmesg support Jean-Christophe PLAGNIOL-VILLARD
2013-03-08  8:05 ` Jan Lübbe
2013-03-08 11:59 ` [PATCH 01/11] kfifo: introduce kfifo_dump_str to dump the fifo Jean-Christophe PLAGNIOL-VILLARD
2013-03-08 11:59   ` [PATCH 02/11] console: switch to kfifo_dump_str Jean-Christophe PLAGNIOL-VILLARD
2013-03-08 11:59   ` [PATCH 03/11] intoduce dmesg to print the barebox printk to dmesg ring buffer Jean-Christophe PLAGNIOL-VILLARD
2013-03-09 10:25     ` Sascha Hauer
2013-03-08 11:59   ` [PATCH 04/11] startup: switch to pr_xxx Jean-Christophe PLAGNIOL-VILLARD
2013-03-08 11:59   ` [PATCH 05/11] at91: clock switch to pr_info Jean-Christophe PLAGNIOL-VILLARD
2013-03-08 11:59   ` [PATCH 06/11] meminfo: switch to pr_xxx Jean-Christophe PLAGNIOL-VILLARD
2013-03-08 11:59   ` [PATCH 07/11] net/console: " Jean-Christophe PLAGNIOL-VILLARD
2013-03-08 17:25     ` Sascha Hauer
2013-03-08 17:43       ` Jean-Christophe PLAGNIOL-VILLARD
2013-03-09 10:19         ` Sascha Hauer
2013-03-08 11:59   ` [PATCH 08/11] startup: " Jean-Christophe PLAGNIOL-VILLARD
2013-03-08 11:59   ` [PATCH 09/11] barebox_banner: switch to pr_info Jean-Christophe PLAGNIOL-VILLARD
2013-03-08 11:59   ` [PATCH 10/11] net/phy: convert " Jean-Christophe PLAGNIOL-VILLARD
2013-03-08 11:59   ` [PATCH 11/11] ext4: switch debug and printf to dev_xxx Jean-Christophe PLAGNIOL-VILLARD

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox