- Remove duplicated implementation of attrib_to_str() - Make mtrr_strings[] static to if.c 25-akpm/arch/i386/kernel/cpu/mtrr/if.c | 23 +++++++++++++++++------ 25-akpm/arch/i386/kernel/cpu/mtrr/main.c | 21 ++------------------- 25-akpm/arch/i386/kernel/cpu/mtrr/mtrr.h | 1 + 3 files changed, 20 insertions(+), 25 deletions(-) diff -puN arch/i386/kernel/cpu/mtrr/if.c~mtrr-attrib_to_str-consolidation arch/i386/kernel/cpu/mtrr/if.c --- 25/arch/i386/kernel/cpu/mtrr/if.c~mtrr-attrib_to_str-consolidation Thu Aug 28 12:33:40 2003 +++ 25-akpm/arch/i386/kernel/cpu/mtrr/if.c Thu Aug 28 12:38:47 2003 @@ -17,6 +17,22 @@ static int mtrr_seq_show(struct seq_file #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_ # 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 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 -puN arch/i386/kernel/cpu/mtrr/main.c~mtrr-attrib_to_str-consolidation arch/i386/kernel/cpu/mtrr/main.c --- 25/arch/i386/kernel/cpu/mtrr/main.c~mtrr-attrib_to_str-consolidation Thu Aug 28 12:33:45 2003 +++ 25-akpm/arch/i386/kernel/cpu/mtrr/main.c Thu Aug 28 12:38:27 2003 @@ -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, un 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 -puN arch/i386/kernel/cpu/mtrr/mtrr.h~mtrr-attrib_to_str-consolidation arch/i386/kernel/cpu/mtrr/mtrr.h --- 25/arch/i386/kernel/cpu/mtrr/mtrr.h~mtrr-attrib_to_str-consolidation Thu Aug 28 12:33:58 2003 +++ 25-akpm/arch/i386/kernel/cpu/mtrr/mtrr.h Thu Aug 28 12:35:00 2003 @@ -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[]; _