Skip to contentSkip to conversation

kernel.h cleanups

PATCH In review Joe Perches 2 participants 18 messages Dec 16, 2009 – Dec 17, 2009

Subsystems (2)
lore
Share & tools
lore
#4 lore raw

PATCH 4/14 kernel.h: Add argument names to strtoXX, Xscanf prototypes

In reply to Joe Perches

It's easier to parse prototypes with argument names.

---
 include/linux/kernel.h |   36 ++++++++++++++++++++++++------------
 1 files changed, 24 insertions(+), 12 deletions(-)
include/linux/kernel.h +24 -12
index 9206268..75e7439 100644
@@ -137,18 +137,30 @@ NORET_TYPE void panic(const char *fmt, ...)
 extern void oops_enter(void);
 extern void oops_exit(void);
 extern int oops_may_print(void);
-NORET_TYPE void do_exit(long error_code)
+NORET_TYPE void do_exit(long code)
 	ATTRIB_NORET;
-NORET_TYPE void complete_and_exit(struct completion *, long)
+NORET_TYPE void complete_and_exit(struct completion *comp, long code)
 	ATTRIB_NORET;
-extern unsigned long simple_strtoul(const char *, char **, unsigned int);
-extern long simple_strtol(const char *, char **, unsigned int);
-extern unsigned long long simple_strtoull(const char *, char **, unsigned int);
-extern long long simple_strtoll(const char *, char **, unsigned int);
-extern int strict_strtoul(const char *, unsigned int, unsigned long *);
-extern int strict_strtol(const char *, unsigned int, long *);
-extern int strict_strtoull(const char *, unsigned int, unsigned long long *);
-extern int strict_strtoll(const char *, unsigned int, long long *);
+
+/*
+ * stdlib - String to type conversions
+ */
+extern unsigned long simple_strtoul(const char *cp, char **endp,
+				    unsigned int base);
+extern long simple_strtol(const char *cp, char **endp, unsigned int base);
+extern unsigned long long simple_strtoull(const char *cp, char **endp,
+					  unsigned int base);
+extern long long simple_strtoll(const char *cp, char **endp, unsigned int base);
+extern int strict_strtoul(const char *cp, unsigned int base,
+			  unsigned long *res);
+extern int strict_strtol(const char *cp, unsigned int base, long *res);
+extern int strict_strtoull(const char *cp, unsigned int base,
+			   unsigned long long *res);
+extern int strict_strtoll(const char *cp, unsigned int base, long long *res);
+
+/*
+ * string - String handling
+ */
 extern int sprintf(char *buf, const char *fmt, ...)
 	__attribute__ ((format (printf, 2, 3)));
 extern int vsprintf(char *buf, const char *, va_list)
@@ -165,9 +177,9 @@ extern char *kasprintf(gfp_t gfp, const char *fmt, ...)
 	__attribute__ ((format (printf, 2, 3)));
 extern char *kvasprintf(gfp_t gfp, const char *fmt, va_list args);
 
-extern int sscanf(const char *, const char *, ...)
+extern int sscanf(const char *buf, const char *fmt, ...)
 	__attribute__ ((format (scanf, 2, 3)));
-extern int vsscanf(const char *, const char *, va_list)
+extern int vsscanf(const char *buf, const char *fmt, va_list)
 	__attribute__ ((format (scanf, 2, 0)));
 
 extern int get_option(char **str, int *pint);
Signature · 1 line
1.6.6.rc0.57.gad7a
#0 lore raw

cover kernel.h cleanups

No one seems to like taking patches for kernel.h so I'm sending these to Linus and seeing what happens.

kernel.h has become a chaotic jumble collected over time. Collect the functions and #defines together in logical groups. Do some checkpatch neatening and make it more style conformant.

Compiled x86 allnoconfig, allyesconfig, defconfig

Joe Perches (14):
kernel.h: Consolidate console and logging functions and defines kernel.h: Checkpatch cleaning
kernel.h: ARRAY_SIZE neatening
kernel.h: Add argument names to strtoXX, Xscanf prototypes kernel.h: printk neatening drivers/firmware/iscsi_ibft.c: Use %pI4 to print netmask kernel.h: Move NIPQUAD and NIPQUAD_FMT to in.h kernel.h: Group math and limits functions, indent function args kernel.h: Don't use NORET_AND just use noreturn, instead kernel.h: Remove ATTRIB_NORET, use __attribute__((noreturn)) kernel.h: Remove uses of NORET_TYPE
kernel.h: Add pr_<level>_once
kernel.h: Kernel address utility aggregation and other neatening kernel/exit.c and kernel/panic.c: Remove unused NORET_TYPE

 drivers/firmware/iscsi_ibft.c |    8 +-
 include/linux/in.h            |   11 +
 include/linux/kernel.h        |  742 +++++++++++++++++++++++------------------
 kernel/exit.c                 |    4 +-
 kernel/panic.c                |    2 +-
 5 files changed, 437 insertions(+), 330 deletions(-)
#5 lore raw

PATCH 5/14 kernel.h: printk neatening

Make a few printk elements a bit more consistent Remove trailing backslashes from static inline prototype Use fmt and ##__VA_ARGS__ in printk_once
Make statement expressions multiline
Use tabs for #define foo bar

---
 include/linux/kernel.h |   90 ++++++++++++++++++++++++++++--------------------
 1 files changed, 53 insertions(+), 37 deletions(-)
include/linux/kernel.h +53 -37
index 75e7439..f7144b1 100644
@@ -385,10 +385,10 @@ extern const char linux_proc_banner[];
 
 extern int console_printk[];
 
-#define console_loglevel (console_printk[0])
-#define default_message_loglevel (console_printk[1])
-#define minimum_console_loglevel (console_printk[2])
-#define default_console_loglevel (console_printk[3])
+#define console_loglevel		(console_printk[0])
+#define default_message_loglevel	(console_printk[1])
+#define minimum_console_loglevel	(console_printk[2])
+#define default_console_loglevel	(console_printk[3])
 
 /*
  * FW_BUG
@@ -430,12 +430,13 @@ extern int printk_delay_msec;
 /*
  * Print a one-time message (analogous to WARN_ONCE() et al):
  */
