aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/aacraid
diff options
context:
space:
mode:
authorMark Haverkamp <markh@osdl.org>2006-03-27 12:44:23 -0500
committerJames Bottomley <jejb@mulgrave.il.steeleye.com>2006-04-13 11:13:19 -0400
commit1241f3593a8857fab4259b6aa9d17f26e7de3a86 (patch)
treec1e22ea22d3fbe011ebe39ce65447893111fdc6e /drivers/scsi/aacraid
parent53926274f24e5c852dbe8f89dea16b7822549472 (diff)
[SCSI] aacraid: General driver cleanup
Received from Mark Salyzyn Remove superfluous code, optimize code, harden code, cast code, correct some text, use msleep instead of schedule_timeout_interruptible. No bugs. Signed-off-by: Mark Haverkamp <markh@osdl.org> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/scsi/aacraid')
-rw-r--r--drivers/scsi/aacraid/aachba.c22
-rw-r--r--drivers/scsi/aacraid/commsup.c4
-rw-r--r--drivers/scsi/aacraid/linit.c3
-rw-r--r--drivers/scsi/aacraid/rkt.c4
-rw-r--r--drivers/scsi/aacraid/rx.c4
-rw-r--r--drivers/scsi/aacraid/sa.c2
6 files changed, 18 insertions, 21 deletions
diff --git a/drivers/scsi/aacraid/aachba.c b/drivers/scsi/aacraid/aachba.c
index 31319d052102..fb8350e86d98 100644
--- a/drivers/scsi/aacraid/aachba.c
+++ b/drivers/scsi/aacraid/aachba.c
@@ -1607,13 +1607,14 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd)
1607 cp[11] = 0; 1607 cp[11] = 0;
1608 cp[12] = 0; 1608 cp[12] = 0;
1609 aac_internal_transfer(scsicmd, cp, 0, 1609 aac_internal_transfer(scsicmd, cp, 0,
1610 min((unsigned int)scsicmd->cmnd[13], sizeof(cp))); 1610 min_t(size_t, scsicmd->cmnd[13], sizeof(cp)));
1611 if (sizeof(cp) < scsicmd->cmnd[13]) { 1611 if (sizeof(cp) < scsicmd->cmnd[13]) {
1612 unsigned int len, offset = sizeof(cp); 1612 unsigned int len, offset = sizeof(cp);
1613 1613
1614 memset(cp, 0, offset); 1614 memset(cp, 0, offset);
1615 do { 1615 do {
1616 len = min(scsicmd->cmnd[13]-offset, sizeof(cp)); 1616 len = min_t(size_t, scsicmd->cmnd[13] - offset,
1617 sizeof(cp));
1617 aac_internal_transfer(scsicmd, cp, offset, len); 1618 aac_internal_transfer(scsicmd, cp, offset, len);
1618 } while ((offset += len) < scsicmd->cmnd[13]); 1619 } while ((offset += len) < scsicmd->cmnd[13]);
1619 } 1620 }
@@ -2080,7 +2081,6 @@ static int aac_send_srb_fib(struct scsi_cmnd* scsicmd)
2080 return 0; 2081 return 0;
2081 } 2082 }
2082 2083
2083 dev = (struct aac_dev *)scsicmd->device->host->hostdata;
2084 switch(scsicmd->sc_data_direction){ 2084 switch(scsicmd->sc_data_direction){
2085 case DMA_TO_DEVICE: 2085 case DMA_TO_DEVICE:
2086 flag = SRB_DataOut; 2086 flag = SRB_DataOut;
@@ -2198,8 +2198,6 @@ static unsigned long aac_build_sg(struct scsi_cmnd* scsicmd, struct sgmap* psg)
2198 scsicmd->sc_data_direction); 2198 scsicmd->sc_data_direction);
2199 psg->count = cpu_to_le32(sg_count); 2199 psg->count = cpu_to_le32(sg_count);
2200 2200
2201 byte_count = 0;
2202
2203 for (i = 0; i < sg_count; i++) { 2201 for (i = 0; i < sg_count; i++) {
2204 psg->sg[i].addr = cpu_to_le32(sg_dma_address(sg)); 2202 psg->sg[i].addr = cpu_to_le32(sg_dma_address(sg));
2205 psg->sg[i].count = cpu_to_le32(sg_dma_len(sg)); 2203 psg->sg[i].count = cpu_to_le32(sg_dma_len(sg));
@@ -2255,18 +2253,17 @@ static unsigned long aac_build_sg64(struct scsi_cmnd* scsicmd, struct sgmap64* p
2255 2253
2256 sg_count = pci_map_sg(dev->pdev, sg, scsicmd->use_sg, 2254 sg_count = pci_map_sg(dev->pdev, sg, scsicmd->use_sg,
2257 scsicmd->sc_data_direction); 2255 scsicmd->sc_data_direction);
2258 psg->count = cpu_to_le32(sg_count);
2259
2260 byte_count = 0;
2261 2256
2262 for (i = 0; i < sg_count; i++) { 2257 for (i = 0; i < sg_count; i++) {
2258 int count = sg_dma_len(sg);
2263 addr = sg_dma_address(sg); 2259 addr = sg_dma_address(sg);
2264 psg->sg[i].addr[0] = cpu_to_le32(addr & 0xffffffff); 2260 psg->sg[i].addr[0] = cpu_to_le32(addr & 0xffffffff);
2265 psg->sg[i].addr[1] = cpu_to_le32(addr>>32); 2261 psg->sg[i].addr[1] = cpu_to_le32(addr>>32);
2266 psg->sg[i].count = cpu_to_le32(sg_dma_len(sg)); 2262 psg->sg[i].count = cpu_to_le32(count);
2267 byte_count += sg_dma_len(sg); 2263 byte_count += count;
2268 sg++; 2264 sg++;
2269 } 2265 }
2266 psg->count = cpu_to_le32(sg_count);
2270 /* hba wants the size to be exact */ 2267 /* hba wants the size to be exact */
2271 if(byte_count > scsicmd->request_bufflen){ 2268 if(byte_count > scsicmd->request_bufflen){
2272 u32 temp = le32_to_cpu(psg->sg[i-1].count) - 2269 u32 temp = le32_to_cpu(psg->sg[i-1].count) -
@@ -2281,16 +2278,15 @@ static unsigned long aac_build_sg64(struct scsi_cmnd* scsicmd, struct sgmap64* p
2281 } 2278 }
2282 } 2279 }
2283 else if(scsicmd->request_bufflen) { 2280 else if(scsicmd->request_bufflen) {
2284 u64 addr; 2281 scsicmd->SCp.dma_handle = pci_map_single(dev->pdev,
2285 addr = pci_map_single(dev->pdev,
2286 scsicmd->request_buffer, 2282 scsicmd->request_buffer,
2287 scsicmd->request_bufflen, 2283 scsicmd->request_bufflen,
2288 scsicmd->sc_data_direction); 2284 scsicmd->sc_data_direction);
2285 addr = scsicmd->SCp.dma_handle;
2289 psg->count = cpu_to_le32(1); 2286 psg->count = cpu_to_le32(1);
2290 psg->sg[0].addr[0] = cpu_to_le32(addr & 0xffffffff); 2287 psg->sg[0].addr[0] = cpu_to_le32(addr & 0xffffffff);
2291 psg->sg[0].addr[1] = cpu_to_le32(addr >> 32); 2288 psg->sg[0].addr[1] = cpu_to_le32(addr >> 32);
2292 psg->sg[0].count = cpu_to_le32(scsicmd->request_bufflen); 2289 psg->sg[0].count = cpu_to_le32(scsicmd->request_bufflen);
2293 scsicmd->SCp.dma_handle = addr;
2294 byte_count = scsicmd->request_bufflen; 2290 byte_count = scsicmd->request_bufflen;
2295 } 2291 }
2296 return byte_count; 2292 return byte_count;
diff --git a/drivers/scsi/aacraid/commsup.c b/drivers/scsi/aacraid/commsup.c
index bed4e2dd1f3e..9f9f4aae23c0 100644
--- a/drivers/scsi/aacraid/commsup.c
+++ b/drivers/scsi/aacraid/commsup.c
@@ -767,9 +767,9 @@ void aac_printf(struct aac_dev *dev, u32 val)
767 if (cp[length] != 0) 767 if (cp[length] != 0)
768 cp[length] = 0; 768 cp[length] = 0;
769 if (level == LOG_AAC_HIGH_ERROR) 769 if (level == LOG_AAC_HIGH_ERROR)
770 printk(KERN_WARNING "aacraid:%s", cp); 770 printk(KERN_WARNING "%s:%s", dev->name, cp);
771 else 771 else
772 printk(KERN_INFO "aacraid:%s", cp); 772 printk(KERN_INFO "%s:%s", dev->name, cp);
773 } 773 }
774 memset(cp, 0, 256); 774 memset(cp, 0, 256);
775} 775}
diff --git a/drivers/scsi/aacraid/linit.c b/drivers/scsi/aacraid/linit.c
index 9437a4c8b64a..eaf429b8778e 100644
--- a/drivers/scsi/aacraid/linit.c
+++ b/drivers/scsi/aacraid/linit.c
@@ -73,7 +73,7 @@
73MODULE_AUTHOR("Red Hat Inc and Adaptec"); 73MODULE_AUTHOR("Red Hat Inc and Adaptec");
74MODULE_DESCRIPTION("Dell PERC2, 2/Si, 3/Si, 3/Di, " 74MODULE_DESCRIPTION("Dell PERC2, 2/Si, 3/Si, 3/Di, "
75 "Adaptec Advanced Raid Products, " 75 "Adaptec Advanced Raid Products, "
76 "and HP NetRAID-4M SCSI driver"); 76 "HP NetRAID-4M, IBM ServeRAID & ICP SCSI driver");
77MODULE_LICENSE("GPL"); 77MODULE_LICENSE("GPL");
78MODULE_VERSION(AAC_DRIVER_FULL_VERSION); 78MODULE_VERSION(AAC_DRIVER_FULL_VERSION);
79 79
@@ -777,6 +777,7 @@ static struct scsi_host_template aac_driver_template = {
777 .cmd_per_lun = AAC_NUM_IO_FIB, 777 .cmd_per_lun = AAC_NUM_IO_FIB,
778#endif 778#endif
779 .use_clustering = ENABLE_CLUSTERING, 779 .use_clustering = ENABLE_CLUSTERING,
780 .emulated = 1,
780}; 781};
781 782
782 783
diff --git a/drivers/scsi/aacraid/rkt.c b/drivers/scsi/aacraid/rkt.c
index e9b775d6bec9..7a23e027eb78 100644
--- a/drivers/scsi/aacraid/rkt.c
+++ b/drivers/scsi/aacraid/rkt.c
@@ -183,7 +183,7 @@ static int rkt_sync_cmd(struct aac_dev *dev, u32 command,
183 /* 183 /*
184 * Yield the processor in case we are slow 184 * Yield the processor in case we are slow
185 */ 185 */
186 schedule_timeout_uninterruptible(1); 186 msleep(1);
187 } 187 }
188 if (ok != 1) { 188 if (ok != 1) {
189 /* 189 /*
@@ -343,7 +343,7 @@ static int aac_rkt_check_health(struct aac_dev *dev)
343 NULL, NULL, NULL, NULL, NULL); 343 NULL, NULL, NULL, NULL, NULL);
344 pci_free_consistent(dev->pdev, sizeof(struct POSTSTATUS), 344 pci_free_consistent(dev->pdev, sizeof(struct POSTSTATUS),
345 post, paddr); 345 post, paddr);
346 if ((buffer[0] == '0') && (buffer[1] == 'x')) { 346 if ((buffer[0] == '0') && ((buffer[1] == 'x') || (buffer[1] == 'X'))) {
347 ret = (buffer[2] <= '9') ? (buffer[2] - '0') : (buffer[2] - 'A' + 10); 347 ret = (buffer[2] <= '9') ? (buffer[2] - '0') : (buffer[2] - 'A' + 10);
348 ret <<= 4; 348 ret <<= 4;
349 ret += (buffer[3] <= '9') ? (buffer[3] - '0') : (buffer[3] - 'A' + 10); 349 ret += (buffer[3] <= '9') ? (buffer[3] - '0') : (buffer[3] - 'A' + 10);
diff --git a/drivers/scsi/aacraid/rx.c b/drivers/scsi/aacraid/rx.c
index 6998bc877dd6..729b9eb268c2 100644
--- a/drivers/scsi/aacraid/rx.c
+++ b/drivers/scsi/aacraid/rx.c
@@ -183,7 +183,7 @@ static int rx_sync_cmd(struct aac_dev *dev, u32 command,
183 /* 183 /*
184 * Yield the processor in case we are slow 184 * Yield the processor in case we are slow
185 */ 185 */
186 schedule_timeout_uninterruptible(1); 186 msleep(1);
187 } 187 }
188 if (ok != 1) { 188 if (ok != 1) {
189 /* 189 /*
@@ -342,7 +342,7 @@ static int aac_rx_check_health(struct aac_dev *dev)
342 NULL, NULL, NULL, NULL, NULL); 342 NULL, NULL, NULL, NULL, NULL);
343 pci_free_consistent(dev->pdev, sizeof(struct POSTSTATUS), 343 pci_free_consistent(dev->pdev, sizeof(struct POSTSTATUS),
344 post, paddr); 344 post, paddr);
345 if ((buffer[0] == '0') && (buffer[1] == 'x')) { 345 if ((buffer[0] == '0') && ((buffer[1] == 'x') || (buffer[1] == 'X'))) {
346 ret = (buffer[2] <= '9') ? (buffer[2] - '0') : (buffer[2] - 'A' + 10); 346 ret = (buffer[2] <= '9') ? (buffer[2] - '0') : (buffer[2] - 'A' + 10);
347 ret <<= 4; 347 ret <<= 4;
348 ret += (buffer[3] <= '9') ? (buffer[3] - '0') : (buffer[3] - 'A' + 10); 348 ret += (buffer[3] <= '9') ? (buffer[3] - '0') : (buffer[3] - 'A' + 10);
diff --git a/drivers/scsi/aacraid/sa.c b/drivers/scsi/aacraid/sa.c
index 466f05cfbf0c..a53454908205 100644
--- a/drivers/scsi/aacraid/sa.c
+++ b/drivers/scsi/aacraid/sa.c
@@ -189,7 +189,7 @@ static int sa_sync_cmd(struct aac_dev *dev, u32 command,
189 ok = 1; 189 ok = 1;
190 break; 190 break;
191 } 191 }
192 schedule_timeout_uninterruptible(1); 192 msleep(1);
193 } 193 }
194 194
195 if (ok != 1) 195 if (ok != 1)