From 8604173deb247107f7950bc5bf7b2412ad1f4b2e Mon Sep 17 00:00:00 2001 From: Andrew Morton Date: Sun, 31 Aug 2003 04:34:35 -0700 Subject: [PATCH] [PATCH] mtrr cleanups - Remove duplicated implementation of attrib_to_str() - Make mtrr_strings[] static to if.c --- arch/i386/kernel/cpu/mtrr/if.c | 23 +++++++++++++++++------ arch/i386/kernel/cpu/mtrr/main.c | 21 ++------------------- arch/i386/kernel/cpu/mtrr/mtrr.h | 1 + 3 files changed, 20 insertions(+), 25 deletions(-) diff --git a/arch/i386/kernel/cpu/mtrr/if.c b/arch/i386/kernel/cpu/mtrr/if.c index 3592f2f57c5b2..3f0ff9887da56 100644 --- a/arch/i386/kernel/cpu/mtrr/if.c +++ b/arch/i386/kernel/cpu/mtrr/if.c @@ -17,6 +17,22 @@ static int mtrr_seq_show(struct seq_file *seq, void *offset); #define FILE_FCOUNT(f) (((struct seq_file *)((f)->private_data))->private) +static char *mtrr_strings[MTRR_NUM_TYPES] = +{ + "uncachable", /* 0 */ + "write-combining", /* 1 */ + "?", /* 2 */ + "?", /* 3 */ + "write-through", /* 4 */ + "write-protect", /* 5 */ + "write-back", /* 6 */ +}; + +char *mtrr_attrib_to_str(int x) +{ + return (x <= 6) ? mtrr_strings[x] : "?"; +} + static int mtrr_file_add(unsigned long base, unsigned long size, unsigned int type, char increment, struct file *file, int page) @@ -300,11 +316,6 @@ static struct proc_dir_entry *proc_root_mtrr; # endif /* CONFIG_PROC_FS */ -char * attrib_to_str(int x) -{ - return (x <= 6) ? mtrr_strings[x] : "?"; -} - static int mtrr_seq_show(struct seq_file *seq, void *offset) { char factor; @@ -332,7 +343,7 @@ static int mtrr_seq_show(struct seq_file *seq, void *offset) len += seq_printf(seq, "reg%02i: base=0x%05lx000 (%4liMB), size=%4i%cB: %s, count=%d\n", i, base, base >> (20 - PAGE_SHIFT), size, factor, - attrib_to_str(type), usage_table[i]); + mtrr_attrib_to_str(type), usage_table[i]); } } return 0; diff --git a/arch/i386/kernel/cpu/mtrr/main.c b/arch/i386/kernel/cpu/mtrr/main.c index 73eb9664eedb0..3c71703a34e0c 100644 --- a/arch/i386/kernel/cpu/mtrr/main.c +++ b/arch/i386/kernel/cpu/mtrr/main.c @@ -111,11 +111,6 @@ void __init set_num_var_ranges(void) num_var_ranges = config & 0xff; } -static char * attrib_to_str(int x) -{ - return (x <= 6) ? mtrr_strings[x] : "?"; -} - static void init_table(void) { int i, max; @@ -362,8 +357,8 @@ int mtrr_add_page(unsigned long base, unsigned long size, if (type == MTRR_TYPE_UNCACHABLE) continue; printk (KERN_WARNING "mtrr: type mismatch for %lx000,%lx000 old: %s new: %s\n", - base, size, attrib_to_str(ltype), - attrib_to_str(type)); + base, size, mtrr_attrib_to_str(ltype), + mtrr_attrib_to_str(type)); goto out; } if (increment) @@ -703,16 +698,4 @@ static int __init mtrr_init(void) return -ENXIO; } -char *mtrr_strings[MTRR_NUM_TYPES] = -{ - "uncachable", /* 0 */ - "write-combining", /* 1 */ - "?", /* 2 */ - "?", /* 3 */ - "write-through", /* 4 */ - "write-protect", /* 5 */ - "write-back", /* 6 */ -}; - subsys_initcall(mtrr_init); - diff --git a/arch/i386/kernel/cpu/mtrr/mtrr.h b/arch/i386/kernel/cpu/mtrr/mtrr.h index 8c64a0d1849f2..fee8b5ccc8c72 100644 --- a/arch/i386/kernel/cpu/mtrr/mtrr.h +++ b/arch/i386/kernel/cpu/mtrr/mtrr.h @@ -95,5 +95,6 @@ extern unsigned int num_var_ranges; void finalize_mtrr_state(void); void mtrr_state_warn(void); +char *mtrr_attrib_to_str(int x); extern char * mtrr_if_name[]; -- 2.53.0