summaryrefslogtreecommitdiffstats
path: root/include/printk.h
diff options
context:
space:
mode:
authorJean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>2012-12-19 14:57:10 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2013-01-27 14:23:09 +0100
commitb537a772c25ed07126d1264f01bc25f8991a3234 (patch)
tree3a6df7cd02da5aeae5e1ccdbdbed76e686aa3614 /include/printk.h
parent4dd9fc810691be82c700eb2c053be9a1458e1659 (diff)
downloadbarebox-b537a772c25ed07126d1264f01bc25f8991a3234.tar.gz
barebox-b537a772c25ed07126d1264f01bc25f8991a3234.tar.xz
consolidate print* in a single header
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'include/printk.h')
-rw-r--r--include/printk.h58
1 files changed, 58 insertions, 0 deletions
diff --git a/include/printk.h b/include/printk.h
new file mode 100644
index 0000000000..9e6f4bd699
--- /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