diff options
author | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2008-03-08 23:44:37 -0500 |
---|---|---|
committer | James Bottomley <James.Bottomley@HansenPartnership.com> | 2008-04-07 13:15:46 -0400 |
commit | 035f5e06515a66827015202685e457a5534441b7 (patch) | |
tree | d8050869fc3965fd1cbd78b1eab4702d75719820 /drivers | |
parent | e943752ecf0ce41cdf949d565140d91c7711dfd9 (diff) |
[SCSI] 3w-9xxx: use sg buffer copy helper functions
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Cc: Adam Radford <linuxraid@amcc.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/scsi/3w-9xxx.c | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/drivers/scsi/3w-9xxx.c b/drivers/scsi/3w-9xxx.c index b4912d1cee2a..fa922f806357 100644 --- a/drivers/scsi/3w-9xxx.c +++ b/drivers/scsi/3w-9xxx.c | |||
@@ -1838,12 +1838,11 @@ static int twa_scsiop_execute_scsi(TW_Device_Extension *tw_dev, int request_id, | |||
1838 | if (scsi_sg_count(srb)) { | 1838 | if (scsi_sg_count(srb)) { |
1839 | if ((scsi_sg_count(srb) == 1) && | 1839 | if ((scsi_sg_count(srb) == 1) && |
1840 | (scsi_bufflen(srb) < TW_MIN_SGL_LENGTH)) { | 1840 | (scsi_bufflen(srb) < TW_MIN_SGL_LENGTH)) { |
1841 | if (srb->sc_data_direction == DMA_TO_DEVICE || srb->sc_data_direction == DMA_BIDIRECTIONAL) { | 1841 | if (srb->sc_data_direction == DMA_TO_DEVICE || |
1842 | struct scatterlist *sg = scsi_sglist(srb); | 1842 | srb->sc_data_direction == DMA_BIDIRECTIONAL) |
1843 | char *buf = kmap_atomic(sg_page(sg), KM_IRQ0) + sg->offset; | 1843 | scsi_sg_copy_to_buffer(srb, |
1844 | memcpy(tw_dev->generic_buffer_virt[request_id], buf, sg->length); | 1844 | tw_dev->generic_buffer_virt[request_id], |
1845 | kunmap_atomic(buf - sg->offset, KM_IRQ0); | 1845 | TW_SECTOR_SIZE); |
1846 | } | ||
1847 | command_packet->sg_list[0].address = TW_CPU_TO_SGL(tw_dev->generic_buffer_phys[request_id]); | 1846 | command_packet->sg_list[0].address = TW_CPU_TO_SGL(tw_dev->generic_buffer_phys[request_id]); |
1848 | command_packet->sg_list[0].length = cpu_to_le32(TW_MIN_SGL_LENGTH); | 1847 | command_packet->sg_list[0].length = cpu_to_le32(TW_MIN_SGL_LENGTH); |
1849 | } else { | 1848 | } else { |
@@ -1915,13 +1914,11 @@ static void twa_scsiop_execute_scsi_complete(TW_Device_Extension *tw_dev, int re | |||
1915 | (cmd->sc_data_direction == DMA_FROM_DEVICE || | 1914 | (cmd->sc_data_direction == DMA_FROM_DEVICE || |
1916 | cmd->sc_data_direction == DMA_BIDIRECTIONAL)) { | 1915 | cmd->sc_data_direction == DMA_BIDIRECTIONAL)) { |
1917 | if (scsi_sg_count(cmd) == 1) { | 1916 | if (scsi_sg_count(cmd) == 1) { |
1918 | struct scatterlist *sg = scsi_sglist(tw_dev->srb[request_id]); | 1917 | unsigned long flags; |
1919 | char *buf; | 1918 | void *buf = tw_dev->generic_buffer_virt[request_id]; |
1920 | unsigned long flags = 0; | 1919 | |
1921 | local_irq_save(flags); | 1920 | local_irq_save(flags); |
1922 | buf = kmap_atomic(sg_page(sg), KM_IRQ0) + sg->offset; | 1921 | scsi_sg_copy_from_buffer(cmd, buf, TW_SECTOR_SIZE); |
1923 | memcpy(buf, tw_dev->generic_buffer_virt[request_id], sg->length); | ||
1924 | kunmap_atomic(buf - sg->offset, KM_IRQ0); | ||
1925 | local_irq_restore(flags); | 1922 | local_irq_restore(flags); |
1926 | } | 1923 | } |
1927 | } | 1924 | } |