aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/aha1542.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/aha1542.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/aha1542.c')
-rw-r--r--drivers/scsi/aha1542.c31
1 files changed, 14 insertions, 17 deletions
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));