From: Alexey Brodkin Date: Fri, 10 Jun 2016 15:39:30 +0300 Subject: [U-Boot] [PATCH 1/2] linux-compat: Use original kern_levels.h for kernel debug levels In-Reply-To: <1465562371-5950-1-git-send-email-abrodkin@synopsys.com> References: <1465562371-5950-1-git-send-email-abrodkin@synopsys.com> Message-ID: <1465562371-5950-2-git-send-email-abrodkin@synopsys.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de 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 Cc: Stefan Roese Cc: Tom Rini --- 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 #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_ */ +#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