mtd/drivers/mtd/maps alchemy-flash.c, 1.2, 1.3 cfi_flagadm.c, 1.15, 1.16 dbox2-flash.c, 1.14, 1.15 dilnetpc.c, 1.20, 1.21 dmv182.c, 1.6, 1.7 h720x-flash.c, 1.12, 1.13 netsc520.c, 1.14, 1.15 nettel.c, 1.12, 1.13 ocotea.c, 1.4, 1.5 pcmciamtd.c, 1.58, 1.59 redwood.c, 1.11, 1.12 sbc8240.c, 1.5, 1.6 sc520cdp.c, 1.23, 1.24 scx200_docflash.c, 1.12, 1.13 sharpsl-flash.c, 1.7, 1.8 ts5500_flash.c, 1.6, 1.7 uclinux.c, 1.12, 1.13

David Woodhouse dwmw2 at infradead.org
Wed Mar 29 03:31:15 EST 2006


Update of /home/cvs/mtd/drivers/mtd/maps
In directory phoenix.infradead.org:/tmp/cvs-serv3863/drivers/mtd/maps

Modified Files:
	alchemy-flash.c cfi_flagadm.c dbox2-flash.c dilnetpc.c 
	dmv182.c h720x-flash.c netsc520.c nettel.c ocotea.c 
	pcmciamtd.c redwood.c sbc8240.c sc520cdp.c scx200_docflash.c 
	sharpsl-flash.c ts5500_flash.c uclinux.c 
Log Message:
From: Tobias Klauser <tklauser at nuerscht.ch>

Use ARRAY_SIZE macro instead of sizeof(x)/sizeof(x[0]) and remove
duplicates of the macro.

Signed-off-by: Tobias Klauser <tklauser at nuerscht.ch>
Cc: Thomas Gleixner <tglx at linutronix.de>
Signed-off-by: David Woodhouse <dwmw2 at infradead.org>
Signed-off-by: Andrew Morton <akpm at osdl.org>


Index: alchemy-flash.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/alchemy-flash.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- alchemy-flash.c	7 Nov 2005 11:14:26 -0000	1.2
+++ alchemy-flash.c	29 Mar 2006 08:31:11 -0000	1.3
@@ -126,8 +126,6 @@
         }
 };
 
-#define NB_OF(x)  (sizeof(x)/sizeof(x[0]))
-
 static struct mtd_info *mymtd;
 
 int __init alchemy_mtd_init(void)
@@ -154,7 +152,7 @@
 	 * Static partition definition selection
 	 */
 	parts = alchemy_partitions;
-	nb_parts = NB_OF(alchemy_partitions);
+	nb_parts = ARRAY_SIZE(alchemy_partitions);
 	alchemy_map.size = window_size;
 
 	/*

Index: cfi_flagadm.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/cfi_flagadm.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- cfi_flagadm.c	7 Nov 2005 11:14:26 -0000	1.15
+++ cfi_flagadm.c	29 Mar 2006 08:31:11 -0000	1.16
@@ -86,7 +86,7 @@
 	}
 };
 
-#define PARTITION_COUNT (sizeof(flagadm_parts)/sizeof(struct mtd_partition))
+#define PARTITION_COUNT ARRAY_SIZE(flagadm_parts)
 
 static struct mtd_info *mymtd;
 

Index: dbox2-flash.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/dbox2-flash.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- dbox2-flash.c	7 Nov 2005 11:14:26 -0000	1.14
+++ dbox2-flash.c	29 Mar 2006 08:31:11 -0000	1.15
@@ -57,7 +57,7 @@
 	}
 };
 
-#define NUM_PARTITIONS (sizeof(partition_info) / sizeof(partition_info[0]))
+#define NUM_PARTITIONS ARRAY_SIZE(partition_info)
 
 #define WINDOW_ADDR 0x10000000
 #define WINDOW_SIZE 0x800000

Index: dilnetpc.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/dilnetpc.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- dilnetpc.c	7 Nov 2005 11:14:26 -0000	1.20
+++ dilnetpc.c	29 Mar 2006 08:31:11 -0000	1.21
@@ -300,7 +300,7 @@
 	},
 };
 
-#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];
@@ -345,7 +345,7 @@
 	},
 };
 
-#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)

Index: dmv182.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/dmv182.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- dmv182.c	7 Nov 2005 11:14:26 -0000	1.6
+++ dmv182.c	29 Mar 2006 08:31:11 -0000	1.7
@@ -99,7 +99,7 @@
 static int __init init_svme182(void)
 {
 	struct mtd_partition *partitions;
-	int num_parts = sizeof(svme182_partitions) / sizeof(struct mtd_partition);
+	int num_parts = ARRAY_SIZE(svme182_partitions);
 
 	partitions = svme182_partitions;
 

Index: h720x-flash.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/h720x-flash.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- h720x-flash.c	7 Nov 2005 11:14:27 -0000	1.12
+++ h720x-flash.c	29 Mar 2006 08:31:11 -0000	1.13
@@ -59,7 +59,7 @@
         }
 };
 
-#define NUM_PARTITIONS  (sizeof(h720x_partitions)/sizeof(h720x_partitions[0]))
+#define NUM_PARTITIONS ARRAY_SIZE(h720x_partitions)
 
 static int                   nr_mtd_parts;
 static struct mtd_partition *mtd_parts;

Index: netsc520.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/netsc520.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- netsc520.c	7 Nov 2005 11:14:27 -0000	1.14
+++ netsc520.c	29 Mar 2006 08:31:11 -0000	1.15
@@ -76,7 +76,7 @@
 	    .size = 0x80000
     },
 };
-#define NUM_PARTITIONS (sizeof(partition_info)/sizeof(partition_info[0]))
+#define NUM_PARTITIONS ARRAY_SIZE(partition_info)
 
 #define WINDOW_SIZE	0x00100000
 #define WINDOW_ADDR	0x00200000
@@ -88,7 +88,7 @@
 	.phys = WINDOW_ADDR,
 };
 
-#define NUM_FLASH_BANKS	(sizeof(netsc520_map)/sizeof(struct map_info))
+#define NUM_FLASH_BANKS	ARRAY_SIZE(netsc520_map)
 
 static struct mtd_info *mymtd;
 

Index: nettel.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/nettel.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- nettel.c	29 Nov 2005 14:30:00 -0000	1.12
+++ nettel.c	29 Mar 2006 08:31:11 -0000	1.13
@@ -128,8 +128,7 @@
 	}
 };
 
-#define NUM_AMD_PARTITIONS \
-	(sizeof(nettel_amd_partitions)/sizeof(nettel_amd_partitions[0]))
+#define NUM_AMD_PARTITIONS ARRAY_SIZE(nettel_amd_partitions)
 
 /****************************************************************************/
 

