powerpc: Replace __get_cpu_var uses
[pandora-kernel.git] / arch / powerpc / kernel / mce.c
index a7fd4cb..15c99b6 100644 (file)
@@ -73,8 +73,8 @@ void save_mce_event(struct pt_regs *regs, long handled,
                    uint64_t nip, uint64_t addr)
 {
        uint64_t srr1;
-       int index = __get_cpu_var(mce_nest_count)++;
-       struct machine_check_event *mce = &__get_cpu_var(mce_event[index]);
+       int index = __this_cpu_inc_return(mce_nest_count);
+       struct machine_check_event *mce = this_cpu_ptr(&mce_event[index]);
 
        /*
         * Return if we don't have enough space to log mce event.
@@ -143,7 +143,7 @@ void save_mce_event(struct pt_regs *regs, long handled,
  */
 int get_mce_event(struct machine_check_event *mce, bool release)
 {
-       int index = __get_cpu_var(mce_nest_count) - 1;
+       int index = __this_cpu_read(mce_nest_count) - 1;
        struct machine_check_event *mc_evt;
        int ret = 0;
 
@@ -153,7 +153,7 @@ int get_mce_event(struct machine_check_event *mce, bool release)
 
        /* Check if we have MCE info to process. */
        if (index < MAX_MC_EVT) {
-               mc_evt = &__get_cpu_var(mce_event[index]);
+               mc_evt = this_cpu_ptr(&mce_event[index]);
                /* Copy the event structure and release the original */
                if (mce)
                        *mce = *mc_evt;
@@ -163,7 +163,7 @@ int get_mce_event(struct machine_check_event *mce, bool release)
        }
        /* Decrement the count to free the slot. */
        if (release)
-               __get_cpu_var(mce_nest_count)--;
+               __this_cpu_dec(mce_nest_count);
 
        return ret;
 }
@@ -184,13 +184,13 @@ void machine_check_queue_event(void)
        if (!get_mce_event(&evt, MCE_EVENT_RELEASE))
                return;
 
-       index = __get_cpu_var(mce_queue_count)++;
+       index = __this_cpu_inc_return(mce_queue_count);
        /* If queue is full, just return for now. */
        if (index >= MAX_MC_EVT) {
-               __get_cpu_var(mce_queue_count)--;
+               __this_cpu_dec(mce_queue_count);
                return;
        }
-       __get_cpu_var(mce_event_queue[index]) = evt;
+       memcpy(this_cpu_ptr(&mce_event_queue[index]), &evt, sizeof(evt));
 
        /* Queue irq work to process this event later. */
        irq_work_queue(&mce_event_process_work);
@@ -208,11 +208,11 @@ static void machine_check_process_queued_event(struct irq_work *work)
         * For now just print it to console.
         * TODO: log this error event to FSP or nvram.
         */
-       while (__get_cpu_var(mce_queue_count) > 0) {
-               index = __get_cpu_var(mce_queue_count) - 1;
+       while (__this_cpu_read(mce_queue_count) > 0) {
+               index = __this_cpu_read(mce_queue_count) - 1;
                machine_check_print_event_info(
-                               &__get_cpu_var(mce_event_queue[index]));
-               __get_cpu_var(mce_queue_count)--;
+                               this_cpu_ptr(&mce_event_queue[index]));
+               __this_cpu_dec(mce_queue_count);
        }
 }