x86, MCE, AMD: Cleanup reading of error_count
authorBorislav Petkov <borislav.petkov@amd.com>
Fri, 27 Apr 2012 10:53:59 +0000 (12:53 +0200)
committerBorislav Petkov <borislav.petkov@amd.com>
Thu, 7 Jun 2012 10:43:46 +0000 (12:43 +0200)
We have rdmsr_on_cpu() now so remove locally defined solution in favor
of the generic one.

No functionality change.

Signed-off-by: Borislav Petkov <borislav.petkov@amd.com>
arch/x86/kernel/cpu/mcheck/mce_amd.c

index 0b1bb0e158810c0d8f0aec6376410daf2433542f..a7204ef37223a875a43127ee7cf1158f6b9b73c4 100644 (file)
@@ -359,27 +359,14 @@ store_threshold_limit(struct threshold_block *b, const char *buf, size_t size)
        return size;
 }
 
-struct threshold_block_cross_cpu {
-       struct threshold_block  *tb;
-       long                    retval;
-};
-
-static void local_error_count_handler(void *_tbcc)
-{
-       struct threshold_block_cross_cpu *tbcc = _tbcc;
-       struct threshold_block *b = tbcc->tb;
-       u32 low, high;
-
-       rdmsr(b->address, low, high);
-       tbcc->retval = (high & 0xFFF) - (THRESHOLD_MAX - b->threshold_limit);
-}
-
 static ssize_t show_error_count(struct threshold_block *b, char *buf)
 {
-       struct threshold_block_cross_cpu tbcc = { .tb = b, };
+       u32 lo, hi;
+
+       rdmsr_on_cpu(b->cpu, b->address, &lo, &hi);
 
-       smp_call_function_single(b->cpu, local_error_count_handler, &tbcc, 1);
-       return sprintf(buf, "%lu\n", tbcc.retval);
+       return sprintf(buf, "%u\n", ((hi & THRESHOLD_MAX) -
+                                    (THRESHOLD_MAX - b->threshold_limit)));
 }
 
 static ssize_t store_error_count(struct threshold_block *b,