Commit 8604173d authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] mtrr cleanups

- Remove duplicated implementation of attrib_to_str()

- Make mtrr_strings[] static to if.c
parent 00bd8e91
...@@ -17,6 +17,22 @@ static int mtrr_seq_show(struct seq_file *seq, void *offset); ...@@ -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) #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 static int
mtrr_file_add(unsigned long base, unsigned long size, mtrr_file_add(unsigned long base, unsigned long size,
unsigned int type, char increment, struct file *file, int page) unsigned int type, char increment, struct file *file, int page)
...@@ -300,11 +316,6 @@ static struct proc_dir_entry *proc_root_mtrr; ...@@ -300,11 +316,6 @@ static struct proc_dir_entry *proc_root_mtrr;
# endif /* CONFIG_PROC_FS */ # 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) static int mtrr_seq_show(struct seq_file *seq, void *offset)
{ {
char factor; char factor;
...@@ -332,7 +343,7 @@ static int mtrr_seq_show(struct seq_file *seq, void *offset) ...@@ -332,7 +343,7 @@ static int mtrr_seq_show(struct seq_file *seq, void *offset)
len += seq_printf(seq, len += seq_printf(seq,
"reg%02i: base=0x%05lx000 (%4liMB), size=%4i%cB: %s, count=%d\n", "reg%02i: base=0x%05lx000 (%4liMB), size=%4i%cB: %s, count=%d\n",
i, base, base >> (20 - PAGE_SHIFT), size, factor, 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; return 0;
......
...@@ -111,11 +111,6 @@ void __init set_num_var_ranges(void) ...@@ -111,11 +111,6 @@ void __init set_num_var_ranges(void)
num_var_ranges = config & 0xff; num_var_ranges = config & 0xff;
} }
static char * attrib_to_str(int x)
{
return (x <= 6) ? mtrr_strings[x] : "?";
}
static void init_table(void) static void init_table(void)
{ {
int i, max; int i, max;
...@@ -362,8 +357,8 @@ int mtrr_add_page(unsigned long base, unsigned long size, ...@@ -362,8 +357,8 @@ int mtrr_add_page(unsigned long base, unsigned long size,
if (type == MTRR_TYPE_UNCACHABLE) if (type == MTRR_TYPE_UNCACHABLE)
continue; continue;
printk (KERN_WARNING "mtrr: type mismatch for %lx000,%lx000 old: %s new: %s\n", printk (KERN_WARNING "mtrr: type mismatch for %lx000,%lx000 old: %s new: %s\n",
base, size, attrib_to_str(ltype), base, size, mtrr_attrib_to_str(ltype),
attrib_to_str(type)); mtrr_attrib_to_str(type));
goto out; goto out;
} }
if (increment) if (increment)
...@@ -703,16 +698,4 @@ static int __init mtrr_init(void) ...@@ -703,16 +698,4 @@ static int __init mtrr_init(void)
return -ENXIO; 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); subsys_initcall(mtrr_init);
...@@ -95,5 +95,6 @@ extern unsigned int num_var_ranges; ...@@ -95,5 +95,6 @@ extern unsigned int num_var_ranges;
void finalize_mtrr_state(void); void finalize_mtrr_state(void);
void mtrr_state_warn(void); void mtrr_state_warn(void);
char *mtrr_attrib_to_str(int x);
extern char * mtrr_if_name[]; extern char * mtrr_if_name[];
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