From: Sascha Hauer <s.hauer@pengutronix.de>
To: barebox@lists.infradead.org
Subject: [PATCH 01/12] consolidate print* in a single header
Date: Tue, 29 Jan 2013 09:45:36 +0100 [thread overview]
Message-ID: <1359449147-30145-2-git-send-email-s.hauer@pengutronix.de> (raw)
In-Reply-To: <1359449147-30145-1-git-send-email-s.hauer@pengutronix.de>
From: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
include/common.h | 17 +---------------
include/driver.h | 29 ---------------------------
include/printk.h | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 59 insertions(+), 45 deletions(-)
create mode 100644 include/printk.h
diff --git a/include/common.h b/include/common.h
index b1c96de..32a5d96 100644
--- a/include/common.h
+++ b/include/common.h
@@ -29,6 +29,7 @@
#include <linux/kernel.h>
#include <linux/stddef.h>
#include <asm/common.h>
+#include <printk.h>
/*
* sanity check. The Linux Kernel defines only one of __LITTLE_ENDIAN and
@@ -48,22 +49,6 @@
#error "None of __LITTLE_ENDIAN and __BIG_ENDIAN are defined"
#endif
-#define pr_info(fmt, arg...) printf(fmt, ##arg)
-#define pr_notice(fmt, arg...) printf(fmt, ##arg)
-#define pr_err(fmt, arg...) printf(fmt, ##arg)
-#define pr_warning(fmt, arg...) printf(fmt, ##arg)
-#define pr_crit(fmt, arg...) printf(fmt, ##arg)
-#define pr_alert(fmt, arg...) printf(fmt, ##arg)
-#define pr_emerg(fmt, arg...) printf(fmt, ##arg)
-
-#ifdef DEBUG
-#define pr_debug(fmt, arg...) printf(fmt, ##arg)
-#else
-#define pr_debug(fmt, arg...) do {} while(0)
-#endif
-
-#define debug(fmt, arg...) pr_debug(fmt, ##arg)
-
#define BUG() do { \
printf("BUG: failure at %s:%d/%s()!\n", __FILE__, __LINE__, __FUNCTION__); \
panic("BUG!"); \
diff --git a/include/driver.h b/include/driver.h
index 7ad0374..31f5d69 100644
--- a/include/driver.h
+++ b/include/driver.h
@@ -358,35 +358,6 @@ static inline int dev_close_default(struct device_d *dev, struct filep *f)
return 0;
}
-/* debugging and troubleshooting/diagnostic helpers. */
-
-int dev_printf(const struct device_d *dev, const char *format, ...)
- __attribute__ ((format(__printf__, 2, 3)));
-
-
-#define dev_emerg(dev, format, arg...) \
- dev_printf((dev) , format , ## arg)
-#define dev_alert(dev, format, arg...) \
- dev_printf((dev) , format , ## arg)
-#define dev_crit(dev, format, arg...) \
- dev_printf((dev) , format , ## arg)
-#define dev_err(dev, format, arg...) \
- dev_printf(dev , format , ## arg)
-#define dev_warn(dev, format, arg...) \
- dev_printf((dev) , format , ## arg)
-#define dev_notice(dev, format, arg...) \
- dev_printf((dev) , format , ## arg)
-#define dev_info(dev, format, arg...) \
- dev_printf((dev) , format , ## arg)
-
-#if defined(DEBUG)
-#define dev_dbg(dev, format, arg...) \
- dev_printf((dev) , format , ## arg)
-#else
-#define dev_dbg(dev, format, arg...) \
- ({ if (0) dev_printf((dev), format, ##arg); 0; })
-#endif
-
struct bus_type {
char *name;
int (*match)(struct device_d *dev, struct driver_d *drv);
diff --git a/include/printk.h b/include/printk.h
new file mode 100644
index 0000000..9e6f4bd
--- /dev/null
+++ b/include/printk.h
@@ -0,0 +1,58 @@
+#ifndef __PRINTK_H
+#define __PRINTK_H
+
+#define MSG_EMERG 0 /* system is unusable */
+#define MSG_ALERT 1 /* action must be taken immediately */
+#define MSG_CRIT 2 /* critical conditions */
+#define MSG_ERR 3 /* error conditions */
+#define MSG_WARNING 4 /* warning conditions */
+#define MSG_NOTICE 5 /* normal but significant condition */
+#define MSG_INFO 6 /* informational */
+#define MSG_DEBUG 7 /* debug-level messages */
+
+/* debugging and troubleshooting/diagnostic helpers. */
+
+int dev_printf(const struct device_d *dev, const char *format, ...)
+ __attribute__ ((format(__printf__, 2, 3)));
+
+
+#define dev_emerg(dev, format, arg...) \
+ dev_printf((dev) , format , ## arg)
+#define dev_alert(dev, format, arg...) \
+ dev_printf((dev) , format , ## arg)
+#define dev_crit(dev, format, arg...) \
+ dev_printf((dev) , format , ## arg)
+#define dev_err(dev, format, arg...) \
+ dev_printf(dev , format , ## arg)
+#define dev_warn(dev, format, arg...) \
+ dev_printf((dev) , format , ## arg)
+#define dev_notice(dev, format, arg...) \
+ dev_printf((dev) , format , ## arg)
+#define dev_info(dev, format, arg...) \
+ dev_printf((dev) , format , ## arg)
+
+#if defined(DEBUG)
+#define dev_dbg(dev, format, arg...) \
+ dev_printf((dev) , format , ## arg)
+#else
+#define dev_dbg(dev, format, arg...) \
+ ({ if (0) dev_printf((dev), format, ##arg); 0; })
+#endif
+
+#define pr_info(fmt, arg...) printk(fmt, ##arg)
+#define pr_notice(fmt, arg...) printk(fmt, ##arg)
+#define pr_err(fmt, arg...) printk(fmt, ##arg)
+#define pr_warning(fmt, arg...) printk(fmt, ##arg)
+#define pr_crit(fmt, arg...) printk(fmt, ##arg)
+#define pr_alert(fmt, arg...) printk(fmt, ##arg)
+#define pr_emerg(fmt, arg...) printk(fmt, ##arg)
+
+#ifdef DEBUG
+#define pr_debug(fmt, arg...) printk(fmt, ##arg)
+#define debug(fmt, arg...) printf(fmt, ##arg)
+#else
+#define pr_debug(fmt, arg...) do {} while(0)
+#define debug(fmt, arg...) do {} while(0)
+#endif
+
+#endif
--
1.7.10.4
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2013-01-29 8:46 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-29 8:45 [PATCH] introduce compiletime loglevel Sascha Hauer
2013-01-29 8:45 ` Sascha Hauer [this message]
2013-01-29 8:45 ` [PATCH 02/12] mtd m25p80: consistenly switch to dev_* messages Sascha Hauer
2013-01-29 8:45 ` [PATCH 03/12] treewide: fix format specifiers Sascha Hauer
2013-01-29 8:45 ` [PATCH 04/12] nios2: Let readl return an unsigned int Sascha Hauer
2013-01-29 8:45 ` [PATCH 05/12] nios2: Use unsigned long for __kernel_size_t Sascha Hauer
2013-01-29 8:45 ` [PATCH 06/12] blackfin: " Sascha Hauer
2013-01-29 8:45 ` [PATCH 07/12] USB ehci: Use dev_* for messages Sascha Hauer
2013-01-29 8:45 ` [PATCH 08/12] introduce compile time loglevel Sascha Hauer
2013-01-29 8:45 ` [PATCH 09/12] introduce pr_fmt Sascha Hauer
2013-01-29 8:45 ` [PATCH 10/12] ARM mmu: Use pr_debug Sascha Hauer
2013-01-29 8:45 ` [PATCH 11/12] ARM pcm038: Specify pr_fmt and change messages to pr_* Sascha Hauer
2013-01-29 8:45 ` [PATCH 12/12] mtd nand: " Sascha Hauer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1359449147-30145-2-git-send-email-s.hauer@pengutronix.de \
--to=s.hauer@pengutronix.de \
--cc=barebox@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox