aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi')
-rw-r--r--drivers/scsi/libata-scsi.c32
1 files changed, 18 insertions, 14 deletions
diff --git a/drivers/scsi/libata-scsi.c b/drivers/scsi/libata-scsi.c
index b7df37ed4393..8192ddd62974 100644
--- a/drivers/scsi/libata-scsi.c
+++ b/drivers/scsi/libata-scsi.c
@@ -2597,6 +2597,21 @@ static inline void ata_scsi_dump_cdb(struct ata_port *ap,
2597#endif 2597#endif
2598} 2598}
2599 2599
2600static inline void __ata_scsi_queuecmd(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *),
2601 struct ata_port *ap, struct ata_device *dev)
2602{
2603 if (dev->class == ATA_DEV_ATA) {
2604 ata_xlat_func_t xlat_func = ata_get_xlat_func(dev,
2605 cmd->cmnd[0]);
2606
2607 if (xlat_func)
2608 ata_scsi_translate(ap, dev, cmd, done, xlat_func);
2609 else
2610 ata_scsi_simulate(ap, dev, cmd, done);
2611 } else
2612 ata_scsi_translate(ap, dev, cmd, done, atapi_xlat);
2613}
2614
2600/** 2615/**
2601 * ata_scsi_queuecmd - Issue SCSI cdb to libata-managed device 2616 * ata_scsi_queuecmd - Issue SCSI cdb to libata-managed device
2602 * @cmd: SCSI command to be sent 2617 * @cmd: SCSI command to be sent
@@ -2631,24 +2646,13 @@ int ata_scsi_queuecmd(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *))
2631 ata_scsi_dump_cdb(ap, cmd); 2646 ata_scsi_dump_cdb(ap, cmd);
2632 2647
2633 dev = ata_scsi_find_dev(ap, scsidev); 2648 dev = ata_scsi_find_dev(ap, scsidev);
2634 if (unlikely(!dev)) { 2649 if (likely(dev))
2650 __ata_scsi_queuecmd(cmd, done, ap, dev);
2651 else {
2635 cmd->result = (DID_BAD_TARGET << 16); 2652 cmd->result = (DID_BAD_TARGET << 16);
2636 done(cmd); 2653 done(cmd);
2637 goto out_unlock;
2638 } 2654 }
2639 2655
2640 if (dev->class == ATA_DEV_ATA) {
2641 ata_xlat_func_t xlat_func = ata_get_xlat_func(dev,
2642 cmd->cmnd[0]);
2643
2644 if (xlat_func)
2645 ata_scsi_translate(ap, dev, cmd, done, xlat_func);
2646 else
2647 ata_scsi_simulate(ap, dev, cmd, done);
2648 } else
2649 ata_scsi_translate(ap, dev, cmd, done, atapi_xlat);
2650
2651out_unlock:
2652 spin_unlock(&ap->host_set->lock); 2656 spin_unlock(&ap->host_set->lock);
2653 spin_lock(shost->host_lock); 2657 spin_lock(shost->host_lock);
2654 return 0; 2658 return 0;