mirror of
https://github.com/edk2-porting/linux-next.git
synced 2025-01-18 10:34:24 +08:00
[SCSI] NCR5380 family: convert to accessors & !use_sg cleanup
- This patch depends on: NCR5380: Use scsi_eh API for REQUEST_SENSE invocation - convert to accessors and !use_sg cleanup - FIXME: Not sg-chain ready look for ++cmd->SCp.buffer Signed-off-by: Boaz Harrosh <bharrosh@panasas.com> Signed-off-by: James <James.Bottomley@HansenPartnership.com> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
This commit is contained in:
parent
9a3dd65baf
commit
9e0fe44ddb
@ -295,16 +295,16 @@ static __inline__ void initialize_SCp(Scsi_Cmnd * cmd)
|
|||||||
* various queues are valid.
|
* various queues are valid.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (cmd->use_sg) {
|
if (scsi_bufflen(cmd)) {
|
||||||
cmd->SCp.buffer = (struct scatterlist *) cmd->request_buffer;
|
cmd->SCp.buffer = scsi_sglist(cmd);
|
||||||
cmd->SCp.buffers_residual = cmd->use_sg - 1;
|
cmd->SCp.buffers_residual = scsi_sg_count(cmd) - 1;
|
||||||
cmd->SCp.ptr = sg_virt(cmd->SCp.buffer);
|
cmd->SCp.ptr = sg_virt(cmd->SCp.buffer);
|
||||||
cmd->SCp.this_residual = cmd->SCp.buffer->length;
|
cmd->SCp.this_residual = cmd->SCp.buffer->length;
|
||||||
} else {
|
} else {
|
||||||
cmd->SCp.buffer = NULL;
|
cmd->SCp.buffer = NULL;
|
||||||
cmd->SCp.buffers_residual = 0;
|
cmd->SCp.buffers_residual = 0;
|
||||||
cmd->SCp.ptr = (char *) cmd->request_buffer;
|
cmd->SCp.ptr = NULL;
|
||||||
cmd->SCp.this_residual = cmd->request_bufflen;
|
cmd->SCp.this_residual = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -975,14 +975,14 @@ static int NCR5380_queue_command(Scsi_Cmnd * cmd, void (*done) (Scsi_Cmnd *))
|
|||||||
case WRITE_6:
|
case WRITE_6:
|
||||||
case WRITE_10:
|
case WRITE_10:
|
||||||
hostdata->time_write[cmd->device->id] -= (jiffies - hostdata->timebase);
|
hostdata->time_write[cmd->device->id] -= (jiffies - hostdata->timebase);
|
||||||
hostdata->bytes_write[cmd->device->id] += cmd->request_bufflen;
|
hostdata->bytes_write[cmd->device->id] += scsi_bufflen(cmd);
|
||||||
hostdata->pendingw++;
|
hostdata->pendingw++;
|
||||||
break;
|
break;
|
||||||
case READ:
|
case READ:
|
||||||
case READ_6:
|
case READ_6:
|
||||||
case READ_10:
|
case READ_10:
|
||||||
hostdata->time_read[cmd->device->id] -= (jiffies - hostdata->timebase);
|
hostdata->time_read[cmd->device->id] -= (jiffies - hostdata->timebase);
|
||||||
hostdata->bytes_read[cmd->device->id] += cmd->request_bufflen;
|
hostdata->bytes_read[cmd->device->id] += scsi_bufflen(cmd);
|
||||||
hostdata->pendingr++;
|
hostdata->pendingr++;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -511,9 +511,9 @@ static inline void initialize_SCp(Scsi_Cmnd *cmd)
|
|||||||
* various queues are valid.
|
* various queues are valid.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (cmd->use_sg) {
|
if (scsi_bufflen(cmd)) {
|
||||||
cmd->SCp.buffer = (struct scatterlist *)cmd->request_buffer;
|
cmd->SCp.buffer = scsi_sglist(cmd);
|
||||||
cmd->SCp.buffers_residual = cmd->use_sg - 1;
|
cmd->SCp.buffers_residual = scsi_sg_count(cmd) - 1;
|
||||||
cmd->SCp.ptr = sg_virt(cmd->SCp.buffer);
|
cmd->SCp.ptr = sg_virt(cmd->SCp.buffer);
|
||||||
cmd->SCp.this_residual = cmd->SCp.buffer->length;
|
cmd->SCp.this_residual = cmd->SCp.buffer->length;
|
||||||
/* ++roman: Try to merge some scatter-buffers if they are at
|
/* ++roman: Try to merge some scatter-buffers if they are at
|
||||||
@ -523,8 +523,8 @@ static inline void initialize_SCp(Scsi_Cmnd *cmd)
|
|||||||
} else {
|
} else {
|
||||||
cmd->SCp.buffer = NULL;
|
cmd->SCp.buffer = NULL;
|
||||||
cmd->SCp.buffers_residual = 0;
|
cmd->SCp.buffers_residual = 0;
|
||||||
cmd->SCp.ptr = (char *)cmd->request_buffer;
|
cmd->SCp.ptr = NULL;
|
||||||
cmd->SCp.this_residual = cmd->request_bufflen;
|
cmd->SCp.this_residual = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -936,21 +936,21 @@ static int NCR5380_queue_command(Scsi_Cmnd *cmd, void (*done)(Scsi_Cmnd *))
|
|||||||
}
|
}
|
||||||
# endif
|
# endif
|
||||||
# ifdef NCR5380_STAT_LIMIT
|
# ifdef NCR5380_STAT_LIMIT
|
||||||
if (cmd->request_bufflen > NCR5380_STAT_LIMIT)
|
if (scsi_bufflen(cmd) > NCR5380_STAT_LIMIT)
|
||||||
# endif
|
# endif
|
||||||
switch (cmd->cmnd[0]) {
|
switch (cmd->cmnd[0]) {
|
||||||
case WRITE:
|
case WRITE:
|
||||||
case WRITE_6:
|
case WRITE_6:
|
||||||
case WRITE_10:
|
case WRITE_10:
|
||||||
hostdata->time_write[cmd->device->id] -= (jiffies - hostdata->timebase);
|
hostdata->time_write[cmd->device->id] -= (jiffies - hostdata->timebase);
|
||||||
hostdata->bytes_write[cmd->device->id] += cmd->request_bufflen;
|
hostdata->bytes_write[cmd->device->id] += scsi_bufflen(cmd);
|
||||||
hostdata->pendingw++;
|
hostdata->pendingw++;
|
||||||
break;
|
break;
|
||||||
case READ:
|
case READ:
|
||||||
case READ_6:
|
case READ_6:
|
||||||
case READ_10:
|
case READ_10:
|
||||||
hostdata->time_read[cmd->device->id] -= (jiffies - hostdata->timebase);
|
hostdata->time_read[cmd->device->id] -= (jiffies - hostdata->timebase);
|
||||||
hostdata->bytes_read[cmd->device->id] += cmd->request_bufflen;
|
hostdata->bytes_read[cmd->device->id] += scsi_bufflen(cmd);
|
||||||
hostdata->pendingr++;
|
hostdata->pendingr++;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1352,21 +1352,21 @@ static irqreturn_t NCR5380_intr(int irq, void *dev_id)
|
|||||||
static void collect_stats(struct NCR5380_hostdata* hostdata, Scsi_Cmnd *cmd)
|
static void collect_stats(struct NCR5380_hostdata* hostdata, Scsi_Cmnd *cmd)
|
||||||
{
|
{
|
||||||
# ifdef NCR5380_STAT_LIMIT
|
# ifdef NCR5380_STAT_LIMIT
|
||||||
if (cmd->request_bufflen > NCR5380_STAT_LIMIT)
|
if (scsi_bufflen(cmd) > NCR5380_STAT_LIMIT)
|
||||||
# endif
|
# endif
|
||||||
switch (cmd->cmnd[0]) {
|
switch (cmd->cmnd[0]) {
|
||||||
case WRITE:
|
case WRITE:
|
||||||
case WRITE_6:
|
case WRITE_6:
|
||||||
case WRITE_10:
|
case WRITE_10:
|
||||||
hostdata->time_write[cmd->device->id] += (jiffies - hostdata->timebase);
|
hostdata->time_write[cmd->device->id] += (jiffies - hostdata->timebase);
|
||||||
/*hostdata->bytes_write[cmd->device->id] += cmd->request_bufflen;*/
|
/*hostdata->bytes_write[cmd->device->id] += scsi_bufflen(cmd);*/
|
||||||
hostdata->pendingw--;
|
hostdata->pendingw--;
|
||||||
break;
|
break;
|
||||||
case READ:
|
case READ:
|
||||||
case READ_6:
|
case READ_6:
|
||||||
case READ_10:
|
case READ_10:
|
||||||
hostdata->time_read[cmd->device->id] += (jiffies - hostdata->timebase);
|
hostdata->time_read[cmd->device->id] += (jiffies - hostdata->timebase);
|
||||||
/*hostdata->bytes_read[cmd->device->id] += cmd->request_bufflen;*/
|
/*hostdata->bytes_read[cmd->device->id] += scsi_bufflen(cmd);*/
|
||||||
hostdata->pendingr--;
|
hostdata->pendingr--;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -515,9 +515,9 @@ static __inline__ void initialize_SCp(struct scsi_cmnd *cmd)
|
|||||||
* various queues are valid.
|
* various queues are valid.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (cmd->use_sg) {
|
if (scsi_bufflen(cmd)) {
|
||||||
cmd->SCp.buffer = (struct scatterlist *) cmd->request_buffer;
|
cmd->SCp.buffer = scsi_sglist(cmd);
|
||||||
cmd->SCp.buffers_residual = cmd->use_sg - 1;
|
cmd->SCp.buffers_residual = scsi_sg_count(cmd) - 1;
|
||||||
cmd->SCp.ptr = (char *) SGADDR(cmd->SCp.buffer);
|
cmd->SCp.ptr = (char *) SGADDR(cmd->SCp.buffer);
|
||||||
cmd->SCp.this_residual = cmd->SCp.buffer->length;
|
cmd->SCp.this_residual = cmd->SCp.buffer->length;
|
||||||
|
|
||||||
@ -528,8 +528,8 @@ static __inline__ void initialize_SCp(struct scsi_cmnd *cmd)
|
|||||||
} else {
|
} else {
|
||||||
cmd->SCp.buffer = NULL;
|
cmd->SCp.buffer = NULL;
|
||||||
cmd->SCp.buffers_residual = 0;
|
cmd->SCp.buffers_residual = 0;
|
||||||
cmd->SCp.ptr = (char *) cmd->request_buffer;
|
cmd->SCp.ptr = NULL;
|
||||||
cmd->SCp.this_residual = cmd->request_bufflen;
|
cmd->SCp.this_residual = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -935,7 +935,7 @@ static int NCR5380_queue_command(struct scsi_cmnd *cmd,
|
|||||||
}
|
}
|
||||||
# endif
|
# endif
|
||||||
# ifdef NCR5380_STAT_LIMIT
|
# ifdef NCR5380_STAT_LIMIT
|
||||||
if (cmd->request_bufflen > NCR5380_STAT_LIMIT)
|
if (scsi_bufflen(cmd) > NCR5380_STAT_LIMIT)
|
||||||
# endif
|
# endif
|
||||||
switch (cmd->cmnd[0])
|
switch (cmd->cmnd[0])
|
||||||
{
|
{
|
||||||
@ -943,14 +943,14 @@ static int NCR5380_queue_command(struct scsi_cmnd *cmd,
|
|||||||
case WRITE_6:
|
case WRITE_6:
|
||||||
case WRITE_10:
|
case WRITE_10:
|
||||||
hostdata->time_write[cmd->device->id] -= (jiffies - hostdata->timebase);
|
hostdata->time_write[cmd->device->id] -= (jiffies - hostdata->timebase);
|
||||||
hostdata->bytes_write[cmd->device->id] += cmd->request_bufflen;
|
hostdata->bytes_write[cmd->device->id] += scsi_bufflen(cmd);
|
||||||
hostdata->pendingw++;
|
hostdata->pendingw++;
|
||||||
break;
|
break;
|
||||||
case READ:
|
case READ:
|
||||||
case READ_6:
|
case READ_6:
|
||||||
case READ_10:
|
case READ_10:
|
||||||
hostdata->time_read[cmd->device->id] -= (jiffies - hostdata->timebase);
|
hostdata->time_read[cmd->device->id] -= (jiffies - hostdata->timebase);
|
||||||
hostdata->bytes_read[cmd->device->id] += cmd->request_bufflen;
|
hostdata->bytes_read[cmd->device->id] += scsi_bufflen(cmd);
|
||||||
hostdata->pendingr++;
|
hostdata->pendingr++;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1345,7 +1345,7 @@ static void collect_stats(struct NCR5380_hostdata *hostdata,
|
|||||||
struct scsi_cmnd *cmd)
|
struct scsi_cmnd *cmd)
|
||||||
{
|
{
|
||||||
# ifdef NCR5380_STAT_LIMIT
|
# ifdef NCR5380_STAT_LIMIT
|
||||||
if (cmd->request_bufflen > NCR5380_STAT_LIMIT)
|
if (scsi_bufflen(cmd) > NCR5380_STAT_LIMIT)
|
||||||
# endif
|
# endif
|
||||||
switch (cmd->cmnd[0])
|
switch (cmd->cmnd[0])
|
||||||
{
|
{
|
||||||
@ -1353,14 +1353,14 @@ static void collect_stats(struct NCR5380_hostdata *hostdata,
|
|||||||
case WRITE_6:
|
case WRITE_6:
|
||||||
case WRITE_10:
|
case WRITE_10:
|
||||||
hostdata->time_write[cmd->device->id] += (jiffies - hostdata->timebase);
|
hostdata->time_write[cmd->device->id] += (jiffies - hostdata->timebase);
|
||||||
/*hostdata->bytes_write[cmd->device->id] += cmd->request_bufflen;*/
|
/*hostdata->bytes_write[cmd->device->id] += scsi_bufflen(cmd);*/
|
||||||
hostdata->pendingw--;
|
hostdata->pendingw--;
|
||||||
break;
|
break;
|
||||||
case READ:
|
case READ:
|
||||||
case READ_6:
|
case READ_6:
|
||||||
case READ_10:
|
case READ_10:
|
||||||
hostdata->time_read[cmd->device->id] += (jiffies - hostdata->timebase);
|
hostdata->time_read[cmd->device->id] += (jiffies - hostdata->timebase);
|
||||||
/*hostdata->bytes_read[cmd->device->id] += cmd->request_bufflen;*/
|
/*hostdata->bytes_read[cmd->device->id] += scsi_bufflen(cmd);*/
|
||||||
hostdata->pendingr--;
|
hostdata->pendingr--;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user