]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - arch/sparc64/kernel/chmc.c
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris...
[linux-2.6-omap-h63xx.git] / arch / sparc64 / kernel / chmc.c
index 259f37e516f54f1e82d5c91169ede37faf3382d6..6d4f02e8a4cfe7da672602b87ab49a8856ff7570 100644 (file)
@@ -1,7 +1,6 @@
-/* $Id: chmc.c,v 1.4 2002/01/08 16:00:14 davem Exp $
- * memctrlr.c: Driver for UltraSPARC-III memory controller.
+/* memctrlr.c: Driver for UltraSPARC-III memory controller.
  *
- * Copyright (C) 2001 David S. Miller (davem@redhat.com)
+ * Copyright (C) 2001, 2007 David S. Miller (davem@davemloft.net)
  */
 
 #include <linux/module.h>
@@ -16,6 +15,7 @@
 #include <linux/init.h>
 #include <asm/spitfire.h>
 #include <asm/chmctrl.h>
+#include <asm/cpudata.h>
 #include <asm/oplib.h>
 #include <asm/prom.h>
 #include <asm/io.h>
@@ -242,8 +242,11 @@ int chmc_getunumber(int syndrome_code,
  */
 static u64 read_mcreg(struct mctrl_info *mp, unsigned long offset)
 {
-       unsigned long ret;
-       int this_cpu = get_cpu();
+       unsigned long ret, this_cpu;
+
+       preempt_disable();
+
+       this_cpu = real_hard_smp_processor_id();
 
        if (mp->portid == this_cpu) {
                __asm__ __volatile__("ldxa      [%1] %2, %0"
@@ -255,7 +258,8 @@ static u64 read_mcreg(struct mctrl_info *mp, unsigned long offset)
                                     : "r" (mp->regs + offset),
                                       "i" (ASI_PHYS_BYPASS_EC_E));
        }
-       put_cpu();
+
+       preempt_enable();
 
        return ret;
 }
@@ -341,15 +345,14 @@ static void fetch_decode_regs(struct mctrl_info *mp)
 
 static int init_one_mctrl(struct device_node *dp)
 {
-       struct mctrl_info *mp = kmalloc(sizeof(*mp), GFP_KERNEL);
+       struct mctrl_info *mp = kzalloc(sizeof(*mp), GFP_KERNEL);
        int portid = of_getintprop_default(dp, "portid", -1);
-       struct linux_prom64_registers *regs;
-       void *pval;
+       const struct linux_prom64_registers *regs;
+       const void *pval;
        int len;
 
        if (!mp)
                return -1;
-       memset(mp, 0, sizeof(*mp));
        if (portid == -1)
                goto fail;