aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi')
-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/libata-scsi.c7
-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/sata_mv.c3
-rw-r--r--drivers/scsi/sata_promise.c12
-rw-r--r--drivers/scsi/sata_sx4.c3
-rw-r--r--drivers/scsi/scsi_error.c7
-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
18 files changed, 60 insertions, 81 deletions
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 2d12355eed33..10bcf42cb65c 100644
--- a/drivers/scsi/iscsi_tcp.c
+++ b/drivers/scsi/iscsi_tcp.c
@@ -3391,7 +3391,7 @@ iscsi_conn_set_param(iscsi_connh_t connh, enum iscsi_param param,
3391 switch(param) { 3391 switch(param) {
3392 case ISCSI_PARAM_MAX_RECV_DLENGTH: { 3392 case ISCSI_PARAM_MAX_RECV_DLENGTH: {
3393 char *saveptr = conn->data; 3393 char *saveptr = conn->data;
3394 int flags = GFP_KERNEL; 3394 gfp_t flags = GFP_KERNEL;
3395 3395
3396 if (conn->data_size >= value) { 3396 if (conn->data_size >= value) {
3397 conn->max_recv_dlength = value; 3397 conn->max_recv_dlength = value;
diff --git a/drivers/scsi/libata-scsi.c b/drivers/scsi/libata-scsi.c
index 379e87089764..72ddba98f8fb 100644
--- a/drivers/scsi/libata-scsi.c
+++ b/drivers/scsi/libata-scsi.c
@@ -2173,9 +2173,12 @@ ata_scsi_find_dev(struct ata_port *ap, const struct scsi_device *scsidev)
2173 if (unlikely(!ata_dev_present(dev))) 2173 if (unlikely(!ata_dev_present(dev)))
2174 return NULL; 2174 return NULL;
2175 2175
2176 if (!atapi_enabled) { 2176 if (!atapi_enabled || (ap->flags & ATA_FLAG_NO_ATAPI)) {
2177 if (unlikely(dev->class == ATA_DEV_ATAPI)) 2177 if (unlikely(dev->class == ATA_DEV_ATAPI)) {
2178 printk(KERN_WARNING "ata%u(%u): WARNING: ATAPI is %s, device ignored.\n",
2179 ap->id, dev->devno, atapi_enabled ? "not supported with this driver" : "disabled");
2178 return NULL; 2180 return NULL;
2181 }
2179 } 2182 }
2180 2183
2181 return dev; 2184 return dev;
diff --git a/drivers/scsi/megaraid.c b/drivers/scsi/megaraid.c
index 9fa41ccadef2..4a6feb1e5e3d 100644
--- a/drivers/scsi/megaraid.c
+++ b/drivers/scsi/megaraid.c
@@ -665,7 +665,7 @@ mega_build_cmd(adapter_t *adapter, Scsi_Cmnd *cmd, int *busy)
665 sg->offset; 665 sg->offset;
666 } else 666 } else
667 buf = cmd->request_buffer; 667 buf = cmd->request_buffer;
668 memset(cmd->request_buffer, 0, cmd->cmnd[4]); 668 memset(buf, 0, cmd->cmnd[4]);
669 if (cmd->use_sg) { 669 if (cmd->use_sg) {
670 struct scatterlist *sg; 670 struct scatterlist *sg;
671 671
diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h
index ce0d88bbaa06..79d8a914f9d0 100644
--- a/drivers/scsi/qla2xxx/qla_def.h
+++ b/drivers/scsi/qla2xxx/qla_def.h
@@ -2498,17 +2498,9 @@ typedef struct scsi_qla_host {
2498 */ 2498 */
2499#define LOOP_TRANSITION(ha) \ 2499#define LOOP_TRANSITION(ha) \
2500 (test_bit(ISP_ABORT_NEEDED, &ha->dpc_flags) || \ 2500 (test_bit(ISP_ABORT_NEEDED, &ha->dpc_flags) || \
2501 test_bit(LOOP_RESYNC_NEEDED, &ha->dpc_flags)) 2501 test_bit(LOOP_RESYNC_NEEDED, &ha->dpc_flags) || \
2502
2503#define LOOP_NOT_READY(ha) \
2504 ((test_bit(ISP_ABORT_NEEDED, &ha->dpc_flags) || \
2505 test_bit(ABORT_ISP_ACTIVE, &ha->dpc_flags) || \
2506 test_bit(LOOP_RESYNC_NEEDED, &ha->dpc_flags) || \
2507 test_bit(LOOP_RESYNC_ACTIVE, &ha->dpc_flags)) || \
2508 atomic_read(&ha->loop_state) == LOOP_DOWN) 2502 atomic_read(&ha->loop_state) == LOOP_DOWN)
2509 2503
2510#define LOOP_RDY(ha) (!LOOP_NOT_READY(ha))
2511
2512#define TGT_Q(ha, t) (ha->otgt[t]) 2504#define TGT_Q(ha, t) (ha->otgt[t])
2513 2505
2514#define to_qla_host(x) ((scsi_qla_host_t *) (x)->hostdata) 2506#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 dadc91bd0ea9..7d973bd9022b 100644
--- a/drivers/scsi/qla2xxx/qla_init.c
+++ b/drivers/scsi/qla2xxx/qla_init.c
@@ -1258,7 +1258,7 @@ qla2x00_configure_hba(scsi_qla_host_t *ha)
1258 rval = qla2x00_get_adapter_id(ha, 1258 rval = qla2x00_get_adapter_id(ha,
1259 &loop_id, &al_pa, &area, &domain, &topo); 1259 &loop_id, &al_pa, &area, &domain, &topo);
1260 if (rval != QLA_SUCCESS) { 1260 if (rval != QLA_SUCCESS) {
1261 if (LOOP_NOT_READY(ha) || atomic_read(&ha->loop_down_timer) || 1261 if (LOOP_TRANSITION(ha) || atomic_read(&ha->loop_down_timer) ||
1262 (rval == QLA_COMMAND_ERROR && loop_id == 0x7)) { 1262 (rval == QLA_COMMAND_ERROR && loop_id == 0x7)) {
1263 DEBUG2(printk("%s(%ld) Loop is in a transition state\n", 1263 DEBUG2(printk("%s(%ld) Loop is in a transition state\n",
1264 __func__, ha->host_no)); 1264 __func__, ha->host_no));
@@ -1795,7 +1795,7 @@ qla2x00_configure_loop(scsi_qla_host_t *ha)
1795 } 1795 }
1796 1796
1797 if (rval == QLA_SUCCESS && test_bit(RSCN_UPDATE, &flags)) { 1797 if (rval == QLA_SUCCESS && test_bit(RSCN_UPDATE, &flags)) {
1798 if (LOOP_NOT_READY(ha)) { 1798 if (LOOP_TRANSITION(ha)) {
1799 rval = QLA_FUNCTION_FAILED; 1799 rval = QLA_FUNCTION_FAILED;
1800 } else { 1800 } else {
1801 rval = qla2x00_configure_fabric(ha); 1801 rval = qla2x00_configure_fabric(ha);
@@ -2368,7 +2368,7 @@ qla2x00_find_all_fabric_devs(scsi_qla_host_t *ha, struct list_head *new_fcports)
2368 if (qla2x00_is_reserved_id(ha, loop_id)) 2368 if (qla2x00_is_reserved_id(ha, loop_id))
2369 continue; 2369 continue;
2370 2370
2371 if (atomic_read(&ha->loop_down_timer) || LOOP_NOT_READY(ha)) 2371 if (atomic_read(&ha->loop_down_timer) || LOOP_TRANSITION(ha))
2372 break; 2372 break;
2373 2373
2374 if (swl != NULL) { 2374 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/sata_mv.c b/drivers/scsi/sata_mv.c
index ab7432a5778e..9321cdf45680 100644
--- a/drivers/scsi/sata_mv.c
+++ b/drivers/scsi/sata_mv.c
@@ -86,7 +86,8 @@ enum {
86 MV_FLAG_DUAL_HC = (1 << 30), /* two SATA Host Controllers */ 86 MV_FLAG_DUAL_HC = (1 << 30), /* two SATA Host Controllers */
87 MV_FLAG_IRQ_COALESCE = (1 << 29), /* IRQ coalescing capability */ 87 MV_FLAG_IRQ_COALESCE = (1 << 29), /* IRQ coalescing capability */
88 MV_COMMON_FLAGS = (ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | 88 MV_COMMON_FLAGS = (ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY |
89 ATA_FLAG_SATA_RESET | ATA_FLAG_MMIO), 89 ATA_FLAG_SATA_RESET | ATA_FLAG_MMIO |
90 ATA_FLAG_NO_ATAPI),
90 MV_6XXX_FLAGS = MV_FLAG_IRQ_COALESCE, 91 MV_6XXX_FLAGS = MV_FLAG_IRQ_COALESCE,
91 92
92 CRQB_FLAG_READ = (1 << 0), 93 CRQB_FLAG_READ = (1 << 0),
diff --git a/drivers/scsi/sata_promise.c b/drivers/scsi/sata_promise.c
index 8a8e3e3ef0ed..2691625f9bce 100644
--- a/drivers/scsi/sata_promise.c
+++ b/drivers/scsi/sata_promise.c
@@ -70,6 +70,9 @@ enum {
70 PDC_HAS_PATA = (1 << 1), /* PDC20375 has PATA */ 70 PDC_HAS_PATA = (1 << 1), /* PDC20375 has PATA */
71 71
72 PDC_RESET = (1 << 11), /* HDMA reset */ 72 PDC_RESET = (1 << 11), /* HDMA reset */
73
74 PDC_COMMON_FLAGS = ATA_FLAG_NO_LEGACY | ATA_FLAG_SRST |
75 ATA_FLAG_MMIO | ATA_FLAG_NO_ATAPI,
73}; 76};
74 77
75 78
@@ -162,8 +165,7 @@ static struct ata_port_info pdc_port_info[] = {
162 /* board_2037x */ 165 /* board_2037x */
163 { 166 {
164 .sht = &pdc_ata_sht, 167 .sht = &pdc_ata_sht,
165 .host_flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | 168 .host_flags = PDC_COMMON_FLAGS | ATA_FLAG_SATA,
166 ATA_FLAG_SRST | ATA_FLAG_MMIO,
167 .pio_mask = 0x1f, /* pio0-4 */ 169 .pio_mask = 0x1f, /* pio0-4 */
168 .mwdma_mask = 0x07, /* mwdma0-2 */ 170 .mwdma_mask = 0x07, /* mwdma0-2 */
169 .udma_mask = 0x7f, /* udma0-6 ; FIXME */ 171 .udma_mask = 0x7f, /* udma0-6 ; FIXME */
@@ -173,8 +175,7 @@ static struct ata_port_info pdc_port_info[] = {
173 /* board_20319 */ 175 /* board_20319 */
174 { 176 {
175 .sht = &pdc_ata_sht, 177 .sht = &pdc_ata_sht,
176 .host_flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | 178 .host_flags = PDC_COMMON_FLAGS | ATA_FLAG_SATA,
177 ATA_FLAG_SRST | ATA_FLAG_MMIO,
178 .pio_mask = 0x1f, /* pio0-4 */ 179 .pio_mask = 0x1f, /* pio0-4 */
179 .mwdma_mask = 0x07, /* mwdma0-2 */ 180 .mwdma_mask = 0x07, /* mwdma0-2 */
180 .udma_mask = 0x7f, /* udma0-6 ; FIXME */ 181 .udma_mask = 0x7f, /* udma0-6 ; FIXME */
@@ -184,8 +185,7 @@ static struct ata_port_info pdc_port_info[] = {
184 /* board_20619 */ 185 /* board_20619 */
185 { 186 {
186 .sht = &pdc_ata_sht, 187 .sht = &pdc_ata_sht,
187 .host_flags = ATA_FLAG_NO_LEGACY | ATA_FLAG_SRST | 188 .host_flags = PDC_COMMON_FLAGS | ATA_FLAG_SLAVE_POSS,
188 ATA_FLAG_MMIO | ATA_FLAG_SLAVE_POSS,
189 .pio_mask = 0x1f, /* pio0-4 */ 189 .pio_mask = 0x1f, /* pio0-4 */
190 .mwdma_mask = 0x07, /* mwdma0-2 */ 190 .mwdma_mask = 0x07, /* mwdma0-2 */
191 .udma_mask = 0x7f, /* udma0-6 ; FIXME */ 191 .udma_mask = 0x7f, /* udma0-6 ; FIXME */
diff --git a/drivers/scsi/sata_sx4.c b/drivers/scsi/sata_sx4.c
index dcc3ad9a9d6e..ac7b0d819ebc 100644
--- a/drivers/scsi/sata_sx4.c
+++ b/drivers/scsi/sata_sx4.c
@@ -220,7 +220,8 @@ static struct ata_port_info pdc_port_info[] = {
220 { 220 {
221 .sht = &pdc_sata_sht, 221 .sht = &pdc_sata_sht,
222 .host_flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | 222 .host_flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY |
223 ATA_FLAG_SRST | ATA_FLAG_MMIO, 223 ATA_FLAG_SRST | ATA_FLAG_MMIO |
224 ATA_FLAG_NO_ATAPI,
224 .pio_mask = 0x1f, /* pio0-4 */ 225 .pio_mask = 0x1f, /* pio0-4 */
225 .mwdma_mask = 0x07, /* mwdma0-2 */ 226 .mwdma_mask = 0x07, /* mwdma0-2 */
226 .udma_mask = 0x7f, /* udma0-6 ; FIXME */ 227 .udma_mask = 0x7f, /* udma0-6 ; FIXME */
diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c
index 53ea62d3b53d..a2333d2c7af0 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_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 d82795455efb..9d893f085015 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 a3fa64cf6650..7e7398d563cc 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 2096d137f5ee..894ad53be04b 100644
--- a/drivers/scsi/st.c
+++ b/drivers/scsi/st.c
@@ -4195,27 +4195,10 @@ static void st_intr(struct scsi_cmnd *SCpnt)
4195 */ 4195 */
4196static int st_init_command(struct scsi_cmnd *SCpnt) 4196static int st_init_command(struct scsi_cmnd *SCpnt)
4197{ 4197{
4198 struct request *rq;
4199
4200 if (!(SCpnt->request->flags & REQ_BLOCK_PC)) 4198 if (!(SCpnt->request->flags & REQ_BLOCK_PC))
4201 return 0; 4199 return 0;
4202 4200
4203 rq = SCpnt->request; 4201 scsi_setup_blk_pc_cmnd(SCpnt, 0);
4204 if (sizeof(rq->cmd) > sizeof(SCpnt->cmnd))
4205 return 0;
4206
4207 memcpy(SCpnt->cmnd, rq->cmd, sizeof(SCpnt->cmnd));
4208 SCpnt->cmd_len = rq->cmd_len;
4209
4210 if (rq_data_dir(rq) == WRITE)
4211 SCpnt->sc_data_direction = DMA_TO_DEVICE;
4212 else if (rq->data_len)
4213 SCpnt->sc_data_direction = DMA_FROM_DEVICE;
4214 else
4215 SCpnt->sc_data_direction = DMA_NONE;
4216
4217 SCpnt->timeout_per_command = rq->timeout;
4218 SCpnt->transfersize = rq->data_len;
4219 SCpnt->done = st_intr; 4202 SCpnt->done = st_intr;
4220 return 1; 4203 return 1;
4221} 4204}
diff --git a/drivers/scsi/sym53c8xx_2/sym_hipd.c b/drivers/scsi/sym53c8xx_2/sym_hipd.c
index 7a3c807dcfca..1010e716162e 100644
--- a/drivers/scsi/sym53c8xx_2/sym_hipd.c
+++ b/drivers/scsi/sym53c8xx_2/sym_hipd.c
@@ -1356,7 +1356,6 @@ static void sym_check_goals(struct sym_hcb *np, struct scsi_target *starget,
1356 goal->iu = 0; 1356 goal->iu = 0;
1357 goal->dt = 0; 1357 goal->dt = 0;
1358 goal->qas = 0; 1358 goal->qas = 0;
1359 goal->period = 0;
1360 goal->offset = 0; 1359 goal->offset = 0;
1361 return; 1360 return;
1362 } 1361 }
@@ -1416,7 +1415,8 @@ static int sym_prepare_nego(struct sym_hcb *np, struct sym_ccb *cp, u_char *msgp
1416 * Many devices implement PPR in a buggy way, so only use it if we 1415 * Many devices implement PPR in a buggy way, so only use it if we
1417 * really want to. 1416 * really want to.
1418 */ 1417 */
1419 if (goal->iu || goal->dt || goal->qas || (goal->period < 0xa)) { 1418 if (goal->offset &&
1419 (goal->iu || goal->dt || goal->qas || (goal->period < 0xa))) {
1420 nego = NS_PPR; 1420 nego = NS_PPR;
1421 } else if (spi_width(starget) != goal->width) { 1421 } else if (spi_width(starget) != goal->width) {
1422 nego = NS_WIDE; 1422 nego = NS_WIDE;