aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi
diff options
context:
space:
mode:
authorJeff Garzik <jgarzik@pobox.com>2005-12-24 09:31:05 -0500
committerJeff Garzik <jgarzik@pobox.com>2005-12-24 09:31:05 -0500
commitaaadff81195056c7c14e0d834b3318c624c0fd78 (patch)
tree34d66d8dcb25fa9ffb568f8acfdb317ddf203b44 /drivers/scsi
parentc6329f4df2263ab5a40601a5236639e61b682f51 (diff)
parentdf7addbb45874f0f992266003155de5a22e1872f (diff)
Merge branch 'master'
Diffstat (limited to 'drivers/scsi')
-rw-r--r--drivers/scsi/dpt_i2o.c25
-rw-r--r--drivers/scsi/ibmvscsi/ibmvscsi.h2
-rw-r--r--drivers/scsi/ibmvscsi/iseries_vscsi.c3
-rw-r--r--drivers/scsi/ibmvscsi/rpa_vscsi.c8
-rw-r--r--drivers/scsi/iscsi_tcp.c2
-rw-r--r--drivers/scsi/megaraid.c2
-rw-r--r--drivers/scsi/qla2xxx/qla_def.h10
-rw-r--r--drivers/scsi/qla2xxx/qla_init.c6
-rw-r--r--drivers/scsi/qla2xxx/qla_isr.c15
-rw-r--r--drivers/scsi/scsi_error.c7
-rw-r--r--drivers/scsi/scsi_lib.c33
-rw-r--r--drivers/scsi/scsi_transport_iscsi.c2
-rw-r--r--drivers/scsi/sd.c16
-rw-r--r--drivers/scsi/sr.c20
-rw-r--r--drivers/scsi/st.c19
-rw-r--r--drivers/scsi/sym53c8xx_2/sym_hipd.c4
16 files changed, 86 insertions, 88 deletions
diff --git a/drivers/scsi/dpt_i2o.c b/drivers/scsi/dpt_i2o.c
index 418fc7b896ac..6252b9ddc01e 100644
--- a/drivers/scsi/dpt_i2o.c
+++ b/drivers/scsi/dpt_i2o.c
@@ -660,7 +660,12 @@ static int adpt_abort(struct scsi_cmnd * cmd)
660 msg[2] = 0; 660 msg[2] = 0;
661 msg[3]= 0; 661 msg[3]= 0;
662 msg[4] = (u32)cmd; 662 msg[4] = (u32)cmd;
663 if( (rcode = adpt_i2o_post_wait(pHba, msg, sizeof(msg), FOREVER)) != 0){ 663 if (pHba->host)
664 spin_lock_irq(pHba->host->host_lock);
665 rcode = adpt_i2o_post_wait(pHba, msg, sizeof(msg), FOREVER);
666 if (pHba->host)
667 spin_unlock_irq(pHba->host->host_lock);
668 if (rcode != 0) {
664 if(rcode == -EOPNOTSUPP ){ 669 if(rcode == -EOPNOTSUPP ){
665 printk(KERN_INFO"%s: Abort cmd not supported\n",pHba->name); 670 printk(KERN_INFO"%s: Abort cmd not supported\n",pHba->name);
666 return FAILED; 671 return FAILED;
@@ -697,10 +702,15 @@ static int adpt_device_reset(struct scsi_cmnd* cmd)
697 msg[2] = 0; 702 msg[2] = 0;
698 msg[3] = 0; 703 msg[3] = 0;
699 704
705 if (pHba->host)
706 spin_lock_irq(pHba->host->host_lock);
700 old_state = d->state; 707 old_state = d->state;
701 d->state |= DPTI_DEV_RESET; 708 d->state |= DPTI_DEV_RESET;
702 if( (rcode = adpt_i2o_post_wait(pHba, msg,sizeof(msg), FOREVER)) ){ 709 rcode = adpt_i2o_post_wait(pHba, msg,sizeof(msg), FOREVER);
703 d->state = old_state; 710 d->state = old_state;
711 if (pHba->host)
712 spin_unlock_irq(pHba->host->host_lock);
713 if (rcode != 0) {
704 if(rcode == -EOPNOTSUPP ){ 714 if(rcode == -EOPNOTSUPP ){
705 printk(KERN_INFO"%s: Device reset not supported\n",pHba->name); 715 printk(KERN_INFO"%s: Device reset not supported\n",pHba->name);
706 return FAILED; 716 return FAILED;
@@ -708,7 +718,6 @@ static int adpt_device_reset(struct scsi_cmnd* cmd)
708 printk(KERN_INFO"%s: Device reset failed\n",pHba->name); 718 printk(KERN_INFO"%s: Device reset failed\n",pHba->name);
709 return FAILED; 719 return FAILED;
710 } else { 720 } else {
711 d->state = old_state;
712 printk(KERN_INFO"%s: Device reset successful\n",pHba->name); 721 printk(KERN_INFO"%s: Device reset successful\n",pHba->name);
713 return SUCCESS; 722 return SUCCESS;
714 } 723 }
@@ -721,6 +730,7 @@ static int adpt_bus_reset(struct scsi_cmnd* cmd)
721{ 730{
722 adpt_hba* pHba; 731 adpt_hba* pHba;
723 u32 msg[4]; 732 u32 msg[4];
733 u32 rcode;
724 734
725 pHba = (adpt_hba*)cmd->device->host->hostdata[0]; 735 pHba = (adpt_hba*)cmd->device->host->hostdata[0];
726 memset(msg, 0, sizeof(msg)); 736 memset(msg, 0, sizeof(msg));
@@ -729,7 +739,12 @@ static int adpt_bus_reset(struct scsi_cmnd* cmd)
729 msg[1] = (I2O_HBA_BUS_RESET<<24|HOST_TID<<12|pHba->channel[cmd->device->channel].tid); 739 msg[1] = (I2O_HBA_BUS_RESET<<24|HOST_TID<<12|pHba->channel[cmd->device->channel].tid);
730 msg[2] = 0; 740 msg[2] = 0;
731 msg[3] = 0; 741 msg[3] = 0;
732 if(adpt_i2o_post_wait(pHba, msg,sizeof(msg), FOREVER) ){ 742 if (pHba->host)
743 spin_lock_irq(pHba->host->host_lock);
744 rcode = adpt_i2o_post_wait(pHba, msg,sizeof(msg), FOREVER);
745 if (pHba->host)
746 spin_unlock_irq(pHba->host->host_lock);
747 if (rcode != 0) {
733 printk(KERN_WARNING"%s: Bus reset failed.\n",pHba->name); 748 printk(KERN_WARNING"%s: Bus reset failed.\n",pHba->name);
734 return FAILED; 749 return FAILED;
735 } else { 750 } else {
diff --git a/drivers/scsi/ibmvscsi/ibmvscsi.h b/drivers/scsi/ibmvscsi/ibmvscsi.h
index 8bec0438dc8a..5b0edd1f1921 100644
--- a/drivers/scsi/ibmvscsi/ibmvscsi.h
+++ b/drivers/scsi/ibmvscsi/ibmvscsi.h
@@ -100,7 +100,7 @@ int ibmvscsi_init_crq_queue(struct crq_queue *queue,
100void ibmvscsi_release_crq_queue(struct crq_queue *queue, 100void ibmvscsi_release_crq_queue(struct crq_queue *queue,
101 struct ibmvscsi_host_data *hostdata, 101 struct ibmvscsi_host_data *hostdata,
102 int max_requests); 102 int max_requests);
103void ibmvscsi_reset_crq_queue(struct crq_queue *queue, 103int ibmvscsi_reset_crq_queue(struct crq_queue *queue,
104 struct ibmvscsi_host_data *hostdata); 104 struct ibmvscsi_host_data *hostdata);
105 105
106void ibmvscsi_handle_crq(struct viosrp_crq *crq, 106void ibmvscsi_handle_crq(struct viosrp_crq *crq,
diff --git a/drivers/scsi/ibmvscsi/iseries_vscsi.c b/drivers/scsi/ibmvscsi/iseries_vscsi.c
index 1045872b0175..ce15d9e39621 100644
--- a/drivers/scsi/ibmvscsi/iseries_vscsi.c
+++ b/drivers/scsi/ibmvscsi/iseries_vscsi.c
@@ -117,9 +117,10 @@ void ibmvscsi_release_crq_queue(struct crq_queue *queue,
117 * 117 *
118 * no-op for iSeries 118 * no-op for iSeries
119 */ 119 */
120void ibmvscsi_reset_crq_queue(struct crq_queue *queue, 120int ibmvscsi_reset_crq_queue(struct crq_queue *queue,
121 struct ibmvscsi_host_data *hostdata) 121 struct ibmvscsi_host_data *hostdata)
122{ 122{
123 return 0;
123} 124}
124 125
125/** 126/**
diff --git a/drivers/scsi/ibmvscsi/rpa_vscsi.c b/drivers/scsi/ibmvscsi/rpa_vscsi.c
index 8bf5652f1060..75db2f5c545e 100644
--- a/drivers/scsi/ibmvscsi/rpa_vscsi.c
+++ b/drivers/scsi/ibmvscsi/rpa_vscsi.c
@@ -230,6 +230,11 @@ int ibmvscsi_init_crq_queue(struct crq_queue *queue,
230 rc = plpar_hcall_norets(H_REG_CRQ, 230 rc = plpar_hcall_norets(H_REG_CRQ,
231 vdev->unit_address, 231 vdev->unit_address,
232 queue->msg_token, PAGE_SIZE); 232 queue->msg_token, PAGE_SIZE);
233 if (rc == H_Resource)
234 /* maybe kexecing and resource is busy. try a reset */
235 rc = ibmvscsi_reset_crq_queue(queue,
236 hostdata);
237
233 if (rc == 2) { 238 if (rc == 2) {
234 /* Adapter is good, but other end is not ready */ 239 /* Adapter is good, but other end is not ready */
235 printk(KERN_WARNING "ibmvscsi: Partner adapter not ready\n"); 240 printk(KERN_WARNING "ibmvscsi: Partner adapter not ready\n");
@@ -281,7 +286,7 @@ int ibmvscsi_init_crq_queue(struct crq_queue *queue,
281 * @hostdata: ibmvscsi_host_data of host 286 * @hostdata: ibmvscsi_host_data of host
282 * 287 *
283 */ 288 */
284void ibmvscsi_reset_crq_queue(struct crq_queue *queue, 289int ibmvscsi_reset_crq_queue(struct crq_queue *queue,
285 struct ibmvscsi_host_data *hostdata) 290 struct ibmvscsi_host_data *hostdata)
286{ 291{
287 int rc; 292 int rc;
@@ -309,4 +314,5 @@ void ibmvscsi_reset_crq_queue(struct crq_queue *queue,
309 printk(KERN_WARNING 314 printk(KERN_WARNING
310 "ibmvscsi: couldn't register crq--rc 0x%x\n", rc); 315 "ibmvscsi: couldn't register crq--rc 0x%x\n", rc);
311 } 316 }
317 return rc;
312} 318}
diff --git a/drivers/scsi/iscsi_tcp.c b/drivers/scsi/iscsi_tcp.c
index 4fea3e4edaa7..3d8009f55342 100644
--- a/drivers/scsi/iscsi_tcp.c
+++ b/drivers/scsi/iscsi_tcp.c
@@ -3368,7 +3368,7 @@ iscsi_conn_set_param(iscsi_connh_t connh, enum iscsi_param param,
3368 switch(param) { 3368 switch(param) {
3369 case ISCSI_PARAM_MAX_RECV_DLENGTH: { 3369 case ISCSI_PARAM_MAX_RECV_DLENGTH: {
3370 char *saveptr = conn->data; 3370 char *saveptr = conn->data;
3371 int flags = GFP_KERNEL; 3371 gfp_t flags = GFP_KERNEL;
3372 3372
3373 if (conn->data_size >= value) { 3373 if (conn->data_size >= value) {
3374 conn->max_recv_dlength = value; 3374 conn->max_recv_dlength = value;
diff --git a/drivers/scsi/megaraid.c b/drivers/scsi/megaraid.c
index f9792528e33f..578143e93a6f 100644
--- a/drivers/scsi/megaraid.c
+++ b/drivers/scsi/megaraid.c
@@ -664,7 +664,7 @@ mega_build_cmd(adapter_t *adapter, Scsi_Cmnd *cmd, int *busy)
664 sg->offset; 664 sg->offset;
665 } else 665 } else
666 buf = cmd->request_buffer; 666 buf = cmd->request_buffer;
667 memset(cmd->request_buffer, 0, cmd->cmnd[4]); 667 memset(buf, 0, cmd->cmnd[4]);
668 if (cmd->use_sg) { 668 if (cmd->use_sg) {
669 struct scatterlist *sg; 669 struct scatterlist *sg;
670 670
diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h
index 7096945ea234..7b3efd531297 100644
--- a/drivers/scsi/qla2xxx/qla_def.h
+++ b/drivers/scsi/qla2xxx/qla_def.h
@@ -2476,17 +2476,9 @@ typedef struct scsi_qla_host {
2476 */ 2476 */
2477#define LOOP_TRANSITION(ha) \ 2477#define LOOP_TRANSITION(ha) \
2478 (test_bit(ISP_ABORT_NEEDED, &ha->dpc_flags) || \ 2478 (test_bit(ISP_ABORT_NEEDED, &ha->dpc_flags) || \
2479 test_bit(LOOP_RESYNC_NEEDED, &ha->dpc_flags)) 2479 test_bit(LOOP_RESYNC_NEEDED, &ha->dpc_flags) || \
2480
2481#define LOOP_NOT_READY(ha) \
2482 ((test_bit(ISP_ABORT_NEEDED, &ha->dpc_flags) || \
2483 test_bit(ABORT_ISP_ACTIVE, &ha->dpc_flags) || \
2484 test_bit(LOOP_RESYNC_NEEDED, &ha->dpc_flags) || \
2485 test_bit(LOOP_RESYNC_ACTIVE, &ha->dpc_flags)) || \
2486 atomic_read(&ha->loop_state) == LOOP_DOWN) 2480 atomic_read(&ha->loop_state) == LOOP_DOWN)
2487 2481
2488#define LOOP_RDY(ha) (!LOOP_NOT_READY(ha))
2489
2490#define TGT_Q(ha, t) (ha->otgt[t]) 2482#define TGT_Q(ha, t) (ha->otgt[t])
2491 2483
2492#define to_qla_host(x) ((scsi_qla_host_t *) (x)->hostdata) 2484#define to_qla_host(x) ((scsi_qla_host_t *) (x)->hostdata)
diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c
index 2d720121a0d3..c46d2469b85f 100644
--- a/drivers/scsi/qla2xxx/qla_init.c
+++ b/drivers/scsi/qla2xxx/qla_init.c
@@ -1259,7 +1259,7 @@ qla2x00_configure_hba(scsi_qla_host_t *ha)
1259 rval = qla2x00_get_adapter_id(ha, 1259 rval = qla2x00_get_adapter_id(ha,
1260 &loop_id, &al_pa, &area, &domain, &topo); 1260 &loop_id, &al_pa, &area, &domain, &topo);
1261 if (rval != QLA_SUCCESS) { 1261 if (rval != QLA_SUCCESS) {
1262 if (LOOP_NOT_READY(ha) || atomic_read(&ha->loop_down_timer) || 1262 if (LOOP_TRANSITION(ha) || atomic_read(&ha->loop_down_timer) ||
1263 (rval == QLA_COMMAND_ERROR && loop_id == 0x7)) { 1263 (rval == QLA_COMMAND_ERROR && loop_id == 0x7)) {
1264 DEBUG2(printk("%s(%ld) Loop is in a transition state\n", 1264 DEBUG2(printk("%s(%ld) Loop is in a transition state\n",
1265 __func__, ha->host_no)); 1265 __func__, ha->host_no));
@@ -1796,7 +1796,7 @@ qla2x00_configure_loop(scsi_qla_host_t *ha)
1796 } 1796 }
1797 1797
1798 if (rval == QLA_SUCCESS && test_bit(RSCN_UPDATE, &flags)) { 1798 if (rval == QLA_SUCCESS && test_bit(RSCN_UPDATE, &flags)) {
1799 if (LOOP_NOT_READY(ha)) { 1799 if (LOOP_TRANSITION(ha)) {
1800 rval = QLA_FUNCTION_FAILED; 1800 rval = QLA_FUNCTION_FAILED;
1801 } else { 1801 } else {
1802 rval = qla2x00_configure_fabric(ha); 1802 rval = qla2x00_configure_fabric(ha);
@@ -2369,7 +2369,7 @@ qla2x00_find_all_fabric_devs(scsi_qla_host_t *ha, struct list_head *new_fcports)
2369 if (qla2x00_is_reserved_id(ha, loop_id)) 2369 if (qla2x00_is_reserved_id(ha, loop_id))
2370 continue; 2370 continue;
2371 2371
2372 if (atomic_read(&ha->loop_down_timer) || LOOP_NOT_READY(ha)) 2372 if (atomic_read(&ha->loop_down_timer) || LOOP_TRANSITION(ha))
2373 break; 2373 break;
2374 2374
2375 if (swl != NULL) { 2375 if (swl != NULL) {
diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c
index 09afc0f06bd4..5181d966fecb 100644
--- a/drivers/scsi/qla2xxx/qla_isr.c
+++ b/drivers/scsi/qla2xxx/qla_isr.c
@@ -909,6 +909,21 @@ qla2x00_status_entry(scsi_qla_host_t *ha, void *pkt)
909 resid = resid_len; 909 resid = resid_len;
910 cp->resid = resid; 910 cp->resid = resid;
911 CMD_RESID_LEN(cp) = resid; 911 CMD_RESID_LEN(cp) = resid;
912
913 if (!lscsi_status &&
914 ((unsigned)(cp->request_bufflen - resid) <
915 cp->underflow)) {
916 qla_printk(KERN_INFO, ha,
917 "scsi(%ld:%d:%d:%d): Mid-layer underflow "
918 "detected (%x of %x bytes)...returning "
919 "error status.\n", ha->host_no,
920 cp->device->channel, cp->device->id,
921 cp->device->lun, resid,
922 cp->request_bufflen);
923
924 cp->result = DID_ERROR << 16;
925 break;
926 }
912 } 927 }
913 cp->result = DID_OK << 16 | lscsi_status; 928 cp->result = DID_OK << 16 | lscsi_status;
914 929
diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c
index 18c5d2523014..c0ae9e965f6f 100644
--- a/drivers/scsi/scsi_error.c
+++ b/drivers/scsi/scsi_error.c
@@ -422,10 +422,15 @@ static int scsi_eh_completed_normally(struct scsi_cmnd *scmd)
422 **/ 422 **/
423static void scsi_eh_done(struct scsi_cmnd *scmd) 423static void scsi_eh_done(struct scsi_cmnd *scmd)
424{ 424{
425 struct completion *eh_action;
426
425 SCSI_LOG_ERROR_RECOVERY(3, 427 SCSI_LOG_ERROR_RECOVERY(3,
426 printk("%s scmd: %p result: %x\n", 428 printk("%s scmd: %p result: %x\n",
427 __FUNCTION__, scmd, scmd->result)); 429 __FUNCTION__, scmd, scmd->result));
428 complete(scmd->device->host->eh_action); 430
431 eh_action = scmd->device->host->eh_action;
432 if (eh_action)
433 complete(eh_action);
429} 434}
430 435
431/** 436/**
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index ce9d73a292e2..dc249cb970ea 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -1085,6 +1085,26 @@ static void scsi_generic_done(struct scsi_cmnd *cmd)
1085 scsi_io_completion(cmd, cmd->result == 0 ? cmd->bufflen : 0, 0); 1085 scsi_io_completion(cmd, cmd->result == 0 ? cmd->bufflen : 0, 0);
1086} 1086}
1087 1087
1088void scsi_setup_blk_pc_cmnd(struct scsi_cmnd *cmd, int retries)
1089{
1090 struct request *req = cmd->request;
1091
1092 BUG_ON(sizeof(req->cmd) > sizeof(cmd->cmnd));
1093 memcpy(cmd->cmnd, req->cmd, sizeof(cmd->cmnd));
1094 cmd->cmd_len = req->cmd_len;
1095 if (!req->data_len)
1096 cmd->sc_data_direction = DMA_NONE;
1097 else if (rq_data_dir(req) == WRITE)
1098 cmd->sc_data_direction = DMA_TO_DEVICE;
1099 else
1100 cmd->sc_data_direction = DMA_FROM_DEVICE;
1101
1102 cmd->transfersize = req->data_len;
1103 cmd->allowed = retries;
1104 cmd->timeout_per_command = req->timeout;
1105}
1106EXPORT_SYMBOL_GPL(scsi_setup_blk_pc_cmnd);
1107
1088static int scsi_prep_fn(struct request_queue *q, struct request *req) 1108static int scsi_prep_fn(struct request_queue *q, struct request *req)
1089{ 1109{
1090 struct scsi_device *sdev = q->queuedata; 1110 struct scsi_device *sdev = q->queuedata;
@@ -1220,18 +1240,7 @@ static int scsi_prep_fn(struct request_queue *q, struct request *req)
1220 goto kill; 1240 goto kill;
1221 } 1241 }
1222 } else { 1242 } else {
1223 memcpy(cmd->cmnd, req->cmd, sizeof(cmd->cmnd)); 1243 scsi_setup_blk_pc_cmnd(cmd, 3);
1224 cmd->cmd_len = req->cmd_len;
1225 if (rq_data_dir(req) == WRITE)
1226 cmd->sc_data_direction = DMA_TO_DEVICE;
1227 else if (req->data_len)
1228 cmd->sc_data_direction = DMA_FROM_DEVICE;
1229 else
1230 cmd->sc_data_direction = DMA_NONE;
1231
1232 cmd->transfersize = req->data_len;
1233 cmd->allowed = 3;
1234 cmd->timeout_per_command = req->timeout;
1235 cmd->done = scsi_generic_done; 1244 cmd->done = scsi_generic_done;
1236 } 1245 }
1237 } 1246 }
diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c
index 49fd18c1a9c6..e08462d50c97 100644
--- a/drivers/scsi/scsi_transport_iscsi.c
+++ b/drivers/scsi/scsi_transport_iscsi.c
@@ -249,7 +249,7 @@ static inline struct list_head *skb_to_lh(struct sk_buff *skb)
249} 249}
250 250
251static void* 251static void*
252mempool_zone_alloc_skb(unsigned int gfp_mask, void *pool_data) 252mempool_zone_alloc_skb(gfp_t gfp_mask, void *pool_data)
253{ 253{
254 struct mempool_zone *zone = pool_data; 254 struct mempool_zone *zone = pool_data;
255 255
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index 8613a1317712..03fcbab30033 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -245,24 +245,10 @@ static int sd_init_command(struct scsi_cmnd * SCpnt)
245 * SG_IO from block layer already setup, just copy cdb basically 245 * SG_IO from block layer already setup, just copy cdb basically
246 */ 246 */
247 if (blk_pc_request(rq)) { 247 if (blk_pc_request(rq)) {
248 if (sizeof(rq->cmd) > sizeof(SCpnt->cmnd)) 248 scsi_setup_blk_pc_cmnd(SCpnt, SD_PASSTHROUGH_RETRIES);
249 return 0;
250
251 memcpy(SCpnt->cmnd, rq->cmd, sizeof(SCpnt->cmnd));
252 SCpnt->cmd_len = rq->cmd_len;
253 if (rq_data_dir(rq) == WRITE)
254 SCpnt->sc_data_direction = DMA_TO_DEVICE;
255 else if (rq->data_len)
256 SCpnt->sc_data_direction = DMA_FROM_DEVICE;
257 else
258 SCpnt->sc_data_direction = DMA_NONE;
259
260 this_count = rq->data_len;
261 if (rq->timeout) 249 if (rq->timeout)
262 timeout = rq->timeout; 250 timeout = rq->timeout;
263 251
264 SCpnt->transfersize = rq->data_len;
265 SCpnt->allowed = SD_PASSTHROUGH_RETRIES;
266 goto queue; 252 goto queue;
267 } 253 }
268 254
diff --git a/drivers/scsi/sr.c b/drivers/scsi/sr.c
index d68cea753bb2..fb4012b5c188 100644
--- a/drivers/scsi/sr.c
+++ b/drivers/scsi/sr.c
@@ -320,25 +320,11 @@ static int sr_init_command(struct scsi_cmnd * SCpnt)
320 * these are already setup, just copy cdb basically 320 * these are already setup, just copy cdb basically
321 */ 321 */
322 if (SCpnt->request->flags & REQ_BLOCK_PC) { 322 if (SCpnt->request->flags & REQ_BLOCK_PC) {
323 struct request *rq = SCpnt->request; 323 scsi_setup_blk_pc_cmnd(SCpnt, MAX_RETRIES);
324 324
325 if (sizeof(rq->cmd) > sizeof(SCpnt->cmnd)) 325 if (SCpnt->timeout_per_command)
326 return 0; 326 timeout = SCpnt->timeout_per_command;
327
328 memcpy(SCpnt->cmnd, rq->cmd, sizeof(SCpnt->cmnd));
329 SCpnt->cmd_len = rq->cmd_len;
330 if (!rq->data_len)
331 SCpnt->sc_data_direction = DMA_NONE;
332 else if (rq_data_dir(rq) == WRITE)
333 SCpnt->sc_data_direction = DMA_TO_DEVICE;
334 else
335 SCpnt->sc_data_direction = DMA_FROM_DEVICE;
336
337 this_count = rq->data_len;
338 if (rq->timeout)
339 timeout = rq->timeout;
340 327
341 SCpnt->transfersize = rq->data_len;
342 goto queue; 328 goto queue;
343 } 329 }
344 330
diff --git a/drivers/scsi/st.c b/drivers/scsi/st.c
index 7ac6ea141fff..dd592f6a2529 100644
--- a/drivers/scsi/st.c
+++ b/drivers/scsi/st.c
@@ -4194,27 +4194,10 @@ static void st_intr(struct scsi_cmnd *SCpnt)
4194 */ 4194 */
4195static int st_init_command(struct scsi_cmnd *SCpnt) 4195static int st_init_command(struct scsi_cmnd *SCpnt)
4196{ 4196{
4197 struct request *rq;
4198
4199 if (!(SCpnt->request->flags & REQ_BLOCK_PC)) 4197 if (!(SCpnt->request->flags & REQ_BLOCK_PC))
4200 return 0; 4198 return 0;
4201 4199
4202 rq = SCpnt->request; 4200 scsi_setup_blk_pc_cmnd(SCpnt, 0);
4203 if (sizeof(rq->cmd) > sizeof(SCpnt->cmnd))
4204 return 0;
4205
4206 memcpy(SCpnt->cmnd, rq->cmd, sizeof(SCpnt->cmnd));
4207 SCpnt->cmd_len = rq->cmd_len;
4208
4209 if (rq_data_dir(rq) == WRITE)
4210 SCpnt->sc_data_direction = DMA_TO_DEVICE;
4211 else if (rq->data_len)
4212 SCpnt->sc_data_direction = DMA_FROM_DEVICE;
4213 else
4214 SCpnt->sc_data_direction = DMA_NONE;
4215
4216 SCpnt->timeout_per_command = rq->timeout;
4217 SCpnt->transfersize = rq->data_len;
4218 SCpnt->done = st_intr; 4201 SCpnt->done = st_intr;
4219 return 1; 4202 return 1;
4220} 4203}
diff --git a/drivers/scsi/sym53c8xx_2/sym_hipd.c b/drivers/scsi/sym53c8xx_2/sym_hipd.c
index a7420cad4547..1564ca203a3e 100644
--- a/drivers/scsi/sym53c8xx_2/sym_hipd.c
+++ b/drivers/scsi/sym53c8xx_2/sym_hipd.c
@@ -1405,7 +1405,6 @@ static void sym_check_goals(struct sym_hcb *np, struct scsi_target *starget,
1405 goal->iu = 0; 1405 goal->iu = 0;
1406 goal->dt = 0; 1406 goal->dt = 0;
1407 goal->qas = 0; 1407 goal->qas = 0;
1408 goal->period = 0;
1409 goal->offset = 0; 1408 goal->offset = 0;
1410 return; 1409 return;
1411 } 1410 }
@@ -1465,7 +1464,8 @@ static int sym_prepare_nego(struct sym_hcb *np, struct sym_ccb *cp, u_char *msgp
1465 * Many devices implement PPR in a buggy way, so only use it if we 1464 * Many devices implement PPR in a buggy way, so only use it if we
1466 * really want to. 1465 * really want to.
1467 */ 1466 */
1468 if (goal->iu || goal->dt || goal->qas || (goal->period < 0xa)) { 1467 if (goal->offset &&
1468 (goal->iu || goal->dt || goal->qas || (goal->period < 0xa))) {
1469 nego = NS_PPR; 1469 nego = NS_PPR;
1470 } else if (spi_width(starget) != goal->width) { 1470 } else if (spi_width(starget) != goal->width) {
1471 nego = NS_WIDE; 1471 nego = NS_WIDE;