-#define printk_once(x...) ({			\
+#define printk_once(fmt, ...)			\
+({						\
 	static bool __print_once;		\
 						\
 	if (!__print_once) {			\
 		__print_once = true;		\
-		printk(x);			\
+		printk(fmt, ##__VA_ARGS__);	\
 	}					\
 })
 
@@ -448,12 +449,14 @@ static inline int printk(const char *s, ...)
 	__attribute__ ((format (printf, 1, 2)));
 static inline int __cold printk(const char *s, ...) { return 0; }
 static inline int printk_ratelimit(void) { return 0; }
-static inline bool printk_timed_ratelimit(unsigned long *caller_jiffies, \
-					  unsigned int interval_msec)	\
-		{ return false; }
+static inline bool printk_timed_ratelimit(unsigned long *caller_jiffies,
+					  unsigned int interval_msec)
+{
+	return false;
+}
 
 /* No effect, but we still get type checking even in the !PRINTK case: */
-#define printk_once(x...) printk(x)
+#define printk_once(fmt, ...) printk(fmt, ##__VA_ARGS__)
 
 static inline void log_buf_kexec_setup(void)
 {
@@ -506,43 +509,51 @@ extern void print_hex_dump_bytes(const char *prefix_str, int prefix_type,
 #define pr_fmt(fmt) fmt
 #endif
 
-#define pr_emerg(fmt, ...) \
+#define pr_emerg(fmt, ...)				\
 	printk(KERN_EMERG pr_fmt(fmt), ##__VA_ARGS__)
-#define pr_alert(fmt, ...) \
+#define pr_alert(fmt, ...)				\
 	printk(KERN_ALERT pr_fmt(fmt), ##__VA_ARGS__)
-#define pr_crit(fmt, ...) \
+#define pr_crit(fmt, ...)				\
 	printk(KERN_CRIT pr_fmt(fmt), ##__VA_ARGS__)
-#define pr_err(fmt, ...) \
+#define pr_err(fmt, ...)				\
 	printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
-#define pr_warning(fmt, ...) \
+#define pr_warning(fmt, ...)				\
 	printk(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__)
-#define pr_notice(fmt, ...) \
+#define pr_notice(fmt, ...)				\
 	printk(KERN_NOTICE pr_fmt(fmt), ##__VA_ARGS__)
-#define pr_info(fmt, ...) \
+#define pr_info(fmt, ...)				\
 	printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
-#define pr_cont(fmt, ...) \
+#define pr_cont(fmt, ...)				\
 	printk(KERN_CONT fmt, ##__VA_ARGS__)
 
 /* pr_devel() should produce zero code unless DEBUG is defined */
 #ifdef DEBUG
-#define pr_devel(fmt, ...) \
+#define pr_devel(fmt, ...)				\
 	printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
 #else
-#define pr_devel(fmt, ...) \
-	({ if (0) printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__); 0; })
+#define pr_devel(fmt, ...)					\
+({								\
+	if (0)							\
+		printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__);	\
+	0;							\
+})
 #endif
 
 /* If you are writing a driver, please use dev_dbg instead */
 #if defined(DEBUG)
-#define pr_debug(fmt, ...) \
+#define pr_debug(fmt, ...)				\
 	printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
 #elif defined(CONFIG_DYNAMIC_DEBUG)
 /* dynamic_pr_debug() uses pr_fmt() internally so we don't need it here */
-#define pr_debug(fmt, ...) \
+#define pr_debug(fmt, ...)				\
 	dynamic_pr_debug(fmt, ##__VA_ARGS__)
 #else
-#define pr_debug(fmt, ...) \
-	({ if (0) printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__); 0; })
+#define pr_debug(fmt, ...)					\
+({								\
+	if (0)							\
+		printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__);	\
+	0;							\
+})
 #endif
 
 /*
@@ -550,7 +561,8 @@ extern void print_hex_dump_bytes(const char *prefix_str, int prefix_type,
  * no local ratelimit_state used in the !PRINTK case
  */
 #ifdef CONFIG_PRINTK
-#define printk_ratelimited(fmt, ...)  ({		\
+#define printk_ratelimited(fmt, ...)			\
+({							\
 	static struct ratelimit_state _rs = {		\
 		.interval = DEFAULT_RATELIMIT_INTERVAL, \
 		.burst = DEFAULT_RATELIMIT_BURST,       \
@@ -564,29 +576,33 @@ extern void print_hex_dump_bytes(const char *prefix_str, int prefix_type,
 #define printk_ratelimited printk
 #endif
 
-#define pr_emerg_ratelimited(fmt, ...) \
+#define pr_emerg_ratelimited(fmt, ...)					\
 	printk_ratelimited(KERN_EMERG pr_fmt(fmt), ##__VA_ARGS__)
-#define pr_alert_ratelimited(fmt, ...) \
+#define pr_alert_ratelimited(fmt, ...)					\
 	printk_ratelimited(KERN_ALERT pr_fmt(fmt), ##__VA_ARGS__)
-#define pr_crit_ratelimited(fmt, ...) \
+#define pr_crit_ratelimited(fmt, ...)					\
 	printk_ratelimited(KERN_CRIT pr_fmt(fmt), ##__VA_ARGS__)
-#define pr_err_ratelimited(fmt, ...) \
+#define pr_err_ratelimited(fmt, ...)					\
 	printk_ratelimited(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
-#define pr_warning_ratelimited(fmt, ...) \
+#define pr_warning_ratelimited(fmt, ...)				\
 	printk_ratelimited(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__)
-#define pr_notice_ratelimited(fmt, ...) \
+#define pr_notice_ratelimited(fmt, ...)					\
 	printk_ratelimited(KERN_NOTICE pr_fmt(fmt), ##__VA_ARGS__)
-#define pr_info_ratelimited(fmt, ...) \
+#define pr_info_ratelimited(fmt, ...)					\
 	printk_ratelimited(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
 /* no pr_cont_ratelimited, don't do that... */
 /* If you are writing a driver, please use dev_dbg instead */
 #if defined(DEBUG)
-#define pr_debug_ratelimited(fmt, ...) \
+#define pr_debug_ratelimited(fmt, ...)					\
 	printk_ratelimited(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
 #else
-#define pr_debug_ratelimited(fmt, ...) \
-	({ if (0) printk_ratelimited(KERN_DEBUG pr_fmt(fmt), \
-				     ##__VA_ARGS__); 0; })
+#define pr_debug_ratelimited(fmt, ...)					\
+({									\
+	if (0)								\
+		printk_ratelimited(KERN_DEBUG pr_fmt(fmt),		\
+				   ##__VA_ARGS__);			\
+	0;								\
+})
 #endif
 
 /*
Signature · 1 line
1.6.6.rc0.57.gad7a
#7 lore raw

PATCH 7/14 kernel.h: Move NIPQUAD and NIPQUAD_FMT to in.h

In reply to Joe Perches

Move the #defines to where they're actually useful. All the current uses of NIPQUAD still compile successfully.

---
 include/linux/in.h     |   11 +++++++++++
 include/linux/kernel.h |   11 -----------
 2 files changed, 11 insertions(+), 11 deletions(-)
include/linux/in.h +11 -0
index b615649..4e0f177 100644
@@ -247,6 +247,17 @@ struct sockaddr_in {
 
 #ifdef __KERNEL__
 
+/*
+ *      Display an IP address in readable format.
+ */
+
+#define NIPQUAD(addr) \
+	((unsigned char *)&addr)[0], \
+	((unsigned char *)&addr)[1], \
+	((unsigned char *)&addr)[2], \
+	((unsigned char *)&addr)[3]
+#define NIPQUAD_FMT "%u.%u.%u.%u"
+
 static inline bool ipv4_is_loopback(__be32 addr)
 {
 	return (addr & htonl(0xff000000)) == htonl(0x7f000000);
include/linux/kernel.h +0 -11
index f7144b1..1764d2d 100644
@@ -240,17 +240,6 @@ static inline char *pack_hex_byte(char *buf, u8 byte)
 }
 
 /*
- *      Display an IP address in readable format.
- */
-
-#define NIPQUAD(addr) \
-	((unsigned char *)&addr)[0], \
-	((unsigned char *)&addr)[1], \
-	((unsigned char *)&addr)[2], \
-	((unsigned char *)&addr)[3]
-#define NIPQUAD_FMT "%u.%u.%u.%u"
-
-/*
  * min()/max()/clamp() macros that also do
  * strict type-checking.. See the
  * "unnecessary" pointer comparison.
Signature · 1 line
1.6.6.rc0.57.gad7a
#2 lore raw

PATCH 2/14 kernel.h: Checkpatch cleaning

In reply to Joe Perches

The warnings and errors still generated aren't interesting

was: total: 43 errors, 8 warnings, 756 lines checked
is: total: 3 errors, 7 warnings, 766 lines checked

---
 include/linux/kernel.h |  127 ++++++++++++++++++++++++------------------------
 1 files changed, 64 insertions(+), 63 deletions(-)
include/linux/kernel.h +64 -63
index c9cdfca..2cc6d70 100644
@@ -16,56 +16,54 @@
 #include <linux/log2.h>
 #include <linux/typecheck.h>
 #include <linux/dynamic_debug.h>
+#include <linux/bug.h>
 #include <asm/byteorder.h>
-#include <asm/bug.h>
 
 #define USHORT_MAX	((u16)(~0U))
-#define SHORT_MAX	((s16)(USHORT_MAX>>1))
+#define SHORT_MAX	((s16)(USHORT_MAX >> 1))
 #define SHORT_MIN	(-SHORT_MAX - 1)
-#define INT_MAX		((int)(~0U>>1))
+#define INT_MAX		((int)(~0U >> 1))
 #define INT_MIN		(-INT_MAX - 1)
 #define UINT_MAX	(~0U)
 #define LONG_MAX	((long)(~0UL>>1))
 #define LONG_MIN	(-LONG_MAX - 1)
 #define ULONG_MAX	(~0UL)
-#define LLONG_MAX	((long long)(~0ULL>>1))
+#define LLONG_MAX	((long long)(~0ULL >> 1))
 #define LLONG_MIN	(-LLONG_MAX - 1)
 #define ULLONG_MAX	(~0ULL)
 
 #define STACK_MAGIC	0xdeadbeef
 
-#define ALIGN(x,a)		__ALIGN_MASK(x,(typeof(x))(a)-1)
-#define __ALIGN_MASK(x,mask)	(((x)+(mask))&~(mask))
+#define __ALIGN_MASK(x, mask)	(((x) + (mask)) & ~(mask))
+#define ALIGN(x, a)		__ALIGN_MASK(x, (typeof(x))(a) - 1)
 #define PTR_ALIGN(p, a)		((typeof(p))ALIGN((unsigned long)(p), (a)))
-#define IS_ALIGNED(x, a)		(((x) & ((typeof(x))(a) - 1)) == 0)
+#define IS_ALIGNED(x, a)	(((x) & ((typeof(x))(a) - 1)) == 0)
 
-#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
+#define ARRAY_SIZE(arr)		(sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
+#define FIELD_SIZEOF(t, f)	(sizeof(((t *)0)->f))
 
-#define FIELD_SIZEOF(t, f) (sizeof(((t*)0)->f))
-#define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d))
-#define roundup(x, y) ((((x) + ((y) - 1)) / (y)) * (y))
-#define DIV_ROUND_CLOSEST(x, divisor)(			\
-{							\
+#define roundup(x, y)		((((x) + ((y) - 1)) / (y)) * (y))
+#define DIV_ROUND_UP(n, d)	(((n) + (d) - 1) / (d))
+#define DIV_ROUND_CLOSEST(x, divisor)			\
+({							\
 	typeof(divisor) __divisor = divisor;		\
 	(((x) + ((__divisor) / 2)) / (__divisor));	\
-}							\
-)
+})
 
-#define _RET_IP_		(unsigned long)__builtin_return_address(0)
-#define _THIS_IP_  ({ __label__ __here; __here: (unsigned long)&&__here; })
+#define _RET_IP_	(unsigned long)__builtin_return_address(0)
+#define _THIS_IP_	({ __label__ __here; __here: (unsigned long)&&__here; })
 
 #ifdef CONFIG_LBDAF
 # include <asm/div64.h>
 # define sector_div(a, b) do_div(a, b)
 #else
-# define sector_div(n, b)( \
-{ \
-	int _res; \
-	_res = (n) % (b); \
-	(n) /= (b); \
-	_res; \
-} \
-)
+# define sector_div(n, b)	\
+({				\
+	int _res;		\
+	_res = (n) % (b);	\
+	(n) /= (b);		\
+	_res;			\
+})
 #endif
 
 /**
@@ -76,13 +74,13 @@
  * the "right shift count >= width of type" warning when that quantity is
  * 32-bits.
  */
-#define upper_32_bits(n) ((u32)(((n) >> 16) >> 16))
+#define upper_32_bits(n)	((u32)(((n) >> 16) >> 16))
 
 /**
  * lower_32_bits - return bits 0-31 of a number
  * @n: the number we're accessing
  */
-#define lower_32_bits(n) ((u32)(n))
+#define lower_32_bits(n)	((u32)(n))
 
 struct completion;
 struct pt_regs;
@@ -96,7 +94,7 @@ extern int _cond_resched(void);
 #endif
 
 #ifdef CONFIG_DEBUG_SPINLOCK_SLEEP
-  void __might_sleep(char *file, int line, int preempt_offset);
+void __might_sleep(char *file, int line, int preempt_offset);
 /**
  * might_sleep - annotation for functions that can sleep
  *
@@ -116,10 +114,11 @@ extern int _cond_resched(void);
 
 #define might_sleep_if(cond) do { if (cond) might_sleep(); } while (0)
 
-#define abs(x) ({				\
-		long __x = (x);			\
-		(__x < 0) ? -__x : __x;		\
-	})
+#define abs(x)				\
+({					\
+	long __x = (x);			\
+	(__x < 0) ? -__x : __x;		\
+})
 
 #ifdef CONFIG_PROVE_LOCKING
 void might_fault(void);
@@ -132,7 +131,7 @@ static inline void might_fault(void)
 
 extern struct atomic_notifier_head panic_notifier_list;
 extern long (*panic_blink)(long time);
-NORET_TYPE void panic(const char * fmt, ...)
+NORET_TYPE void panic(const char *fmt, ...)
 	__attribute__ ((NORET_AND format (printf, 1, 2))) __cold;
 extern void oops_enter(void);
 extern void oops_exit(void);
@@ -141,23 +140,23 @@ NORET_TYPE void do_exit(long error_code)
 	ATTRIB_NORET;
 NORET_TYPE void complete_and_exit(struct completion *, long)
 	ATTRIB_NORET;
-extern unsigned long simple_strtoul(const char *,char **,unsigned int);
-extern long simple_strtol(const char *,char **,unsigned int);
-extern unsigned long long simple_strtoull(const char *,char **,unsigned int);
-extern long long simple_strtoll(const char *,char **,unsigned int);
+extern unsigned long simple_strtoul(const char *, char **, unsigned int);
+extern long simple_strtol(const char *, char **, unsigned int);
+extern unsigned long long simple_strtoull(const char *, char **, unsigned int);
+extern long long simple_strtoll(const char *, char **, unsigned int);
 extern int strict_strtoul(const char *, unsigned int, unsigned long *);
 extern int strict_strtol(const char *, unsigned int, long *);
 extern int strict_strtoull(const char *, unsigned int, unsigned long long *);
 extern int strict_strtoll(const char *, unsigned int, long long *);
-extern int sprintf(char * buf, const char * fmt, ...)
+extern int sprintf(char *buf, const char *fmt, ...)
 	__attribute__ ((format (printf, 2, 3)));
 extern int vsprintf(char *buf, const char *, va_list)
 	__attribute__ ((format (printf, 2, 0)));
-extern int snprintf(char * buf, size_t size, const char * fmt, ...)
+extern int snprintf(char *buf, size_t size, const char *fmt, ...)
 	__attribute__ ((format (printf, 3, 4)));
 extern int vsnprintf(char *buf, size_t size, const char *fmt, va_list args)
 	__attribute__ ((format (printf, 3, 0)));
-extern int scnprintf(char * buf, size_t size, const char * fmt, ...)
+extern int scnprintf(char *buf, size_t size, const char *fmt, ...)
 	__attribute__ ((format (printf, 3, 4)));
 extern int vscnprintf(char *buf, size_t size, const char *fmt, va_list args)
 	__attribute__ ((format (printf, 3, 0)));
@@ -270,8 +269,8 @@ static inline char *pack_hex_byte(char *buf, u8 byte)
 	typeof(max) __max = (max);		\
 	(void) (&__val == &__min);		\
 	(void) (&__val == &__max);		\
-	__val = __val < __min ? __min: __val;	\
-	__val > __max ? __max: __val; })
+	__val = __val < __min ? __min : __val;	\
+	__val > __max ? __max : __val; })
 
 /*
  * ..and if you can't take the strict
@@ -282,12 +281,12 @@ static inline char *pack_hex_byte(char *buf, u8 byte)
 #define min_t(type, x, y) ({			\
 	type __min1 = (x);			\
 	type __min2 = (y);			\
-	__min1 < __min2 ? __min1: __min2; })
+	__min1 < __min2 ? __min1 : __min2; })
 
 #define max_t(type, x, y) ({			\
 	type __max1 = (x);			\
 	type __max2 = (y);			\
-	__max1 > __max2 ? __max1: __max2; })
+	__max1 > __max2 ? __max1 : __max2; })
 
 /**
  * clamp_t - return a value clamped to a given range using a given type
@@ -303,8 +302,8 @@ static inline char *pack_hex_byte(char *buf, u8 byte)
 	type __val = (val);			\
 	type __min = (min);			\
 	type __max = (max);			\
-	__val = __val < __min ? __min: __val;	\
-	__val > __max ? __max: __val; })
+	__val = __val < __min ? __min : __val;	\
+	__val > __max ? __max : __val; })
 
 /**
  * clamp_val - return a value clamped to a given range using val's type
@@ -321,8 +320,8 @@ static inline char *pack_hex_byte(char *buf, u8 byte)
 	typeof(val) __val = (val);		\
 	typeof(val) __min = (min);		\
 	typeof(val) __max = (max);		\
-	__val = __val < __min ? __min: __val;	\
-	__val > __max ? __max: __val; })
+	__val = __val < __min ? __min : __val;	\
+	__val > __max ? __max : __val; })
 
 
 /*
@@ -339,8 +338,8 @@ static inline char *pack_hex_byte(char *buf, u8 byte)
  *
  */
 #define container_of(ptr, type, member) ({			\
-	const typeof( ((type *)0)->member ) *__mptr = (ptr);	\
-	(type *)( (char *)__mptr - offsetof(type,member) );	\
+	const typeof(((type *)0)->member) *__mptr = (ptr);	\
+	(type *)((char *)__mptr - offsetof(type, member));	\
 })
 
 struct sysinfo;
@@ -385,7 +384,7 @@ extern int console_printk[];
  * should be able to fix this issue or at least get a concrete idea of the
  * problem by reading your message without the need of looking at the kernel
  * code.
- * 
+ *
  * Use it for definite and high priority BIOS bugs.
  *
  * FW_WARN
@@ -405,7 +404,7 @@ extern int console_printk[];
 #ifdef CONFIG_PRINTK
 asmlinkage int vprintk(const char *fmt, va_list args)
 	__attribute__ ((format (printf, 1, 0)));
-asmlinkage int printk(const char * fmt, ...)
+asmlinkage int printk(const char *fmt, ...)
 	__attribute__ ((format (printf, 1, 2))) __cold;
 
 extern int __printk_ratelimit(const char *func);
@@ -469,7 +468,9 @@ static inline void console_verbose(void)
 
 extern void bust_spinlocks(int yes);
 extern void wake_up_klogd(void);
-extern int oops_in_progress;		/* If set, an oops, panic(), BUG() or die() is in progress */
+
+/* If set, an oops, panic(), BUG() or die() is in progress */
+extern int oops_in_progress;
 
 extern void dump_stack(void) __cold;
 
@@ -493,19 +494,19 @@ extern void print_hex_dump_bytes(const char *prefix_str, int prefix_type,
 #endif
 
 #define pr_emerg(fmt, ...) \
-        printk(KERN_EMERG pr_fmt(fmt), ##__VA_ARGS__)
+	printk(KERN_EMERG pr_fmt(fmt), ##__VA_ARGS__)
 #define pr_alert(fmt, ...) \
-        printk(KERN_ALERT pr_fmt(fmt), ##__VA_ARGS__)
+	printk(KERN_ALERT pr_fmt(fmt), ##__VA_ARGS__)
 #define pr_crit(fmt, ...) \
-        printk(KERN_CRIT pr_fmt(fmt), ##__VA_ARGS__)
+	printk(KERN_CRIT pr_fmt(fmt), ##__VA_ARGS__)
 #define pr_err(fmt, ...) \
-        printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
+	printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
 #define pr_warning(fmt, ...) \
-        printk(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__)
+	printk(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__)
 #define pr_notice(fmt, ...) \
-        printk(KERN_NOTICE pr_fmt(fmt), ##__VA_ARGS__)
+	printk(KERN_NOTICE pr_fmt(fmt), ##__VA_ARGS__)
 #define pr_info(fmt, ...) \
-        printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
+	printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
 #define pr_cont(fmt, ...) \
 	printk(KERN_CONT fmt, ##__VA_ARGS__)
 
@@ -738,14 +739,14 @@ struct sysinfo {
 #define BUILD_BUG_ON(condition) ((void)BUILD_BUG_ON_ZERO(condition))
 
 /* Force a compilation error if condition is constant and true */
-#define MAYBE_BUILD_BUG_ON(cond) ((void)sizeof(char[1 - 2 * !!(cond)]))
+#define MAYBE_BUILD_BUG_ON(cond)	((void)sizeof(char[1 - 2 * !!(cond)]))
 
 /* Force a compilation error if condition is true, but also produce a
    result (of value 0 and type size_t), so the expression can be used
    e.g. in a structure initializer (or where-ever else comma expressions
    aren't permitted). */
-#define BUILD_BUG_ON_ZERO(e) (sizeof(struct { int:-!!(e); }))
-#define BUILD_BUG_ON_NULL(e) ((void *)sizeof(struct { int:-!!(e); }))
+#define BUILD_BUG_ON_ZERO(e)	(sizeof(struct { int:-!!(e); }))
+#define BUILD_BUG_ON_NULL(e)	((void *)sizeof(struct { int:-!!(e); }))
 
 /* Trap pasters of __FUNCTION__ at compile-time */
 #define __FUNCTION__ (__func__)
Signature · 1 line
1.6.6.rc0.57.gad7a
#3 lore raw

PATCH 3/14 kernel.h: ARRAY_SIZE neatening

In reply to Joe Perches

Make < 80 column, use array as name

---
 include/linux/kernel.h |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
include/linux/kernel.h +2 -1
index 2cc6d70..9206268 100644
@@ -39,7 +39,8 @@
 #define PTR_ALIGN(p, a)		((typeof(p))ALIGN((unsigned long)(p), (a)))
 #define IS_ALIGNED(x, a)	(((x) & ((typeof(x))(a) - 1)) == 0)
 
-#define ARRAY_SIZE(arr)		(sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
+#define ARRAY_SIZE(array)	(sizeof(array) / sizeof((array)[0]) +	\
+				 __must_be_array(array))
 #define FIELD_SIZEOF(t, f)	(sizeof(((t *)0)->f))
 
 #define roundup(x, y)		((((x) + ((y) - 1)) / (y)) * (y))
Signature · 1 line
1.6.6.rc0.57.gad7a
#1 lore raw

PATCH 1/14 kernel.h: Consolidate console and logging functions and defines

In reply to Joe Perches

Console and logging functions were not logically grouped by type. Move the around a bit for ease of reading.

---
 include/linux/kernel.h |  383 ++++++++++++++++++++++++-----------------------
 1 files changed, 196 insertions(+), 187 deletions(-)
include/linux/kernel.h +196 -187
index 4d9c916..c9cdfca 100644
@@ -19,9 +19,6 @@
 #include <asm/byteorder.h>
 #include <asm/bug.h>
 
-extern const char linux_banner[];
-extern const char linux_proc_banner[];
-
 #define USHORT_MAX	((u16)(~0U))
 #define SHORT_MAX	((s16)(USHORT_MAX>>1))
 #define SHORT_MIN	(-SHORT_MAX - 1)
@@ -87,31 +84,6 @@ extern const char linux_proc_banner[];
  */
 #define lower_32_bits(n) ((u32)(n))
 
-#define	KERN_EMERG	"<0>"	/* system is unusable			*/
-#define	KERN_ALERT	"<1>"	/* action must be taken immediately	*/
-#define	KERN_CRIT	"<2>"	/* critical conditions			*/
-#define	KERN_ERR	"<3>"	/* error conditions			*/
-#define	KERN_WARNING	"<4>"	/* warning conditions			*/
-#define	KERN_NOTICE	"<5>"	/* normal but significant condition	*/
-#define	KERN_INFO	"<6>"	/* informational			*/
-#define	KERN_DEBUG	"<7>"	/* debug-level messages			*/
-
-/* Use the default kernel loglevel */
-#define KERN_DEFAULT	"<d>"
-/*
- * 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	"<c>"
-
-extern int console_printk[];
-
-#define console_loglevel (console_printk[0])
-#define default_message_loglevel (console_printk[1])
-#define minimum_console_loglevel (console_printk[2])
-#define default_console_loglevel (console_printk[3])
-
 struct completion;
 struct pt_regs;
 struct user;
@@ -210,6 +182,202 @@ extern int func_ptr_is_kernel_text(void *ptr);
 struct pid;
 extern struct pid *session_of_pgrp(struct pid *pgrp);
 
+/* Values used for system_state */
+extern enum system_states {
+	SYSTEM_BOOTING,
+	SYSTEM_RUNNING,
+	SYSTEM_HALT,
+	SYSTEM_POWER_OFF,
+	SYSTEM_RESTART,
+	SYSTEM_SUSPEND_DISK,
+} system_state;
+
+#define TAINT_PROPRIETARY_MODULE	0
+#define TAINT_FORCED_MODULE		1
+#define TAINT_UNSAFE_SMP		2
+#define TAINT_FORCED_RMMOD		3
+#define TAINT_MACHINE_CHECK		4
+#define TAINT_BAD_PAGE			5
+#define TAINT_USER			6
+#define TAINT_DIE			7
+#define TAINT_OVERRIDDEN_ACPI_TABLE	8
+#define TAINT_WARN			9
+#define TAINT_CRAP			10
+
+extern const char *print_tainted(void);
+extern void add_taint(unsigned flag);
+extern int test_taint(unsigned flag);
+extern unsigned long get_taint(void);
+
+extern int panic_timeout;
+extern int panic_on_oops;
+extern int panic_on_unrecovered_nmi;
+extern int panic_on_io_nmi;
+extern int root_mountflags;
+
+
+extern const char hex_asc[];
+#define hex_asc_lo(x)	hex_asc[((x) & 0x0f)]
+#define hex_asc_hi(x)	hex_asc[((x) & 0xf0) >> 4]
+
+static inline char *pack_hex_byte(char *buf, u8 byte)
+{
+	*buf++ = hex_asc_hi(byte);
+	*buf++ = hex_asc_lo(byte);
+	return buf;
+}
+
+/*
+ *      Display an IP address in readable format.
+ */
+
+#define NIPQUAD(addr) \
+	((unsigned char *)&addr)[0], \
+	((unsigned char *)&addr)[1], \
+	((unsigned char *)&addr)[2], \
+	((unsigned char *)&addr)[3]
+#define NIPQUAD_FMT "%u.%u.%u.%u"
+
+/*
+ * min()/max()/clamp() macros that also do
+ * strict type-checking.. See the
+ * "unnecessary" pointer comparison.
+ */
+#define min(x, y) ({				\
+	typeof(x) _min1 = (x);			\
+	typeof(y) _min2 = (y);			\
+	(void) (&_min1 == &_min2);		\
+	_min1 < _min2 ? _min1 : _min2; })
+
+#define max(x, y) ({				\
+	typeof(x) _max1 = (x);			\
+	typeof(y) _max2 = (y);			\
+	(void) (&_max1 == &_max2);		\
+	_max1 > _max2 ? _max1 : _max2; })
+
+/**
+ * clamp - return a value clamped to a given range with strict typechecking
+ * @val: current value
+ * @min: minimum allowable value
+ * @max: maximum allowable value
+ *
+ * This macro does strict typechecking of min/max to make sure they are of the
+ * same type as val.  See the unnecessary pointer comparisons.
+ */
+#define clamp(val, min, max) ({			\
+	typeof(val) __val = (val);		\
+	typeof(min) __min = (min);		\
+	typeof(max) __max = (max);		\
+	(void) (&__val == &__min);		\
+	(void) (&__val == &__max);		\
+	__val = __val < __min ? __min: __val;	\
+	__val > __max ? __max: __val; })
+
+/*
+ * ..and if you can't take the strict
+ * types, you can specify one yourself.
+ *
+ * Or not use min/max/clamp at all, of course.
+ */
+#define min_t(type, x, y) ({			\
+	type __min1 = (x);			\
+	type __min2 = (y);			\
+	__min1 < __min2 ? __min1: __min2; })
+
+#define max_t(type, x, y) ({			\
+	type __max1 = (x);			\
+	type __max2 = (y);			\
+	__max1 > __max2 ? __max1: __max2; })
+
+/**
+ * clamp_t - return a value clamped to a given range using a given type
+ * @type: the type of variable to use
+ * @val: current value
+ * @min: minimum allowable value
+ * @max: maximum allowable value
+ *
+ * This macro does no typechecking and uses temporary variables of type
+ * 'type' to make all the comparisons.
+ */
+#define clamp_t(type, val, min, max) ({		\
+	type __val = (val);			\
+	type __min = (min);			\
+	type __max = (max);			\
+	__val = __val < __min ? __min: __val;	\
+	__val > __max ? __max: __val; })
+
+/**
+ * clamp_val - return a value clamped to a given range using val's type
+ * @val: current value
+ * @min: minimum allowable value
+ * @max: maximum allowable value
+ *
+ * This macro does no typechecking and uses temporary variables of whatever
+ * type the input argument 'val' is.  This is useful when val is an unsigned
+ * type and min and max are literals that will otherwise be assigned a signed
+ * integer type.
+ */
+#define clamp_val(val, min, max) ({		\
+	typeof(val) __val = (val);		\
+	typeof(val) __min = (min);		\
+	typeof(val) __max = (max);		\
+	__val = __val < __min ? __min: __val;	\
+	__val > __max ? __max: __val; })
+
+
+/*
+ * swap - swap value of @a and @b
+ */
+#define swap(a, b) \
+	do { typeof(a) __tmp = (a); (a) = (b); (b) = __tmp; } while (0)
+
+/**
+ * container_of - cast a member of a structure out to the containing structure
+ * @ptr:	the pointer to the member.
+ * @type:	the type of the container struct this is embedded in.
+ * @member:	the name of the member within the struct.
+ *
+ */
+#define container_of(ptr, type, member) ({			\
+	const typeof( ((type *)0)->member ) *__mptr = (ptr);	\
+	(type *)( (char *)__mptr - offsetof(type,member) );	\
+})
+
+struct sysinfo;
+extern int do_sysinfo(struct sysinfo *info);
+
+/*
+ * Console and logging support
+ */
+
+extern const char linux_banner[];
+extern const char linux_proc_banner[];
+
+#define	KERN_EMERG	"<0>"	/* system is unusable			*/
+#define	KERN_ALERT	"<1>"	/* action must be taken immediately	*/
+#define	KERN_CRIT	"<2>"	/* critical conditions			*/
+#define	KERN_ERR	"<3>"	/* error conditions			*/
+#define	KERN_WARNING	"<4>"	/* warning conditions			*/
+#define	KERN_NOTICE	"<5>"	/* normal but significant condition	*/
+#define	KERN_INFO	"<6>"	/* informational			*/
+#define	KERN_DEBUG	"<7>"	/* debug-level messages			*/
+
+/* Use the default kernel loglevel */
+#define KERN_DEFAULT	"<d>"
+/*
+ * 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	"<c>"
+
+extern int console_printk[];
+
+#define console_loglevel (console_printk[0])
+#define default_message_loglevel (console_printk[1])
+#define minimum_console_loglevel (console_printk[2])
+#define default_console_loglevel (console_printk[3])
+
 /*
  * FW_BUG
  * Add this to a message where you are sure the firmware is buggy or behaves
@@ -302,37 +470,6 @@ static inline void console_verbose(void)
 extern void bust_spinlocks(int yes);
 extern void wake_up_klogd(void);
 extern int oops_in_progress;		/* If set, an oops, panic(), BUG() or die() is in progress */
-extern int panic_timeout;
-extern int panic_on_oops;
-extern int panic_on_unrecovered_nmi;
-extern int panic_on_io_nmi;
-extern const char *print_tainted(void);
-extern void add_taint(unsigned flag);
-extern int test_taint(unsigned flag);
-extern unsigned long get_taint(void);
-extern int root_mountflags;
-
-/* Values used for system_state */
-extern enum system_states {
-	SYSTEM_BOOTING,
-	SYSTEM_RUNNING,
-	SYSTEM_HALT,
-	SYSTEM_POWER_OFF,
-	SYSTEM_RESTART,
-	SYSTEM_SUSPEND_DISK,
-} system_state;
-
-#define TAINT_PROPRIETARY_MODULE	0
-#define TAINT_FORCED_MODULE		1
-#define TAINT_UNSAFE_SMP		2
-#define TAINT_FORCED_RMMOD		3
-#define TAINT_MACHINE_CHECK		4
-#define TAINT_BAD_PAGE			5
-#define TAINT_USER			6
-#define TAINT_DIE			7
-#define TAINT_OVERRIDDEN_ACPI_TABLE	8
-#define TAINT_WARN			9
-#define TAINT_CRAP			10
 
 extern void dump_stack(void) __cold;
 
@@ -350,16 +487,6 @@ extern void print_hex_dump(const char *level, const char *prefix_str,
 extern void print_hex_dump_bytes(const char *prefix_str, int prefix_type,
 			const void *buf, size_t len);
 
-extern const char hex_asc[];
-#define hex_asc_lo(x)	hex_asc[((x) & 0x0f)]
-#define hex_asc_hi(x)	hex_asc[((x) & 0xf0) >> 4]
-
-static inline char *pack_hex_byte(char *buf, u8 byte)
-{
-	*buf++ = hex_asc_hi(byte);
-	*buf++ = hex_asc_lo(byte);
-	return buf;
-}
 
 #ifndef pr_fmt
 #define pr_fmt(fmt) fmt
@@ -581,124 +708,6 @@ ftrace_vprintk(const char *fmt, va_list ap)
 static inline void ftrace_dump(void) { }
 #endif /* CONFIG_TRACING */
 
-/*
- *      Display an IP address in readable format.
- */
-
-#define NIPQUAD(addr) \
-	((unsigned char *)&addr)[0], \
-	((unsigned char *)&addr)[1], \
-	((unsigned char *)&addr)[2], \
-	((unsigned char *)&addr)[3]
-#define NIPQUAD_FMT "%u.%u.%u.%u"
-
-/*
- * min()/max()/clamp() macros that also do
- * strict type-checking.. See the
- * "unnecessary" pointer comparison.
- */
-#define min(x, y) ({				\
-	typeof(x) _min1 = (x);			\
-	typeof(y) _min2 = (y);			\
-	(void) (&_min1 == &_min2);		\
-	_min1 < _min2 ? _min1 : _min2; })
-
-#define max(x, y) ({				\
-	typeof(x) _max1 = (x);			\
-	typeof(y) _max2 = (y);			\
-	(void) (&_max1 == &_max2);		\
-	_max1 > _max2 ? _max1 : _max2; })
-
-/**
- * clamp - return a value clamped to a given range with strict typechecking
- * @val: current value
- * @min: minimum allowable value
- * @max: maximum allowable value
- *
- * This macro does strict typechecking of min/max to make sure they are of the
- * same type as val.  See the unnecessary pointer comparisons.
- */
-#define clamp(val, min, max) ({			\
-	typeof(val) __val = (val);		\
-	typeof(min) __min = (min);		\
-	typeof(max) __max = (max);		\
-	(void) (&__val == &__min);		\
-	(void) (&__val == &__max);		\
-	__val = __val < __min ? __min: __val;	\
-	__val > __max ? __max: __val; })
-
-/*
- * ..and if you can't take the strict
- * types, you can specify one yourself.
- *
- * Or not use min/max/clamp at all, of course.
- */
-#define min_t(type, x, y) ({			\
-	type __min1 = (x);			\
-	type __min2 = (y);			\
-	__min1 < __min2 ? __min1: __min2; })
-
-#define max_t(type, x, y) ({			\
-	type __max1 = (x);			\
-	type __max2 = (y);			\
-	__max1 > __max2 ? __max1: __max2; })
-
-/**
- * clamp_t - return a value clamped to a given range using a given type
- * @type: the type of variable to use
- * @val: current value
- * @min: minimum allowable value
- * @max: maximum allowable value
- *
- * This macro does no typechecking and uses temporary variables of type
- * 'type' to make all the comparisons.
- */
-#define clamp_t(type, val, min, max) ({		\
-	type __val = (val);			\
-	type __min = (min);			\
-	type __max = (max);			\
-	__val = __val < __min ? __min: __val;	\
-	__val > __max ? __max: __val; })
-
-/**
- * clamp_val - return a value clamped to a given range using val's type
- * @val: current value
- * @min: minimum allowable value
- * @max: maximum allowable value
- *
- * This macro does no typechecking and uses temporary variables of whatever
- * type the input argument 'val' is.  This is useful when val is an unsigned
- * type and min and max are literals that will otherwise be assigned a signed
- * integer type.
- */
-#define clamp_val(val, min, max) ({		\
-	typeof(val) __val = (val);		\
-	typeof(val) __min = (min);		\
-	typeof(val) __max = (max);		\
-	__val = __val < __min ? __min: __val;	\
-	__val > __max ? __max: __val; })
-
-
-/*
- * swap - swap value of @a and @b
- */
-#define swap(a, b) \
-	do { typeof(a) __tmp = (a); (a) = (b); (b) = __tmp; } while (0)
-
-/**
- * container_of - cast a member of a structure out to the containing structure
- * @ptr:	the pointer to the member.
- * @type:	the type of the container struct this is embedded in.
- * @member:	the name of the member within the struct.
- *
- */
-#define container_of(ptr, type, member) ({			\
-	const typeof( ((type *)0)->member ) *__mptr = (ptr);	\
-	(type *)( (char *)__mptr - offsetof(type,member) );})
-
-struct sysinfo;
-extern int do_sysinfo(struct sysinfo *info);
-
 #endif /* __KERNEL__ */
 
 #ifndef __EXPORTED_HEADERS__
