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 /drivers/scsi/53c700.c | |
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>
Diffstat (limited to 'drivers/scsi/53c700.c')
-rw-r--r-- | drivers/scsi/53c700.c | 19 |
1 files changed, 8 insertions, 11 deletions
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)" : ""); |