Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/roland...
[pandora-kernel.git] / arch / x86 / kernel / cpu / mcheck / mce_amd_64.c
index 77e6666..88736ca 100644 (file)
@@ -251,18 +251,18 @@ struct threshold_attr {
        ssize_t(*store) (struct threshold_block *, const char *, size_t count);
 };
 
-static cpumask_t affinity_set(unsigned int cpu)
+static void affinity_set(unsigned int cpu, cpumask_t *oldmask,
+                                          cpumask_t *newmask)
 {
-       cpumask_t oldmask = current->cpus_allowed;
-       cpumask_t newmask = CPU_MASK_NONE;
-       cpu_set(cpu, newmask);
-       set_cpus_allowed(current, newmask);
-       return oldmask;
+       *oldmask = current->cpus_allowed;
+       cpus_clear(*newmask);
+       cpu_set(cpu, *newmask);
+       set_cpus_allowed_ptr(current, newmask);
 }
 
-static void affinity_restore(cpumask_t oldmask)
+static void affinity_restore(const cpumask_t *oldmask)
 {
-       set_cpus_allowed(current, oldmask);
+       set_cpus_allowed_ptr(current, oldmask);
 }
 
 #define SHOW_FIELDS(name)                                           \
@@ -277,15 +277,15 @@ static ssize_t store_interrupt_enable(struct threshold_block *b,
                                      const char *buf, size_t count)
 {
        char *end;
-       cpumask_t oldmask;
+       cpumask_t oldmask, newmask;
        unsigned long new = simple_strtoul(buf, &end, 0);
        if (end == buf)
                return -EINVAL;
        b->interrupt_enable = !!new;
 
-       oldmask = affinity_set(b->cpu);
+       affinity_set(b->cpu, &oldmask, &newmask);
        threshold_restart_bank(b, 0, 0);
-       affinity_restore(oldmask);
+       affinity_restore(&oldmask);
 
        return end - buf;
 }
@@ -294,7 +294,7 @@ static ssize_t store_threshold_limit(struct threshold_block *b,
                                     const char *buf, size_t count)
 {
        char *end;
-       cpumask_t oldmask;
+       cpumask_t oldmask, newmask;
        u16 old;
        unsigned long new = simple_strtoul(buf, &end, 0);
        if (end == buf)
@@ -306,9 +306,9 @@ static ssize_t store_threshold_limit(struct threshold_block *b,
        old = b->threshold_limit;
        b->threshold_limit = new;
 
-       oldmask = affinity_set(b->cpu);
+       affinity_set(b->cpu, &oldmask, &newmask);
        threshold_restart_bank(b, 0, old);
-       affinity_restore(oldmask);
+       affinity_restore(&oldmask);
 
        return end - buf;
 }
@@ -316,10 +316,10 @@ static ssize_t store_threshold_limit(struct threshold_block *b,
 static ssize_t show_error_count(struct threshold_block *b, char *buf)
 {
        u32 high, low;
-       cpumask_t oldmask;
-       oldmask = affinity_set(b->cpu);
+       cpumask_t oldmask, newmask;
+       affinity_set(b->cpu, &oldmask, &newmask);
        rdmsr(b->address, low, high);
-       affinity_restore(oldmask);
+       affinity_restore(&oldmask);
        return sprintf(buf, "%x\n",
                       (high & 0xFFF) - (THRESHOLD_MAX - b->threshold_limit));
 }
@@ -327,10 +327,10 @@ static ssize_t show_error_count(struct threshold_block *b, char *buf)
 static ssize_t store_error_count(struct threshold_block *b,
                                 const char *buf, size_t count)
 {
-       cpumask_t oldmask;
-       oldmask = affinity_set(b->cpu);
+       cpumask_t oldmask, newmask;
+       affinity_set(b->cpu, &oldmask, &newmask);
        threshold_restart_bank(b, 1, 0);
-       affinity_restore(oldmask);
+       affinity_restore(&oldmask);
        return 1;
 }
 
@@ -468,7 +468,7 @@ static __cpuinit int threshold_create_bank(unsigned int cpu, unsigned int bank)
 {
        int i, err = 0;
        struct threshold_bank *b = NULL;
-       cpumask_t oldmask = CPU_MASK_NONE;
+       cpumask_t oldmask, newmask;
        char name[32];
 
        sprintf(name, "threshold_bank%i", bank);
@@ -519,15 +519,15 @@ static __cpuinit int threshold_create_bank(unsigned int cpu, unsigned int bank)
 
        per_cpu(threshold_banks, cpu)[bank] = b;
 
-       oldmask = affinity_set(cpu);
+       affinity_set(cpu, &oldmask, &newmask);
        err = allocate_threshold_blocks(cpu, bank, 0,
                                        MSR_IA32_MC0_MISC + bank * 4);
-       affinity_restore(oldmask);
+       affinity_restore(&oldmask);
 
        if (err)
                goto out_free;
 
-       for_each_cpu_mask(i, b->cpus) {
+       for_each_cpu_mask_nr(i, b->cpus) {
                if (i == cpu)
                        continue;
 
@@ -555,7 +555,7 @@ static __cpuinit int threshold_create_device(unsigned int cpu)
        int err = 0;
 
        for (bank = 0; bank < NR_BANKS; ++bank) {
-               if (!(per_cpu(bank_map, cpu) & 1 << bank))
+               if (!(per_cpu(bank_map, cpu) & (1 << bank)))
                        continue;
                err = threshold_create_bank(cpu, bank);
                if (err)
@@ -617,7 +617,7 @@ static void threshold_remove_bank(unsigned int cpu, int bank)
 #endif
 
        /* remove all sibling symlinks before unregistering */
-       for_each_cpu_mask(i, b->cpus) {
+       for_each_cpu_mask_nr(i, b->cpus) {
                if (i == cpu)
                        continue;
 
@@ -638,7 +638,7 @@ static void threshold_remove_device(unsigned int cpu)
        unsigned int bank;
 
        for (bank = 0; bank < NR_BANKS; ++bank) {
-               if (!(per_cpu(bank_map, cpu) & 1 << bank))
+               if (!(per_cpu(bank_map, cpu) & (1 << bank)))
                        continue;
                threshold_remove_bank(cpu, bank);
        }