aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata/libata-scsi.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ata/libata-scsi.c')
-rw-r--r--drivers/ata/libata-scsi.c23
1 files changed, 14 insertions, 9 deletions
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index 7af2a4ba4990..47ea111d5ace 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -1451,6 +1451,7 @@ nothing_to_do:
1451 1451
1452static void ata_scsi_qc_complete(struct ata_queued_cmd *qc) 1452static void ata_scsi_qc_complete(struct ata_queued_cmd *qc)
1453{ 1453{
1454 struct ata_port *ap = qc->ap;
1454 struct scsi_cmnd *cmd = qc->scsicmd; 1455 struct scsi_cmnd *cmd = qc->scsicmd;
1455 u8 *cdb = cmd->cmnd; 1456 u8 *cdb = cmd->cmnd;
1456 int need_sense = (qc->err_mask != 0); 1457 int need_sense = (qc->err_mask != 0);
@@ -1459,11 +1460,12 @@ static void ata_scsi_qc_complete(struct ata_queued_cmd *qc)
1459 * schedule EH_REVALIDATE operation to update the IDENTIFY DEVICE 1460 * schedule EH_REVALIDATE operation to update the IDENTIFY DEVICE
1460 * cache 1461 * cache
1461 */ 1462 */
1462 if (!need_sense && (qc->tf.command == ATA_CMD_SET_FEATURES) && 1463 if (ap->ops->error_handler &&
1464 !need_sense && (qc->tf.command == ATA_CMD_SET_FEATURES) &&
1463 ((qc->tf.feature == SETFEATURES_WC_ON) || 1465 ((qc->tf.feature == SETFEATURES_WC_ON) ||
1464 (qc->tf.feature == SETFEATURES_WC_OFF))) { 1466 (qc->tf.feature == SETFEATURES_WC_OFF))) {
1465 qc->ap->eh_info.action |= ATA_EH_REVALIDATE; 1467 ap->eh_info.action |= ATA_EH_REVALIDATE;
1466 ata_port_schedule_eh(qc->ap); 1468 ata_port_schedule_eh(ap);
1467 } 1469 }
1468 1470
1469 /* For ATA pass thru (SAT) commands, generate a sense block if 1471 /* For ATA pass thru (SAT) commands, generate a sense block if
@@ -1490,8 +1492,8 @@ static void ata_scsi_qc_complete(struct ata_queued_cmd *qc)
1490 } 1492 }
1491 } 1493 }
1492 1494
1493 if (need_sense && !qc->ap->ops->error_handler) 1495 if (need_sense && !ap->ops->error_handler)
1494 ata_dump_status(qc->ap->id, &qc->result_tf); 1496 ata_dump_status(ap->id, &qc->result_tf);
1495 1497
1496 qc->scsidone(cmd); 1498 qc->scsidone(cmd);
1497 1499
@@ -1612,9 +1614,9 @@ early_finish:
1612 1614
1613err_did: 1615err_did:
1614 ata_qc_free(qc); 1616 ata_qc_free(qc);
1615err_mem:
1616 cmd->result = (DID_ERROR << 16); 1617 cmd->result = (DID_ERROR << 16);
1617 done(cmd); 1618 done(cmd);
1619err_mem:
1618 DPRINTK("EXIT - internal\n"); 1620 DPRINTK("EXIT - internal\n");
1619 return 0; 1621 return 0;
1620 1622
@@ -3345,20 +3347,23 @@ EXPORT_SYMBOL_GPL(ata_sas_slave_configure);
3345 * @ap: ATA port to which the command is being sent 3347 * @ap: ATA port to which the command is being sent
3346 * 3348 *
3347 * RETURNS: 3349 * RETURNS:
3348 * Zero. 3350 * Return value from __ata_scsi_queuecmd() if @cmd can be queued,
3351 * 0 otherwise.
3349 */ 3352 */
3350 3353
3351int ata_sas_queuecmd(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *), 3354int ata_sas_queuecmd(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *),
3352 struct ata_port *ap) 3355 struct ata_port *ap)
3353{ 3356{
3357 int rc = 0;
3358
3354 ata_scsi_dump_cdb(ap, cmd); 3359 ata_scsi_dump_cdb(ap, cmd);
3355 3360
3356 if (likely(ata_scsi_dev_enabled(ap->device))) 3361 if (likely(ata_scsi_dev_enabled(ap->device)))
3357 __ata_scsi_queuecmd(cmd, done, ap->device); 3362 rc = __ata_scsi_queuecmd(cmd, done, ap->device);
3358 else { 3363 else {
3359 cmd->result = (DID_BAD_TARGET << 16); 3364 cmd->result = (DID_BAD_TARGET << 16);
3360 done(cmd); 3365 done(cmd);
3361 } 3366 }
3362 return 0; 3367 return rc;
3363} 3368}
3364EXPORT_SYMBOL_GPL(ata_sas_queuecmd); 3369EXPORT_SYMBOL_GPL(ata_sas_queuecmd);