diff options
author | Tobias Klauser <tklauser@nuerscht.ch> | 2006-06-09 01:23:48 -0400 |
---|---|---|
committer | James Bottomley <jejb@mulgrave.il.steeleye.com> | 2006-06-10 11:45:30 -0400 |
commit | 6391a11375de5e2bb1eb8481e54619761dc65d9f (patch) | |
tree | 956aae1d278a3f731b2e6148ff40a69aa7957ea8 | |
parent | 9dc399de0840a478adb71278becf598d3ab3aacc (diff) |
[SCSI] drivers/scsi: Use ARRAY_SIZE macro
Use ARRAY_SIZE macro instead of sizeof(x)/sizeof(x[0]) and remove
duplicates of the macro.
Signed-off-by: Tobias Klauser <tklauser@nuerscht.ch>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
47 files changed, 167 insertions, 200 deletions
diff --git a/drivers/scsi/3w-xxxx.c b/drivers/scsi/3w-xxxx.c index 37a58c6dad29..17dbd4ac8692 100644 --- a/drivers/scsi/3w-xxxx.c +++ b/drivers/scsi/3w-xxxx.c | |||
@@ -405,7 +405,7 @@ static int tw_decode_sense(TW_Device_Extension *tw_dev, int request_id, int fill | |||
405 | /* Attempt to return intelligent sense information */ | 405 | /* Attempt to return intelligent sense information */ |
406 | if (fill_sense) { | 406 | if (fill_sense) { |
407 | if ((command->status == 0xc7) || (command->status == 0xcb)) { | 407 | if ((command->status == 0xc7) || (command->status == 0xcb)) { |
408 | for (i=0;i<(sizeof(tw_sense_table)/sizeof(tw_sense_table[0]));i++) { | 408 | for (i = 0; i < ARRAY_SIZE(tw_sense_table); i++) { |
409 | if (command->flags == tw_sense_table[i][0]) { | 409 | if (command->flags == tw_sense_table[i][0]) { |
410 | 410 | ||
411 | /* Valid bit and 'current errors' */ | 411 | /* Valid bit and 'current errors' */ |
@@ -625,7 +625,7 @@ static int tw_aen_complete(TW_Device_Extension *tw_dev, int request_id) | |||
625 | if (aen == 0x0ff) { | 625 | if (aen == 0x0ff) { |
626 | printk(KERN_WARNING "3w-xxxx: scsi%d: AEN: INFO: AEN queue overflow.\n", tw_dev->host->host_no); | 626 | printk(KERN_WARNING "3w-xxxx: scsi%d: AEN: INFO: AEN queue overflow.\n", tw_dev->host->host_no); |
627 | } else { | 627 | } else { |
628 | table_max = sizeof(tw_aen_string)/sizeof(char *); | 628 | table_max = ARRAY_SIZE(tw_aen_string); |
629 | if ((aen & 0x0ff) < table_max) { | 629 | if ((aen & 0x0ff) < table_max) { |
630 | if ((tw_aen_string[aen & 0xff][strlen(tw_aen_string[aen & 0xff])-1]) == '#') { | 630 | if ((tw_aen_string[aen & 0xff][strlen(tw_aen_string[aen & 0xff])-1]) == '#') { |
631 | printk(KERN_WARNING "3w-xxxx: scsi%d: AEN: %s%d.\n", tw_dev->host->host_no, tw_aen_string[aen & 0xff], aen >> 8); | 631 | printk(KERN_WARNING "3w-xxxx: scsi%d: AEN: %s%d.\n", tw_dev->host->host_no, tw_aen_string[aen & 0xff], aen >> 8); |
@@ -786,7 +786,7 @@ static int tw_aen_drain_queue(TW_Device_Extension *tw_dev) | |||
786 | if (aen == 0x0ff) { | 786 | if (aen == 0x0ff) { |
787 | printk(KERN_WARNING "3w-xxxx: AEN: INFO: AEN queue overflow.\n"); | 787 | printk(KERN_WARNING "3w-xxxx: AEN: INFO: AEN queue overflow.\n"); |
788 | } else { | 788 | } else { |
789 | table_max = sizeof(tw_aen_string)/sizeof(char *); | 789 | table_max = ARRAY_SIZE(tw_aen_string); |
790 | if ((aen & 0x0ff) < table_max) { | 790 | if ((aen & 0x0ff) < table_max) { |
791 | if ((tw_aen_string[aen & 0xff][strlen(tw_aen_string[aen & 0xff])-1]) == '#') { | 791 | if ((tw_aen_string[aen & 0xff][strlen(tw_aen_string[aen & 0xff])-1]) == '#') { |
792 | printk(KERN_WARNING "3w-xxxx: AEN: %s%d.\n", tw_aen_string[aen & 0xff], aen >> 8); | 792 | printk(KERN_WARNING "3w-xxxx: AEN: %s%d.\n", tw_aen_string[aen & 0xff], aen >> 8); |
diff --git a/drivers/scsi/53c700.c b/drivers/scsi/53c700.c index b767918b9a98..4958c3b93c30 100644 --- a/drivers/scsi/53c700.c +++ b/drivers/scsi/53c700.c | |||
@@ -316,7 +316,7 @@ NCR_700_detect(struct scsi_host_template *tpnt, | |||
316 | BUG_ON(!dma_is_consistent(pScript) && L1_CACHE_BYTES < dma_get_cache_alignment()); | 316 | BUG_ON(!dma_is_consistent(pScript) && L1_CACHE_BYTES < dma_get_cache_alignment()); |
317 | hostdata->slots = (struct NCR_700_command_slot *)(memory + SLOTS_OFFSET); | 317 | hostdata->slots = (struct NCR_700_command_slot *)(memory + SLOTS_OFFSET); |
318 | hostdata->dev = dev; | 318 | hostdata->dev = dev; |
319 | 319 | ||
320 | pSlots = pScript + SLOTS_OFFSET; | 320 | pSlots = pScript + SLOTS_OFFSET; |
321 | 321 | ||
322 | /* Fill in the missing routines from the host template */ | 322 | /* Fill in the missing routines from the host template */ |
@@ -332,19 +332,18 @@ NCR_700_detect(struct scsi_host_template *tpnt, | |||
332 | tpnt->slave_destroy = NCR_700_slave_destroy; | 332 | tpnt->slave_destroy = NCR_700_slave_destroy; |
333 | tpnt->change_queue_depth = NCR_700_change_queue_depth; | 333 | tpnt->change_queue_depth = NCR_700_change_queue_depth; |
334 | tpnt->change_queue_type = NCR_700_change_queue_type; | 334 | tpnt->change_queue_type = NCR_700_change_queue_type; |
335 | 335 | ||
336 | if(tpnt->name == NULL) | 336 | if(tpnt->name == NULL) |
337 | tpnt->name = "53c700"; | 337 | tpnt->name = "53c700"; |
338 | if(tpnt->proc_name == NULL) | 338 | if(tpnt->proc_name == NULL) |
339 | tpnt->proc_name = "53c700"; | 339 | tpnt->proc_name = "53c700"; |
340 | |||
341 | 340 | ||
342 | host = scsi_host_alloc(tpnt, 4); | 341 | host = scsi_host_alloc(tpnt, 4); |
343 | if (!host) | 342 | if (!host) |
344 | return NULL; | 343 | return NULL; |
345 | memset(hostdata->slots, 0, sizeof(struct NCR_700_command_slot) | 344 | memset(hostdata->slots, 0, sizeof(struct NCR_700_command_slot) |
346 | * NCR_700_COMMAND_SLOTS_PER_HOST); | 345 | * NCR_700_COMMAND_SLOTS_PER_HOST); |
347 | for(j = 0; j < NCR_700_COMMAND_SLOTS_PER_HOST; j++) { | 346 | for (j = 0; j < NCR_700_COMMAND_SLOTS_PER_HOST; j++) { |
348 | dma_addr_t offset = (dma_addr_t)((unsigned long)&hostdata->slots[j].SG[0] | 347 | dma_addr_t offset = (dma_addr_t)((unsigned long)&hostdata->slots[j].SG[0] |
349 | - (unsigned long)&hostdata->slots[0].SG[0]); | 348 | - (unsigned long)&hostdata->slots[0].SG[0]); |
350 | hostdata->slots[j].pSG = (struct NCR_700_SG_List *)((unsigned long)(pSlots + offset)); | 349 | hostdata->slots[j].pSG = (struct NCR_700_SG_List *)((unsigned long)(pSlots + offset)); |
@@ -355,14 +354,12 @@ NCR_700_detect(struct scsi_host_template *tpnt, | |||
355 | hostdata->slots[j].state = NCR_700_SLOT_FREE; | 354 | hostdata->slots[j].state = NCR_700_SLOT_FREE; |
356 | } | 355 | } |
357 | 356 | ||
358 | for(j = 0; j < sizeof(SCRIPT)/sizeof(SCRIPT[0]); j++) { | 357 | for (j = 0; j < ARRAY_SIZE(SCRIPT); j++) |
359 | script[j] = bS_to_host(SCRIPT[j]); | 358 | script[j] = bS_to_host(SCRIPT[j]); |
360 | } | ||
361 | 359 | ||
362 | /* adjust all labels to be bus physical */ | 360 | /* adjust all labels to be bus physical */ |
363 | for(j = 0; j < PATCHES; j++) { | 361 | for (j = 0; j < PATCHES; j++) |
364 | script[LABELPATCHES[j]] = bS_to_host(pScript + SCRIPT[LABELPATCHES[j]]); | 362 | script[LABELPATCHES[j]] = bS_to_host(pScript + SCRIPT[LABELPATCHES[j]]); |
365 | } | ||
366 | /* now patch up fixed addresses. */ | 363 | /* now patch up fixed addresses. */ |
367 | script_patch_32(script, MessageLocation, | 364 | script_patch_32(script, MessageLocation, |
368 | pScript + MSGOUT_OFFSET); | 365 | pScript + MSGOUT_OFFSET); |
@@ -385,17 +382,17 @@ NCR_700_detect(struct scsi_host_template *tpnt, | |||
385 | host->hostdata[0] = (unsigned long)hostdata; | 382 | host->hostdata[0] = (unsigned long)hostdata; |
386 | /* kick the chip */ | 383 | /* kick the chip */ |
387 | NCR_700_writeb(0xff, host, CTEST9_REG); | 384 | NCR_700_writeb(0xff, host, CTEST9_REG); |
388 | if(hostdata->chip710) | 385 | if (hostdata->chip710) |
389 | hostdata->rev = (NCR_700_readb(host, CTEST8_REG)>>4) & 0x0f; | 386 | hostdata->rev = (NCR_700_readb(host, CTEST8_REG)>>4) & 0x0f; |
390 | else | 387 | else |
391 | hostdata->rev = (NCR_700_readb(host, CTEST7_REG)>>4) & 0x0f; | 388 | hostdata->rev = (NCR_700_readb(host, CTEST7_REG)>>4) & 0x0f; |
392 | hostdata->fast = (NCR_700_readb(host, CTEST9_REG) == 0); | 389 | hostdata->fast = (NCR_700_readb(host, CTEST9_REG) == 0); |
393 | if(banner == 0) { | 390 | if (banner == 0) { |
394 | printk(KERN_NOTICE "53c700: Version " NCR_700_VERSION " By James.Bottomley@HansenPartnership.com\n"); | 391 | printk(KERN_NOTICE "53c700: Version " NCR_700_VERSION " By James.Bottomley@HansenPartnership.com\n"); |
395 | banner = 1; | 392 | banner = 1; |
396 | } | 393 | } |
397 | printk(KERN_NOTICE "scsi%d: %s rev %d %s\n", host->host_no, | 394 | printk(KERN_NOTICE "scsi%d: %s rev %d %s\n", host->host_no, |
398 | hostdata->chip710 ? "53c710" : | 395 | hostdata->chip710 ? "53c710" : |
399 | (hostdata->fast ? "53c700-66" : "53c700"), | 396 | (hostdata->fast ? "53c700-66" : "53c700"), |
400 | hostdata->rev, hostdata->differential ? | 397 | hostdata->rev, hostdata->differential ? |
401 | "(Differential)" : ""); | 398 | "(Differential)" : ""); |
diff --git a/drivers/scsi/53c7xx.c b/drivers/scsi/53c7xx.c index cfc991271cc8..765769a629e4 100644 --- a/drivers/scsi/53c7xx.c +++ b/drivers/scsi/53c7xx.c | |||
@@ -361,7 +361,7 @@ int CmdPageStart = (0 - Ent_dsa_zero - sizeof(struct NCR53c7x0_cmd)) & 0xff; | |||
361 | static char *setup_strings[] = | 361 | static char *setup_strings[] = |
362 | {"","","","","","","",""}; | 362 | {"","","","","","","",""}; |
363 | 363 | ||
364 | #define MAX_SETUP_STRINGS (sizeof(setup_strings) / sizeof(char *)) | 364 | #define MAX_SETUP_STRINGS ARRAY_SIZE(setup_strings) |
365 | #define SETUP_BUFFER_SIZE 200 | 365 | #define SETUP_BUFFER_SIZE 200 |
366 | static char setup_buffer[SETUP_BUFFER_SIZE]; | 366 | static char setup_buffer[SETUP_BUFFER_SIZE]; |
367 | static char setup_used[MAX_SETUP_STRINGS]; | 367 | static char setup_used[MAX_SETUP_STRINGS]; |
@@ -2190,15 +2190,15 @@ static const struct { | |||
2190 | */ | 2190 | */ |
2191 | 2191 | ||
2192 | 2192 | ||
2193 | static void | 2193 | static void |
2194 | synchronous (struct Scsi_Host *host, int target, char *msg) { | 2194 | synchronous (struct Scsi_Host *host, int target, char *msg) { |
2195 | struct NCR53c7x0_hostdata *hostdata = (struct NCR53c7x0_hostdata *) | 2195 | struct NCR53c7x0_hostdata *hostdata = (struct NCR53c7x0_hostdata *) |
2196 | host->hostdata[0]; | 2196 | host->hostdata[0]; |
2197 | int desire, divisor, i, limit; | 2197 | int desire, divisor, i, limit; |
2198 | unsigned char scntl3, sxfer; | 2198 | unsigned char scntl3, sxfer; |
2199 | /* The diagnostic message fits on one line, even with max. width integers */ | 2199 | /* The diagnostic message fits on one line, even with max. width integers */ |
2200 | char buf[80]; | 2200 | char buf[80]; |
2201 | 2201 | ||
2202 | /* Desired transfer clock in Hz */ | 2202 | /* Desired transfer clock in Hz */ |
2203 | desire = 1000000000L / (msg[3] * 4); | 2203 | desire = 1000000000L / (msg[3] * 4); |
2204 | /* Scale the available SCSI clock by 10 so we get tenths */ | 2204 | /* Scale the available SCSI clock by 10 so we get tenths */ |
@@ -2209,14 +2209,14 @@ synchronous (struct Scsi_Host *host, int target, char *msg) { | |||
2209 | msg[4] = 8; | 2209 | msg[4] = 8; |
2210 | 2210 | ||
2211 | if (hostdata->options & OPTION_DEBUG_SDTR) | 2211 | if (hostdata->options & OPTION_DEBUG_SDTR) |
2212 | printk("scsi%d : optimal synchronous divisor of %d.%01d\n", | 2212 | printk("scsi%d : optimal synchronous divisor of %d.%01d\n", |
2213 | host->host_no, divisor / 10, divisor % 10); | 2213 | host->host_no, divisor / 10, divisor % 10); |
2214 | 2214 | ||
2215 | limit = (sizeof(syncs) / sizeof(syncs[0]) -1); | 2215 | limit = ARRAY_SIZE(syncs) - 1; |
2216 | for (i = 0; (i < limit) && (divisor > syncs[i].div); ++i); | 2216 | for (i = 0; (i < limit) && (divisor > syncs[i].div); ++i); |
2217 | 2217 | ||
2218 | if (hostdata->options & OPTION_DEBUG_SDTR) | 2218 | if (hostdata->options & OPTION_DEBUG_SDTR) |
2219 | printk("scsi%d : selected synchronous divisor of %d.%01d\n", | 2219 | printk("scsi%d : selected synchronous divisor of %d.%01d\n", |
2220 | host->host_no, syncs[i].div / 10, syncs[i].div % 10); | 2220 | host->host_no, syncs[i].div / 10, syncs[i].div % 10); |
2221 | 2221 | ||
2222 | msg[3] = ((1000000000L / hostdata->scsi_clock) * syncs[i].div / 10 / 4); | 2222 | msg[3] = ((1000000000L / hostdata->scsi_clock) * syncs[i].div / 10 / 4); |
diff --git a/drivers/scsi/NCR53c406a.c b/drivers/scsi/NCR53c406a.c index ae37d3ab9c4a..8472c5359023 100644 --- a/drivers/scsi/NCR53c406a.c +++ b/drivers/scsi/NCR53c406a.c | |||
@@ -213,16 +213,16 @@ static void *addresses[] = { | |||
213 | (void *) 0xd8000, | 213 | (void *) 0xd8000, |
214 | (void *) 0xc8000 | 214 | (void *) 0xc8000 |
215 | }; | 215 | }; |
216 | #define ADDRESS_COUNT (sizeof( addresses ) / sizeof( unsigned )) | 216 | #define ADDRESS_COUNT ARRAY_SIZE(addresses) |
217 | #endif /* USE_BIOS */ | 217 | #endif /* USE_BIOS */ |
218 | 218 | ||
219 | /* possible i/o port addresses */ | 219 | /* possible i/o port addresses */ |
220 | static unsigned short ports[] = { 0x230, 0x330, 0x280, 0x290, 0x330, 0x340, 0x300, 0x310, 0x348, 0x350 }; | 220 | static unsigned short ports[] = { 0x230, 0x330, 0x280, 0x290, 0x330, 0x340, 0x300, 0x310, 0x348, 0x350 }; |
221 | #define PORT_COUNT (sizeof( ports ) / sizeof( unsigned short )) | 221 | #define PORT_COUNT ARRAY_SIZE(ports) |
222 | 222 | ||
223 | /* possible interrupt channels */ | 223 | /* possible interrupt channels */ |
224 | static unsigned short intrs[] = { 10, 11, 12, 15 }; | 224 | static unsigned short intrs[] = { 10, 11, 12, 15 }; |
225 | #define INTR_COUNT (sizeof( intrs ) / sizeof( unsigned short )) | 225 | #define INTR_COUNT ARRAY_SIZE(intrs) |
226 | 226 | ||
227 | /* signatures for NCR 53c406a based controllers */ | 227 | /* signatures for NCR 53c406a based controllers */ |
228 | #if USE_BIOS | 228 | #if USE_BIOS |
@@ -236,7 +236,7 @@ struct signature { | |||
236 | { | 236 | { |
237 | "Copyright (C) Acculogic, Inc.\r\n2.8M Diskette Extension Bios ver 4.04.03 03/01/1993", 61, 82},}; | 237 | "Copyright (C) Acculogic, Inc.\r\n2.8M Diskette Extension Bios ver 4.04.03 03/01/1993", 61, 82},}; |
238 | 238 | ||
239 | #define SIGNATURE_COUNT (sizeof( signatures ) / sizeof( struct signature )) | 239 | #define SIGNATURE_COUNT ARRAY_SIZE(signatures) |
240 | #endif /* USE_BIOS */ | 240 | #endif /* USE_BIOS */ |
241 | 241 | ||
242 | /* ============================================================ */ | 242 | /* ============================================================ */ |
diff --git a/drivers/scsi/aacraid/aachba.c b/drivers/scsi/aacraid/aachba.c index e4b38f896cbd..ea9e038813eb 100644 --- a/drivers/scsi/aacraid/aachba.c +++ b/drivers/scsi/aacraid/aachba.c | |||
@@ -641,13 +641,13 @@ static void setinqstr(struct aac_dev *dev, void *data, int tindex) | |||
641 | cp[sizeof(str->pid)] = c; | 641 | cp[sizeof(str->pid)] = c; |
642 | } else { | 642 | } else { |
643 | struct aac_driver_ident *mp = aac_get_driver_ident(dev->cardtype); | 643 | struct aac_driver_ident *mp = aac_get_driver_ident(dev->cardtype); |
644 | 644 | ||
645 | inqstrcpy (mp->vname, str->vid); | 645 | inqstrcpy (mp->vname, str->vid); |
646 | /* last six chars reserved for vol type */ | 646 | /* last six chars reserved for vol type */ |
647 | inqstrcpy (mp->model, str->pid); | 647 | inqstrcpy (mp->model, str->pid); |
648 | } | 648 | } |
649 | 649 | ||
650 | if (tindex < (sizeof(container_types)/sizeof(char *))){ | 650 | if (tindex < ARRAY_SIZE(container_types)){ |
651 | char *findit = str->pid; | 651 | char *findit = str->pid; |
652 | 652 | ||
653 | for ( ; *findit != ' '; findit++); /* walk till we find a space */ | 653 | for ( ; *findit != ' '; findit++); /* walk till we find a space */ |
@@ -1576,7 +1576,7 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd) | |||
1576 | * see: <vendor>.c i.e. aac.c | 1576 | * see: <vendor>.c i.e. aac.c |
1577 | */ | 1577 | */ |
1578 | if (scmd_id(scsicmd) == host->this_id) { | 1578 | if (scmd_id(scsicmd) == host->this_id) { |
1579 | setinqstr(dev, (void *) (inq_data.inqd_vid), (sizeof(container_types)/sizeof(char *))); | 1579 | setinqstr(dev, (void *) (inq_data.inqd_vid), ARRAY_SIZE(container_types)); |
1580 | inq_data.inqd_pdt = INQD_PDT_PROC; /* Processor device */ | 1580 | inq_data.inqd_pdt = INQD_PDT_PROC; /* Processor device */ |
1581 | aac_internal_transfer(scsicmd, &inq_data, 0, sizeof(inq_data)); | 1581 | aac_internal_transfer(scsicmd, &inq_data, 0, sizeof(inq_data)); |
1582 | scsicmd->result = DID_OK << 16 | COMMAND_COMPLETE << 8 | SAM_STAT_GOOD; | 1582 | scsicmd->result = DID_OK << 16 | COMMAND_COMPLETE << 8 | SAM_STAT_GOOD; |
@@ -2381,7 +2381,7 @@ static struct aac_srb_status_info srb_status_info[] = { | |||
2381 | { SRB_STATUS_SUCCESS, "Success"}, | 2381 | { SRB_STATUS_SUCCESS, "Success"}, |
2382 | { SRB_STATUS_ABORTED, "Aborted Command"}, | 2382 | { SRB_STATUS_ABORTED, "Aborted Command"}, |
2383 | { SRB_STATUS_ABORT_FAILED, "Abort Failed"}, | 2383 | { SRB_STATUS_ABORT_FAILED, "Abort Failed"}, |
2384 | { SRB_STATUS_ERROR, "Error Event"}, | 2384 | { SRB_STATUS_ERROR, "Error Event"}, |
2385 | { SRB_STATUS_BUSY, "Device Busy"}, | 2385 | { SRB_STATUS_BUSY, "Device Busy"}, |
2386 | { SRB_STATUS_INVALID_REQUEST, "Invalid Request"}, | 2386 | { SRB_STATUS_INVALID_REQUEST, "Invalid Request"}, |
2387 | { SRB_STATUS_INVALID_PATH_ID, "Invalid Path ID"}, | 2387 | { SRB_STATUS_INVALID_PATH_ID, "Invalid Path ID"}, |
@@ -2400,7 +2400,7 @@ static struct aac_srb_status_info srb_status_info[] = { | |||
2400 | { SRB_STATUS_BAD_SRB_BLOCK_LENGTH,"Bad Srb Block Length"}, | 2400 | { SRB_STATUS_BAD_SRB_BLOCK_LENGTH,"Bad Srb Block Length"}, |
2401 | { SRB_STATUS_REQUEST_FLUSHED, "Request Flushed"}, | 2401 | { SRB_STATUS_REQUEST_FLUSHED, "Request Flushed"}, |
2402 | { SRB_STATUS_DELAYED_RETRY, "Delayed Retry"}, | 2402 | { SRB_STATUS_DELAYED_RETRY, "Delayed Retry"}, |
2403 | { SRB_STATUS_INVALID_LUN, "Invalid LUN"}, | 2403 | { SRB_STATUS_INVALID_LUN, "Invalid LUN"}, |
2404 | { SRB_STATUS_INVALID_TARGET_ID, "Invalid TARGET ID"}, | 2404 | { SRB_STATUS_INVALID_TARGET_ID, "Invalid TARGET ID"}, |
2405 | { SRB_STATUS_BAD_FUNCTION, "Bad Function"}, | 2405 | { SRB_STATUS_BAD_FUNCTION, "Bad Function"}, |
2406 | { SRB_STATUS_ERROR_RECOVERY, "Error Recovery"}, | 2406 | { SRB_STATUS_ERROR_RECOVERY, "Error Recovery"}, |
@@ -2415,11 +2415,9 @@ char *aac_get_status_string(u32 status) | |||
2415 | { | 2415 | { |
2416 | int i; | 2416 | int i; |
2417 | 2417 | ||
2418 | for(i=0; i < (sizeof(srb_status_info)/sizeof(struct aac_srb_status_info)); i++ ){ | 2418 | for (i = 0; i < ARRAY_SIZE(srb_status_info); i++) |
2419 | if(srb_status_info[i].status == status){ | 2419 | if (srb_status_info[i].status == status) |
2420 | return srb_status_info[i].str; | 2420 | return srb_status_info[i].str; |
2421 | } | ||
2422 | } | ||
2423 | 2421 | ||
2424 | return "Bad Status Code"; | 2422 | return "Bad Status Code"; |
2425 | } | 2423 | } |
diff --git a/drivers/scsi/aacraid/commctrl.c b/drivers/scsi/aacraid/commctrl.c index 9f75144e5247..255421de9d1a 100644 --- a/drivers/scsi/aacraid/commctrl.c +++ b/drivers/scsi/aacraid/commctrl.c | |||
@@ -535,7 +535,7 @@ static int aac_send_raw_srb(struct aac_dev* dev, void __user * arg) | |||
535 | default: | 535 | default: |
536 | data_dir = DMA_NONE; | 536 | data_dir = DMA_NONE; |
537 | } | 537 | } |
538 | if (user_srbcmd->sg.count > (sizeof(sg_list)/sizeof(sg_list[0]))) { | 538 | if (user_srbcmd->sg.count > ARRAY_SIZE(sg_list)) { |
539 | dprintk((KERN_DEBUG"aacraid: too many sg entries %d\n", | 539 | dprintk((KERN_DEBUG"aacraid: too many sg entries %d\n", |
540 | le32_to_cpu(srbcmd->sg.count))); | 540 | le32_to_cpu(srbcmd->sg.count))); |
541 | rcode = -EINVAL; | 541 | rcode = -EINVAL; |
diff --git a/drivers/scsi/aha1542.c b/drivers/scsi/aha1542.c index 51bad7a1e773..86c6bd234591 100644 --- a/drivers/scsi/aha1542.c +++ b/drivers/scsi/aha1542.c | |||
@@ -1011,7 +1011,7 @@ static int __init do_setup(char *str) | |||
1011 | 1011 | ||
1012 | int count=setup_idx; | 1012 | int count=setup_idx; |
1013 | 1013 | ||
1014 | get_options(str, sizeof(ints)/sizeof(int), ints); | 1014 | get_options(str, ARRAY_SIZE(ints), ints); |
1015 | aha1542_setup(str,ints); | 1015 | aha1542_setup(str,ints); |
1016 | 1016 | ||
1017 | return count<setup_idx; | 1017 | return count<setup_idx; |
@@ -1072,8 +1072,7 @@ static int __init aha1542_detect(struct scsi_host_template * tpnt) | |||
1072 | int slot = 0; | 1072 | int slot = 0; |
1073 | int pos = 0; | 1073 | int pos = 0; |
1074 | 1074 | ||
1075 | for (indx = 0; (slot != MCA_NOTFOUND) && | 1075 | for (indx = 0; (slot != MCA_NOTFOUND) && (indx < ARRAY_SIZE(bases)); indx++) { |
1076 | (indx < sizeof(bases)/sizeof(bases[0])); indx++) { | ||
1077 | 1076 | ||
1078 | if (bases[indx]) | 1077 | if (bases[indx]) |
1079 | continue; | 1078 | continue; |
@@ -1083,10 +1082,9 @@ static int __init aha1542_detect(struct scsi_host_template * tpnt) | |||
1083 | if (slot == MCA_NOTFOUND) | 1082 | if (slot == MCA_NOTFOUND) |
1084 | break; | 1083 | break; |
1085 | 1084 | ||
1086 | |||
1087 | /* Found one */ | 1085 | /* Found one */ |
1088 | pos = mca_read_stored_pos(slot, 3); | 1086 | pos = mca_read_stored_pos(slot, 3); |
1089 | 1087 | ||
1090 | /* Decode address */ | 1088 | /* Decode address */ |
1091 | if (pos & 0x80) { | 1089 | if (pos & 0x80) { |
1092 | if (pos & 0x02) { | 1090 | if (pos & 0x02) { |
@@ -1118,23 +1116,22 @@ static int __init aha1542_detect(struct scsi_host_template * tpnt) | |||
1118 | mca_set_adapter_name(slot, "Adapter AHA-1640"); | 1116 | mca_set_adapter_name(slot, "Adapter AHA-1640"); |
1119 | mca_set_adapter_procfn(slot, NULL, NULL); | 1117 | mca_set_adapter_procfn(slot, NULL, NULL); |
1120 | mca_mark_as_used(slot); | 1118 | mca_mark_as_used(slot); |
1121 | 1119 | ||
1122 | /* Go on */ | 1120 | /* Go on */ |
1123 | slot++; | 1121 | slot++; |
1124 | } | 1122 | } |
1125 | 1123 | ||
1126 | } | 1124 | } |
1127 | #endif | 1125 | #endif |
1128 | 1126 | ||
1129 | /* | 1127 | /* |
1130 | * Hunt for ISA Plug'n'Pray Adaptecs (AHA1535) | 1128 | * Hunt for ISA Plug'n'Pray Adaptecs (AHA1535) |
1131 | */ | 1129 | */ |
1132 | 1130 | ||
1133 | if(isapnp) | 1131 | if(isapnp) |
1134 | { | 1132 | { |
1135 | struct pnp_dev *pdev = NULL; | 1133 | struct pnp_dev *pdev = NULL; |
1136 | for(indx = 0; indx <sizeof(bases)/sizeof(bases[0]);indx++) | 1134 | for(indx = 0; indx < ARRAY_SIZE(bases); indx++) { |
1137 | { | ||
1138 | if(bases[indx]) | 1135 | if(bases[indx]) |
1139 | continue; | 1136 | continue; |
1140 | pdev = pnp_find_dev(NULL, ISAPNP_VENDOR('A', 'D', 'P'), | 1137 | pdev = pnp_find_dev(NULL, ISAPNP_VENDOR('A', 'D', 'P'), |
@@ -1144,29 +1141,29 @@ static int __init aha1542_detect(struct scsi_host_template * tpnt) | |||
1144 | /* | 1141 | /* |
1145 | * Activate the PnP card | 1142 | * Activate the PnP card |
1146 | */ | 1143 | */ |
1147 | 1144 | ||
1148 | if(pnp_device_attach(pdev)<0) | 1145 | if(pnp_device_attach(pdev)<0) |
1149 | continue; | 1146 | continue; |
1150 | 1147 | ||
1151 | if(pnp_activate_dev(pdev)<0) { | 1148 | if(pnp_activate_dev(pdev)<0) { |
1152 | pnp_device_detach(pdev); | 1149 | pnp_device_detach(pdev); |
1153 | continue; | 1150 | continue; |
1154 | } | 1151 | } |
1155 | 1152 | ||
1156 | if(!pnp_port_valid(pdev, 0)) { | 1153 | if(!pnp_port_valid(pdev, 0)) { |
1157 | pnp_device_detach(pdev); | 1154 | pnp_device_detach(pdev); |
1158 | continue; | 1155 | continue; |
1159 | } | 1156 | } |
1160 | 1157 | ||
1161 | bases[indx] = pnp_port_start(pdev, 0); | 1158 | bases[indx] = pnp_port_start(pdev, 0); |
1162 | 1159 | ||
1163 | /* The card can be queried for its DMA, we have | 1160 | /* The card can be queried for its DMA, we have |
1164 | the DMA set up that is enough */ | 1161 | the DMA set up that is enough */ |
1165 | 1162 | ||
1166 | printk(KERN_INFO "ISAPnP found an AHA1535 at I/O 0x%03X\n", bases[indx]); | 1163 | printk(KERN_INFO "ISAPnP found an AHA1535 at I/O 0x%03X\n", bases[indx]); |
1167 | } | 1164 | } |
1168 | } | 1165 | } |
1169 | for (indx = 0; indx < sizeof(bases) / sizeof(bases[0]); indx++) | 1166 | for (indx = 0; indx < ARRAY_SIZE(bases); indx++) |
1170 | if (bases[indx] != 0 && request_region(bases[indx], 4, "aha1542")) { | 1167 | if (bases[indx] != 0 && request_region(bases[indx], 4, "aha1542")) { |
1171 | shpnt = scsi_register(tpnt, | 1168 | shpnt = scsi_register(tpnt, |
1172 | sizeof(struct aha1542_hostdata)); | 1169 | sizeof(struct aha1542_hostdata)); |
diff --git a/drivers/scsi/aic7xxx/aic7770.c b/drivers/scsi/aic7xxx/aic7770.c index 527efd36f5c1..c4d17231c828 100644 --- a/drivers/scsi/aic7xxx/aic7770.c +++ b/drivers/scsi/aic7xxx/aic7770.c | |||
@@ -107,7 +107,7 @@ struct aic7770_identity aic7770_ident_table[] = | |||
107 | ahc_aic7770_EISA_setup | 107 | ahc_aic7770_EISA_setup |
108 | } | 108 | } |
109 | }; | 109 | }; |
110 | const int ahc_num_aic7770_devs = NUM_ELEMENTS(aic7770_ident_table); | 110 | const int ahc_num_aic7770_devs = ARRAY_SIZE(aic7770_ident_table); |
111 | 111 | ||
112 | struct aic7770_identity * | 112 | struct aic7770_identity * |
113 | aic7770_find_device(uint32_t id) | 113 | aic7770_find_device(uint32_t id) |
diff --git a/drivers/scsi/aic7xxx/aic79xx.h b/drivers/scsi/aic7xxx/aic79xx.h index bb5166da4358..eb7745692682 100644 --- a/drivers/scsi/aic7xxx/aic79xx.h +++ b/drivers/scsi/aic7xxx/aic79xx.h | |||
@@ -68,8 +68,6 @@ struct scb_platform_data; | |||
68 | #define FALSE 0 | 68 | #define FALSE 0 |
69 | #endif | 69 | #endif |
70 | 70 | ||
71 | #define NUM_ELEMENTS(array) (sizeof(array) / sizeof(*array)) | ||
72 | |||
73 | #define ALL_CHANNELS '\0' | 71 | #define ALL_CHANNELS '\0' |
74 | #define ALL_TARGETS_MASK 0xFFFF | 72 | #define ALL_TARGETS_MASK 0xFFFF |
75 | #define INITIATOR_WILDCARD (~0) | 73 | #define INITIATOR_WILDCARD (~0) |
diff --git a/drivers/scsi/aic7xxx/aic79xx_core.c b/drivers/scsi/aic7xxx/aic79xx_core.c index e14244aa69d7..801fc81d0b20 100644 --- a/drivers/scsi/aic7xxx/aic79xx_core.c +++ b/drivers/scsi/aic7xxx/aic79xx_core.c | |||
@@ -59,7 +59,7 @@ char *ahd_chip_names[] = | |||
59 | "aic7902", | 59 | "aic7902", |
60 | "aic7901A" | 60 | "aic7901A" |
61 | }; | 61 | }; |
62 | static const u_int num_chip_names = NUM_ELEMENTS(ahd_chip_names); | 62 | static const u_int num_chip_names = ARRAY_SIZE(ahd_chip_names); |
63 | 63 | ||
64 | /* | 64 | /* |
65 | * Hardware error codes. | 65 | * Hardware error codes. |
@@ -77,7 +77,7 @@ static struct ahd_hard_error_entry ahd_hard_errors[] = { | |||
77 | { MPARERR, "Scratch or SCB Memory Parity Error" }, | 77 | { MPARERR, "Scratch or SCB Memory Parity Error" }, |
78 | { CIOPARERR, "CIOBUS Parity Error" }, | 78 | { CIOPARERR, "CIOBUS Parity Error" }, |
79 | }; | 79 | }; |
80 | static const u_int num_errors = NUM_ELEMENTS(ahd_hard_errors); | 80 | static const u_int num_errors = ARRAY_SIZE(ahd_hard_errors); |
81 | 81 | ||
82 | static struct ahd_phase_table_entry ahd_phase_table[] = | 82 | static struct ahd_phase_table_entry ahd_phase_table[] = |
83 | { | 83 | { |
@@ -97,7 +97,7 @@ static struct ahd_phase_table_entry ahd_phase_table[] = | |||
97 | * In most cases we only wish to itterate over real phases, so | 97 | * In most cases we only wish to itterate over real phases, so |
98 | * exclude the last element from the count. | 98 | * exclude the last element from the count. |
99 | */ | 99 | */ |
100 | static const u_int num_phases = NUM_ELEMENTS(ahd_phase_table) - 1; | 100 | static const u_int num_phases = ARRAY_SIZE(ahd_phase_table) - 1; |
101 | 101 | ||
102 | /* Our Sequencer Program */ | 102 | /* Our Sequencer Program */ |
103 | #include "aic79xx_seq.h" | 103 | #include "aic79xx_seq.h" |
@@ -7259,7 +7259,7 @@ ahd_qinfifo_count(struct ahd_softc *ahd) | |||
7259 | return (wrap_qinfifonext - wrap_qinpos); | 7259 | return (wrap_qinfifonext - wrap_qinpos); |
7260 | else | 7260 | else |
7261 | return (wrap_qinfifonext | 7261 | return (wrap_qinfifonext |
7262 | + NUM_ELEMENTS(ahd->qinfifo) - wrap_qinpos); | 7262 | + ARRAY_SIZE(ahd->qinfifo) - wrap_qinpos); |
7263 | } | 7263 | } |
7264 | 7264 | ||
7265 | void | 7265 | void |
@@ -8619,7 +8619,7 @@ ahd_check_patch(struct ahd_softc *ahd, struct patch **start_patch, | |||
8619 | struct patch *last_patch; | 8619 | struct patch *last_patch; |
8620 | u_int num_patches; | 8620 | u_int num_patches; |
8621 | 8621 | ||
8622 | num_patches = sizeof(patches)/sizeof(struct patch); | 8622 | num_patches = ARRAY_SIZE(patches); |
8623 | last_patch = &patches[num_patches]; | 8623 | last_patch = &patches[num_patches]; |
8624 | cur_patch = *start_patch; | 8624 | cur_patch = *start_patch; |
8625 | 8625 | ||
diff --git a/drivers/scsi/aic7xxx/aic79xx_osm.c b/drivers/scsi/aic7xxx/aic79xx_osm.c index 66e4a47bb9ee..e0ccdf362200 100644 --- a/drivers/scsi/aic7xxx/aic79xx_osm.c +++ b/drivers/scsi/aic7xxx/aic79xx_osm.c | |||
@@ -916,7 +916,7 @@ ahd_linux_setup_iocell_info(u_long index, int instance, int targ, int32_t value) | |||
916 | { | 916 | { |
917 | 917 | ||
918 | if ((instance >= 0) | 918 | if ((instance >= 0) |
919 | && (instance < NUM_ELEMENTS(aic79xx_iocell_info))) { | 919 | && (instance < ARRAY_SIZE(aic79xx_iocell_info))) { |
920 | uint8_t *iocell_info; | 920 | uint8_t *iocell_info; |
921 | 921 | ||
922 | iocell_info = (uint8_t*)&aic79xx_iocell_info[instance]; | 922 | iocell_info = (uint8_t*)&aic79xx_iocell_info[instance]; |
@@ -934,7 +934,7 @@ ahd_linux_setup_tag_info_global(char *p) | |||
934 | tags = simple_strtoul(p + 1, NULL, 0) & 0xff; | 934 | tags = simple_strtoul(p + 1, NULL, 0) & 0xff; |
935 | printf("Setting Global Tags= %d\n", tags); | 935 | printf("Setting Global Tags= %d\n", tags); |
936 | 936 | ||
937 | for (i = 0; i < NUM_ELEMENTS(aic79xx_tag_info); i++) { | 937 | for (i = 0; i < ARRAY_SIZE(aic79xx_tag_info); i++) { |
938 | for (j = 0; j < AHD_NUM_TARGETS; j++) { | 938 | for (j = 0; j < AHD_NUM_TARGETS; j++) { |
939 | aic79xx_tag_info[i].tag_commands[j] = tags; | 939 | aic79xx_tag_info[i].tag_commands[j] = tags; |
940 | } | 940 | } |
@@ -946,7 +946,7 @@ ahd_linux_setup_tag_info(u_long arg, int instance, int targ, int32_t value) | |||
946 | { | 946 | { |
947 | 947 | ||
948 | if ((instance >= 0) && (targ >= 0) | 948 | if ((instance >= 0) && (targ >= 0) |
949 | && (instance < NUM_ELEMENTS(aic79xx_tag_info)) | 949 | && (instance < ARRAY_SIZE(aic79xx_tag_info)) |
950 | && (targ < AHD_NUM_TARGETS)) { | 950 | && (targ < AHD_NUM_TARGETS)) { |
951 | aic79xx_tag_info[instance].tag_commands[targ] = value & 0x1FF; | 951 | aic79xx_tag_info[instance].tag_commands[targ] = value & 0x1FF; |
952 | if (bootverbose) | 952 | if (bootverbose) |
@@ -1072,21 +1072,21 @@ aic79xx_setup(char *s) | |||
1072 | end = strchr(s, '\0'); | 1072 | end = strchr(s, '\0'); |
1073 | 1073 | ||
1074 | /* | 1074 | /* |
1075 | * XXX ia64 gcc isn't smart enough to know that NUM_ELEMENTS | 1075 | * XXX ia64 gcc isn't smart enough to know that ARRAY_SIZE |
1076 | * will never be 0 in this case. | 1076 | * will never be 0 in this case. |
1077 | */ | 1077 | */ |
1078 | n = 0; | 1078 | n = 0; |
1079 | 1079 | ||
1080 | while ((p = strsep(&s, ",.")) != NULL) { | 1080 | while ((p = strsep(&s, ",.")) != NULL) { |
1081 | if (*p == '\0') | 1081 | if (*p == '\0') |
1082 | continue; | 1082 | continue; |
1083 | for (i = 0; i < NUM_ELEMENTS(options); i++) { | 1083 | for (i = 0; i < ARRAY_SIZE(options); i++) { |
1084 | 1084 | ||
1085 | n = strlen(options[i].name); | 1085 | n = strlen(options[i].name); |
1086 | if (strncmp(options[i].name, p, n) == 0) | 1086 | if (strncmp(options[i].name, p, n) == 0) |
1087 | break; | 1087 | break; |
1088 | } | 1088 | } |
1089 | if (i == NUM_ELEMENTS(options)) | 1089 | if (i == ARRAY_SIZE(options)) |
1090 | continue; | 1090 | continue; |
1091 | 1091 | ||
1092 | if (strncmp(p, "global_tag_depth", n) == 0) { | 1092 | if (strncmp(p, "global_tag_depth", n) == 0) { |
@@ -1294,7 +1294,7 @@ ahd_platform_init(struct ahd_softc *ahd) | |||
1294 | /* | 1294 | /* |
1295 | * Lookup and commit any modified IO Cell options. | 1295 | * Lookup and commit any modified IO Cell options. |
1296 | */ | 1296 | */ |
1297 | if (ahd->unit < NUM_ELEMENTS(aic79xx_iocell_info)) { | 1297 | if (ahd->unit < ARRAY_SIZE(aic79xx_iocell_info)) { |
1298 | struct ahd_linux_iocell_opts *iocell_opts; | 1298 | struct ahd_linux_iocell_opts *iocell_opts; |
1299 | 1299 | ||
1300 | iocell_opts = &aic79xx_iocell_info[ahd->unit]; | 1300 | iocell_opts = &aic79xx_iocell_info[ahd->unit]; |
@@ -1426,7 +1426,7 @@ ahd_linux_user_tagdepth(struct ahd_softc *ahd, struct ahd_devinfo *devinfo) | |||
1426 | 1426 | ||
1427 | tags = 0; | 1427 | tags = 0; |
1428 | if ((ahd->user_discenable & devinfo->target_mask) != 0) { | 1428 | if ((ahd->user_discenable & devinfo->target_mask) != 0) { |
1429 | if (ahd->unit >= NUM_ELEMENTS(aic79xx_tag_info)) { | 1429 | if (ahd->unit >= ARRAY_SIZE(aic79xx_tag_info)) { |
1430 | 1430 | ||
1431 | if (warned_user == 0) { | 1431 | if (warned_user == 0) { |
1432 | printf(KERN_WARNING | 1432 | printf(KERN_WARNING |
diff --git a/drivers/scsi/aic7xxx/aic79xx_pci.c b/drivers/scsi/aic7xxx/aic79xx_pci.c index 757242e522c2..14850f31aafa 100644 --- a/drivers/scsi/aic7xxx/aic79xx_pci.c +++ b/drivers/scsi/aic7xxx/aic79xx_pci.c | |||
@@ -201,7 +201,7 @@ struct ahd_pci_identity ahd_pci_ident_table [] = | |||
201 | } | 201 | } |
202 | }; | 202 | }; |
203 | 203 | ||
204 | const u_int ahd_num_pci_devs = NUM_ELEMENTS(ahd_pci_ident_table); | 204 | const u_int ahd_num_pci_devs = ARRAY_SIZE(ahd_pci_ident_table); |
205 | 205 | ||
206 | #define DEVCONFIG 0x40 | 206 | #define DEVCONFIG 0x40 |
207 | #define PCIXINITPAT 0x0000E000ul | 207 | #define PCIXINITPAT 0x0000E000ul |
diff --git a/drivers/scsi/aic7xxx/aic79xx_proc.c b/drivers/scsi/aic7xxx/aic79xx_proc.c index 39a27840fce6..24fd59a230bf 100644 --- a/drivers/scsi/aic7xxx/aic79xx_proc.c +++ b/drivers/scsi/aic7xxx/aic79xx_proc.c | |||
@@ -76,11 +76,9 @@ static u_int | |||
76 | ahd_calc_syncsrate(u_int period_factor) | 76 | ahd_calc_syncsrate(u_int period_factor) |
77 | { | 77 | { |
78 | int i; | 78 | int i; |
79 | int num_syncrates; | ||
80 | 79 | ||
81 | num_syncrates = sizeof(scsi_syncrates) / sizeof(scsi_syncrates[0]); | ||
82 | /* See if the period is in the "exception" table */ | 80 | /* See if the period is in the "exception" table */ |
83 | for (i = 0; i < num_syncrates; i++) { | 81 | for (i = 0; i < ARRAY_SIZE(scsi_syncrates); i++) { |
84 | 82 | ||
85 | if (period_factor == scsi_syncrates[i].period_factor) { | 83 | if (period_factor == scsi_syncrates[i].period_factor) { |
86 | /* Period in kHz */ | 84 | /* Period in kHz */ |
diff --git a/drivers/scsi/aic7xxx/aic7xxx.h b/drivers/scsi/aic7xxx/aic7xxx.h index 91d294c6334e..e24e6067401b 100644 --- a/drivers/scsi/aic7xxx/aic7xxx.h +++ b/drivers/scsi/aic7xxx/aic7xxx.h | |||
@@ -69,8 +69,6 @@ struct seeprom_descriptor; | |||
69 | #define FALSE 0 | 69 | #define FALSE 0 |
70 | #endif | 70 | #endif |
71 | 71 | ||
72 | #define NUM_ELEMENTS(array) (sizeof(array) / sizeof(*array)) | ||
73 | |||
74 | #define ALL_CHANNELS '\0' | 72 | #define ALL_CHANNELS '\0' |
75 | #define ALL_TARGETS_MASK 0xFFFF | 73 | #define ALL_TARGETS_MASK 0xFFFF |
76 | #define INITIATOR_WILDCARD (~0) | 74 | #define INITIATOR_WILDCARD (~0) |
diff --git a/drivers/scsi/aic7xxx/aic7xxx_core.c b/drivers/scsi/aic7xxx/aic7xxx_core.c index 50a3dd047cfe..93e4e40944b6 100644 --- a/drivers/scsi/aic7xxx/aic7xxx_core.c +++ b/drivers/scsi/aic7xxx/aic7xxx_core.c | |||
@@ -68,7 +68,7 @@ char *ahc_chip_names[] = | |||
68 | "aic7892", | 68 | "aic7892", |
69 | "aic7899" | 69 | "aic7899" |
70 | }; | 70 | }; |
71 | static const u_int num_chip_names = NUM_ELEMENTS(ahc_chip_names); | 71 | static const u_int num_chip_names = ARRAY_SIZE(ahc_chip_names); |
72 | 72 | ||
73 | /* | 73 | /* |
74 | * Hardware error codes. | 74 | * Hardware error codes. |
@@ -88,7 +88,7 @@ static struct ahc_hard_error_entry ahc_hard_errors[] = { | |||
88 | { PCIERRSTAT, "PCI Error detected" }, | 88 | { PCIERRSTAT, "PCI Error detected" }, |
89 | { CIOPARERR, "CIOBUS Parity Error" }, | 89 | { CIOPARERR, "CIOBUS Parity Error" }, |
90 | }; | 90 | }; |
91 | static const u_int num_errors = NUM_ELEMENTS(ahc_hard_errors); | 91 | static const u_int num_errors = ARRAY_SIZE(ahc_hard_errors); |
92 | 92 | ||
93 | static struct ahc_phase_table_entry ahc_phase_table[] = | 93 | static struct ahc_phase_table_entry ahc_phase_table[] = |
94 | { | 94 | { |
@@ -108,7 +108,7 @@ static struct ahc_phase_table_entry ahc_phase_table[] = | |||
108 | * In most cases we only wish to itterate over real phases, so | 108 | * In most cases we only wish to itterate over real phases, so |
109 | * exclude the last element from the count. | 109 | * exclude the last element from the count. |
110 | */ | 110 | */ |
111 | static const u_int num_phases = NUM_ELEMENTS(ahc_phase_table) - 1; | 111 | static const u_int num_phases = ARRAY_SIZE(ahc_phase_table) - 1; |
112 | 112 | ||
113 | /* | 113 | /* |
114 | * Valid SCSIRATE values. (p. 3-17) | 114 | * Valid SCSIRATE values. (p. 3-17) |
@@ -6367,7 +6367,7 @@ ahc_check_patch(struct ahc_softc *ahc, struct patch **start_patch, | |||
6367 | struct patch *last_patch; | 6367 | struct patch *last_patch; |
6368 | u_int num_patches; | 6368 | u_int num_patches; |
6369 | 6369 | ||
6370 | num_patches = sizeof(patches)/sizeof(struct patch); | 6370 | num_patches = ARRAY_SIZE(patches); |
6371 | last_patch = &patches[num_patches]; | 6371 | last_patch = &patches[num_patches]; |
6372 | cur_patch = *start_patch; | 6372 | cur_patch = *start_patch; |
6373 | 6373 | ||
diff --git a/drivers/scsi/aic7xxx/aic7xxx_osm.c b/drivers/scsi/aic7xxx/aic7xxx_osm.c index 2c801672d8bb..eadfefdd8d7a 100644 --- a/drivers/scsi/aic7xxx/aic7xxx_osm.c +++ b/drivers/scsi/aic7xxx/aic7xxx_osm.c | |||
@@ -886,7 +886,7 @@ ahc_linux_setup_tag_info_global(char *p) | |||
886 | tags = simple_strtoul(p + 1, NULL, 0) & 0xff; | 886 | tags = simple_strtoul(p + 1, NULL, 0) & 0xff; |
887 | printf("Setting Global Tags= %d\n", tags); | 887 | printf("Setting Global Tags= %d\n", tags); |
888 | 888 | ||
889 | for (i = 0; i < NUM_ELEMENTS(aic7xxx_tag_info); i++) { | 889 | for (i = 0; i < ARRAY_SIZE(aic7xxx_tag_info); i++) { |
890 | for (j = 0; j < AHC_NUM_TARGETS; j++) { | 890 | for (j = 0; j < AHC_NUM_TARGETS; j++) { |
891 | aic7xxx_tag_info[i].tag_commands[j] = tags; | 891 | aic7xxx_tag_info[i].tag_commands[j] = tags; |
892 | } | 892 | } |
@@ -898,7 +898,7 @@ ahc_linux_setup_tag_info(u_long arg, int instance, int targ, int32_t value) | |||
898 | { | 898 | { |
899 | 899 | ||
900 | if ((instance >= 0) && (targ >= 0) | 900 | if ((instance >= 0) && (targ >= 0) |
901 | && (instance < NUM_ELEMENTS(aic7xxx_tag_info)) | 901 | && (instance < ARRAY_SIZE(aic7xxx_tag_info)) |
902 | && (targ < AHC_NUM_TARGETS)) { | 902 | && (targ < AHC_NUM_TARGETS)) { |
903 | aic7xxx_tag_info[instance].tag_commands[targ] = value & 0xff; | 903 | aic7xxx_tag_info[instance].tag_commands[targ] = value & 0xff; |
904 | if (bootverbose) | 904 | if (bootverbose) |
@@ -1020,7 +1020,7 @@ aic7xxx_setup(char *s) | |||
1020 | end = strchr(s, '\0'); | 1020 | end = strchr(s, '\0'); |
1021 | 1021 | ||
1022 | /* | 1022 | /* |
1023 | * XXX ia64 gcc isn't smart enough to know that NUM_ELEMENTS | 1023 | * XXX ia64 gcc isn't smart enough to know that ARRAY_SIZE |
1024 | * will never be 0 in this case. | 1024 | * will never be 0 in this case. |
1025 | */ | 1025 | */ |
1026 | n = 0; | 1026 | n = 0; |
@@ -1028,13 +1028,13 @@ aic7xxx_setup(char *s) | |||
1028 | while ((p = strsep(&s, ",.")) != NULL) { | 1028 | while ((p = strsep(&s, ",.")) != NULL) { |
1029 | if (*p == '\0') | 1029 | if (*p == '\0') |
1030 | continue; | 1030 | continue; |
1031 | for (i = 0; i < NUM_ELEMENTS(options); i++) { | 1031 | for (i = 0; i < ARRAY_SIZE(options); i++) { |
1032 | 1032 | ||
1033 | n = strlen(options[i].name); | 1033 | n = strlen(options[i].name); |
1034 | if (strncmp(options[i].name, p, n) == 0) | 1034 | if (strncmp(options[i].name, p, n) == 0) |
1035 | break; | 1035 | break; |
1036 | } | 1036 | } |
1037 | if (i == NUM_ELEMENTS(options)) | 1037 | if (i == ARRAY_SIZE(options)) |
1038 | continue; | 1038 | continue; |
1039 | 1039 | ||
1040 | if (strncmp(p, "global_tag_depth", n) == 0) { | 1040 | if (strncmp(p, "global_tag_depth", n) == 0) { |
@@ -1360,7 +1360,7 @@ ahc_linux_user_tagdepth(struct ahc_softc *ahc, struct ahc_devinfo *devinfo) | |||
1360 | 1360 | ||
1361 | tags = 0; | 1361 | tags = 0; |
1362 | if ((ahc->user_discenable & devinfo->target_mask) != 0) { | 1362 | if ((ahc->user_discenable & devinfo->target_mask) != 0) { |
1363 | if (ahc->unit >= NUM_ELEMENTS(aic7xxx_tag_info)) { | 1363 | if (ahc->unit >= ARRAY_SIZE(aic7xxx_tag_info)) { |
1364 | if (warned_user == 0) { | 1364 | if (warned_user == 0) { |
1365 | 1365 | ||
1366 | printf(KERN_WARNING | 1366 | printf(KERN_WARNING |
diff --git a/drivers/scsi/aic7xxx/aic7xxx_pci.c b/drivers/scsi/aic7xxx/aic7xxx_pci.c index 5f586140e057..b1156fbd4a1a 100644 --- a/drivers/scsi/aic7xxx/aic7xxx_pci.c +++ b/drivers/scsi/aic7xxx/aic7xxx_pci.c | |||
@@ -553,7 +553,7 @@ struct ahc_pci_identity ahc_pci_ident_table [] = | |||
553 | } | 553 | } |
554 | }; | 554 | }; |
555 | 555 | ||
556 | const u_int ahc_num_pci_devs = NUM_ELEMENTS(ahc_pci_ident_table); | 556 | const u_int ahc_num_pci_devs = ARRAY_SIZE(ahc_pci_ident_table); |
557 | 557 | ||
558 | #define AHC_394X_SLOT_CHANNEL_A 4 | 558 | #define AHC_394X_SLOT_CHANNEL_A 4 |
559 | #define AHC_394X_SLOT_CHANNEL_B 5 | 559 | #define AHC_394X_SLOT_CHANNEL_B 5 |
diff --git a/drivers/scsi/aic7xxx/aic7xxx_proc.c b/drivers/scsi/aic7xxx/aic7xxx_proc.c index 04a3506cf340..5914b4aa4a8f 100644 --- a/drivers/scsi/aic7xxx/aic7xxx_proc.c +++ b/drivers/scsi/aic7xxx/aic7xxx_proc.c | |||
@@ -77,11 +77,9 @@ static u_int | |||
77 | ahc_calc_syncsrate(u_int period_factor) | 77 | ahc_calc_syncsrate(u_int period_factor) |
78 | { | 78 | { |
79 | int i; | 79 | int i; |
80 | int num_syncrates; | ||
81 | 80 | ||
82 | num_syncrates = sizeof(scsi_syncrates) / sizeof(scsi_syncrates[0]); | ||
83 | /* See if the period is in the "exception" table */ | 81 | /* See if the period is in the "exception" table */ |
84 | for (i = 0; i < num_syncrates; i++) { | 82 | for (i = 0; i < ARRAY_SIZE(scsi_syncrates); i++) { |
85 | 83 | ||
86 | if (period_factor == scsi_syncrates[i].period_factor) { | 84 | if (period_factor == scsi_syncrates[i].period_factor) { |
87 | /* Period in kHz */ | 85 | /* Period in kHz */ |
diff --git a/drivers/scsi/aic7xxx_old.c b/drivers/scsi/aic7xxx_old.c index 770f1647e4d6..5dba1c63122e 100644 --- a/drivers/scsi/aic7xxx_old.c +++ b/drivers/scsi/aic7xxx_old.c | |||
@@ -1565,7 +1565,7 @@ aic7xxx_check_patch(struct aic7xxx_host *p, | |||
1565 | struct sequencer_patch *last_patch; | 1565 | struct sequencer_patch *last_patch; |
1566 | int num_patches; | 1566 | int num_patches; |
1567 | 1567 | ||
1568 | num_patches = sizeof(sequencer_patches)/sizeof(struct sequencer_patch); | 1568 | num_patches = ARRAY_SIZE(sequencer_patches); |
1569 | last_patch = &sequencer_patches[num_patches]; | 1569 | last_patch = &sequencer_patches[num_patches]; |
1570 | cur_patch = *start_patch; | 1570 | cur_patch = *start_patch; |
1571 | 1571 | ||
diff --git a/drivers/scsi/constants.c b/drivers/scsi/constants.c index 30a335349cee..e24835b38b54 100644 --- a/drivers/scsi/constants.c +++ b/drivers/scsi/constants.c | |||
@@ -114,8 +114,7 @@ static const struct value_name_pair maint_in_arr[] = { | |||
114 | {0xd, "Report supported task management functions"}, | 114 | {0xd, "Report supported task management functions"}, |
115 | {0xe, "Report priority"}, | 115 | {0xe, "Report priority"}, |
116 | }; | 116 | }; |
117 | #define MAINT_IN_SZ \ | 117 | #define MAINT_IN_SZ ARRAY_SIZE(maint_in_arr) |
118 | (int)(sizeof(maint_in_arr) / sizeof(maint_in_arr[0])) | ||
119 | 118 | ||
120 | static const struct value_name_pair maint_out_arr[] = { | 119 | static const struct value_name_pair maint_out_arr[] = { |
121 | {0x6, "Set device identifier"}, | 120 | {0x6, "Set device identifier"}, |
@@ -123,34 +122,29 @@ static const struct value_name_pair maint_out_arr[] = { | |||
123 | {0xb, "Change aliases"}, | 122 | {0xb, "Change aliases"}, |
124 | {0xe, "Set priority"}, | 123 | {0xe, "Set priority"}, |
125 | }; | 124 | }; |
126 | #define MAINT_OUT_SZ \ | 125 | #define MAINT_OUT_SZ ARRAY_SIZE(maint_out_arr) |
127 | (int)(sizeof(maint_out_arr) / sizeof(maint_out_arr[0])) | ||
128 | 126 | ||
129 | static const struct value_name_pair serv_in12_arr[] = { | 127 | static const struct value_name_pair serv_in12_arr[] = { |
130 | {0x1, "Read media serial number"}, | 128 | {0x1, "Read media serial number"}, |
131 | }; | 129 | }; |
132 | #define SERV_IN12_SZ \ | 130 | #define SERV_IN12_SZ ARRAY_SIZE(serv_in12_arr) |
133 | (int)(sizeof(serv_in12_arr) / sizeof(serv_in12_arr[0])) | ||
134 | 131 | ||
135 | static const struct value_name_pair serv_out12_arr[] = { | 132 | static const struct value_name_pair serv_out12_arr[] = { |
136 | {-1, "dummy entry"}, | 133 | {-1, "dummy entry"}, |
137 | }; | 134 | }; |
138 | #define SERV_OUT12_SZ \ | 135 | #define SERV_OUT12_SZ ARRAY_SIZE(serv_out12_arr) |
139 | (int)(sizeof(serv_out12_arr) / sizeof(serv_in12_arr[0])) | ||
140 | 136 | ||
141 | static const struct value_name_pair serv_in16_arr[] = { | 137 | static const struct value_name_pair serv_in16_arr[] = { |
142 | {0x10, "Read capacity(16)"}, | 138 | {0x10, "Read capacity(16)"}, |
143 | {0x11, "Read long(16)"}, | 139 | {0x11, "Read long(16)"}, |
144 | }; | 140 | }; |
145 | #define SERV_IN16_SZ \ | 141 | #define SERV_IN16_SZ ARRAY_SIZE(serv_in16_arr) |
146 | (int)(sizeof(serv_in16_arr) / sizeof(serv_in16_arr[0])) | ||
147 | 142 | ||
148 | static const struct value_name_pair serv_out16_arr[] = { | 143 | static const struct value_name_pair serv_out16_arr[] = { |
149 | {0x11, "Write long(16)"}, | 144 | {0x11, "Write long(16)"}, |
150 | {0x1f, "Notify data transfer device(16)"}, | 145 | {0x1f, "Notify data transfer device(16)"}, |
151 | }; | 146 | }; |
152 | #define SERV_OUT16_SZ \ | 147 | #define SERV_OUT16_SZ ARRAY_SIZE(serv_out16_arr) |
153 | (int)(sizeof(serv_out16_arr) / sizeof(serv_in16_arr[0])) | ||
154 | 148 | ||
155 | static const struct value_name_pair variable_length_arr[] = { | 149 | static const struct value_name_pair variable_length_arr[] = { |
156 | {0x1, "Rebuild(32)"}, | 150 | {0x1, "Rebuild(32)"}, |
@@ -190,8 +184,7 @@ static const struct value_name_pair variable_length_arr[] = { | |||
190 | {0x8f7e, "Perform SCSI command (osd)"}, | 184 | {0x8f7e, "Perform SCSI command (osd)"}, |
191 | {0x8f7f, "Perform task management function (osd)"}, | 185 | {0x8f7f, "Perform task management function (osd)"}, |
192 | }; | 186 | }; |
193 | #define VARIABLE_LENGTH_SZ \ | 187 | #define VARIABLE_LENGTH_SZ ARRAY_SIZE(variable_length_arr) |
194 | (int)(sizeof(variable_length_arr) / sizeof(variable_length_arr[0])) | ||
195 | 188 | ||
196 | static const char * get_sa_name(const struct value_name_pair * arr, | 189 | static const char * get_sa_name(const struct value_name_pair * arr, |
197 | int arr_sz, int service_action) | 190 | int arr_sz, int service_action) |
@@ -1290,10 +1283,10 @@ EXPORT_SYMBOL(scsi_print_command); | |||
1290 | #ifdef CONFIG_SCSI_CONSTANTS | 1283 | #ifdef CONFIG_SCSI_CONSTANTS |
1291 | 1284 | ||
1292 | static const char * const hostbyte_table[]={ | 1285 | static const char * const hostbyte_table[]={ |
1293 | "DID_OK", "DID_NO_CONNECT", "DID_BUS_BUSY", "DID_TIME_OUT", "DID_BAD_TARGET", | 1286 | "DID_OK", "DID_NO_CONNECT", "DID_BUS_BUSY", "DID_TIME_OUT", "DID_BAD_TARGET", |
1294 | "DID_ABORT", "DID_PARITY", "DID_ERROR", "DID_RESET", "DID_BAD_INTR", | 1287 | "DID_ABORT", "DID_PARITY", "DID_ERROR", "DID_RESET", "DID_BAD_INTR", |
1295 | "DID_PASSTHROUGH", "DID_SOFT_ERROR", "DID_IMM_RETRY"}; | 1288 | "DID_PASSTHROUGH", "DID_SOFT_ERROR", "DID_IMM_RETRY"}; |
1296 | #define NUM_HOSTBYTE_STRS (sizeof(hostbyte_table) / sizeof(const char *)) | 1289 | #define NUM_HOSTBYTE_STRS ARRAY_SIZE(hostbyte_table) |
1297 | 1290 | ||
1298 | void scsi_print_hostbyte(int scsiresult) | 1291 | void scsi_print_hostbyte(int scsiresult) |
1299 | { | 1292 | { |
@@ -1303,7 +1296,7 @@ void scsi_print_hostbyte(int scsiresult) | |||
1303 | if (hb < NUM_HOSTBYTE_STRS) | 1296 | if (hb < NUM_HOSTBYTE_STRS) |
1304 | printk("(%s) ", hostbyte_table[hb]); | 1297 | printk("(%s) ", hostbyte_table[hb]); |
1305 | else | 1298 | else |
1306 | printk("is invalid "); | 1299 | printk("is invalid "); |
1307 | } | 1300 | } |
1308 | #else | 1301 | #else |
1309 | void scsi_print_hostbyte(int scsiresult) | 1302 | void scsi_print_hostbyte(int scsiresult) |
@@ -1315,14 +1308,14 @@ void scsi_print_hostbyte(int scsiresult) | |||
1315 | #ifdef CONFIG_SCSI_CONSTANTS | 1308 | #ifdef CONFIG_SCSI_CONSTANTS |
1316 | 1309 | ||
1317 | static const char * const driverbyte_table[]={ | 1310 | static const char * const driverbyte_table[]={ |
1318 | "DRIVER_OK", "DRIVER_BUSY", "DRIVER_SOFT", "DRIVER_MEDIA", "DRIVER_ERROR", | 1311 | "DRIVER_OK", "DRIVER_BUSY", "DRIVER_SOFT", "DRIVER_MEDIA", "DRIVER_ERROR", |
1319 | "DRIVER_INVALID", "DRIVER_TIMEOUT", "DRIVER_HARD", "DRIVER_SENSE"}; | 1312 | "DRIVER_INVALID", "DRIVER_TIMEOUT", "DRIVER_HARD", "DRIVER_SENSE"}; |
1320 | #define NUM_DRIVERBYTE_STRS (sizeof(driverbyte_table) / sizeof(const char *)) | 1313 | #define NUM_DRIVERBYTE_STRS ARRAY_SIZE(driverbyte_table) |
1321 | 1314 | ||
1322 | static const char * const driversuggest_table[]={"SUGGEST_OK", | 1315 | static const char * const driversuggest_table[]={"SUGGEST_OK", |
1323 | "SUGGEST_RETRY", "SUGGEST_ABORT", "SUGGEST_REMAP", "SUGGEST_DIE", | 1316 | "SUGGEST_RETRY", "SUGGEST_ABORT", "SUGGEST_REMAP", "SUGGEST_DIE", |
1324 | "SUGGEST_5", "SUGGEST_6", "SUGGEST_7", "SUGGEST_SENSE"}; | 1317 | "SUGGEST_5", "SUGGEST_6", "SUGGEST_7", "SUGGEST_SENSE"}; |
1325 | #define NUM_SUGGEST_STRS (sizeof(driversuggest_table) / sizeof(const char *)) | 1318 | #define NUM_SUGGEST_STRS ARRAY_SIZE(driversuggest_table) |
1326 | 1319 | ||
1327 | void scsi_print_driverbyte(int scsiresult) | 1320 | void scsi_print_driverbyte(int scsiresult) |
1328 | { | 1321 | { |
diff --git a/drivers/scsi/dtc.c b/drivers/scsi/dtc.c index 310d2f488668..c5108c8c887b 100644 --- a/drivers/scsi/dtc.c +++ b/drivers/scsi/dtc.c | |||
@@ -145,35 +145,35 @@ static struct override { | |||
145 | 0, IRQ_AUTO}}; | 145 | 0, IRQ_AUTO}}; |
146 | #endif | 146 | #endif |
147 | 147 | ||
148 | #define NO_OVERRIDES (sizeof(overrides) / sizeof(struct override)) | 148 | #define NO_OVERRIDES ARRAY_SIZE(overrides) |
149 | 149 | ||
150 | static struct base { | 150 | static struct base { |
151 | unsigned long address; | 151 | unsigned long address; |
152 | int noauto; | 152 | int noauto; |
153 | } bases[] __initdata = { | 153 | } bases[] __initdata = { |
154 | { 0xcc000, 0 }, | 154 | { 0xcc000, 0 }, |
155 | { 0xc8000, 0 }, | 155 | { 0xc8000, 0 }, |
156 | { 0xdc000, 0 }, | 156 | { 0xdc000, 0 }, |
157 | { 0xd8000, 0 } | 157 | { 0xd8000, 0 } |
158 | }; | 158 | }; |
159 | 159 | ||
160 | #define NO_BASES (sizeof (bases) / sizeof (struct base)) | 160 | #define NO_BASES ARRAY_SIZE(bases) |
161 | 161 | ||
162 | static const struct signature { | 162 | static const struct signature { |
163 | const char *string; | 163 | const char *string; |
164 | int offset; | 164 | int offset; |
165 | } signatures[] = { | 165 | } signatures[] = { |
166 | {"DATA TECHNOLOGY CORPORATION BIOS", 0x25}, | 166 | {"DATA TECHNOLOGY CORPORATION BIOS", 0x25}, |
167 | }; | 167 | }; |
168 | 168 | ||
169 | #define NO_SIGNATURES (sizeof (signatures) / sizeof (struct signature)) | 169 | #define NO_SIGNATURES ARRAY_SIZE(signatures) |
170 | 170 | ||
171 | #ifndef MODULE | 171 | #ifndef MODULE |
172 | /* | 172 | /* |
173 | * Function : dtc_setup(char *str, int *ints) | 173 | * Function : dtc_setup(char *str, int *ints) |
174 | * | 174 | * |
175 | * Purpose : LILO command line initialization of the overrides array, | 175 | * Purpose : LILO command line initialization of the overrides array, |
176 | * | 176 | * |
177 | * Inputs : str - unused, ints - array of integer parameters with ints[0] | 177 | * Inputs : str - unused, ints - array of integer parameters with ints[0] |
178 | * equal to the number of ints. | 178 | * equal to the number of ints. |
179 | * | 179 | * |
diff --git a/drivers/scsi/fd_mcs.c b/drivers/scsi/fd_mcs.c index cca485a2b438..70a1606bd580 100644 --- a/drivers/scsi/fd_mcs.c +++ b/drivers/scsi/fd_mcs.c | |||
@@ -279,7 +279,7 @@ static struct fd_mcs_adapters_struct fd_mcs_adapters[] = { | |||
279 | 2}, | 279 | 2}, |
280 | }; | 280 | }; |
281 | 281 | ||
282 | #define FD_BRDS sizeof(fd_mcs_adapters)/sizeof(struct fd_mcs_adapters_struct) | 282 | #define FD_BRDS ARRAY_SIZE(fd_mcs_adapters) |
283 | 283 | ||
284 | static irqreturn_t fd_mcs_intr(int irq, void *dev_id, struct pt_regs *regs); | 284 | static irqreturn_t fd_mcs_intr(int irq, void *dev_id, struct pt_regs *regs); |
285 | 285 | ||
diff --git a/drivers/scsi/fdomain.c b/drivers/scsi/fdomain.c index 7334244397d1..e16013f0ad6e 100644 --- a/drivers/scsi/fdomain.c +++ b/drivers/scsi/fdomain.c | |||
@@ -420,10 +420,10 @@ static unsigned long addresses[] = { | |||
420 | 0xd0000, | 420 | 0xd0000, |
421 | 0xe0000, | 421 | 0xe0000, |
422 | }; | 422 | }; |
423 | #define ADDRESS_COUNT (sizeof( addresses ) / sizeof( unsigned )) | 423 | #define ADDRESS_COUNT ARRAY_SIZE(addresses) |
424 | 424 | ||
425 | static unsigned short ports[] = { 0x140, 0x150, 0x160, 0x170 }; | 425 | static unsigned short ports[] = { 0x140, 0x150, 0x160, 0x170 }; |
426 | #define PORT_COUNT (sizeof( ports ) / sizeof( unsigned short )) | 426 | #define PORT_COUNT ARRAY_SIZE(ports) |
427 | 427 | ||
428 | static unsigned short ints[] = { 3, 5, 10, 11, 12, 14, 15, 0 }; | 428 | static unsigned short ints[] = { 3, 5, 10, 11, 12, 14, 15, 0 }; |
429 | 429 | ||
@@ -502,7 +502,7 @@ static struct signature { | |||
502 | geometry location are verified). */ | 502 | geometry location are verified). */ |
503 | }; | 503 | }; |
504 | 504 | ||
505 | #define SIGNATURE_COUNT (sizeof( signatures ) / sizeof( struct signature )) | 505 | #define SIGNATURE_COUNT ARRAY_SIZE(signatures) |
506 | 506 | ||
507 | static void print_banner( struct Scsi_Host *shpnt ) | 507 | static void print_banner( struct Scsi_Host *shpnt ) |
508 | { | 508 | { |
@@ -519,7 +519,7 @@ static void print_banner( struct Scsi_Host *shpnt ) | |||
519 | 519 | ||
520 | if (bios_minor >= 0) printk("%d", bios_minor); | 520 | if (bios_minor >= 0) printk("%d", bios_minor); |
521 | else printk("?."); | 521 | else printk("?."); |
522 | 522 | ||
523 | printk( " at 0x%lx using scsi id %d\n", | 523 | printk( " at 0x%lx using scsi id %d\n", |
524 | bios_base, shpnt->this_id ); | 524 | bios_base, shpnt->this_id ); |
525 | } | 525 | } |
diff --git a/drivers/scsi/g_NCR5380.c b/drivers/scsi/g_NCR5380.c index e6bcfe949340..5f313c93b7a9 100644 --- a/drivers/scsi/g_NCR5380.c +++ b/drivers/scsi/g_NCR5380.c | |||
@@ -138,10 +138,9 @@ static struct override { | |||
138 | [1] __initdata = { { 0,},}; | 138 | [1] __initdata = { { 0,},}; |
139 | #endif | 139 | #endif |
140 | 140 | ||
141 | #define NO_OVERRIDES ARRAY_SIZE(overrides) | ||
141 | 142 | ||
142 | #define NO_OVERRIDES (sizeof(overrides) / sizeof(struct override)) | 143 | #ifndef MODULE |
143 | |||
144 | #ifndef MODULE | ||
145 | 144 | ||
146 | /** | 145 | /** |
147 | * internal_setup - handle lilo command string override | 146 | * internal_setup - handle lilo command string override |
@@ -210,7 +209,7 @@ static int __init do_NCR5380_setup(char *str) | |||
210 | { | 209 | { |
211 | int ints[10]; | 210 | int ints[10]; |
212 | 211 | ||
213 | get_options(str, sizeof(ints) / sizeof(int), ints); | 212 | get_options(str, ARRAY_SIZE(ints), ints); |
214 | internal_setup(BOARD_NCR5380, str, ints); | 213 | internal_setup(BOARD_NCR5380, str, ints); |
215 | return 1; | 214 | return 1; |
216 | } | 215 | } |
@@ -218,7 +217,7 @@ static int __init do_NCR5380_setup(char *str) | |||
218 | /** | 217 | /** |
219 | * do_NCR53C400_setup - set up entry point | 218 | * do_NCR53C400_setup - set up entry point |
220 | * @str: unused | 219 | * @str: unused |
221 | * @ints: integer parameters from kernel setup code | 220 | * @ints: integer parameters from kernel setup code |
222 | * | 221 | * |
223 | * Setup function invoked at boot to parse the ncr53c400= command | 222 | * Setup function invoked at boot to parse the ncr53c400= command |
224 | * line. | 223 | * line. |
@@ -228,7 +227,7 @@ static int __init do_NCR53C400_setup(char *str) | |||
228 | { | 227 | { |
229 | int ints[10]; | 228 | int ints[10]; |
230 | 229 | ||
231 | get_options(str, sizeof(ints) / sizeof(int), ints); | 230 | get_options(str, ARRAY_SIZE(ints), ints); |
232 | internal_setup(BOARD_NCR53C400, str, ints); | 231 | internal_setup(BOARD_NCR53C400, str, ints); |
233 | return 1; | 232 | return 1; |
234 | } | 233 | } |
@@ -236,7 +235,7 @@ static int __init do_NCR53C400_setup(char *str) | |||
236 | /** | 235 | /** |
237 | * do_NCR53C400A_setup - set up entry point | 236 | * do_NCR53C400A_setup - set up entry point |
238 | * @str: unused | 237 | * @str: unused |
239 | * @ints: integer parameters from kernel setup code | 238 | * @ints: integer parameters from kernel setup code |
240 | * | 239 | * |
241 | * Setup function invoked at boot to parse the ncr53c400a= command | 240 | * Setup function invoked at boot to parse the ncr53c400a= command |
242 | * line. | 241 | * line. |
@@ -246,7 +245,7 @@ static int __init do_NCR53C400A_setup(char *str) | |||
246 | { | 245 | { |
247 | int ints[10]; | 246 | int ints[10]; |
248 | 247 | ||
249 | get_options(str, sizeof(ints) / sizeof(int), ints); | 248 | get_options(str, ARRAY_SIZE(ints), ints); |
250 | internal_setup(BOARD_NCR53C400A, str, ints); | 249 | internal_setup(BOARD_NCR53C400A, str, ints); |
251 | return 1; | 250 | return 1; |
252 | } | 251 | } |
@@ -254,7 +253,7 @@ static int __init do_NCR53C400A_setup(char *str) | |||
254 | /** | 253 | /** |
255 | * do_DTC3181E_setup - set up entry point | 254 | * do_DTC3181E_setup - set up entry point |
256 | * @str: unused | 255 | * @str: unused |
257 | * @ints: integer parameters from kernel setup code | 256 | * @ints: integer parameters from kernel setup code |
258 | * | 257 | * |
259 | * Setup function invoked at boot to parse the dtc3181e= command | 258 | * Setup function invoked at boot to parse the dtc3181e= command |
260 | * line. | 259 | * line. |
@@ -264,7 +263,7 @@ static int __init do_DTC3181E_setup(char *str) | |||
264 | { | 263 | { |
265 | int ints[10]; | 264 | int ints[10]; |
266 | 265 | ||
267 | get_options(str, sizeof(ints) / sizeof(int), ints); | 266 | get_options(str, ARRAY_SIZE(ints), ints); |
268 | internal_setup(BOARD_DTC3181E, str, ints); | 267 | internal_setup(BOARD_DTC3181E, str, ints); |
269 | return 1; | 268 | return 1; |
270 | } | 269 | } |
diff --git a/drivers/scsi/gdth.c b/drivers/scsi/gdth.c index e720bb017c1e..fc4d9f61cf3d 100644 --- a/drivers/scsi/gdth.c +++ b/drivers/scsi/gdth.c | |||
@@ -569,8 +569,8 @@ static struct timer_list gdth_timer; | |||
569 | #endif | 569 | #endif |
570 | 570 | ||
571 | #define PTR2USHORT(a) (ushort)(ulong)(a) | 571 | #define PTR2USHORT(a) (ushort)(ulong)(a) |
572 | #define GDTOFFSOF(a,b) (size_t)&(((a*)0)->b) | 572 | #define GDTOFFSOF(a,b) (size_t)&(((a*)0)->b) |
573 | #define INDEX_OK(i,t) ((i)<sizeof(t)/sizeof((t)[0])) | 573 | #define INDEX_OK(i,t) ((i)<ARRAY_SIZE(t)) |
574 | 574 | ||
575 | #define NUMDATA(a) ( (gdth_num_str *)((a)->hostdata)) | 575 | #define NUMDATA(a) ( (gdth_num_str *)((a)->hostdata)) |
576 | #define HADATA(a) (&((gdth_ext_str *)((a)->hostdata))->haext) | 576 | #define HADATA(a) (&((gdth_ext_str *)((a)->hostdata))->haext) |
diff --git a/drivers/scsi/ibmmca.c b/drivers/scsi/ibmmca.c index 24eb59e143a9..0c6dc31bb14d 100644 --- a/drivers/scsi/ibmmca.c +++ b/drivers/scsi/ibmmca.c | |||
@@ -1441,7 +1441,7 @@ static int ibmmca_getinfo(char *buf, int slot, void *dev_id) | |||
1441 | struct Scsi_Host *dev = dev_id; | 1441 | struct Scsi_Host *dev = dev_id; |
1442 | 1442 | ||
1443 | spin_lock_irqsave(dev->host_lock, flags); | 1443 | spin_lock_irqsave(dev->host_lock, flags); |
1444 | 1444 | ||
1445 | shpnt = dev; /* assign host-structure to local pointer */ | 1445 | shpnt = dev; /* assign host-structure to local pointer */ |
1446 | len = 0; /* set filled text-buffer index to 0 */ | 1446 | len = 0; /* set filled text-buffer index to 0 */ |
1447 | /* get the _special contents of the hostdata structure */ | 1447 | /* get the _special contents of the hostdata structure */ |
@@ -1456,7 +1456,7 @@ static int ibmmca_getinfo(char *buf, int slot, void *dev_id) | |||
1456 | /* if the integrated subsystem has been found automatically: */ | 1456 | /* if the integrated subsystem has been found automatically: */ |
1457 | len += sprintf(buf + len, | 1457 | len += sprintf(buf + len, |
1458 | "Adapter category: integrated\n" "Chip revision level: %d\n" "Chip status: %s\n" "8 kByte NVRAM status: %s\n", ((pos[2] & 0xf0) >> 4), (pos[2] & 1) ? "enabled" : "disabled", (pos[2] & 2) ? "locked" : "accessible"); | 1458 | "Adapter category: integrated\n" "Chip revision level: %d\n" "Chip status: %s\n" "8 kByte NVRAM status: %s\n", ((pos[2] & 0xf0) >> 4), (pos[2] & 1) ? "enabled" : "disabled", (pos[2] & 2) ? "locked" : "accessible"); |
1459 | } else if ((speciale >= 0) && (speciale < (sizeof(subsys_list) / sizeof(struct subsys_list_struct)))) { | 1459 | } else if ((speciale >= 0) && (speciale < ARRAY_SIZE(subsys_list))) { |
1460 | /* if the subsystem is a slot adapter */ | 1460 | /* if the subsystem is a slot adapter */ |
1461 | len += sprintf(buf + len, "Adapter category: slot-card\n" "ROM Segment Address: "); | 1461 | len += sprintf(buf + len, "Adapter category: slot-card\n" "ROM Segment Address: "); |
1462 | if ((pos[2] & 0xf0) == 0xf0) | 1462 | if ((pos[2] & 0xf0) == 0xf0) |
@@ -1477,16 +1477,16 @@ static int ibmmca_getinfo(char *buf, int slot, void *dev_id) | |||
1477 | while (len % sizeof(int) != (sizeof(int) - 1)) | 1477 | while (len % sizeof(int) != (sizeof(int) - 1)) |
1478 | len += sprintf(buf + len, " "); | 1478 | len += sprintf(buf + len, " "); |
1479 | len += sprintf(buf + len, "\n"); | 1479 | len += sprintf(buf + len, "\n"); |
1480 | 1480 | ||
1481 | spin_unlock_irqrestore(shpnt->host_lock, flags); | 1481 | spin_unlock_irqrestore(shpnt->host_lock, flags); |
1482 | 1482 | ||
1483 | return len; | 1483 | return len; |
1484 | } | 1484 | } |
1485 | 1485 | ||
1486 | int ibmmca_detect(struct scsi_host_template * scsi_template) | 1486 | int ibmmca_detect(struct scsi_host_template * scsi_template) |
1487 | { | 1487 | { |
1488 | struct Scsi_Host *shpnt; | 1488 | struct Scsi_Host *shpnt; |
1489 | int port, id, i, j, k, list_size, slot; | 1489 | int port, id, i, j, k, slot; |
1490 | int devices_on_irq_11 = 0; | 1490 | int devices_on_irq_11 = 0; |
1491 | int devices_on_irq_14 = 0; | 1491 | int devices_on_irq_14 = 0; |
1492 | int IRQ14_registered = 0; | 1492 | int IRQ14_registered = 0; |
@@ -1603,8 +1603,7 @@ int ibmmca_detect(struct scsi_host_template * scsi_template) | |||
1603 | /* now look for other adapters in MCA slots, */ | 1603 | /* now look for other adapters in MCA slots, */ |
1604 | /* determine the number of known IBM-SCSI-subsystem types */ | 1604 | /* determine the number of known IBM-SCSI-subsystem types */ |
1605 | /* see the pos[2] dependence to get the adapter port-offset. */ | 1605 | /* see the pos[2] dependence to get the adapter port-offset. */ |
1606 | list_size = sizeof(subsys_list) / sizeof(struct subsys_list_struct); | 1606 | for (i = 0; i < ARRAY_SIZE(subsys_list); i++) { |
1607 | for (i = 0; i < list_size; i++) { | ||
1608 | /* scan each slot for a fitting adapter id */ | 1607 | /* scan each slot for a fitting adapter id */ |
1609 | slot = 0; /* start at slot 0 */ | 1608 | slot = 0; /* start at slot 0 */ |
1610 | while ((slot = mca_find_adapter(subsys_list[i].mca_id, slot)) | 1609 | while ((slot = mca_find_adapter(subsys_list[i].mca_id, slot)) |
@@ -1669,8 +1668,7 @@ int ibmmca_detect(struct scsi_host_template * scsi_template) | |||
1669 | /* now check for SCSI-adapters, mapped to the integrated SCSI | 1668 | /* now check for SCSI-adapters, mapped to the integrated SCSI |
1670 | * area. E.g. a W/Cache in MCA-slot 9(!). Do the check correct here, | 1669 | * area. E.g. a W/Cache in MCA-slot 9(!). Do the check correct here, |
1671 | * as this is a known effect on some models 95xx. */ | 1670 | * as this is a known effect on some models 95xx. */ |
1672 | list_size = sizeof(subsys_list) / sizeof(struct subsys_list_struct); | 1671 | for (i = 0; i < ARRAY_SIZE(subsys_list); i++) { |
1673 | for (i = 0; i < list_size; i++) { | ||
1674 | /* scan each slot for a fitting adapter id */ | 1672 | /* scan each slot for a fitting adapter id */ |
1675 | slot = mca_find_adapter(subsys_list[i].mca_id, MCA_INTEGSCSI); | 1673 | slot = mca_find_adapter(subsys_list[i].mca_id, MCA_INTEGSCSI); |
1676 | if (slot != MCA_NOTFOUND) { /* scan through all slots */ | 1674 | if (slot != MCA_NOTFOUND) { /* scan through all slots */ |
diff --git a/drivers/scsi/in2000.c b/drivers/scsi/in2000.c index 89a57a62e8ca..883bc92b4d9a 100644 --- a/drivers/scsi/in2000.c +++ b/drivers/scsi/in2000.c | |||
@@ -1809,7 +1809,7 @@ static int in2000_abort(Scsi_Cmnd * cmd) | |||
1809 | 1809 | ||
1810 | 1810 | ||
1811 | #define MAX_IN2000_HOSTS 3 | 1811 | #define MAX_IN2000_HOSTS 3 |
1812 | #define MAX_SETUP_ARGS (sizeof(setup_args) / sizeof(char *)) | 1812 | #define MAX_SETUP_ARGS ARRAY_SIZE(setup_args) |
1813 | #define SETUP_BUFFER_SIZE 200 | 1813 | #define SETUP_BUFFER_SIZE 200 |
1814 | static char setup_buffer[SETUP_BUFFER_SIZE]; | 1814 | static char setup_buffer[SETUP_BUFFER_SIZE]; |
1815 | static char setup_used[MAX_SETUP_ARGS]; | 1815 | static char setup_used[MAX_SETUP_ARGS]; |
diff --git a/drivers/scsi/initio.c b/drivers/scsi/initio.c index 0cc7f65b584f..913ba95f85bd 100644 --- a/drivers/scsi/initio.c +++ b/drivers/scsi/initio.c | |||
@@ -154,7 +154,6 @@ | |||
154 | static unsigned int i91u_debug = DEBUG_DEFAULT; | 154 | static unsigned int i91u_debug = DEBUG_DEFAULT; |
155 | #endif | 155 | #endif |
156 | 156 | ||
157 | #define TULSZ(sz) (sizeof(sz) / sizeof(sz[0])) | ||
158 | #define TUL_RDWORD(x,y) (short)(inl((int)((ULONG)((ULONG)x+(UCHAR)y)) )) | 157 | #define TUL_RDWORD(x,y) (short)(inl((int)((ULONG)((ULONG)x+(UCHAR)y)) )) |
159 | 158 | ||
160 | typedef struct PCI_ID_Struc { | 159 | typedef struct PCI_ID_Struc { |
@@ -2771,7 +2770,7 @@ static int tul_NewReturnNumberOfAdapters(void) | |||
2771 | 2770 | ||
2772 | init_i91uAdapter_table(); | 2771 | init_i91uAdapter_table(); |
2773 | 2772 | ||
2774 | for (i = 0; i < TULSZ(i91u_pci_devices); i++) | 2773 | for (i = 0; i < ARRAY_SIZE(i91u_pci_devices); i++) |
2775 | { | 2774 | { |
2776 | while ((pDev = pci_find_device(i91u_pci_devices[i].vendor_id, i91u_pci_devices[i].device_id, pDev)) != NULL) { | 2775 | while ((pDev = pci_find_device(i91u_pci_devices[i].vendor_id, i91u_pci_devices[i].device_id, pDev)) != NULL) { |
2777 | if (pci_enable_device(pDev)) | 2776 | if (pci_enable_device(pDev)) |
diff --git a/drivers/scsi/ips.c b/drivers/scsi/ips.c index 350c08c60887..5353b28b2939 100644 --- a/drivers/scsi/ips.c +++ b/drivers/scsi/ips.c | |||
@@ -556,7 +556,7 @@ ips_setup(char *ips_str) | |||
556 | * We now have key/value pairs. | 556 | * We now have key/value pairs. |
557 | * Update the variables | 557 | * Update the variables |
558 | */ | 558 | */ |
559 | for (i = 0; i < (sizeof (options) / sizeof (options[0])); i++) { | 559 | for (i = 0; i < ARRAY_SIZE(options); i++) { |
560 | if (strnicmp | 560 | if (strnicmp |
561 | (key, options[i].option_name, | 561 | (key, options[i].option_name, |
562 | strlen(options[i].option_name)) == 0) { | 562 | strlen(options[i].option_name)) == 0) { |
diff --git a/drivers/scsi/osst.c b/drivers/scsi/osst.c index e3bd4bc339f4..ce0ba3a174f9 100644 --- a/drivers/scsi/osst.c +++ b/drivers/scsi/osst.c | |||
@@ -5492,7 +5492,7 @@ static int __init osst_setup (char *str) | |||
5492 | char *stp; | 5492 | char *stp; |
5493 | 5493 | ||
5494 | stp = get_options(str, ARRAY_SIZE(ints), ints); | 5494 | stp = get_options(str, ARRAY_SIZE(ints), ints); |
5495 | 5495 | ||
5496 | if (ints[0] > 0) { | 5496 | if (ints[0] > 0) { |
5497 | for (i = 0; i < ints[0] && i < ARRAY_SIZE(parms); i++) | 5497 | for (i = 0; i < ints[0] && i < ARRAY_SIZE(parms); i++) |
5498 | *parms[i].val = ints[i + 1]; | 5498 | *parms[i].val = ints[i + 1]; |
@@ -5507,7 +5507,7 @@ static int __init osst_setup (char *str) | |||
5507 | break; | 5507 | break; |
5508 | } | 5508 | } |
5509 | } | 5509 | } |
5510 | if (i >= sizeof(parms) / sizeof(struct osst_dev_parm)) | 5510 | if (i >= ARRAY_SIZE(parms)) |
5511 | printk(KERN_INFO "osst :I: Illegal parameter in '%s'\n", | 5511 | printk(KERN_INFO "osst :I: Illegal parameter in '%s'\n", |
5512 | stp); | 5512 | stp); |
5513 | stp = strchr(stp, ','); | 5513 | stp = strchr(stp, ','); |
diff --git a/drivers/scsi/pas16.c b/drivers/scsi/pas16.c index f09e94af9ade..1bf96ed8f935 100644 --- a/drivers/scsi/pas16.c +++ b/drivers/scsi/pas16.c | |||
@@ -156,7 +156,7 @@ static int default_irqs[] __initdata = | |||
156 | static struct override { | 156 | static struct override { |
157 | unsigned short io_port; | 157 | unsigned short io_port; |
158 | int irq; | 158 | int irq; |
159 | } overrides | 159 | } overrides |
160 | #ifdef PAS16_OVERRIDE | 160 | #ifdef PAS16_OVERRIDE |
161 | [] __initdata = PAS16_OVERRIDE; | 161 | [] __initdata = PAS16_OVERRIDE; |
162 | #else | 162 | #else |
@@ -164,19 +164,19 @@ static struct override { | |||
164 | {0,IRQ_AUTO}}; | 164 | {0,IRQ_AUTO}}; |
165 | #endif | 165 | #endif |
166 | 166 | ||
167 | #define NO_OVERRIDES (sizeof(overrides) / sizeof(struct override)) | 167 | #define NO_OVERRIDES ARRAY_SIZE(overrides) |
168 | 168 | ||
169 | static struct base { | 169 | static struct base { |
170 | unsigned short io_port; | 170 | unsigned short io_port; |
171 | int noauto; | 171 | int noauto; |
172 | } bases[] __initdata = | 172 | } bases[] __initdata = |
173 | { {PAS16_DEFAULT_BASE_1, 0}, | 173 | { {PAS16_DEFAULT_BASE_1, 0}, |
174 | {PAS16_DEFAULT_BASE_2, 0}, | 174 | {PAS16_DEFAULT_BASE_2, 0}, |
175 | {PAS16_DEFAULT_BASE_3, 0}, | 175 | {PAS16_DEFAULT_BASE_3, 0}, |
176 | {PAS16_DEFAULT_BASE_4, 0} | 176 | {PAS16_DEFAULT_BASE_4, 0} |
177 | }; | 177 | }; |
178 | 178 | ||
179 | #define NO_BASES (sizeof (bases) / sizeof (struct base)) | 179 | #define NO_BASES ARRAY_SIZE(bases) |
180 | 180 | ||
181 | static const unsigned short pas16_offset[ 8 ] = | 181 | static const unsigned short pas16_offset[ 8 ] = |
182 | { | 182 | { |
diff --git a/drivers/scsi/qla1280.c b/drivers/scsi/qla1280.c index 5a48e55f9418..77bb2351500c 100644 --- a/drivers/scsi/qla1280.c +++ b/drivers/scsi/qla1280.c | |||
@@ -4239,15 +4239,12 @@ qla1280_get_token(char *str) | |||
4239 | { | 4239 | { |
4240 | char *sep; | 4240 | char *sep; |
4241 | long ret = -1; | 4241 | long ret = -1; |
4242 | int i, len; | 4242 | int i; |
4243 | |||
4244 | len = sizeof(setup_token)/sizeof(struct setup_tokens); | ||
4245 | 4243 | ||
4246 | sep = strchr(str, ':'); | 4244 | sep = strchr(str, ':'); |
4247 | 4245 | ||
4248 | if (sep) { | 4246 | if (sep) { |
4249 | for (i = 0; i < len; i++){ | 4247 | for (i = 0; i < ARRAY_SIZE(setup_token); i++) { |
4250 | |||
4251 | if (!strncmp(setup_token[i].token, str, (sep - str))) { | 4248 | if (!strncmp(setup_token[i].token, str, (sep - str))) { |
4252 | ret = setup_token[i].val; | 4249 | ret = setup_token[i].val; |
4253 | break; | 4250 | break; |
diff --git a/drivers/scsi/qlogicpti.c b/drivers/scsi/qlogicpti.c index c7e78dcf09df..00f4b846360e 100644 --- a/drivers/scsi/qlogicpti.c +++ b/drivers/scsi/qlogicpti.c | |||
@@ -132,7 +132,7 @@ static const u_char mbox_param[] = { | |||
132 | PACKB(0, 0) /* 0x0042 */ | 132 | PACKB(0, 0) /* 0x0042 */ |
133 | }; | 133 | }; |
134 | 134 | ||
135 | #define MAX_MBOX_COMMAND (sizeof(mbox_param)/sizeof(u_short)) | 135 | #define MAX_MBOX_COMMAND ARRAY_SIZE(mbox_param) |
136 | 136 | ||
137 | /* queue length's _must_ be power of two: */ | 137 | /* queue length's _must_ be power of two: */ |
138 | #define QUEUE_DEPTH(in, out, ql) ((in - out) & (ql)) | 138 | #define QUEUE_DEPTH(in, out, ql) ((in - out) & (ql)) |
diff --git a/drivers/scsi/raid_class.c b/drivers/scsi/raid_class.c index 50c398aab557..327b33a57b0a 100644 --- a/drivers/scsi/raid_class.c +++ b/drivers/scsi/raid_class.c | |||
@@ -131,7 +131,7 @@ static const char *raid_state_name(enum raid_state state) | |||
131 | int i; | 131 | int i; |
132 | char *name = NULL; | 132 | char *name = NULL; |
133 | 133 | ||
134 | for (i = 0; i < sizeof(raid_states)/sizeof(raid_states[0]); i++) { | 134 | for (i = 0; i < ARRAY_SIZE(raid_states); i++) { |
135 | if (raid_states[i].value == state) { | 135 | if (raid_states[i].value == state) { |
136 | name = raid_states[i].name; | 136 | name = raid_states[i].name; |
137 | break; | 137 | break; |
@@ -161,7 +161,7 @@ static const char *raid_level_name(enum raid_level level) | |||
161 | int i; | 161 | int i; |
162 | char *name = NULL; | 162 | char *name = NULL; |
163 | 163 | ||
164 | for (i = 0; i < sizeof(raid_levels)/sizeof(raid_levels[0]); i++) { | 164 | for (i = 0; i < ARRAY_SIZE(raid_levels); i++) { |
165 | if (raid_levels[i].value == level) { | 165 | if (raid_levels[i].value == level) { |
166 | name = raid_levels[i].name; | 166 | name = raid_levels[i].name; |
167 | break; | 167 | break; |
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index 68d413c444f9..3ca7b9d3086c 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c | |||
@@ -30,7 +30,7 @@ | |||
30 | #include "scsi_logging.h" | 30 | #include "scsi_logging.h" |
31 | 31 | ||
32 | 32 | ||
33 | #define SG_MEMPOOL_NR (sizeof(scsi_sg_pools)/sizeof(struct scsi_host_sg_pool)) | 33 | #define SG_MEMPOOL_NR ARRAY_SIZE(scsi_sg_pools) |
34 | #define SG_MEMPOOL_SIZE 32 | 34 | #define SG_MEMPOOL_SIZE 32 |
35 | 35 | ||
36 | struct scsi_host_sg_pool { | 36 | struct scsi_host_sg_pool { |
diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c index a6fde52946d6..5ec7a4fb0145 100644 --- a/drivers/scsi/scsi_sysfs.c +++ b/drivers/scsi/scsi_sysfs.c | |||
@@ -39,7 +39,7 @@ const char *scsi_device_state_name(enum scsi_device_state state) | |||
39 | int i; | 39 | int i; |
40 | char *name = NULL; | 40 | char *name = NULL; |
41 | 41 | ||
42 | for (i = 0; i < sizeof(sdev_states)/sizeof(sdev_states[0]); i++) { | 42 | for (i = 0; i < ARRAY_SIZE(sdev_states); i++) { |
43 | if (sdev_states[i].value == state) { | 43 | if (sdev_states[i].value == state) { |
44 | name = sdev_states[i].name; | 44 | name = sdev_states[i].name; |
45 | break; | 45 | break; |
@@ -65,7 +65,7 @@ const char *scsi_host_state_name(enum scsi_host_state state) | |||
65 | int i; | 65 | int i; |
66 | char *name = NULL; | 66 | char *name = NULL; |
67 | 67 | ||
68 | for (i = 0; i < sizeof(shost_states)/sizeof(shost_states[0]); i++) { | 68 | for (i = 0; i < ARRAY_SIZE(shost_states); i++) { |
69 | if (shost_states[i].value == state) { | 69 | if (shost_states[i].value == state) { |
70 | name = shost_states[i].name; | 70 | name = shost_states[i].name; |
71 | break; | 71 | break; |
@@ -160,7 +160,7 @@ store_shost_state(struct class_device *class_dev, const char *buf, size_t count) | |||
160 | struct Scsi_Host *shost = class_to_shost(class_dev); | 160 | struct Scsi_Host *shost = class_to_shost(class_dev); |
161 | enum scsi_host_state state = 0; | 161 | enum scsi_host_state state = 0; |
162 | 162 | ||
163 | for (i = 0; i < sizeof(shost_states)/sizeof(shost_states[0]); i++) { | 163 | for (i = 0; i < ARRAY_SIZE(shost_states); i++) { |
164 | const int len = strlen(shost_states[i].name); | 164 | const int len = strlen(shost_states[i].name); |
165 | if (strncmp(shost_states[i].name, buf, len) == 0 && | 165 | if (strncmp(shost_states[i].name, buf, len) == 0 && |
166 | buf[len] == '\n') { | 166 | buf[len] == '\n') { |
@@ -466,7 +466,7 @@ store_state_field(struct device *dev, struct device_attribute *attr, const char | |||
466 | struct scsi_device *sdev = to_scsi_device(dev); | 466 | struct scsi_device *sdev = to_scsi_device(dev); |
467 | enum scsi_device_state state = 0; | 467 | enum scsi_device_state state = 0; |
468 | 468 | ||
469 | for (i = 0; i < sizeof(sdev_states)/sizeof(sdev_states[0]); i++) { | 469 | for (i = 0; i < ARRAY_SIZE(sdev_states); i++) { |
470 | const int len = strlen(sdev_states[i].name); | 470 | const int len = strlen(sdev_states[i].name); |
471 | if (strncmp(sdev_states[i].name, buf, len) == 0 && | 471 | if (strncmp(sdev_states[i].name, buf, len) == 0 && |
472 | buf[len] == '\n') { | 472 | buf[len] == '\n') { |
diff --git a/drivers/scsi/scsi_transport_fc.c b/drivers/scsi/scsi_transport_fc.c index 95c5478dcdfd..f2db7a41cf1d 100644 --- a/drivers/scsi/scsi_transport_fc.c +++ b/drivers/scsi/scsi_transport_fc.c | |||
@@ -50,7 +50,7 @@ static const char *get_fc_##title##_name(enum table_type table_key) \ | |||
50 | int i; \ | 50 | int i; \ |
51 | char *name = NULL; \ | 51 | char *name = NULL; \ |
52 | \ | 52 | \ |
53 | for (i = 0; i < sizeof(table)/sizeof(table[0]); i++) { \ | 53 | for (i = 0; i < ARRAY_SIZE(table); i++) { \ |
54 | if (table[i].value == table_key) { \ | 54 | if (table[i].value == table_key) { \ |
55 | name = table[i].name; \ | 55 | name = table[i].name; \ |
56 | break; \ | 56 | break; \ |
@@ -65,7 +65,7 @@ static int get_fc_##title##_match(const char *table_key, \ | |||
65 | { \ | 65 | { \ |
66 | int i; \ | 66 | int i; \ |
67 | \ | 67 | \ |
68 | for (i = 0; i < sizeof(table)/sizeof(table[0]); i++) { \ | 68 | for (i = 0; i < ARRAY_SIZE(table); i++) { \ |
69 | if (strncmp(table_key, table[i].name, \ | 69 | if (strncmp(table_key, table[i].name, \ |
70 | table[i].matchlen) == 0) { \ | 70 | table[i].matchlen) == 0) { \ |
71 | *value = table[i].value; \ | 71 | *value = table[i].value; \ |
@@ -140,7 +140,7 @@ get_fc_##title##_names(u32 table_key, char *buf) \ | |||
140 | ssize_t len = 0; \ | 140 | ssize_t len = 0; \ |
141 | int i; \ | 141 | int i; \ |
142 | \ | 142 | \ |
143 | for (i = 0; i < sizeof(table)/sizeof(table[0]); i++) { \ | 143 | for (i = 0; i < ARRAY_SIZE(table); i++) { \ |
144 | if (table[i].value & table_key) { \ | 144 | if (table[i].value & table_key) { \ |
145 | len += sprintf(buf + len, "%s%s", \ | 145 | len += sprintf(buf + len, "%s%s", \ |
146 | prefix, table[i].name); \ | 146 | prefix, table[i].name); \ |
diff --git a/drivers/scsi/scsi_transport_sas.c b/drivers/scsi/scsi_transport_sas.c index 8b6d65e21bae..ce4f806bd8ec 100644 --- a/drivers/scsi/scsi_transport_sas.c +++ b/drivers/scsi/scsi_transport_sas.c | |||
@@ -65,7 +65,7 @@ get_sas_##title##_names(u32 table_key, char *buf) \ | |||
65 | ssize_t len = 0; \ | 65 | ssize_t len = 0; \ |
66 | int i; \ | 66 | int i; \ |
67 | \ | 67 | \ |
68 | for (i = 0; i < sizeof(table)/sizeof(table[0]); i++) { \ | 68 | for (i = 0; i < ARRAY_SIZE(table); i++) { \ |
69 | if (table[i].value & table_key) { \ | 69 | if (table[i].value & table_key) { \ |
70 | len += sprintf(buf + len, "%s%s", \ | 70 | len += sprintf(buf + len, "%s%s", \ |
71 | prefix, table[i].name); \ | 71 | prefix, table[i].name); \ |
@@ -83,7 +83,7 @@ get_sas_##title##_names(u32 table_key, char *buf) \ | |||
83 | ssize_t len = 0; \ | 83 | ssize_t len = 0; \ |
84 | int i; \ | 84 | int i; \ |
85 | \ | 85 | \ |
86 | for (i = 0; i < sizeof(table)/sizeof(table[0]); i++) { \ | 86 | for (i = 0; i < ARRAY_SIZE(table); i++) { \ |
87 | if (table[i].value == table_key) { \ | 87 | if (table[i].value == table_key) { \ |
88 | len += sprintf(buf + len, "%s", \ | 88 | len += sprintf(buf + len, "%s", \ |
89 | table[i].name); \ | 89 | table[i].name); \ |
diff --git a/drivers/scsi/scsi_transport_spi.c b/drivers/scsi/scsi_transport_spi.c index 780aaedcbce9..5829f97a2068 100644 --- a/drivers/scsi/scsi_transport_spi.c +++ b/drivers/scsi/scsi_transport_spi.c | |||
@@ -146,7 +146,7 @@ static inline const char *spi_signal_to_string(enum spi_signal_type type) | |||
146 | { | 146 | { |
147 | int i; | 147 | int i; |
148 | 148 | ||
149 | for (i = 0; i < sizeof(signal_types)/sizeof(signal_types[0]); i++) { | 149 | for (i = 0; i < ARRAY_SIZE(signal_types); i++) { |
150 | if (type == signal_types[i].value) | 150 | if (type == signal_types[i].value) |
151 | return signal_types[i].name; | 151 | return signal_types[i].name; |
152 | } | 152 | } |
@@ -156,7 +156,7 @@ static inline enum spi_signal_type spi_signal_to_value(const char *name) | |||
156 | { | 156 | { |
157 | int i, len; | 157 | int i, len; |
158 | 158 | ||
159 | for (i = 0; i < sizeof(signal_types)/sizeof(signal_types[0]); i++) { | 159 | for (i = 0; i < ARRAY_SIZE(signal_types); i++) { |
160 | len = strlen(signal_types[i].name); | 160 | len = strlen(signal_types[i].name); |
161 | if (strncmp(name, signal_types[i].name, len) == 0 && | 161 | if (strncmp(name, signal_types[i].name, len) == 0 && |
162 | (name[len] == '\n' || name[len] == '\0')) | 162 | (name[len] == '\n' || name[len] == '\0')) |
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index a112e49e946f..354199011246 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c | |||
@@ -175,7 +175,7 @@ static ssize_t sd_store_cache_type(struct class_device *cdev, const char *buf, | |||
175 | * it's not worth the risk */ | 175 | * it's not worth the risk */ |
176 | return -EINVAL; | 176 | return -EINVAL; |
177 | 177 | ||
178 | for (i = 0; i < sizeof(sd_cache_types)/sizeof(sd_cache_types[0]); i++) { | 178 | for (i = 0; i < ARRAY_SIZE(sd_cache_types); i++) { |
179 | const int len = strlen(sd_cache_types[i]); | 179 | const int len = strlen(sd_cache_types[i]); |
180 | if (strncmp(sd_cache_types[i], buf, len) == 0 && | 180 | if (strncmp(sd_cache_types[i], buf, len) == 0 && |
181 | buf[len] == '\n') { | 181 | buf[len] == '\n') { |
diff --git a/drivers/scsi/seagate.c b/drivers/scsi/seagate.c index 0ff83ddf13fe..7fa4da4ea64f 100644 --- a/drivers/scsi/seagate.c +++ b/drivers/scsi/seagate.c | |||
@@ -312,7 +312,7 @@ static Signature __initdata signatures[] = { | |||
312 | {"IBM F1 V1.2009/22/93", 5, 25, FD}, | 312 | {"IBM F1 V1.2009/22/93", 5, 25, FD}, |
313 | }; | 313 | }; |
314 | 314 | ||
315 | #define NUM_SIGNATURES (sizeof(signatures) / sizeof(Signature)) | 315 | #define NUM_SIGNATURES ARRAY_SIZE(signatures) |
316 | #endif /* n OVERRIDE */ | 316 | #endif /* n OVERRIDE */ |
317 | 317 | ||
318 | /* | 318 | /* |
@@ -457,7 +457,7 @@ int __init seagate_st0x_detect (struct scsi_host_template * tpnt) | |||
457 | * space for the on-board RAM instead. | 457 | * space for the on-board RAM instead. |
458 | */ | 458 | */ |
459 | 459 | ||
460 | for (i = 0; i < (sizeof (seagate_bases) / sizeof (unsigned int)); ++i) { | 460 | for (i = 0; i < ARRAY_SIZE(seagate_bases); ++i) { |
461 | void __iomem *p = ioremap(seagate_bases[i], 0x2000); | 461 | void __iomem *p = ioremap(seagate_bases[i], 0x2000); |
462 | if (!p) | 462 | if (!p) |
463 | continue; | 463 | continue; |
diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c index b098942445ec..98b9312ba8da 100644 --- a/drivers/scsi/sg.c +++ b/drivers/scsi/sg.c | |||
@@ -2635,8 +2635,7 @@ static int | |||
2635 | sg_proc_init(void) | 2635 | sg_proc_init(void) |
2636 | { | 2636 | { |
2637 | int k, mask; | 2637 | int k, mask; |
2638 | int num_leaves = | 2638 | int num_leaves = ARRAY_SIZE(sg_proc_leaf_arr); |
2639 | sizeof (sg_proc_leaf_arr) / sizeof (sg_proc_leaf_arr[0]); | ||
2640 | struct proc_dir_entry *pdep; | 2639 | struct proc_dir_entry *pdep; |
2641 | struct sg_proc_leaf * leaf; | 2640 | struct sg_proc_leaf * leaf; |
2642 | 2641 | ||
@@ -2661,8 +2660,7 @@ static void | |||
2661 | sg_proc_cleanup(void) | 2660 | sg_proc_cleanup(void) |
2662 | { | 2661 | { |
2663 | int k; | 2662 | int k; |
2664 | int num_leaves = | 2663 | int num_leaves = ARRAY_SIZE(sg_proc_leaf_arr); |
2665 | sizeof (sg_proc_leaf_arr) / sizeof (sg_proc_leaf_arr[0]); | ||
2666 | 2664 | ||
2667 | if (!sg_proc_sgp) | 2665 | if (!sg_proc_sgp) |
2668 | return; | 2666 | return; |
diff --git a/drivers/scsi/st.c b/drivers/scsi/st.c index d40e7c871c36..2691248b2cbd 100644 --- a/drivers/scsi/st.c +++ b/drivers/scsi/st.c | |||
@@ -3839,7 +3839,7 @@ static int __init st_setup(char *str) | |||
3839 | break; | 3839 | break; |
3840 | } | 3840 | } |
3841 | } | 3841 | } |
3842 | if (i >= sizeof(parms) / sizeof(struct st_dev_parm)) | 3842 | if (i >= ARRAY_SIZE(parms)) |
3843 | printk(KERN_WARNING "st: invalid parameter in '%s'\n", | 3843 | printk(KERN_WARNING "st: invalid parameter in '%s'\n", |
3844 | stp); | 3844 | stp); |
3845 | stp = strchr(stp, ','); | 3845 | stp = strchr(stp, ','); |
diff --git a/drivers/scsi/sym53c8xx_2/sym_hipd.c b/drivers/scsi/sym53c8xx_2/sym_hipd.c index a671bdc07450..940fa1e6f994 100644 --- a/drivers/scsi/sym53c8xx_2/sym_hipd.c +++ b/drivers/scsi/sym53c8xx_2/sym_hipd.c | |||
@@ -1276,8 +1276,7 @@ static struct sym_chip sym_dev_table[] = { | |||
1276 | FE_RAM|FE_IO256|FE_LEDC} | 1276 | FE_RAM|FE_IO256|FE_LEDC} |
1277 | }; | 1277 | }; |
1278 | 1278 | ||
1279 | #define sym_num_devs \ | 1279 | #define sym_num_devs (ARRAY_SIZE(sym_dev_table)) |
1280 | (sizeof(sym_dev_table) / sizeof(sym_dev_table[0])) | ||
1281 | 1280 | ||
1282 | /* | 1281 | /* |
1283 | * Look up the chip table. | 1282 | * Look up the chip table. |
diff --git a/drivers/scsi/t128.c b/drivers/scsi/t128.c index 21305fc91479..a24f661b0270 100644 --- a/drivers/scsi/t128.c +++ b/drivers/scsi/t128.c | |||
@@ -126,15 +126,15 @@ | |||
126 | static struct override { | 126 | static struct override { |
127 | unsigned long address; | 127 | unsigned long address; |
128 | int irq; | 128 | int irq; |
129 | } overrides | 129 | } overrides |
130 | #ifdef T128_OVERRIDE | 130 | #ifdef T128_OVERRIDE |
131 | [] __initdata = T128_OVERRIDE; | 131 | [] __initdata = T128_OVERRIDE; |
132 | #else | 132 | #else |
133 | [4] __initdata = {{0, IRQ_AUTO}, {0, IRQ_AUTO}, | 133 | [4] __initdata = {{0, IRQ_AUTO}, {0, IRQ_AUTO}, |
134 | {0 ,IRQ_AUTO}, {0, IRQ_AUTO}}; | 134 | {0 ,IRQ_AUTO}, {0, IRQ_AUTO}}; |
135 | #endif | 135 | #endif |
136 | 136 | ||
137 | #define NO_OVERRIDES (sizeof(overrides) / sizeof(struct override)) | 137 | #define NO_OVERRIDES ARRAY_SIZE(overrides) |
138 | 138 | ||
139 | static struct base { | 139 | static struct base { |
140 | unsigned int address; | 140 | unsigned int address; |
@@ -143,7 +143,7 @@ static struct base { | |||
143 | { 0xcc000, 0}, { 0xc8000, 0}, { 0xdc000, 0}, { 0xd8000, 0} | 143 | { 0xcc000, 0}, { 0xc8000, 0}, { 0xdc000, 0}, { 0xd8000, 0} |
144 | }; | 144 | }; |
145 | 145 | ||
146 | #define NO_BASES (sizeof (bases) / sizeof (struct base)) | 146 | #define NO_BASES ARRAY_SIZE(bases) |
147 | 147 | ||
148 | static struct signature { | 148 | static struct signature { |
149 | const char *string; | 149 | const char *string; |
@@ -152,7 +152,7 @@ static struct signature { | |||
152 | {"TSROM: SCSI BIOS, Version 1.12", 0x36}, | 152 | {"TSROM: SCSI BIOS, Version 1.12", 0x36}, |
153 | }; | 153 | }; |
154 | 154 | ||
155 | #define NO_SIGNATURES (sizeof (signatures) / sizeof (struct signature)) | 155 | #define NO_SIGNATURES ARRAY_SIZE(signatures) |
156 | 156 | ||
157 | /* | 157 | /* |
158 | * Function : t128_setup(char *str, int *ints) | 158 | * Function : t128_setup(char *str, int *ints) |
diff --git a/drivers/scsi/wd33c93.c b/drivers/scsi/wd33c93.c index d8a72609a31d..9341703dee00 100644 --- a/drivers/scsi/wd33c93.c +++ b/drivers/scsi/wd33c93.c | |||
@@ -1701,7 +1701,7 @@ wd33c93_abort(struct scsi_cmnd * cmd) | |||
1701 | } | 1701 | } |
1702 | 1702 | ||
1703 | #define MAX_WD33C93_HOSTS 4 | 1703 | #define MAX_WD33C93_HOSTS 4 |
1704 | #define MAX_SETUP_ARGS ((int)(sizeof(setup_args) / sizeof(char *))) | 1704 | #define MAX_SETUP_ARGS ARRAY_SIZE(setup_args) |
1705 | #define SETUP_BUFFER_SIZE 200 | 1705 | #define SETUP_BUFFER_SIZE 200 |
1706 | static char setup_buffer[SETUP_BUFFER_SIZE]; | 1706 | static char setup_buffer[SETUP_BUFFER_SIZE]; |
1707 | static char setup_used[MAX_SETUP_ARGS]; | 1707 | static char setup_used[MAX_SETUP_ARGS]; |
diff --git a/drivers/scsi/wd7000.c b/drivers/scsi/wd7000.c index fb54a87a80a3..e55f0ee7e7e4 100644 --- a/drivers/scsi/wd7000.c +++ b/drivers/scsi/wd7000.c | |||
@@ -267,7 +267,7 @@ static const long wd7000_biosaddr[] = { | |||
267 | 0xc0000, 0xc2000, 0xc4000, 0xc6000, 0xc8000, 0xca000, 0xcc000, 0xce000, | 267 | 0xc0000, 0xc2000, 0xc4000, 0xc6000, 0xc8000, 0xca000, 0xcc000, 0xce000, |
268 | 0xd0000, 0xd2000, 0xd4000, 0xd6000, 0xd8000, 0xda000, 0xdc000, 0xde000 | 268 | 0xd0000, 0xd2000, 0xd4000, 0xd6000, 0xd8000, 0xda000, 0xdc000, 0xde000 |
269 | }; | 269 | }; |
270 | #define NUM_ADDRS (sizeof(wd7000_biosaddr)/sizeof(long)) | 270 | #define NUM_ADDRS ARRAY_SIZE(wd7000_biosaddr) |
271 | 271 | ||
272 | static const unsigned short wd7000_iobase[] = { | 272 | static const unsigned short wd7000_iobase[] = { |
273 | 0x0300, 0x0308, 0x0310, 0x0318, 0x0320, 0x0328, 0x0330, 0x0338, | 273 | 0x0300, 0x0308, 0x0310, 0x0318, 0x0320, 0x0328, 0x0330, 0x0338, |
@@ -275,13 +275,13 @@ static const unsigned short wd7000_iobase[] = { | |||
275 | 0x0380, 0x0388, 0x0390, 0x0398, 0x03a0, 0x03a8, 0x03b0, 0x03b8, | 275 | 0x0380, 0x0388, 0x0390, 0x0398, 0x03a0, 0x03a8, 0x03b0, 0x03b8, |
276 | 0x03c0, 0x03c8, 0x03d0, 0x03d8, 0x03e0, 0x03e8, 0x03f0, 0x03f8 | 276 | 0x03c0, 0x03c8, 0x03d0, 0x03d8, 0x03e0, 0x03e8, 0x03f0, 0x03f8 |
277 | }; | 277 | }; |
278 | #define NUM_IOPORTS (sizeof(wd7000_iobase)/sizeof(unsigned short)) | 278 | #define NUM_IOPORTS ARRAY_SIZE(wd7000_iobase) |
279 | 279 | ||
280 | static const short wd7000_irq[] = { 3, 4, 5, 7, 9, 10, 11, 12, 14, 15 }; | 280 | static const short wd7000_irq[] = { 3, 4, 5, 7, 9, 10, 11, 12, 14, 15 }; |
281 | #define NUM_IRQS (sizeof(wd7000_irq)/sizeof(short)) | 281 | #define NUM_IRQS ARRAY_SIZE(wd7000_irq) |
282 | 282 | ||
283 | static const short wd7000_dma[] = { 5, 6, 7 }; | 283 | static const short wd7000_dma[] = { 5, 6, 7 }; |
284 | #define NUM_DMAS (sizeof(wd7000_dma)/sizeof(short)) | 284 | #define NUM_DMAS ARRAY_SIZE(wd7000_dma) |
285 | 285 | ||
286 | /* | 286 | /* |
287 | * The following is set up by wd7000_detect, and used thereafter for | 287 | * The following is set up by wd7000_detect, and used thereafter for |
@@ -317,7 +317,7 @@ static Config configs[] = { | |||
317 | {7, 6, 0x350, BUS_ON, BUS_OFF}, /* My configuration (Zaga) */ | 317 | {7, 6, 0x350, BUS_ON, BUS_OFF}, /* My configuration (Zaga) */ |
318 | {-1, -1, 0x0, BUS_ON, BUS_OFF} /* Empty slot */ | 318 | {-1, -1, 0x0, BUS_ON, BUS_OFF} /* Empty slot */ |
319 | }; | 319 | }; |
320 | #define NUM_CONFIGS (sizeof(configs)/sizeof(Config)) | 320 | #define NUM_CONFIGS ARRAY_SIZE(configs) |
321 | 321 | ||
322 | /* | 322 | /* |
323 | * The following list defines strings to look for in the BIOS that identify | 323 | * The following list defines strings to look for in the BIOS that identify |
@@ -333,7 +333,7 @@ typedef struct signature { | |||
333 | static const Signature signatures[] = { | 333 | static const Signature signatures[] = { |
334 | {"SSTBIOS", 0x0000d, 7} /* "SSTBIOS" @ offset 0x0000d */ | 334 | {"SSTBIOS", 0x0000d, 7} /* "SSTBIOS" @ offset 0x0000d */ |
335 | }; | 335 | }; |
336 | #define NUM_SIGNATURES (sizeof(signatures)/sizeof(Signature)) | 336 | #define NUM_SIGNATURES ARRAY_SIZE(signatures) |
337 | 337 | ||
338 | 338 | ||
339 | /* | 339 | /* |