[SCSI] 3w-xxxx: use sg buffer copy helper functions

This rewrites tw_transfer_internal with scsi_sg_copy_from/to_buffer.

Signed-off-by: FUJITA Tomonori <[email protected]>
Cc: Adam Radford <[email protected]>
Signed-off-by: James Bottomley <[email protected]>
This commit is contained in:
FUJITA Tomonori authored and James Bottomley committed 2008-04-07 12:15:46 -05:00
1 parent 31fe47d437
commit e943752ecf
1 file changed
+2 -10
+2 -10
View File
@@ -1463,18 +1463,10 @@ static void tw_transfer_internal(TW_Device_Extension *tw_dev, int request_id,
void *data, unsigned int len)
{
struct scsi_cmnd *cmd = tw_dev->srb[request_id];
void *buf;
unsigned int transfer_len;
unsigned long flags = 0;
struct scatterlist *sg = scsi_sglist(cmd);
unsigned long flags;
local_irq_save(flags);
buf = kmap_atomic(sg_page(sg), KM_IRQ0) + sg->offset;
transfer_len = min(sg->length, len);
memcpy(buf, data, transfer_len);
kunmap_atomic(buf - sg->offset, KM_IRQ0);
scsi_sg_copy_from_buffer(cmd, data, len);
local_irq_restore(flags);
}