diff options
| -rw-r--r-- | drivers/ata/libata-scsi.c | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c index 19835d39289d..66aa4bee80a6 100644 --- a/drivers/ata/libata-scsi.c +++ b/drivers/ata/libata-scsi.c | |||
| @@ -3166,8 +3166,8 @@ static inline int __ata_scsi_queuecmd(struct scsi_cmnd *scmd, | |||
| 3166 | 3166 | ||
| 3167 | /** | 3167 | /** |
| 3168 | * ata_scsi_queuecmd - Issue SCSI cdb to libata-managed device | 3168 | * ata_scsi_queuecmd - Issue SCSI cdb to libata-managed device |
| 3169 | * @shost: SCSI host of command to be sent | ||
| 3169 | * @cmd: SCSI command to be sent | 3170 | * @cmd: SCSI command to be sent |
| 3170 | * @done: Completion function, called when command is complete | ||
| 3171 | * | 3171 | * |
| 3172 | * In some cases, this function translates SCSI commands into | 3172 | * In some cases, this function translates SCSI commands into |
| 3173 | * ATA taskfiles, and queues the taskfiles to be sent to | 3173 | * ATA taskfiles, and queues the taskfiles to be sent to |
| @@ -3177,42 +3177,39 @@ static inline int __ata_scsi_queuecmd(struct scsi_cmnd *scmd, | |||
| 3177 | * ATA and ATAPI devices appearing as SCSI devices. | 3177 | * ATA and ATAPI devices appearing as SCSI devices. |
| 3178 | * | 3178 | * |
| 3179 | * LOCKING: | 3179 | * LOCKING: |
| 3180 | * Releases scsi-layer-held lock, and obtains host lock. | 3180 | * ATA host lock |
| 3181 | * | 3181 | * |
| 3182 | * RETURNS: | 3182 | * RETURNS: |
| 3183 | * Return value from __ata_scsi_queuecmd() if @cmd can be queued, | 3183 | * Return value from __ata_scsi_queuecmd() if @cmd can be queued, |
| 3184 | * 0 otherwise. | 3184 | * 0 otherwise. |
| 3185 | */ | 3185 | */ |
| 3186 | static int ata_scsi_queuecmd_lck(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *)) | 3186 | int ata_scsi_queuecmd(struct Scsi_Host *shost, struct scsi_cmnd *cmd) |
| 3187 | { | 3187 | { |
| 3188 | struct ata_port *ap; | 3188 | struct ata_port *ap; |
| 3189 | struct ata_device *dev; | 3189 | struct ata_device *dev; |
| 3190 | struct scsi_device *scsidev = cmd->device; | 3190 | struct scsi_device *scsidev = cmd->device; |
| 3191 | struct Scsi_Host *shost = scsidev->host; | ||
| 3192 | int rc = 0; | 3191 | int rc = 0; |
| 3192 | unsigned long irq_flags; | ||
| 3193 | 3193 | ||
| 3194 | ap = ata_shost_to_port(shost); | 3194 | ap = ata_shost_to_port(shost); |
| 3195 | 3195 | ||
| 3196 | spin_unlock(shost->host_lock); | 3196 | spin_lock_irqsave(ap->lock, irq_flags); |
| 3197 | spin_lock(ap->lock); | ||
| 3198 | 3197 | ||
| 3199 | ata_scsi_dump_cdb(ap, cmd); | 3198 | ata_scsi_dump_cdb(ap, cmd); |
| 3200 | 3199 | ||
| 3201 | dev = ata_scsi_find_dev(ap, scsidev); | 3200 | dev = ata_scsi_find_dev(ap, scsidev); |
| 3202 | if (likely(dev)) | 3201 | if (likely(dev)) |
| 3203 | rc = __ata_scsi_queuecmd(cmd, done, dev); | 3202 | rc = __ata_scsi_queuecmd(cmd, cmd->scsi_done, dev); |
| 3204 | else { | 3203 | else { |
| 3205 | cmd->result = (DID_BAD_TARGET << 16); | 3204 | cmd->result = (DID_BAD_TARGET << 16); |
| 3206 | done(cmd); | 3205 | cmd->scsi_done(cmd); |
| 3207 | } | 3206 | } |
| 3208 | 3207 | ||
| 3209 | spin_unlock(ap->lock); | 3208 | spin_unlock_irqrestore(ap->lock, irq_flags); |
| 3210 | spin_lock(shost->host_lock); | 3209 | |
| 3211 | return rc; | 3210 | return rc; |
| 3212 | } | 3211 | } |
| 3213 | 3212 | ||
| 3214 | DEF_SCSI_QCMD(ata_scsi_queuecmd) | ||
| 3215 | |||
| 3216 | /** | 3213 | /** |
| 3217 | * ata_scsi_simulate - simulate SCSI command on ATA device | 3214 | * ata_scsi_simulate - simulate SCSI command on ATA device |
| 3218 | * @dev: the target device | 3215 | * @dev: the target device |
