aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Klauser <tklauser@nuerscht.ch>2006-01-08 04:05:11 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-01-08 23:14:08 -0500
commit945f390f02ce44a13aefc6d9449c99f33c9286a5 (patch)
treebe5685ed17677b4c076b69e7d4d77eae4cbe718c
parentef9ceab28203690a42d7d3915ccf6e208f0762bc (diff)
[PATCH] drivers/block: Use ARRAY_SIZE macro
Use ARRAY_SIZE macro instead of sizeof(x)/sizeof(x[0]) and remove a duplicate of ARRAY_SIZE. Some trailing whitespaces are also removed. drivers/block/acsi* has been left out as it's marked BROKEN. Signed-off-by: Tobias Klauser <tklauser@nuerscht.ch> Cc: Jens Axboe <axboe@suse.de> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r--drivers/block/DAC960.c2
-rw-r--r--drivers/block/amiflop.c2
-rw-r--r--drivers/block/ataflop.c2
-rw-r--r--drivers/block/cciss.c4
-rw-r--r--drivers/block/cpqarray.c4
-rw-r--r--drivers/block/floppy.c9
-rw-r--r--drivers/block/xd.c6
7 files changed, 14 insertions, 15 deletions
diff --git a/drivers/block/DAC960.c b/drivers/block/DAC960.c
index 179c68a3cef3..4a7bb7dfce85 100644
--- a/drivers/block/DAC960.c
+++ b/drivers/block/DAC960.c
@@ -3760,7 +3760,7 @@ static void DAC960_V1_ProcessCompletedCommand(DAC960_Command_T *Command)
3760 if (SenseKey == DAC960_SenseKey_VendorSpecific && 3760 if (SenseKey == DAC960_SenseKey_VendorSpecific &&
3761 AdditionalSenseCode == 0x80 && 3761 AdditionalSenseCode == 0x80 &&
3762 AdditionalSenseCodeQualifier < 3762 AdditionalSenseCodeQualifier <
3763 sizeof(DAC960_EventMessages) / sizeof(char *)) 3763 ARRAY_SIZE(DAC960_EventMessages))
3764 DAC960_Critical("Physical Device %d:%d %s\n", Controller, 3764 DAC960_Critical("Physical Device %d:%d %s\n", Controller,
3765 EventLogEntry->Channel, 3765 EventLogEntry->Channel,
3766 EventLogEntry->TargetID, 3766 EventLogEntry->TargetID,
diff --git a/drivers/block/amiflop.c b/drivers/block/amiflop.c
index cb2a545e57dc..3c679d30b698 100644
--- a/drivers/block/amiflop.c
+++ b/drivers/block/amiflop.c
@@ -131,7 +131,7 @@ static struct fd_drive_type drive_types[] = {
131{ FD_DD_5, "DD 5.25", 40, 2, 14716, 13630, 1, 40, 81, 6, 30, 2}, 131{ FD_DD_5, "DD 5.25", 40, 2, 14716, 13630, 1, 40, 81, 6, 30, 2},
132{ FD_NODRIVE, "No Drive", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} 132{ FD_NODRIVE, "No Drive", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
133}; 133};
134static int num_dr_types = sizeof(drive_types) / sizeof(drive_types[0]); 134static int num_dr_types = ARRAY_SIZE(drive_types);
135 135
136static int amiga_read(int), dos_read(int); 136static int amiga_read(int), dos_read(int);
137static void amiga_write(int), dos_write(int); 137static void amiga_write(int), dos_write(int);
diff --git a/drivers/block/ataflop.c b/drivers/block/ataflop.c
index 22bda05fc693..3aa68a5447d6 100644
--- a/drivers/block/ataflop.c
+++ b/drivers/block/ataflop.c
@@ -181,7 +181,7 @@ static struct {
181 { 6, TYPE_HD }, /* 31: H1640 <- was H1600 == h1600 for PC */ 181 { 6, TYPE_HD }, /* 31: H1640 <- was H1600 == h1600 for PC */
182}; 182};
183 183
184#define NUM_DISK_MINORS (sizeof(minor2disktype)/sizeof(*minor2disktype)) 184#define NUM_DISK_MINORS ARRAY_SIZE(minor2disktype)
185 185
186/* 186/*
187 * Maximum disk size (in kilobytes). This default is used whenever the 187 * Maximum disk size (in kilobytes). This default is used whenever the
diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c
index 46e8356a962a..74818cc6509b 100644
--- a/drivers/block/cciss.c
+++ b/drivers/block/cciss.c
@@ -103,7 +103,7 @@ static const struct pci_device_id cciss_pci_device_id[] = {
103}; 103};
104MODULE_DEVICE_TABLE(pci, cciss_pci_device_id); 104MODULE_DEVICE_TABLE(pci, cciss_pci_device_id);
105 105
106#define NR_PRODUCTS (sizeof(products)/sizeof(struct board_type)) 106#define NR_PRODUCTS ARRAY_SIZE(products)
107 107
108/* board_id = Subsystem Device ID & Vendor ID 108/* board_id = Subsystem Device ID & Vendor ID
109 * product = Marketing Name for the board 109 * product = Marketing Name for the board
@@ -2833,7 +2833,7 @@ static int cciss_pci_init(ctlr_info_t *c, struct pci_dev *pdev)
2833 c->board_id = board_id; 2833 c->board_id = board_id;
2834 2834
2835#ifdef CCISS_DEBUG 2835#ifdef CCISS_DEBUG
2836 print_cfg_table(c->cfgtable); 2836 print_cfg_table(c->cfgtable);
2837#endif /* CCISS_DEBUG */ 2837#endif /* CCISS_DEBUG */
2838 2838
2839 for(i=0; i<NR_PRODUCTS; i++) { 2839 for(i=0; i<NR_PRODUCTS; i++) {
diff --git a/drivers/block/cpqarray.c b/drivers/block/cpqarray.c
index 9f0664dd3800..862b9abac0ae 100644
--- a/drivers/block/cpqarray.c
+++ b/drivers/block/cpqarray.c
@@ -72,11 +72,11 @@ static ctlr_info_t *hba[MAX_CTLR];
72 72
73static int eisa[8]; 73static int eisa[8];
74 74
75#define NR_PRODUCTS (sizeof(products)/sizeof(struct board_type)) 75#define NR_PRODUCTS ARRAY_SIZE(products)
76 76
77/* board_id = Subsystem Device ID & Vendor ID 77/* board_id = Subsystem Device ID & Vendor ID
78 * product = Marketing Name for the board 78 * product = Marketing Name for the board
79 * access = Address of the struct of function pointers 79 * access = Address of the struct of function pointers
80 */ 80 */
81static struct board_type products[] = { 81static struct board_type products[] = {
82 { 0x0040110E, "IDA", &smart1_access }, 82 { 0x0040110E, "IDA", &smart1_access },
diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c
index b86613b21cf1..374621a512e0 100644
--- a/drivers/block/floppy.c
+++ b/drivers/block/floppy.c
@@ -479,7 +479,6 @@ static struct floppy_struct floppy_type[32] = {
479 { 3200,20,2,80,0,0x1C,0x00,0xCF,0x2C,"H1600" }, /* 31 1.6MB 3.5" */ 479 { 3200,20,2,80,0,0x1C,0x00,0xCF,0x2C,"H1600" }, /* 31 1.6MB 3.5" */
480}; 480};
481 481
482#define NUMBER(x) (sizeof(x) / sizeof(*(x)))
483#define SECTSIZE (_FD_SECTSIZE(*floppy)) 482#define SECTSIZE (_FD_SECTSIZE(*floppy))
484 483
485/* Auto-detection: Disk type used until the next media change occurs. */ 484/* Auto-detection: Disk type used until the next media change occurs. */
@@ -3645,7 +3644,7 @@ static void __init config_types(void)
3645 const char *name = NULL; 3644 const char *name = NULL;
3646 static char temparea[32]; 3645 static char temparea[32];
3647 3646
3648 if (type < NUMBER(default_drive_params)) { 3647 if (type < ARRAY_SIZE(default_drive_params)) {
3649 params = &default_drive_params[type].params; 3648 params = &default_drive_params[type].params;
3650 if (type) { 3649 if (type) {
3651 name = default_drive_params[type].name; 3650 name = default_drive_params[type].name;
@@ -3961,7 +3960,7 @@ static void __init register_devfs_entries(int drive)
3961{ 3960{
3962 int base_minor = (drive < 4) ? drive : (124 + drive); 3961 int base_minor = (drive < 4) ? drive : (124 + drive);
3963 3962
3964 if (UDP->cmos < NUMBER(default_drive_params)) { 3963 if (UDP->cmos < ARRAY_SIZE(default_drive_params)) {
3965 int i = 0; 3964 int i = 0;
3966 do { 3965 do {
3967 int minor = base_minor + (table_sup[UDP->cmos][i] << 2); 3966 int minor = base_minor + (table_sup[UDP->cmos][i] << 2);
@@ -4219,7 +4218,7 @@ static struct kobject *floppy_find(dev_t dev, int *part, void *data)
4219 !(allowed_drive_mask & (1 << drive)) || 4218 !(allowed_drive_mask & (1 << drive)) ||
4220 fdc_state[FDC(drive)].version == FDC_NONE) 4219 fdc_state[FDC(drive)].version == FDC_NONE)
4221 return NULL; 4220 return NULL;
4222 if (((*part >> 2) & 0x1f) >= NUMBER(floppy_type)) 4221 if (((*part >> 2) & 0x1f) >= ARRAY_SIZE(floppy_type))
4223 return NULL; 4222 return NULL;
4224 *part = 0; 4223 *part = 0;
4225 return get_disk(disks[drive]); 4224 return get_disk(disks[drive]);
@@ -4571,7 +4570,7 @@ static void unregister_devfs_entries(int drive)
4571{ 4570{
4572 int i; 4571 int i;
4573 4572
4574 if (UDP->cmos < NUMBER(default_drive_params)) { 4573 if (UDP->cmos < ARRAY_SIZE(default_drive_params)) {
4575 i = 0; 4574 i = 0;
4576 do { 4575 do {
4577 devfs_remove("floppy/%d%s", drive, 4576 devfs_remove("floppy/%d%s", drive,
diff --git a/drivers/block/xd.c b/drivers/block/xd.c
index 97f5dab24b5a..cbce7c5e9445 100644
--- a/drivers/block/xd.c
+++ b/drivers/block/xd.c
@@ -279,11 +279,11 @@ static u_char __init xd_detect (u_char *controller, unsigned int *address)
279 return(1); 279 return(1);
280 } 280 }
281 281
282 for (i = 0; i < (sizeof(xd_bases) / sizeof(xd_bases[0])); i++) { 282 for (i = 0; i < ARRAY_SIZE(xd_bases); i++) {
283 void __iomem *p = ioremap(xd_bases[i], 0x2000); 283 void __iomem *p = ioremap(xd_bases[i], 0x2000);
284 if (!p) 284 if (!p)
285 continue; 285 continue;
286 for (j = 1; j < (sizeof(xd_sigs) / sizeof(xd_sigs[0])); j++) { 286 for (j = 1; j < ARRAY_SIZE(xd_sigs); j++) {
287 const char *s = xd_sigs[j].string; 287 const char *s = xd_sigs[j].string;
288 if (check_signature(p + xd_sigs[j].offset, s, strlen(s))) { 288 if (check_signature(p + xd_sigs[j].offset, s, strlen(s))) {
289 *controller = j; 289 *controller = j;
@@ -1018,7 +1018,7 @@ static void __init do_xd_setup (int *integers)
1018 case 2: if ((integers[2] > 0) && (integers[2] < 16)) 1018 case 2: if ((integers[2] > 0) && (integers[2] < 16))
1019 xd_irq = integers[2]; 1019 xd_irq = integers[2];
1020 case 1: xd_override = 1; 1020 case 1: xd_override = 1;
1021 if ((integers[1] >= 0) && (integers[1] < (sizeof(xd_sigs) / sizeof(xd_sigs[0])))) 1021 if ((integers[1] >= 0) && (integers[1] < ARRAY_SIZE(xd_sigs)))
1022 xd_type = integers[1]; 1022 xd_type = integers[1];
1023 case 0: break; 1023 case 0: break;
1024 default:printk("xd: too many parameters for xd\n"); 1024 default:printk("xd: too many parameters for xd\n");