Signature · 1 line
1.6.6.rc0.57.gad7a
#14 lore raw

PATCH 14/14 kernel/exit.c and kernel/panic.c: Remove unused NORET_TYPE

In reply to Joe Perches

Make the functions match the prototypes in <linux/kernel.h> It's defined to nothing and useless

---
 kernel/exit.c  |    4 ++--
 kernel/panic.c |    2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)
kernel/exit.c +2 -2
index 5962d7c..ebb485c 100644
@@ -886,7 +886,7 @@ static void check_stack_usage(void)
 static inline void check_stack_usage(void) {}
 #endif
 
-NORET_TYPE void do_exit(long code)
+void do_exit(long code)
 {
 	struct task_struct *tsk = current;
 	int group_dead;
@@ -1029,7 +1029,7 @@ NORET_TYPE void do_exit(long code)
 
 EXPORT_SYMBOL_GPL(do_exit);
 
-NORET_TYPE void complete_and_exit(struct completion *comp, long code)
+void complete_and_exit(struct completion *comp, long code)
 {
 	if (comp)
 		complete(comp);
kernel/panic.c +1 -1
index 96b45d0..08d24b2 100644
@@ -52,7 +52,7 @@ EXPORT_SYMBOL(panic_blink);
  *
  *	This function never returns.
  */
-NORET_TYPE void panic(const char * fmt, ...)
+void panic(const char * fmt, ...)
 {
 	static char buf[1024];
 	va_list args;
Signature · 1 line
1.6.6.rc0.57.gad7a
#13 lore raw

PATCH 13/14 kernel.h: Kernel address utility aggregation and other neatening

In reply to Joe Perches

Group the address utilities
Move upper_32_bits and lower_32_bits to math and limits group Add a few new group headers
panic and oops
shutdown
string parsing
sysinfo

---
 include/linux/kernel.h |   69 +++++++++++++++++++++++++++++++----------------
 1 files changed, 45 insertions(+), 24 deletions(-)
include/linux/kernel.h +45 -24
index 7d7f7e2..0fd5949 100644
@@ -32,8 +32,6 @@
 #define LLONG_MIN	(-LLONG_MAX - 1)
 #define ULLONG_MAX	(~0ULL)
 
-#define STACK_MAGIC	0xdeadbeef
-
 #define __ALIGN_MASK(x, mask)	(((x) + (mask)) & ~(mask))
 #define ALIGN(x, a)		__ALIGN_MASK(x, (typeof(x))(a) - 1)
 #define PTR_ALIGN(p, a)		((typeof(p))ALIGN((unsigned long)(p), (a)))
@@ -51,9 +49,6 @@
 	(((x) + ((__divisor) / 2)) / (__divisor));	\
 })
 
-#define _RET_IP_	(unsigned long)__builtin_return_address(0)
-#define _THIS_IP_	({ __label__ __here; __here: (unsigned long)&&__here; })
-
 #ifdef CONFIG_LBDAF
 # include <asm/div64.h>
 # define sector_div(a, b) do_div(a, b)
@@ -67,22 +62,6 @@
 })
 #endif
 
