diff options
author | Boaz Harrosh <bharrosh@panasas.com> | 2007-07-29 15:24:09 -0400 |
---|---|---|
committer | James Bottomley <jejb@mulgrave.localdomain> | 2007-08-04 10:13:28 -0400 |
commit | 66acdb0309507950376393f2fb1c8e7482fb4d52 (patch) | |
tree | 1829383c32d93fc8b4fe645ebf755b72d93ed0ce /drivers/scsi/aha152x.c | |
parent | 0ceb47987d31f8529c60f1e802e0523fcde9492c (diff) |
[SCSI] aha152x: Clean Reset path
What Reset code was doing: Save command's important/dangerous
Info on stack. NULL those members from scsi_cmnd.
Issue a Reset. wait for it to finish than restore members
and return.
What I do is save or NULL nothing. But use the "resetting"
hint in aha152x_internal_queue() to NULL out working members
and leave struct scsi_cmnd alone.
The indent here looks funny but it will change/drop in last
patch and it is clear this way what changed.
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/scsi/aha152x.c')
-rw-r--r-- | drivers/scsi/aha152x.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/drivers/scsi/aha152x.c b/drivers/scsi/aha152x.c index dc7d84bae96b..d7ca86f9d1f2 100644 --- a/drivers/scsi/aha152x.c +++ b/drivers/scsi/aha152x.c | |||
@@ -1022,6 +1022,14 @@ static int aha152x_internal_queue(Scsi_Cmnd *SCpnt, struct completion *complete, | |||
1022 | SCp.buffer : next buffer | 1022 | SCp.buffer : next buffer |
1023 | SCp.buffers_residual : left buffers in list | 1023 | SCp.buffers_residual : left buffers in list |
1024 | SCp.phase : current state of the command */ | 1024 | SCp.phase : current state of the command */ |
1025 | |||
1026 | if(phase & resetting) { | ||
1027 | SCpnt->SCp.ptr = NULL; | ||
1028 | SCpnt->SCp.this_residual = 0; | ||
1029 | SCpnt->resid = 0; | ||
1030 | SCpnt->SCp.buffer = NULL; | ||
1031 | SCpnt->SCp.buffers_residual = 0; | ||
1032 | } else { | ||
1025 | if (SCpnt->use_sg) { | 1033 | if (SCpnt->use_sg) { |
1026 | SCpnt->SCp.buffer = (struct scatterlist *) SCpnt->request_buffer; | 1034 | SCpnt->SCp.buffer = (struct scatterlist *) SCpnt->request_buffer; |
1027 | SCpnt->SCp.ptr = SG_ADDRESS(SCpnt->SCp.buffer); | 1035 | SCpnt->SCp.ptr = SG_ADDRESS(SCpnt->SCp.buffer); |
@@ -1033,6 +1041,7 @@ static int aha152x_internal_queue(Scsi_Cmnd *SCpnt, struct completion *complete, | |||
1033 | SCpnt->SCp.buffer = NULL; | 1041 | SCpnt->SCp.buffer = NULL; |
1034 | SCpnt->SCp.buffers_residual = 0; | 1042 | SCpnt->SCp.buffers_residual = 0; |
1035 | } | 1043 | } |
1044 | } | ||
1036 | 1045 | ||
1037 | DO_LOCK(flags); | 1046 | DO_LOCK(flags); |
1038 | 1047 | ||
@@ -1150,9 +1159,6 @@ static int aha152x_device_reset(Scsi_Cmnd * SCpnt) | |||
1150 | DECLARE_COMPLETION(done); | 1159 | DECLARE_COMPLETION(done); |
1151 | int ret, issued, disconnected; | 1160 | int ret, issued, disconnected; |
1152 | unsigned char old_cmd_len = SCpnt->cmd_len; | 1161 | unsigned char old_cmd_len = SCpnt->cmd_len; |
1153 | unsigned short old_use_sg = SCpnt->use_sg; | ||
1154 | void *old_buffer = SCpnt->request_buffer; | ||
1155 | unsigned old_bufflen = SCpnt->request_bufflen; | ||
1156 | unsigned long flags; | 1162 | unsigned long flags; |
1157 | unsigned long timeleft; | 1163 | unsigned long timeleft; |
1158 | 1164 | ||
@@ -1174,9 +1180,6 @@ static int aha152x_device_reset(Scsi_Cmnd * SCpnt) | |||
1174 | DO_UNLOCK(flags); | 1180 | DO_UNLOCK(flags); |
1175 | 1181 | ||
1176 | SCpnt->cmd_len = 0; | 1182 | SCpnt->cmd_len = 0; |
1177 | SCpnt->use_sg = 0; | ||
1178 | SCpnt->request_buffer = NULL; | ||
1179 | SCpnt->request_bufflen = 0; | ||
1180 | 1183 | ||
1181 | aha152x_internal_queue(SCpnt, &done, resetting, reset_done); | 1184 | aha152x_internal_queue(SCpnt, &done, resetting, reset_done); |
1182 | 1185 | ||
@@ -1189,9 +1192,6 @@ static int aha152x_device_reset(Scsi_Cmnd * SCpnt) | |||
1189 | } | 1192 | } |
1190 | 1193 | ||
1191 | SCpnt->cmd_len = old_cmd_len; | 1194 | SCpnt->cmd_len = old_cmd_len; |
1192 | SCpnt->use_sg = old_use_sg; | ||
1193 | SCpnt->request_buffer = old_buffer; | ||
1194 | SCpnt->request_bufflen = old_bufflen; | ||
1195 | 1195 | ||
1196 | DO_LOCK(flags); | 1196 | DO_LOCK(flags); |
1197 | 1197 | ||