]> err.no Git - linux-2.6/blobdiff - arch/x86/kernel/cpu/mtrr/if.c
Merge branch 'for-2.6.26' of master.kernel.org:/pub/scm/linux/kernel/git/jwboyer...
[linux-2.6] / arch / x86 / kernel / cpu / mtrr / if.c
index c7d8f175674525543baa11f712b1241eeb364d67..84c480bb3715af21405c6d55fab0f3160cbf3a59 100644 (file)
 #include <asm/mtrr.h>
 #include "mtrr.h"
 
-/* RED-PEN: this is accessed without any locking */
-extern unsigned int *usage_table;
-
-
 #define FILE_FCOUNT(f) (((struct seq_file *)((f)->private_data))->private)
 
 static const char *const mtrr_strings[MTRR_NUM_TYPES] =
@@ -37,7 +33,7 @@ const char *mtrr_attrib_to_str(int x)
 
 static int
 mtrr_file_add(unsigned long base, unsigned long size,
-             unsigned int type, char increment, struct file *file, int page)
+             unsigned int type, bool increment, struct file *file, int page)
 {
        int reg, max;
        unsigned int *fcount = FILE_FCOUNT(file); 
@@ -55,7 +51,7 @@ mtrr_file_add(unsigned long base, unsigned long size,
                base >>= PAGE_SHIFT;
                size >>= PAGE_SHIFT;
        }
-       reg = mtrr_add_page(base, size, type, 1);
+       reg = mtrr_add_page(base, size, type, true);
        if (reg >= 0)
                ++fcount[reg];
        return reg;
@@ -141,7 +137,7 @@ mtrr_write(struct file *file, const char __user *buf, size_t len, loff_t * ppos)
                size >>= PAGE_SHIFT;
                err =
                    mtrr_add_page((unsigned long) base, (unsigned long) size, i,
-                                 1);
+                                 true);
                if (err < 0)
                        return err;
                return len;
@@ -217,7 +213,7 @@ mtrr_ioctl(struct file *file, unsigned int cmd, unsigned long __arg)
                if (!capable(CAP_SYS_ADMIN))
                        return -EPERM;
                err =
-                   mtrr_file_add(sentry.base, sentry.size, sentry.type, 1,
+                   mtrr_file_add(sentry.base, sentry.size, sentry.type, true,
                                  file, 0);
                break;
        case MTRRIOC_SET_ENTRY:
@@ -226,7 +222,7 @@ mtrr_ioctl(struct file *file, unsigned int cmd, unsigned long __arg)
 #endif
                if (!capable(CAP_SYS_ADMIN))
                        return -EPERM;
-               err = mtrr_add(sentry.base, sentry.size, sentry.type, 0);
+               err = mtrr_add(sentry.base, sentry.size, sentry.type, false);
                break;
        case MTRRIOC_DEL_ENTRY:
 #ifdef CONFIG_COMPAT
@@ -270,7 +266,7 @@ mtrr_ioctl(struct file *file, unsigned int cmd, unsigned long __arg)
                if (!capable(CAP_SYS_ADMIN))
                        return -EPERM;
                err =
-                   mtrr_file_add(sentry.base, sentry.size, sentry.type, 1,
+                   mtrr_file_add(sentry.base, sentry.size, sentry.type, true,
                                  file, 1);
                break;
        case MTRRIOC_SET_PAGE_ENTRY:
@@ -279,7 +275,8 @@ mtrr_ioctl(struct file *file, unsigned int cmd, unsigned long __arg)
 #endif
                if (!capable(CAP_SYS_ADMIN))
                        return -EPERM;
-               err = mtrr_add_page(sentry.base, sentry.size, sentry.type, 0);
+               err =
+                   mtrr_add_page(sentry.base, sentry.size, sentry.type, false);
                break;
        case MTRRIOC_DEL_PAGE_ENTRY:
 #ifdef CONFIG_COMPAT
@@ -396,7 +393,7 @@ static int mtrr_seq_show(struct seq_file *seq, void *offset)
        for (i = 0; i < max; i++) {
                mtrr_if->get(i, &base, &size, &type);
                if (size == 0)
-                       usage_table[i] = 0;
+                       mtrr_usage_table[i] = 0;
                else {
                        if (size < (0x100000 >> PAGE_SHIFT)) {
                                /* less than 1MB */
@@ -410,7 +407,7 @@ static int mtrr_seq_show(struct seq_file *seq, void *offset)
                        len += seq_printf(seq, 
                                   "reg%02i: base=0x%05lx000 (%4luMB), size=%4lu%cB: %s, count=%d\n",
                             i, base, base >> (20 - PAGE_SHIFT), size, factor,
-                            mtrr_attrib_to_str(type), usage_table[i]);
+                            mtrr_attrib_to_str(type), mtrr_usage_table[i]);
                }
        }
        return 0;
@@ -427,11 +424,10 @@ static int __init mtrr_if_init(void)
                return -ENODEV;
 
        proc_root_mtrr =
-           create_proc_entry("mtrr", S_IWUSR | S_IRUGO, &proc_root);
-       if (proc_root_mtrr) {
+               proc_create("mtrr", S_IWUSR | S_IRUGO, NULL, &mtrr_fops);
+
+       if (proc_root_mtrr)
                proc_root_mtrr->owner = THIS_MODULE;
-               proc_root_mtrr->proc_fops = &mtrr_fops;
-       }
        return 0;
 }