public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Alexey Brodkin <Alexey.Brodkin@synopsys.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH RESEND 1/2 v2] linux-compat: Use original kern_levels.h for kernel debug levels
Date: Fri, 10 Jun 2016 15:42:30 +0300	[thread overview]
Message-ID: <1465562551-6529-2-git-send-email-abrodkin@synopsys.com> (raw)
In-Reply-To: <1465562551-6529-1-git-send-email-abrodkin@synopsys.com>

Even currently in U-Boot we don't really use kernel debug levels
we do have quite a lot of code that was copy-pasted from Linux kernel
and so contains symbols like KERN_DEBUG and alike.

We used to just define those symbols which is fine if it is used in
constructions like:
----------------->8--------------
    printk(KERN_DEBUG "My debug message");
----------------->8--------------

But in other places where the symbol gets passed as a separate
argument (which we also have but luckily all of them are intself
dummy stubs in U-Boot) that won't work.

Now as a preparation to introduction of a real implementation of
print_hex_dump() we need those symbols to be defined as something real
so we're taking them as they are from Linux kernel.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Stefan Roese <sr@denx.de>
Cc: Tom Rini <trini@konsulko.com>
---

Changes v1 -> v2:
 * This patch was only introduced in v2.

 include/linux/compat.h      |  9 +--------
 include/linux/kern_levels.h | 38 ++++++++++++++++++++++++++++++++++++++
 2 files changed, 39 insertions(+), 8 deletions(-)
 create mode 100644 include/linux/kern_levels.h

diff --git a/include/linux/compat.h b/include/linux/compat.h
index e561ee3..0ce7d65 100644
--- a/include/linux/compat.h
+++ b/include/linux/compat.h
@@ -28,14 +28,7 @@ extern struct p_current *current;
 #define printk	printf
 #define printk_once	printf
 
-#define KERN_EMERG
-#define KERN_ALERT
-#define KERN_CRIT
-#define KERN_ERR
-#define KERN_WARNING
-#define KERN_NOTICE
-#define KERN_INFO
-#define KERN_DEBUG
+#include <linux/kern_levels.h>
 
 #define GFP_ATOMIC ((gfp_t) 0)
 #define GFP_KERNEL ((gfp_t) 0)
diff --git a/include/linux/kern_levels.h b/include/linux/kern_levels.h
new file mode 100644
index 0000000..c2ce155
--- /dev/null
+++ b/include/linux/kern_levels.h
@@ -0,0 +1,38 @@
+#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	""
+
+/* integer equivalents of KERN_<LEVEL> */
+#define LOGLEVEL_SCHED		-2	/* Deferred messages from sched code
+					 * are set to this special level */
+#define LOGLEVEL_DEFAULT	-1	/* default (or last) loglevel */
+#define LOGLEVEL_EMERG		0	/* system is unusable */
+#define LOGLEVEL_ALERT		1	/* action must be taken immediately */
+#define LOGLEVEL_CRIT		2	/* critical conditions */
+#define LOGLEVEL_ERR		3	/* error conditions */
+#define LOGLEVEL_WARNING	4	/* warning conditions */
+#define LOGLEVEL_NOTICE		5	/* normal but significant condition */
+#define LOGLEVEL_INFO		6	/* informational */
+#define LOGLEVEL_DEBUG		7	/* debug-level messages */
+
+#endif
-- 
2.5.5

  reply	other threads:[~2016-06-10 12:42 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-10 12:42 [U-Boot] [PATCH RESEND 0/2 v2] Introduce hexdump Alexey Brodkin
2016-06-10 12:42 ` Alexey Brodkin [this message]
2016-06-10 19:20   ` [U-Boot] [PATCH RESEND 1/2 v2] linux-compat: Use original kern_levels.h for kernel debug levels Tom Rini
2016-06-13 12:36     ` Alexey Brodkin
2016-06-13 14:13       ` Tom Rini
2016-06-10 12:42 ` [U-Boot] [PATCH RESEND 2/2 v2] lib: Add hexdump Alexey Brodkin
2016-06-10 15:31   ` Langer, Thomas
2016-06-10 19:37     ` Tom Rini
2016-06-10 20:51       ` Alexey Brodkin
2016-06-10 21:39         ` Tom Rini
2016-06-10 21:58           ` Алексей Бродкин
2016-06-10 22:18             ` Tom Rini
2016-06-10 19:22   ` Tom Rini
2016-06-10 20:49     ` Alexey Brodkin

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=1465562551-6529-2-git-send-email-abrodkin@synopsys.com \
    --to=alexey.brodkin@synopsys.com \
    --cc=u-boot@lists.denx.de \
    /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