-/**
- * upper_32_bits - return bits 32-63 of a number
- * @n: the number we're accessing
- *
- * A basic shift-right of a 64- or 32-bit quantity.  Use this to suppress
- * the "right shift count >= width of type" warning when that quantity is
- * 32-bits.
- */
-#define upper_32_bits(n)	((u32)(((n) >> 16) >> 16))
-
-/**
- * lower_32_bits - return bits 0-31 of a number
- * @n: the number we're accessing
- */
-#define lower_32_bits(n)	((u32)(n))
-
 struct completion;
 struct pt_regs;
 struct user;
@@ -124,6 +103,9 @@ static inline void might_fault(void)
 }
 #endif
 
+/*
+ * panic and oops support
+ */
 extern struct atomic_notifier_head panic_notifier_list;
 extern long (*panic_blink)(long time);
 extern void panic(const char *fmt, ...)
@@ -131,6 +113,10 @@ extern void panic(const char *fmt, ...)
 extern void oops_enter(void);
 extern void oops_exit(void);
 extern int oops_may_print(void);
+
+/*
+ * shutdown support
+ */
 extern void do_exit(long code)
 	__attribute__ ((noreturn));
 extern void complete_and_exit(struct completion *comp, long code)
@@ -176,15 +162,28 @@ extern int sscanf(const char *buf, const char *fmt, ...)
 extern int vsscanf(const char *buf, const char *fmt, va_list)
 	__attribute__ ((format (scanf, 2, 0)));
 
