aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/ibmmca.c
diff options
context:
space:
mode:
authorTobias Klauser <tklauser@nuerscht.ch>2006-06-09 01:23:48 -0400
committerJames Bottomley <jejb@mulgrave.il.steeleye.com>2006-06-10 11:45:30 -0400
commit6391a11375de5e2bb1eb8481e54619761dc65d9f (patch)
tree956aae1d278a3f731b2e6148ff40a69aa7957ea8 /drivers/scsi/ibmmca.c
parent9dc399de0840a478adb71278becf598d3ab3aacc (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/ibmmca.c')
-rw-r--r--drivers/scsi/ibmmca.c16
1 files changed, 7 insertions, 9 deletions
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
1486int ibmmca_detect(struct scsi_host_template * scsi_template) 1486int 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 */