Index: ocotea.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/ocotea.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- ocotea.c	29 Nov 2005 20:01:28 -0000	1.4
+++ ocotea.c	29 Mar 2006 08:31:11 -0000	1.5
@@ -58,8 +58,6 @@
 	}
 };
 
-#define NB_OF(x)  (sizeof(x)/sizeof(x[0]))
-
 int __init init_ocotea(void)
 {
 	u8 fpga0_reg;
@@ -97,7 +95,7 @@
 	if (flash) {
 		flash->owner = THIS_MODULE;
 		add_mtd_partitions(flash, ocotea_small_partitions,
-					NB_OF(ocotea_small_partitions));
+					ARRAY_SIZE(ocotea_small_partitions));
 	} else {
 		printk("map probe failed for flash\n");
 		return -ENXIO;
@@ -118,7 +116,7 @@
 	if (flash) {
 		flash->owner = THIS_MODULE;
 		add_mtd_partitions(flash, ocotea_large_partitions,
-					NB_OF(ocotea_large_partitions));
+					ARRAY_SIZE(ocotea_large_partitions));
 	} else {
 		printk("map probe failed for flash\n");
 		return -ENXIO;

Index: pcmciamtd.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/pcmciamtd.c,v
retrieving revision 1.58
retrieving revision 1.59
diff -u -r1.58 -r1.59
--- pcmciamtd.c	30 Jan 2006 09:10:39 -0000	1.58
+++ pcmciamtd.c	29 Mar 2006 08:31:11 -0000	1.59
@@ -619,7 +619,7 @@
 	} else if(mem_type == 2) {
 		mtd = do_map_probe("map_rom", &dev->pcmcia_map);
 	} else {
-		for(i = 0; i < sizeof(probes) / sizeof(char *); i++) {
+		for(i = 0; i < ARRAY_SIZE(probes); i++) {
 			DEBUG(1, "Trying %s", probes[i]);
 			mtd = do_map_probe(probes[i], &dev->pcmcia_map);
 			if(mtd)

Index: redwood.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/redwood.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- redwood.c	7 Nov 2005 11:14:28 -0000	1.11
+++ redwood.c	29 Mar 2006 08:31:11 -0000	1.12
@@ -121,8 +121,7 @@
 };
 
 
-#define NUM_REDWOOD_FLASH_PARTITIONS \
-	(sizeof(redwood_flash_partitions)/sizeof(redwood_flash_partitions[0]))
+#define NUM_REDWOOD_FLASH_PARTITIONS ARRAY_SIZE(redwood_flash_partitions)
 
 static struct mtd_info *redwood_mtd;
 

Index: sbc8240.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/sbc8240.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- sbc8240.c	7 Nov 2005 11:14:28 -0000	1.5
+++ sbc8240.c	29 Mar 2006 08:31:11 -0000	1.6
@@ -66,7 +66,7 @@
 	}
 };
 
