include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit...
[safe/jmp/linux-2.6] / arch / powerpc / platforms / chrp / nvram.c
index 4ac7125..ba3588f 100644 (file)
 
 #include <linux/kernel.h>
 #include <linux/init.h>
-#include <linux/slab.h>
 #include <linux/spinlock.h>
 #include <asm/uaccess.h>
 #include <asm/prom.h>
 #include <asm/machdep.h>
+#include <asm/rtas.h>
 #include "chrp.h"
 
 static unsigned int nvram_size;
@@ -25,7 +25,8 @@ static DEFINE_SPINLOCK(nvram_lock);
 
 static unsigned char chrp_nvram_read(int addr)
 {
-       unsigned long done, flags;
+       unsigned int done;
+       unsigned long flags;
        unsigned char ret;
 
        if (addr >= nvram_size) {
@@ -34,7 +35,8 @@ static unsigned char chrp_nvram_read(int addr)
                return 0xff;
        }
        spin_lock_irqsave(&nvram_lock, flags);
-       if ((call_rtas("nvram-fetch", 3, 2, &done, addr, __pa(nvram_buf), 1) != 0) || 1 != done)
+       if ((rtas_call(rtas_token("nvram-fetch"), 3, 2, &done, addr,
+                      __pa(nvram_buf), 1) != 0) || 1 != done)
                ret = 0xff;
        else
                ret = nvram_buf[0];
@@ -45,7 +47,8 @@ static unsigned char chrp_nvram_read(int addr)
 
 static void chrp_nvram_write(int addr, unsigned char val)
 {
-       unsigned long done, flags;
+       unsigned int done;
+       unsigned long flags;
 
        if (addr >= nvram_size) {
                printk(KERN_DEBUG "%s: write addr %d > nvram_size %u\n",
@@ -54,7 +57,8 @@ static void chrp_nvram_write(int addr, unsigned char val)
        }
        spin_lock_irqsave(&nvram_lock, flags);
        nvram_buf[0] = val;
-       if ((call_rtas("nvram-store", 3, 2, &done, addr, __pa(nvram_buf), 1) != 0) || 1 != done)
+       if ((rtas_call(rtas_token("nvram-store"), 3, 2, &done, addr,
+                      __pa(nvram_buf), 1) != 0) || 1 != done)
                printk(KERN_DEBUG "rtas IO error storing 0x%02x at %d", val, addr);
        spin_unlock_irqrestore(&nvram_lock, flags);
 }
@@ -62,13 +66,14 @@ static void chrp_nvram_write(int addr, unsigned char val)
 void __init chrp_nvram_init(void)
 {
        struct device_node *nvram;
-       unsigned int *nbytes_p, proplen;
+       const unsigned int *nbytes_p;
+       unsigned int proplen;
 
        nvram = of_find_node_by_type(NULL, "nvram");
        if (nvram == NULL)
                return;
 
-       nbytes_p = (unsigned int *)get_property(nvram, "#bytes", &proplen);
+       nbytes_p = of_get_property(nvram, "#bytes", &proplen);
        if (nbytes_p == NULL || proplen != sizeof(unsigned int))
                return;