+/*
+ * String parsing
+ */
 extern int get_option(char **str, int *pint);
 extern char *get_options(const char *str, int nints, int *ints);
 extern unsigned long long memparse(const char *ptr, char **retptr);
+		/*parse a string with mem suffixes into a number */
 
+/*
+ * Kernel address utils
+ */
 extern int core_kernel_text(unsigned long addr);
 extern int __kernel_text_address(unsigned long addr);
 extern int kernel_text_address(unsigned long addr);
 extern int func_ptr_is_kernel_text(void *ptr);
+#define _RET_IP_	(unsigned long)__builtin_return_address(0)
+#define _THIS_IP_	({ __label__ __here; __here: (unsigned long)&&__here; })
+#define STACK_MAGIC	0xdeadbeef
 
+/*
+ * Process ID and process group
+ */
 struct pid;
 extern struct pid *session_of_pgrp(struct pid *pgrp);
 
@@ -221,6 +220,9 @@ extern int panic_on_unrecovered_nmi;
 extern int panic_on_io_nmi;
 extern int root_mountflags;
 
+/*
+ * Hex to ascii helpers
+ */
 
 extern const char hex_asc[];
 #define hex_asc_lo(x)	hex_asc[((x) & 0x0f)]
@@ -244,6 +246,22 @@ static inline char *pack_hex_byte(char *buf, u8 byte)
 
 unsigned long int_sqrt(unsigned long);
 
