Commit 73d2cb165af80f6a61458d808d80514d2665d7da

Authored by Boaz Harrosh
Committed by James Bottomley
1 parent 75a9a4e147

[SCSI] aha152x: Use scsi_eh API for REQUEST_SENSE invocation

- Use new scsi_eh_prep/restor_cmnd() for synchronous
    REQUEST_SENSE invocation.

Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>

Showing 1 changed file with 8 additions and 30 deletions Side-by-side Diff

drivers/scsi/aha152x.c
... ... @@ -260,6 +260,7 @@
260 260 #include <scsi/scsi_dbg.h>
261 261 #include <scsi/scsi_host.h>
262 262 #include <scsi/scsi_transport_spi.h>
  263 +#include <scsi/scsi_eh.h>
263 264 #include "aha152x.h"
264 265  
265 266 static LIST_HEAD(aha152x_host_list);
... ... @@ -558,9 +559,7 @@
558 559 struct aha152x_scdata {
559 560 Scsi_Cmnd *next; /* next sc in queue */
560 561 struct completion *done;/* semaphore to block on */
561   - unsigned char aha_orig_cmd_len;
562   - unsigned char aha_orig_cmnd[MAX_COMMAND_SIZE];
563   - int aha_orig_resid;
  562 + struct scsi_eh_save ses;
564 563 };
565 564  
566 565 /* access macros for hostdata */
... ... @@ -1017,16 +1016,10 @@
1017 1016 SCp.buffers_residual : left buffers in list
1018 1017 SCp.phase : current state of the command */
1019 1018  
1020   - if ((phase & (check_condition|resetting)) || !scsi_sglist(SCpnt)) {
1021   - if (phase & check_condition) {
1022   - SCpnt->SCp.ptr = SCpnt->sense_buffer;
1023   - SCpnt->SCp.this_residual = sizeof(SCpnt->sense_buffer);
1024   - scsi_set_resid(SCpnt, sizeof(SCpnt->sense_buffer));
1025   - } else {
1026   - SCpnt->SCp.ptr = NULL;
1027   - SCpnt->SCp.this_residual = 0;
1028   - scsi_set_resid(SCpnt, 0);
1029   - }
  1019 + if ((phase & resetting) || !scsi_sglist(SCpnt)) {
  1020 + SCpnt->SCp.ptr = NULL;
  1021 + SCpnt->SCp.this_residual = 0;
  1022 + scsi_set_resid(SCpnt, 0);
1030 1023 SCpnt->SCp.buffer = NULL;
1031 1024 SCpnt->SCp.buffers_residual = 0;
1032 1025 } else {
... ... @@ -1561,10 +1554,7 @@
1561 1554 }
1562 1555 #endif
1563 1556  
1564   - /* restore old command */
1565   - memcpy(cmd->cmnd, sc->aha_orig_cmnd, sizeof(cmd->cmnd));
1566   - cmd->cmd_len = sc->aha_orig_cmd_len;
1567   - scsi_set_resid(cmd, sc->aha_orig_resid);
  1557 + scsi_eh_restore_cmnd(cmd, &sc->ses);
1568 1558  
1569 1559 cmd->SCp.Status = SAM_STAT_CHECK_CONDITION;
1570 1560  
1571 1561  
... ... @@ -1587,22 +1577,10 @@
1587 1577 DPRINTK(debug_eh, ERR_LEAD "requesting sense\n", CMDINFO(ptr));
1588 1578 #endif
1589 1579  
1590   - /* save old command */
1591 1580 sc = SCDATA(ptr);
1592 1581 /* It was allocated in aha152x_internal_queue? */
1593 1582 BUG_ON(!sc);
1594   - memcpy(sc->aha_orig_cmnd, ptr->cmnd,
1595   - sizeof(ptr->cmnd));
1596   - sc->aha_orig_cmd_len = ptr->cmd_len;
1597   - sc->aha_orig_resid = scsi_get_resid(ptr);
1598   -
1599   - ptr->cmnd[0] = REQUEST_SENSE;
1600   - ptr->cmnd[1] = 0;
1601   - ptr->cmnd[2] = 0;
1602   - ptr->cmnd[3] = 0;
1603   - ptr->cmnd[4] = sizeof(ptr->sense_buffer);
1604   - ptr->cmnd[5] = 0;
1605   - ptr->cmd_len = 6;
  1583 + scsi_eh_prep_cmnd(ptr, &sc->ses, NULL, 0, ~0);
1606 1584  
1607 1585 DO_UNLOCK(flags);
1608 1586 aha152x_internal_queue(ptr, NULL, check_condition, ptr->scsi_done);