]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - arch/powerpc/platforms/powermac/nvram.c
Disintegrate asm/system.h for PowerPC
[karo-tx-linux.git] / arch / powerpc / platforms / powermac / nvram.c
index 54d227127c9f10839d79f639e6e8f98c7257fbdc..014d06e6d46b88922e29367d26a227dbeef7c573 100644 (file)
@@ -23,7 +23,6 @@
 #include <linux/spinlock.h>
 #include <asm/sections.h>
 #include <asm/io.h>
-#include <asm/system.h>
 #include <asm/prom.h>
 #include <asm/machdep.h>
 #include <asm/nvram.h>
@@ -279,7 +278,7 @@ static u32 core99_check(u8* datas)
 
 static int sm_erase_bank(int bank)
 {
-       int stat, i;
+       int stat;
        unsigned long timeout;
 
        u8 __iomem *base = (u8 __iomem *)nvram_data + core99_bank*NVRAM_SIZE;
@@ -301,11 +300,10 @@ static int sm_erase_bank(int bank)
        out_8(base, SM_FLASH_CMD_CLEAR_STATUS);
        out_8(base, SM_FLASH_CMD_RESET);
 
-       for (i=0; i<NVRAM_SIZE; i++)
-               if (base[i] != 0xff) {
-                       printk(KERN_ERR "nvram: Sharp/Micron flash erase failed !\n");
-                       return -ENXIO;
-               }
+       if (memchr_inv(base, 0xff, NVRAM_SIZE)) {
+               printk(KERN_ERR "nvram: Sharp/Micron flash erase failed !\n");
+               return -ENXIO;
+       }
        return 0;
 }
 
@@ -336,17 +334,16 @@ static int sm_write_bank(int bank, u8* datas)
        }
        out_8(base, SM_FLASH_CMD_CLEAR_STATUS);
        out_8(base, SM_FLASH_CMD_RESET);
-       for (i=0; i<NVRAM_SIZE; i++)
-               if (base[i] != datas[i]) {
-                       printk(KERN_ERR "nvram: Sharp/Micron flash write failed !\n");
-                       return -ENXIO;
-               }
+       if (memcmp(base, datas, NVRAM_SIZE)) {
+               printk(KERN_ERR "nvram: Sharp/Micron flash write failed !\n");
+               return -ENXIO;
+       }
        return 0;
 }
 
 static int amd_erase_bank(int bank)
 {
-       int i, stat = 0;
+       int stat = 0;
        unsigned long timeout;
 
        u8 __iomem *base = (u8 __iomem *)nvram_data + core99_bank*NVRAM_SIZE;
@@ -382,12 +379,11 @@ static int amd_erase_bank(int bank)
        /* Reset */
        out_8(base, 0xf0);
        udelay(1);
-       
-       for (i=0; i<NVRAM_SIZE; i++)
-               if (base[i] != 0xff) {
-                       printk(KERN_ERR "nvram: AMD flash erase failed !\n");
-                       return -ENXIO;
-               }
+
+       if (memchr_inv(base, 0xff, NVRAM_SIZE)) {
+               printk(KERN_ERR "nvram: AMD flash erase failed !\n");
+               return -ENXIO;
+       }
        return 0;
 }
 
@@ -429,11 +425,10 @@ static int amd_write_bank(int bank, u8* datas)
        out_8(base, 0xf0);
        udelay(1);
 
-       for (i=0; i<NVRAM_SIZE; i++)
-               if (base[i] != datas[i]) {
-                       printk(KERN_ERR "nvram: AMD flash write failed !\n");
-                       return -ENXIO;
-               }
+       if (memcmp(base, datas, NVRAM_SIZE)) {
+               printk(KERN_ERR "nvram: AMD flash write failed !\n");
+               return -ENXIO;
+       }
        return 0;
 }