+/**
+ * upper_32_bits - return bits 32-63 of a number
+ * @n: the number we're accessing
+ *
+ * A basic shift-right of a 64- or 32-bit quantity.  Use this to suppress
+ * the "right shift count >= width of type" warning when that quantity is
+ * 32-bits.
+ */
+#define upper_32_bits(n)	((u32)(((n) >> 16) >> 16))
+
+/**
+ * lower_32_bits - return bits 0-31 of a number
+ * @n: the number we're accessing
+ */
+#define lower_32_bits(n)	((u32)(n))
+
 /*
  * min()/max()/clamp() macros that also do
  * strict type-checking.. See the
@@ -362,9 +380,6 @@ unsigned long int_sqrt(unsigned long);
 	(type *)((char *)__mptr - offsetof(type, member));	\
 })
 
-struct sysinfo;
-extern int do_sysinfo(struct sysinfo *info);
-
 /*
  * Console and logging support
  */
@@ -776,6 +791,12 @@ ftrace_vprintk(const char *fmt, va_list ap)
 static inline void ftrace_dump(void) { }
 #endif /* CONFIG_TRACING */
 
+/*
+ * sysinfo support
+ */
+struct sysinfo;
+extern int do_sysinfo(struct sysinfo *info);
+
 #endif /* __KERNEL__ */
 
 #ifndef __EXPORTED_HEADERS__
Signature · 1 line
1.6.6.rc0.57.gad7a
#12 lore raw

PATCH 12/14 kernel.h: Add pr_<level>_once

In reply to Joe Perches

Consolidate the define and use of printk_once near printk_ratelimited Add pr_<level>_once macros that use pr_fmt(fmt)
A little alignment neatening

---
 include/linux/kernel.h |  105 +++++++++++++++++++++++++++++++----------------
 1 files changed, 69 insertions(+), 36 deletions(-)
