summaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/cpu/mtrr/mtrr.h
diff options
context:
space:
mode:
authorEmese Revfy2010-01-31 20:16:34 +0100
committerH. Peter Anvin2010-02-01 20:20:43 +0100
commit3b9cfc0a99f88c0db7c72363620584a9b40b4543 (patch)
treef34b481d28eae0c04521a36c45bb50c1511cf5e6 /arch/x86/kernel/cpu/mtrr/mtrr.h
parentMerge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tiw... (diff)
downloadkernel-qcow2-linux-3b9cfc0a99f88c0db7c72363620584a9b40b4543.tar.gz
kernel-qcow2-linux-3b9cfc0a99f88c0db7c72363620584a9b40b4543.tar.xz
kernel-qcow2-linux-3b9cfc0a99f88c0db7c72363620584a9b40b4543.zip
x86, mtrr: Constify struct mtrr_ops
This is part of the ops structure constification effort started by Arjan van de Ven et al. Benefits of this constification: * prevents modification of data that is shared (referenced) by many other structure instances at runtime * detects/prevents accidental (but not intentional) modification attempts on archs that enforce read-only kernel data at runtime * potentially better optimized code as the compiler can assume that the const data cannot be changed * the compiler/linker move const data into .rodata and therefore exclude them from false sharing Signed-off-by: Emese Revfy <re.emese@gmail.com> LKML-Reference: <4B65D712.3080804@gmail.com> Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Diffstat (limited to 'arch/x86/kernel/cpu/mtrr/mtrr.h')
-rw-r--r--arch/x86/kernel/cpu/mtrr/mtrr.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/arch/x86/kernel/cpu/mtrr/mtrr.h b/arch/x86/kernel/cpu/mtrr/mtrr.h
index a501dee9a87a..df5e41f31a27 100644
--- a/arch/x86/kernel/cpu/mtrr/mtrr.h
+++ b/arch/x86/kernel/cpu/mtrr/mtrr.h
@@ -32,7 +32,7 @@ extern int generic_get_free_region(unsigned long base, unsigned long size,
extern int generic_validate_add_page(unsigned long base, unsigned long size,
unsigned int type);
-extern struct mtrr_ops generic_mtrr_ops;
+extern const struct mtrr_ops generic_mtrr_ops;
extern int positive_have_wrcomb(void);
@@ -53,10 +53,10 @@ void fill_mtrr_var_range(unsigned int index,
u32 base_lo, u32 base_hi, u32 mask_lo, u32 mask_hi);
void get_mtrr_state(void);
-extern void set_mtrr_ops(struct mtrr_ops *ops);
+extern void set_mtrr_ops(const struct mtrr_ops *ops);
extern u64 size_or_mask, size_and_mask;
-extern struct mtrr_ops *mtrr_if;
+extern const struct mtrr_ops *mtrr_if;
#define is_cpu(vnd) (mtrr_if && mtrr_if->vendor == X86_VENDOR_##vnd)
#define use_intel() (mtrr_if && mtrr_if->use_intel_if == 1)