Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 29429
b: refs/heads/master
c: 2115ea9
h: refs/heads/master
i:
  29427: d5d323b
v: v3
  • Loading branch information
Tejun Heo committed May 15, 2006
1 parent 2877988 commit 3645c83
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 17 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 88e490340ea4c3a2ebc0187a4339912e2fc1a081
refs/heads/master: 2115ea94a2d11fbd228b049e667ec2d3e91ca371
40 changes: 24 additions & 16 deletions trunk/drivers/scsi/libata-scsi.c
Original file line number Diff line number Diff line change
Expand Up @@ -1248,11 +1248,14 @@ static void ata_scsi_qc_complete(struct ata_queued_cmd *qc)
*
* LOCKING:
* spin_lock_irqsave(host_set lock)
*
* RETURNS:
* 0 on success, SCSI_ML_QUEUE_DEVICE_BUSY if the command
* needs to be deferred.
*/

static void ata_scsi_translate(struct ata_device *dev, struct scsi_cmnd *cmd,
void (*done)(struct scsi_cmnd *),
ata_xlat_func_t xlat_func)
static int ata_scsi_translate(struct ata_device *dev, struct scsi_cmnd *cmd,
void (*done)(struct scsi_cmnd *),
ata_xlat_func_t xlat_func)
{
struct ata_queued_cmd *qc;
u8 *scsicmd = cmd->cmnd;
Expand Down Expand Up @@ -1290,21 +1293,21 @@ static void ata_scsi_translate(struct ata_device *dev, struct scsi_cmnd *cmd,
ata_qc_issue(qc);

VPRINTK("EXIT\n");
return;
return 0;

early_finish:
ata_qc_free(qc);
done(cmd);
DPRINTK("EXIT - early finish (good or error)\n");
return;
return 0;

err_did:
ata_qc_free(qc);
err_mem:
cmd->result = (DID_ERROR << 16);
done(cmd);
DPRINTK("EXIT - internal\n");
return;
return 0;
}

/**
Expand Down Expand Up @@ -2456,20 +2459,24 @@ static inline void ata_scsi_dump_cdb(struct ata_port *ap,
#endif
}

static inline void __ata_scsi_queuecmd(struct scsi_cmnd *cmd,
void (*done)(struct scsi_cmnd *),
struct ata_device *dev)
static inline int __ata_scsi_queuecmd(struct scsi_cmnd *cmd,
void (*done)(struct scsi_cmnd *),
struct ata_device *dev)
{
int rc = 0;

if (dev->class == ATA_DEV_ATA) {
ata_xlat_func_t xlat_func = ata_get_xlat_func(dev,
cmd->cmnd[0]);

if (xlat_func)
ata_scsi_translate(dev, cmd, done, xlat_func);
rc = ata_scsi_translate(dev, cmd, done, xlat_func);
else
ata_scsi_simulate(dev, cmd, done);
} else
ata_scsi_translate(dev, cmd, done, atapi_xlat);
rc = ata_scsi_translate(dev, cmd, done, atapi_xlat);

return rc;
}

/**
Expand All @@ -2488,15 +2495,16 @@ static inline void __ata_scsi_queuecmd(struct scsi_cmnd *cmd,
* Releases scsi-layer-held lock, and obtains host_set lock.
*
* RETURNS:
* Zero.
* Return value from __ata_scsi_queuecmd() if @cmd can be queued,
* 0 otherwise.
*/

int ata_scsi_queuecmd(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *))
{
struct ata_port *ap;
struct ata_device *dev;
struct scsi_device *scsidev = cmd->device;
struct Scsi_Host *shost = scsidev->host;
int rc = 0;

ap = ata_shost_to_port(shost);

Expand All @@ -2507,15 +2515,15 @@ int ata_scsi_queuecmd(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *))

dev = ata_scsi_find_dev(ap, scsidev);
if (likely(dev))
__ata_scsi_queuecmd(cmd, done, dev);
rc = __ata_scsi_queuecmd(cmd, done, dev);
else {
cmd->result = (DID_BAD_TARGET << 16);
done(cmd);
}

spin_unlock(&ap->host_set->lock);
spin_lock(shost->host_lock);
return 0;
return rc;
}

/**
Expand Down

0 comments on commit 3645c83

Please sign in to comment.