include/linux/kernel.h +69 -36
index e079744..7d7f7e2 100644
@@ -434,19 +434,6 @@ extern bool printk_timed_ratelimit(unsigned long *caller_jiffies,
 
 extern int printk_delay_msec;
 
-/*
- * Print a one-time message (analogous to WARN_ONCE() et al):
- */
-#define printk_once(fmt, ...)			\
-({						\
-	static bool __print_once;		\
-						\
-	if (!__print_once) {			\
-		__print_once = true;		\
-		printk(fmt, ##__VA_ARGS__);	\
-	}					\
-})
-
 void log_buf_kexec_setup(void);
 #else
 static inline int vprintk(const char *s, va_list args)
@@ -462,9 +449,6 @@ static inline bool printk_timed_ratelimit(unsigned long *caller_jiffies,
 	return false;
 }
 
-/* No effect, but we still get type checking even in the !PRINTK case: */
-#define printk_once(fmt, ...) printk(fmt, ##__VA_ARGS__)
-
 static inline void log_buf_kexec_setup(void)
 {
 }
@@ -514,26 +498,26 @@ extern void print_hex_dump_bytes(const char *prefix_str, int prefix_type,
 #define pr_fmt(fmt) fmt
 #endif
 
-#define pr_emerg(fmt, ...)				\
+#define pr_emerg(fmt, ...)					\
 	printk(KERN_EMERG pr_fmt(fmt), ##__VA_ARGS__)
-#define pr_alert(fmt, ...)				\
+#define pr_alert(fmt, ...)					\
 	printk(KERN_ALERT pr_fmt(fmt), ##__VA_ARGS__)
-#define pr_crit(fmt, ...)				\
+#define pr_crit(fmt, ...)					\
 	printk(KERN_CRIT pr_fmt(fmt), ##__VA_ARGS__)
-#define pr_err(fmt, ...)				\
+#define pr_err(fmt, ...)					\
 	printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
-#define pr_warning(fmt, ...)				\
+#define pr_warning(fmt, ...)					\
 	printk(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__)
-#define pr_notice(fmt, ...)				\
+#define pr_notice(fmt, ...)					\
 	printk(KERN_NOTICE pr_fmt(fmt), ##__VA_ARGS__)
-#define pr_info(fmt, ...)				\
+#define pr_info(fmt, ...)					\
 	printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
-#define pr_cont(fmt, ...)				\
+#define pr_cont(fmt, ...)					\
 	printk(KERN_CONT fmt, ##__VA_ARGS__)
 
 /* pr_devel() should produce zero code unless DEBUG is defined */
 #ifdef DEBUG
-#define pr_devel(fmt, ...)				\
+#define pr_devel(fmt, ...)					\
 	printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
 #else
 #define pr_devel(fmt, ...)					\
@@ -546,11 +530,11 @@ extern void print_hex_dump_bytes(const char *prefix_str, int prefix_type,
 
 /* If you are writing a driver, please use dev_dbg instead */
 #if defined(DEBUG)
-#define pr_debug(fmt, ...)				\
+#define pr_debug(fmt, ...)					\
 	printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
 #elif defined(CONFIG_DYNAMIC_DEBUG)
 /* dynamic_pr_debug() uses pr_fmt() internally so we don't need it here */
-#define pr_debug(fmt, ...)				\
+#define pr_debug(fmt, ...)					\
 	dynamic_pr_debug(fmt, ##__VA_ARGS__)
 #else
 #define pr_debug(fmt, ...)					\
@@ -562,19 +546,68 @@ extern void print_hex_dump_bytes(const char *prefix_str, int prefix_type,
 #endif
 
 /*
+ * Print a one-time message (analogous to WARN_ONCE() et al):
+ * no local state used in the !PRINTK case
+ */
+#ifdef CONFIG_PRINTK
+#define printk_once(fmt, ...)					\
+({								\
+	static bool __print_once;				\
+								\
+	if (!__print_once) {					\
+		__print_once = true;				\
+		printk(fmt, ##__VA_ARGS__);			\
+	}							\
+})
+
+#else
+/* No effect, but we still get type checking even in the !PRINTK case: */
+#define printk_once(fmt, ...) printk(fmt, ##__VA_ARGS__)
+#endif
+
+#define pr_emerg_once(fmt, ...)					\
+	printk_once(KERN_EMERG pr_fmt(fmt), ##__VA_ARGS__)
+#define pr_alert_once(fmt, ...)					\
+	printk_once(KERN_ALERT pr_fmt(fmt), ##__VA_ARGS__)
+#define pr_crit_once(fmt, ...)					\
+	printk_once(KERN_CRIT pr_fmt(fmt), ##__VA_ARGS__)
+#define pr_err_once(fmt, ...)					\
+	printk_once(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
+#define pr_warning_once(fmt, ...)				\
+	printk_once(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__)
+#define pr_notice_once(fmt, ...)				\
+	printk_once(KERN_NOTICE pr_fmt(fmt), ##__VA_ARGS__)
+#define pr_info_once(fmt, ...)					\
+	printk_once(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
+/* no pr_cont_once, don't do that... */
+/* If you are writing a driver, please use dev_dbg instead */
+#if defined(DEBUG)
+#define pr_debug_once(fmt, ...)					\
+	printk_once(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
+#else
+#define pr_debug_once(fmt, ...)					\
+({								\
+	if (0)							\
+		printk_once(KERN_DEBUG pr_fmt(fmt),		\
+				   ##__VA_ARGS__);		\
+	0;							\
+})
+#endif
+
+/*
  * ratelimited messages with local ratelimit_state,
  * no local ratelimit_state used in the !PRINTK case
  */
 #ifdef CONFIG_PRINTK
-#define printk_ratelimited(fmt, ...)			\
-({							\
-	static struct ratelimit_state _rs = {		\
-		.interval = DEFAULT_RATELIMIT_INTERVAL, \
-		.burst = DEFAULT_RATELIMIT_BURST,       \
-	};                                              \
-							\
-	if (!__ratelimit(&_rs))                         \
-		printk(fmt, ##__VA_ARGS__);		\
+#define printk_ratelimited(fmt, ...)				\
+({								\
+	static struct ratelimit_state _rs = {			\
+		.interval = DEFAULT_RATELIMIT_INTERVAL,		\
+		.burst = DEFAULT_RATELIMIT_BURST,		\
+	};							\
+								\
+	if (!__ratelimit(&_rs))					\
+		printk(fmt, ##__VA_ARGS__);			\
 })
 #else
 /* No effect, but we still get type checking even in the !PRINTK case: */
Signature · 1 line
1.6.6.rc0.57.gad7a
#10 lore raw

PATCH 10/14 kernel.h: Remove ATTRIB_NORET, use __attribute__((noreturn))

In reply to Joe Perches

No real need to indirect this

---
 include/linux/kernel.h |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
include/linux/kernel.h +2 -2
index 3b796b9..5c97b73 100644
@@ -132,9 +132,9 @@ extern void oops_enter(void);
 extern void oops_exit(void);
 extern int oops_may_print(void);
 NORET_TYPE void do_exit(long code)
-	ATTRIB_NORET;
+	__attribute__ ((noreturn));
 NORET_TYPE void complete_and_exit(struct completion *comp, long code)
-	ATTRIB_NORET;
+	__attribute__ ((noreturn));
 
 /*
  * stdlib - String to type conversions
Signature · 1 line
1.6.6.rc0.57.gad7a
#9 lore raw

PATCH 9/14 kernel.h: Don't use NORET_AND just use noreturn, instead

In reply to Joe Perches
---
 include/linux/kernel.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
include/linux/kernel.h +1 -1
index 97c80c7..3b796b9 100644
@@ -127,7 +127,7 @@ static inline void might_fault(void)
 extern struct atomic_notifier_head panic_notifier_list;
 extern long (*panic_blink)(long time);
 NORET_TYPE void panic(const char *fmt, ...)
-	__attribute__ ((NORET_AND format (printf, 1, 2))) __cold;
+	__attribute__ ((noreturn, format (printf, 1, 2))) __cold;
 extern void oops_enter(void);
 extern void oops_exit(void);
 extern int oops_may_print(void);
Signature · 1 line
1.6.6.rc0.57.gad7a
#8 lore raw

PATCH 8/14 kernel.h: Group math and limits functions, indent function args

In reply to Joe Perches

Use a bit more standardized statement expression format

---
 include/linux/kernel.h |   72 +++++++++++++++++++++++++++++------------------
 1 files changed, 44 insertions(+), 28 deletions(-)
include/linux/kernel.h +44 -28
index 1764d2d..97c80c7 100644
@@ -115,12 +115,6 @@ void __might_sleep(char *file, int line, int preempt_offset);
 
 #define might_sleep_if(cond) do { if (cond) might_sleep(); } while (0)
 
-#define abs(x)				\
-({					\
-	long __x = (x);			\
-	(__x < 0) ? -__x : __x;		\
-})
-
 #ifdef CONFIG_PROVE_LOCKING
 void might_fault(void);
 #else
@@ -240,21 +234,36 @@ static inline char *pack_hex_byte(char *buf, u8 byte)
 }
 
 /*
+ * stdlib - limits and maths
+ */
+#define abs(x)					\
+({						\
+	long __x = (x);				\
+	(__x < 0) ? -__x : __x;			\
+})
+
+unsigned long int_sqrt(unsigned long);
+
+/*
  * min()/max()/clamp() macros that also do
  * strict type-checking.. See the
  * "unnecessary" pointer comparison.
  */
-#define min(x, y) ({				\
+#define min(x, y)				\
+({						\
 	typeof(x) _min1 = (x);			\
 	typeof(y) _min2 = (y);			\
 	(void) (&_min1 == &_min2);		\
-	_min1 < _min2 ? _min1 : _min2; })
+	_min1 < _min2 ? _min1 : _min2;		\
+})
 
-#define max(x, y) ({				\
+#define max(x, y)				\
+({						\
 	typeof(x) _max1 = (x);			\
 	typeof(y) _max2 = (y);			\
 	(void) (&_max1 == &_max2);		\
-	_max1 > _max2 ? _max1 : _max2; })
+	_max1 > _max2 ? _max1 : _max2;		\
+})
 
 /**
  * clamp - return a value clamped to a given range with strict typechecking
@@ -265,14 +274,16 @@ static inline char *pack_hex_byte(char *buf, u8 byte)
  * This macro does strict typechecking of min/max to make sure they are of the
  * same type as val.  See the unnecessary pointer comparisons.
  */
-#define clamp(val, min, max) ({			\
+#define clamp(val, min, max)			\
+({						\
 	typeof(val) __val = (val);		\
 	typeof(min) __min = (min);		\
 	typeof(max) __max = (max);		\
 	(void) (&__val == &__min);		\
 	(void) (&__val == &__max);		\
 	__val = __val < __min ? __min : __val;	\
-	__val > __max ? __max : __val; })
+	__val > __max ? __max : __val;		\
+})
 
 /*
  * ..and if you can't take the strict
@@ -280,15 +291,19 @@ static inline char *pack_hex_byte(char *buf, u8 byte)
  *
  * Or not use min/max/clamp at all, of course.
  */
-#define min_t(type, x, y) ({			\
+#define min_t(type, x, y)			\
+({						\
 	type __min1 = (x);			\
 	type __min2 = (y);			\
-	__min1 < __min2 ? __min1 : __min2; })
+	__min1 < __min2 ? __min1 : __min2;	\
+})
 
-#define max_t(type, x, y) ({			\
+#define max_t(type, x, y)			\
+({						\
 	type __max1 = (x);			\
 	type __max2 = (y);			\
-	__max1 > __max2 ? __max1 : __max2; })
+	__max1 > __max2 ? __max1 : __max2;	\
+})
 
 /**
  * clamp_t - return a value clamped to a given range using a given type
@@ -300,12 +315,14 @@ static inline char *pack_hex_byte(char *buf, u8 byte)
  * This macro does no typechecking and uses temporary variables of type
  * 'type' to make all the comparisons.
  */
-#define clamp_t(type, val, min, max) ({		\
+#define clamp_t(type, val, min, max)		\
+({						\
 	type __val = (val);			\
 	type __min = (min);			\
 	type __max = (max);			\
 	__val = __val < __min ? __min : __val;	\
-	__val > __max ? __max : __val; })
+	__val > __max ? __max : __val;		\
+})
 
 /**
  * clamp_val - return a value clamped to a given range using val's type
@@ -318,13 +335,14 @@ static inline char *pack_hex_byte(char *buf, u8 byte)
  * type and min and max are literals that will otherwise be assigned a signed
  * integer type.
  */
-#define clamp_val(val, min, max) ({		\
+#define clamp_val(val, min, max)		\
+({						\
 	typeof(val) __val = (val);		\
 	typeof(val) __min = (min);		\
 	typeof(val) __max = (max);		\
 	__val = __val < __min ? __min : __val;	\
-	__val > __max ? __max : __val; })
-
+	__val > __max ? __max : __val;		\
+})
 
 /*
  * swap - swap value of @a and @b
@@ -458,8 +476,6 @@ extern void printk_tick(void);
 extern void asmlinkage __attribute__((format(printf, 1, 2)))
 	early_printk(const char *fmt, ...);
 
-unsigned long int_sqrt(unsigned long);
-
 static inline void console_silent(void)
 {
 	console_loglevel = 0;
@@ -485,13 +501,13 @@ enum {
 	DUMP_PREFIX_OFFSET
 };
 extern void hex_dump_to_buffer(const void *buf, size_t len,
-				int rowsize, int groupsize,
-				char *linebuf, size_t linebuflen, bool ascii);
+			       int rowsize, int groupsize,
+			       char *linebuf, size_t linebuflen, bool ascii);
 extern void print_hex_dump(const char *level, const char *prefix_str,
-				int prefix_type, int rowsize, int groupsize,
-				const void *buf, size_t len, bool ascii);
+			   int prefix_type, int rowsize, int groupsize,
+			   const void *buf, size_t len, bool ascii);
 extern void print_hex_dump_bytes(const char *prefix_str, int prefix_type,
-			const void *buf, size_t len);
+				 const void *buf, size_t len);
 
 
 #ifndef pr_fmt
Signature · 1 line
1.6.6.rc0.57.gad7a
#11 lore raw

PATCH 11/14 kernel.h: Remove uses of NORET_TYPE

In reply to Joe Perches

It's useless
Replaced with extern just for consistency

---
 include/linux/kernel.h |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
include/linux/kernel.h +3 -3
index 5c97b73..e079744 100644
@@ -126,14 +126,14 @@ static inline void might_fault(void)
 
 extern struct atomic_notifier_head panic_notifier_list;
 extern long (*panic_blink)(long time);
-NORET_TYPE void panic(const char *fmt, ...)
+extern void panic(const char *fmt, ...)
 	__attribute__ ((noreturn, format (printf, 1, 2))) __cold;
 extern void oops_enter(void);
 extern void oops_exit(void);
 extern int oops_may_print(void);
-NORET_TYPE void do_exit(long code)
+extern void do_exit(long code)
 	__attribute__ ((noreturn));
-NORET_TYPE void complete_and_exit(struct completion *comp, long code)
+extern void complete_and_exit(struct completion *comp, long code)
 	__attribute__ ((noreturn));
 
 /*
Signature · 1 line
1.6.6.rc0.57.gad7a
#6 lore raw

PATCH 6/14 drivers/firmware/iscsi_ibft.c: Use %pI4 to print netmask

In reply to Joe Perches
---
 drivers/firmware/iscsi_ibft.c |    8 +++-----
 1 files changed, 3 insertions(+), 5 deletions(-)
drivers/firmware/iscsi_ibft.c +3 -5
index 051d1eb..f82bcda 100644
@@ -381,7 +381,7 @@ static ssize_t ibft_attr_show_nic(struct ibft_kobject *entry,
 	void *ibft_loc = entry->header;
 	char *str = buf;
 	char *mac;
-	int val;
+	__be32 val;
 
 	if (!nic)
 		return 0;
@@ -397,10 +397,8 @@ static ssize_t ibft_attr_show_nic(struct ibft_kobject *entry,
 		str += sprintf_ipaddr(str, nic->ip_addr);
 		break;
 	case ibft_eth_subnet_mask:
-		val = ~((1 << (32-nic->subnet_mask_prefix))-1);
-		str += sprintf(str, NIPQUAD_FMT,
-			       (u8)(val >> 24), (u8)(val >> 16),
-			       (u8)(val >> 8), (u8)(val));
+		val = cpu_to_be32(~((1 << (32-nic->subnet_mask_prefix))-1));
+		str += sprintf(str, "%pI4", &val);
 		break;
 	case ibft_eth_origin:
 		str += sprintf(str, "%d\n", nic->origin);
Signature · 1 line
1.6.6.rc0.57.gad7a
#15 lore raw

Re: [PATCH 14/14] kernel/exit.c and kernel/panic.c: Remove unused NORET_TYPE

In reply to Joe Perches
Quoted 2 lines · Joe Perches

Make the functions match the prototypes in <linux/kernel.h> It's defined to nothing and useless

Uhm, why not make it useful again and define it to something like:

#define NORET_TYPE __attribute__((noreturn))

except I guess that should come after the function name, not before.

Annotations that tell a particular function is not supposed to exit seems useful to me..

#16 lore raw

Re: [PATCH 14/14] kernel/exit.c and kernel/panic.c: Remove unused NORET_TYPE

Quoted 4 lines · Peter Zijlstra
Quoted 2 lines · Joe Perches

Make the functions match the prototypes in <linux/kernel.h> It's defined to nothing and useless

Quoted 8 lines

Uhm, why not make it useful again and define it to something like:

#define NORET_TYPE __attribute__((noreturn))

except I guess that should come after the function name, not before.

Annotations that tell a particular function is not supposed to exit seems useful to me..

Ah, that got hidden in the header and was done in a different patch.

#17 lore raw
In reply to Joe Perches
Quoted 3 lines · Joe Perches

kernel.h has become a chaotic jumble collected over time. Collect the functions and #defines together in logical groups. Do some checkpatch neatening and make it more style conformant.

Are there negative attributes in this patchset that prevent it from being applied?

Quoted 22 lines

Joe Perches (14):
kernel.h: Consolidate console and logging functions and defines kernel.h: Checkpatch cleaning
kernel.h: ARRAY_SIZE neatening
kernel.h: Add argument names to strtoXX, Xscanf prototypes kernel.h: printk neatening drivers/firmware/iscsi_ibft.c: Use %pI4 to print netmask kernel.h: Move NIPQUAD and NIPQUAD_FMT to in.h kernel.h: Group math and limits functions, indent function args kernel.h: Don't use NORET_AND just use noreturn, instead kernel.h: Remove ATTRIB_NORET, use __attribute__((noreturn)) kernel.h: Remove uses of NORET_TYPE
kernel.h: Add pr_<level>_once
kernel.h: Kernel address utility aggregation and other neatening kernel/exit.c and kernel/panic.c: Remove unused NORET_TYPE

 drivers/firmware/iscsi_ibft.c |    8 +-
 include/linux/in.h            |   11 +
 include/linux/kernel.h        |  742 +++++++++++++++++++++++------------------
 kernel/exit.c                 |    4 +-
 kernel/panic.c                |    2 +-
 5 files changed, 437 insertions(+), 330 deletions(-)