diff options
author | Mark Haverkamp <markh@osdl.org> | 2006-03-27 17:44:23 (GMT) |
---|---|---|
committer | James Bottomley <jejb@mulgrave.il.steeleye.com> | 2006-04-13 15:13:19 (GMT) |
commit | 1241f3593a8857fab4259b6aa9d17f26e7de3a86 (patch) | |
tree | c1e22ea22d3fbe011ebe39ce65447893111fdc6e /drivers | |
parent | 53926274f24e5c852dbe8f89dea16b7822549472 (diff) | |
download | linux-fsl-qoriq-1241f3593a8857fab4259b6aa9d17f26e7de3a86.tar.xz |
[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')
-rw-r--r-- | drivers/scsi/aacraid/aachba.c | 22 | ||||
-rw-r--r-- | drivers/scsi/aacraid/commsup.c | 4 | ||||
-rw-r--r-- | drivers/scsi/aacraid/linit.c | 3 | ||||
-rw-r--r-- | drivers/scsi/aacraid/rkt.c | 4 | ||||
-rw-r--r-- | drivers/scsi/aacraid/rx.c | 4 | ||||
-rw-r--r-- | drivers/scsi/aacraid/sa.c | 2 |
6 files changed, 18 insertions, 21 deletions
diff --git a/drivers/scsi/aacraid/aachba.c b/drivers/scsi/aacraid/aachba.c index 31319d0..fb8350e 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) cp[11] = 0; cp[12] = 0; aac_internal_transfer(scsicmd, cp, 0, - min((unsigned int)scsicmd->cmnd[13], sizeof(cp))); + min_t(size_t, scsicmd->cmnd[13], sizeof(cp))); if (sizeof(cp) < scsicmd->cmnd[13]) { unsigned int len, offset = sizeof(cp); memset(cp, 0, offset); do { - len = min(scsicmd->cmnd[13]-offset, sizeof(cp)); + len = min_t(size_t, scsicmd->cmnd[13] - offset, + sizeof(cp)); aac_internal_transfer(scsicmd, cp, offset, len); } while ((offset += len) < scsicmd->cmnd[13]); } @@ -2080,7 +2081,6 @@ static int aac_send_srb_fib(struct scsi_cmnd* scsicmd) return 0; } - dev = (struct aac_dev *)scsicmd->device->host->hostdata; switch(scsicmd->sc_data_direction){ case DMA_TO_DEVICE: flag = SRB_DataOut; @@ -2198,8 +2198,6 @@ static unsigned long aac_build_sg(struct scsi_cmnd* scsicmd, struct sgmap* psg) scsicmd->sc_data_direction); psg->count = cpu_to_le32(sg_count); - byte_count = 0; - for (i = 0; i < sg_count; i++) { psg->sg[i].addr = cpu_to_le32(sg_dma_address(sg)); 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 sg_count = pci_map_sg(dev->pdev, sg, scsicmd->use_sg, scsicmd->sc_data_direction); - psg->count = cpu_to_le32(sg_count); - - byte_count = 0; for (i = 0; i < sg_count; i++) { + int count = sg_dma_len(sg); addr = sg_dma_address(sg); psg->sg[i].addr[0] = cpu_to_le32(addr & 0xffffffff); psg->sg[i].addr[1] = cpu_to_le32(addr>>32); - psg->sg[i].count = cpu_to_le32(sg_dma_len(sg)); - byte_count += sg_dma_len(sg); + psg->sg[i].count = cpu_to_le32(count); + byte_count += count; sg++; } + psg->count = cpu_to_le32(sg_count); /* hba wants the size to be exact */ if(byte_count > scsicmd->request_bufflen){ 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 } } else if(scsicmd->request_bufflen) { - u64 addr; - addr = pci_map_single(dev->pdev, + scsicmd->SCp.dma_handle = pci_map_single(dev->pdev, scsicmd->request_buffer, scsicmd->request_bufflen, scsicmd->sc_data_direction); + addr = scsicmd->SCp.dma_handle; psg->count = cpu_to_le32(1); psg->sg[0].addr[0] = cpu_to_le32(addr & 0xffffffff); psg->sg[0].addr[1] = cpu_to_le32(addr >> 32); psg->sg[0].count = cpu_to_le32(scsicmd->request_bufflen); - scsicmd->SCp.dma_handle = addr; byte_count = scsicmd->request_bufflen; } return byte_count; diff --git a/drivers/scsi/aacraid/commsup.c b/drivers/scsi/aacraid/commsup.c index bed4e2d..9f9f4aa 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) if (cp[length] != 0) cp[length] = 0; if (level == LOG_AAC_HIGH_ERROR) - printk(KERN_WARNING "aacraid:%s", cp); + printk(KERN_WARNING "%s:%s", dev->name, cp); else - printk(KERN_INFO "aacraid:%s", cp); + printk(KERN_INFO "%s:%s", dev->name, cp); } memset(cp, 0, 256); } diff --git a/drivers/scsi/aacraid/linit.c b/drivers/scsi/aacraid/linit.c index 9437a4c..eaf429b 100644 --- a/drivers/scsi/aacraid/linit.c +++ b/drivers/scsi/aacraid/linit.c @@ -73,7 +73,7 @@ MODULE_AUTHOR("Red Hat Inc and Adaptec"); MODULE_DESCRIPTION("Dell PERC2, 2/Si, 3/Si, 3/Di, " "Adaptec Advanced Raid Products, " - "and HP NetRAID-4M SCSI driver"); + "HP NetRAID-4M, IBM ServeRAID & ICP SCSI driver"); MODULE_LICENSE("GPL"); MODULE_VERSION(AAC_DRIVER_FULL_VERSION); @@ -777,6 +777,7 @@ static struct scsi_host_template aac_driver_template = { .cmd_per_lun = AAC_NUM_IO_FIB, #endif .use_clustering = ENABLE_CLUSTERING, + .emulated = 1, }; diff --git a/drivers/scsi/aacraid/rkt.c b/drivers/scsi/aacraid/rkt.c index e9b775d..7a23e02 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, /* * Yield the processor in case we are slow */ - schedule_timeout_uninterruptible(1); + msleep(1); } if (ok != 1) { /* @@ -343,7 +343,7 @@ static int aac_rkt_check_health(struct aac_dev *dev) NULL, NULL, NULL, NULL, NULL); pci_free_consistent(dev->pdev, sizeof(struct POSTSTATUS), post, paddr); - if ((buffer[0] == '0') && (buffer[1] == 'x')) { + if ((buffer[0] == '0') && ((buffer[1] == 'x') || (buffer[1] == 'X'))) { ret = (buffer[2] <= '9') ? (buffer[2] - '0') : (buffer[2] - 'A' + 10); ret <<= 4; 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 6998bc8..729b9eb 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, /* * Yield the processor in case we are slow */ - schedule_timeout_uninterruptible(1); + msleep(1); } if (ok != 1) { /* @@ -342,7 +342,7 @@ static int aac_rx_check_health(struct aac_dev *dev) NULL, NULL, NULL, NULL, NULL); pci_free_consistent(dev->pdev, sizeof(struct POSTSTATUS), post, paddr); - if ((buffer[0] == '0') && (buffer[1] == 'x')) { + if ((buffer[0] == '0') && ((buffer[1] == 'x') || (buffer[1] == 'X'))) { ret = (buffer[2] <= '9') ? (buffer[2] - '0') : (buffer[2] - 'A' + 10); ret <<= 4; 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 466f05c..a534549 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, ok = 1; break; } - schedule_timeout_uninterruptible(1); + msleep(1); } if (ok != 1) |