X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=drivers%2Fscsi%2Fimm.c;h=f97d172844be8e084cca57e3750752be77529816;hb=77b96bd7e5ee0b44aed1b77fef5949bc19e8301f;hp=a3d0c6b149583156fda2f7e2267654c6aab9f47a;hpb=37e58df30063e229ee5157f9d1c1fa1d749917c2;p=linux-2.6 diff --git a/drivers/scsi/imm.c b/drivers/scsi/imm.c index a3d0c6b149..f97d172844 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++;