From: Boaz Harrosh Date: Sun, 9 Sep 2007 18:13:42 +0000 (+0300) Subject: [SCSI] imm: convert to accessors and !use_sg cleanup X-Git-Tag: v2.6.25-rc1~1230^2~153 X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=3ce7c6588637614b00072569679791a04898c790;p=linux-2.6-omap-h63xx.git [SCSI] imm: convert to accessors and !use_sg cleanup - convert to accessors and !use_sg cleanup - Not ready for sg-chaining Signed-off-by: Boaz Harrosh Acked-by: Randy Dunlap Tested-by: Randy Dunlap Signed-off-by: James Bottomley --- diff --git a/drivers/scsi/imm.c b/drivers/scsi/imm.c index a3d0c6b1495..f97d172844b 100644 --- a/drivers/scsi/imm.c +++ b/drivers/scsi/imm.c @@ -837,19 +837,16 @@ static int imm_engine(imm_struct *dev, struct scsi_cmnd *cmd) /* Phase 4 - Setup scatter/gather buffers */ case 4: - if (cmd->use_sg) { - /* if many buffers are available, start filling the first */ - cmd->SCp.buffer = - (struct scatterlist *) cmd->request_buffer; + if (scsi_bufflen(cmd)) { + cmd->SCp.buffer = scsi_sglist(cmd); cmd->SCp.this_residual = cmd->SCp.buffer->length; cmd->SCp.ptr = sg_virt(cmd->SCp.buffer); } else { - /* else fill the only available buffer */ cmd->SCp.buffer = NULL; - cmd->SCp.this_residual = cmd->request_bufflen; - cmd->SCp.ptr = cmd->request_buffer; + cmd->SCp.this_residual = 0; + cmd->SCp.ptr = NULL; } - cmd->SCp.buffers_residual = cmd->use_sg - 1; + cmd->SCp.buffers_residual = scsi_sg_count(cmd) - 1; cmd->SCp.phase++; if (cmd->SCp.this_residual & 0x01) cmd->SCp.this_residual++;