Commit c28aa1f0 authored by Joe Perches's avatar Joe Perches Committed by Linus Torvalds

printk/cache: mark printk_once test variable __read_mostly

Add #include <linux/cache.h> to define __read_mostly.

Convert cache.h to use uapi/linux/kernel.h instead
of linux/kernel.h to avoid recursive #includes.

Convert the ALIGN macro to __ALIGN_KERNEL.

printk_once only sets the bool variable tested
once so mark it __read_mostly.

Neaten the alignment so it matches the rest of the
pr_<level>_once #defines too.
Signed-off-by: default avatarJoe Perches <joe@perches.com>
Reviewed-by: default avatarJames Hogan <james.hogan@imgtec.com>
Cc: Wu Fengguang <fengguang.wu@intel.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 8f073bd0
...@@ -71,6 +71,7 @@ ...@@ -71,6 +71,7 @@
#include <linux/compiler.h> #include <linux/compiler.h>
#include <linux/threads.h> #include <linux/threads.h>
#include <linux/types.h> #include <linux/types.h>
#include <linux/bitops.h>
#include <asm/fpu.h> #include <asm/fpu.h>
#include <asm/page.h> #include <asm/page.h>
......
#ifndef __LINUX_CACHE_H #ifndef __LINUX_CACHE_H
#define __LINUX_CACHE_H #define __LINUX_CACHE_H
#include <linux/kernel.h> #include <uapi/linux/kernel.h>
#include <asm/cache.h> #include <asm/cache.h>
#ifndef L1_CACHE_ALIGN #ifndef L1_CACHE_ALIGN
#define L1_CACHE_ALIGN(x) ALIGN(x, L1_CACHE_BYTES) #define L1_CACHE_ALIGN(x) __ALIGN_KERNEL(x, L1_CACHE_BYTES)
#endif #endif
#ifndef SMP_CACHE_BYTES #ifndef SMP_CACHE_BYTES
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
#include <linux/init.h> #include <linux/init.h>
#include <linux/kern_levels.h> #include <linux/kern_levels.h>
#include <linux/linkage.h> #include <linux/linkage.h>
#include <linux/cache.h>
extern const char linux_banner[]; extern const char linux_banner[];
extern const char linux_proc_banner[]; extern const char linux_proc_banner[];
...@@ -253,17 +254,17 @@ extern asmlinkage void dump_stack(void) __cold; ...@@ -253,17 +254,17 @@ extern asmlinkage void dump_stack(void) __cold;
*/ */
#ifdef CONFIG_PRINTK #ifdef CONFIG_PRINTK
#define printk_once(fmt, ...) \ #define printk_once(fmt, ...) \
({ \ ({ \
static bool __print_once; \ static bool __print_once __read_mostly; \
\ \
if (!__print_once) { \ if (!__print_once) { \
__print_once = true; \ __print_once = true; \
printk(fmt, ##__VA_ARGS__); \ printk(fmt, ##__VA_ARGS__); \
} \ } \
}) })
#else #else
#define printk_once(fmt, ...) \ #define printk_once(fmt, ...) \
no_printk(fmt, ##__VA_ARGS__) no_printk(fmt, ##__VA_ARGS__)
#endif #endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment