Fedora kernel-2.6.17-1.2142_FC4 patched with stable patch-2.6.17.4-vs2.0.2-rc26.diff
[linux-2.6.git] / drivers / mtd / maps / dilnetpc.c
index 0bc79c9..c299d10 100644 (file)
@@ -14,7 +14,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
  *
- * $Id: dilnetpc.c,v 1.17 2004/11/28 09:40:39 dwmw2 Exp $
+ * $Id: dilnetpc.c,v 1.20 2005/11/07 11:14:26 gleixner Exp $
  *
  * The DIL/Net PC is a tiny embedded PC board made by SSV Embedded Systems
  * featuring the AMD Elan SC410 processor. There are two variants of this
 #include <linux/types.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
-#include <asm/io.h>
+#include <linux/string.h>
+
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/map.h>
 #include <linux/mtd/partitions.h>
 #include <linux/mtd/concat.h>
 
+#include <asm/io.h>
+
 /*
 ** The DIL/NetPC keeps its BIOS in two distinct flash blocks.
 ** Destroying any of these blocks transforms the DNPC into
@@ -215,8 +218,8 @@ static void dnp_set_vpp(struct map_info *not_used, int on)
        {
                if(--vpp_counter == 0)
                        setcsc(CSC_RBWR, getcsc(CSC_RBWR) | 0x4);
-               else if(vpp_counter < 0)
-                       BUG();
+               else
+                       BUG_ON(vpp_counter < 0);
        }
        spin_unlock_irq(&dnpc_spin);
 }
@@ -237,8 +240,8 @@ static void adnp_set_vpp(struct map_info *not_used, int on)
        {
                if(--vpp_counter == 0)
                        setcsc(CSC_RBWR, getcsc(CSC_RBWR) | 0x8);
-               else if(vpp_counter < 0)
-                       BUG();
+               else
+                       BUG_ON(vpp_counter < 0);
        }
        spin_unlock_irq(&dnpc_spin);
 }
@@ -269,13 +272,13 @@ static struct map_info dnpc_map = {
 
 static struct mtd_partition partition_info[]=
 {
-       { 
-               .name =         "ADNP boot", 
-               .offset =       0, 
+       {
+               .name =         "ADNP boot",
+               .offset =       0,
                .size =         0xf0000,
        },
-       { 
-               .name =         "ADNP system BIOS", 
+       {
+               .name =         "ADNP system BIOS",
                .offset =       MTDPART_OFS_NXTBLK,
                .size =         0x10000,
 #ifdef DNPC_BIOS_BLOCKS_WRITEPROTECTED
@@ -288,7 +291,7 @@ static struct mtd_partition partition_info[]=
                .size =         0x2f0000,
        },
        {
-               .name =         "ADNP system BIOS entry", 
+               .name =         "ADNP system BIOS entry",
                .offset =       MTDPART_OFS_NXTBLK,
                .size =         MTDPART_SIZ_FULL,
 #ifdef DNPC_BIOS_BLOCKS_WRITEPROTECTED
@@ -297,7 +300,7 @@ static struct mtd_partition partition_info[]=
        },
 };
 
-#define NUM_PARTITIONS (sizeof(partition_info)/sizeof(partition_info[0]))
+#define NUM_PARTITIONS ARRAY_SIZE(partition_info)
 
 static struct mtd_info *mymtd;
 static struct mtd_info *lowlvl_parts[NUM_PARTITIONS];
@@ -322,9 +325,9 @@ static struct mtd_info *merged_mtd;
 
 static struct mtd_partition higlvl_partition_info[]=
 {
-       { 
-               .name =         "ADNP boot block", 
-               .offset =       0, 
+       {
+               .name =         "ADNP boot block",
+               .offset =       0,
                .size =         CONFIG_MTD_DILNETPC_BOOTSIZE,
        },
        {
@@ -332,8 +335,8 @@ static struct mtd_partition higlvl_partition_info[]=
                .offset =       MTDPART_OFS_NXTBLK,
                .size =         ADNP_WINDOW_SIZE-CONFIG_MTD_DILNETPC_BOOTSIZE-0x20000,
        },
-       { 
-               .name =         "ADNP system BIOS + BIOS Entry", 
+       {
+               .name =         "ADNP system BIOS + BIOS Entry",
                .offset =       MTDPART_OFS_NXTBLK,
                .size =         MTDPART_SIZ_FULL,
 #ifdef DNPC_BIOS_BLOCKS_WRITEPROTECTED
@@ -342,7 +345,7 @@ static struct mtd_partition higlvl_partition_info[]=
        },
 };
 
-#define NUM_HIGHLVL_PARTITIONS (sizeof(higlvl_partition_info)/sizeof(partition_info[0]))
+#define NUM_HIGHLVL_PARTITIONS ARRAY_SIZE(higlvl_partition_info)
 
 
 static int dnp_adnp_probe(void)
@@ -368,7 +371,7 @@ static int __init init_dnpc(void)
 
        /*
        ** determine hardware (DNP/ADNP/invalid)
-       */      
+       */
        if((is_dnp = dnp_adnp_probe()) < 0)
                return -ENXIO;
 
@@ -394,13 +397,13 @@ static int __init init_dnpc(void)
                ++dnpc_map.name;
                for(i = 0; i < NUM_PARTITIONS; i++)
                        ++partition_info[i].name;
-               higlvl_partition_info[1].size = DNP_WINDOW_SIZE - 
+               higlvl_partition_info[1].size = DNP_WINDOW_SIZE -
                        CONFIG_MTD_DILNETPC_BOOTSIZE - 0x20000;
                for(i = 0; i < NUM_HIGHLVL_PARTITIONS; i++)
                        ++higlvl_partition_info[i].name;
        }
 
-       printk(KERN_NOTICE "DIL/Net %s flash: 0x%lx at 0x%lx\n", 
+       printk(KERN_NOTICE "DIL/Net %s flash: 0x%lx at 0x%lx\n",
                is_dnp ? "DNPC" : "ADNP", dnpc_map.size, dnpc_map.phys);
 
        dnpc_map.virt = ioremap_nocache(dnpc_map.phys, dnpc_map.size);
@@ -433,7 +436,7 @@ static int __init init_dnpc(void)
                iounmap(dnpc_map.virt);
                return -ENXIO;
        }
-               
+
        mymtd->owner = THIS_MODULE;
 
        /*