-#define NUM_FLASH_BANKS	(sizeof(sbc8240_map) / sizeof(struct map_info))
+#define NUM_FLASH_BANKS	ARRAY_SIZE(sbc8240_map)
 
 /*
  * The following defines the partition layout of SBC8240 boards.
@@ -125,8 +125,6 @@
 	}
 };
 
-#define NB_OF(x) (sizeof (x) / sizeof (x[0]))
-
 /* trivial struct to describe partition information */
 struct mtd_part_def
 {
@@ -190,10 +188,10 @@
 #ifdef CONFIG_MTD_PARTITIONS
 	sbc8240_part_banks[0].mtd_part   = sbc8240_uboot_partitions;
 	sbc8240_part_banks[0].type       = "static image";
-	sbc8240_part_banks[0].nums       = NB_OF(sbc8240_uboot_partitions);
+	sbc8240_part_banks[0].nums       = ARRAY_SIZE(sbc8240_uboot_partitions);
 	sbc8240_part_banks[1].mtd_part   = sbc8240_fs_partitions;
 	sbc8240_part_banks[1].type       = "static file system";
-	sbc8240_part_banks[1].nums       = NB_OF(sbc8240_fs_partitions);
+	sbc8240_part_banks[1].nums       = ARRAY_SIZE(sbc8240_fs_partitions);
 
 	for (i = 0; i < NUM_FLASH_BANKS; i++) {
 

Index: sc520cdp.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/sc520cdp.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- sc520cdp.c	17 Nov 2005 08:20:27 -0000	1.23
+++ sc520cdp.c	29 Mar 2006 08:31:11 -0000	1.24
@@ -107,7 +107,7 @@
 	},
 };
 
-#define NUM_FLASH_BANKS	(sizeof(sc520cdp_map)/sizeof(struct map_info))
+#define NUM_FLASH_BANKS	ARRAY_SIZE(sc520cdp_map)
 
 static struct mtd_info *mymtd[NUM_FLASH_BANKS];
 static struct mtd_info *merged_mtd;

Index: scx200_docflash.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/scx200_docflash.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- scx200_docflash.c	7 Nov 2005 11:14:28 -0000	1.12
+++ scx200_docflash.c	29 Mar 2006 08:31:12 -0000	1.13
@@ -70,7 +70,7 @@
 		.size   = 0x80000
 	},
 };
-#define NUM_PARTITIONS (sizeof(partition_info)/sizeof(partition_info[0]))
+#define NUM_PARTITIONS ARRAY_SIZE(partition_info)
 #endif
 
 

Index: sharpsl-flash.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/sharpsl-flash.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- sharpsl-flash.c	7 Nov 2005 11:14:28 -0000	1.7
+++ sharpsl-flash.c	29 Mar 2006 08:31:12 -0000	1.8
@@ -49,8 +49,6 @@
 	}
 };
 
-#define NB_OF(x)  (sizeof(x)/sizeof(x[0]))
-
 int __init init_sharpsl(void)
 {
 	struct mtd_partition *parts;
@@ -92,7 +90,7 @@
 	}
 
 	parts = sharpsl_partitions;
-	nb_parts = NB_OF(sharpsl_partitions);
+	nb_parts = ARRAY_SIZE(sharpsl_partitions);
 
 	printk(KERN_NOTICE "Using %s partision definition\n", part_type);
 	add_mtd_partitions(mymtd, parts, nb_parts);

Index: ts5500_flash.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/ts5500_flash.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- ts5500_flash.c	29 Nov 2005 20:01:28 -0000	1.6
+++ ts5500_flash.c	29 Mar 2006 08:31:12 -0000	1.7
@@ -64,7 +64,7 @@
 	}
 };
 
-#define NUM_PARTITIONS (sizeof(ts5500_partitions)/sizeof(struct mtd_partition))
+#define NUM_PARTITIONS ARRAY_SIZE(ts5500_partitions)
 
 static struct mtd_info *mymtd;
 

Index: uclinux.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/uclinux.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- uclinux.c	7 Nov 2005 11:14:29 -0000	1.12
+++ uclinux.c	29 Mar 2006 08:31:12 -0000	1.13
@@ -37,7 +37,7 @@
 	{ .name = "ROMfs" }
 };
 
-#define	NUM_PARTITIONS	(sizeof(uclinux_romfs) / sizeof(uclinux_romfs[0]))
+#define	NUM_PARTITIONS	ARRAY_SIZE(uclinux_romfs)
 
 /****************************************************************************/
 





More information about the linux-mtd-cvs mailing list