aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorBoaz Harrosh <bharrosh@panasas.com>2007-11-01 12:54:44 -0400
committerJames Bottomley <James.Bottomley@HansenPartnership.com>2008-01-11 19:22:34 -0500
commit73d2cb165af80f6a61458d808d80514d2665d7da (patch)
treedd64c0635060576255e4f546ff1e5cf61f6c0899 /drivers
parent75a9a4e1476db705dbbcbd2e3a16b265ef8ec3e9 (diff)
[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>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/scsi/aha152x.c38
1 files changed, 8 insertions, 30 deletions
diff --git a/drivers/scsi/aha152x.c b/drivers/scsi/aha152x.c
index ea8c69947644..6ccdc96cc480 100644
--- a/drivers/scsi/aha152x.c
+++ b/drivers/scsi/aha152x.c
@@ -260,6 +260,7 @@
260#include <scsi/scsi_dbg.h> 260#include <scsi/scsi_dbg.h>
261#include <scsi/scsi_host.h> 261#include <scsi/scsi_host.h>
262#include <scsi/scsi_transport_spi.h> 262#include <scsi/scsi_transport_spi.h>
263#include <scsi/scsi_eh.h>
263#include "aha152x.h" 264#include "aha152x.h"
264 265
265static LIST_HEAD(aha152x_host_list); 266static LIST_HEAD(aha152x_host_list);
@@ -558,9 +559,7 @@ struct aha152x_hostdata {
558struct aha152x_scdata { 559struct aha152x_scdata {
559 Scsi_Cmnd *next; /* next sc in queue */ 560 Scsi_Cmnd *next; /* next sc in queue */
560 struct completion *done;/* semaphore to block on */ 561 struct completion *done;/* semaphore to block on */
561 unsigned char aha_orig_cmd_len; 562 struct scsi_eh_save ses;
562 unsigned char aha_orig_cmnd[MAX_COMMAND_SIZE];
563 int aha_orig_resid;
564}; 563};
565 564
566/* access macros for hostdata */ 565/* access macros for hostdata */
@@ -1017,16 +1016,10 @@ static int aha152x_internal_queue(Scsi_Cmnd *SCpnt, struct completion *complete,
1017 SCp.buffers_residual : left buffers in list 1016 SCp.buffers_residual : left buffers in list
1018 SCp.phase : current state of the command */ 1017 SCp.phase : current state of the command */
1019 1018
1020 if ((phase & (check_condition|resetting)) || !scsi_sglist(SCpnt)) { 1019 if ((phase & resetting) || !scsi_sglist(SCpnt)) {
1021 if (phase & check_condition) { 1020 SCpnt->SCp.ptr = NULL;
1022 SCpnt->SCp.ptr = SCpnt->sense_buffer; 1021 SCpnt->SCp.this_residual = 0;
1023 SCpnt->SCp.this_residual = sizeof(SCpnt->sense_buffer); 1022 scsi_set_resid(SCpnt, 0);
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 }
1030 SCpnt->SCp.buffer = NULL; 1023 SCpnt->SCp.buffer = NULL;
1031 SCpnt->SCp.buffers_residual = 0; 1024 SCpnt->SCp.buffers_residual = 0;
1032 } else { 1025 } else {
@@ -1561,10 +1554,7 @@ static void busfree_run(struct Scsi_Host *shpnt)
1561 } 1554 }
1562#endif 1555#endif
1563 1556
1564 /* restore old command */ 1557 scsi_eh_restore_cmnd(cmd, &sc->ses);
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);
1568 1558
1569 cmd->SCp.Status = SAM_STAT_CHECK_CONDITION; 1559 cmd->SCp.Status = SAM_STAT_CHECK_CONDITION;
1570 1560
@@ -1587,22 +1577,10 @@ static void busfree_run(struct Scsi_Host *shpnt)
1587 DPRINTK(debug_eh, ERR_LEAD "requesting sense\n", CMDINFO(ptr)); 1577 DPRINTK(debug_eh, ERR_LEAD "requesting sense\n", CMDINFO(ptr));
1588#endif 1578#endif
1589 1579
1590 /* save old command */
1591 sc = SCDATA(ptr); 1580 sc = SCDATA(ptr);
1592 /* It was allocated in aha152x_internal_queue? */ 1581 /* It was allocated in aha152x_internal_queue? */
1593 BUG_ON(!sc); 1582 BUG_ON(!sc);
1594 memcpy(sc->aha_orig_cmnd, ptr->cmnd, 1583 scsi_eh_prep_cmnd(ptr, &sc->ses, NULL, 0, ~0);
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;
1606 1584
1607 DO_UNLOCK(flags); 1585 DO_UNLOCK(flags);
1608 aha152x_internal_queue(ptr, NULL, check_condition, ptr->scsi_done); 1586 aha152x_internal_queue(ptr, NULL, check_condition, ptr->scsi_done);