Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 29405
b: refs/heads/master
c: c234fb0
h: refs/heads/master
i:
  29403: 629503b
v: v3
  • Loading branch information
Albert Lee authored and Jeff Garzik committed Mar 29, 2006
1 parent 88aa177 commit c7f30fd
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 7 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: c2bbc551615c21a4c280c797987dbb50f2701594
refs/heads/master: c234fb00ea8999076728137d96603b713ad8b53f
34 changes: 28 additions & 6 deletions trunk/drivers/scsi/libata-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -3535,6 +3535,33 @@ static void atapi_pio_bytes(struct ata_queued_cmd *qc)
ap->hsm_task_state = HSM_ST_ERR;
}

/**
* ata_hsm_ok_in_wq - Check if the qc can be handled in the workqueue.
* @ap: the target ata_port
* @qc: qc on going
*
* RETURNS:
* 1 if ok in workqueue, 0 otherwise.
*/

static inline int ata_hsm_ok_in_wq(struct ata_port *ap, struct ata_queued_cmd *qc)
{
if (qc->tf.flags & ATA_TFLAG_POLLING)
return 1;

if (ap->hsm_task_state == HSM_ST_FIRST) {
if (qc->tf.protocol == ATA_PROT_PIO &&
(qc->tf.flags & ATA_TFLAG_WRITE))
return 1;

if (is_atapi_taskfile(&qc->tf) &&
!(qc->dev->flags & ATA_DFLAG_CDB_INTR))
return 1;
}

return 0;
}

/**
* ata_hsm_move - move the HSM to the next state.
* @ap: the target ata_port
Expand All @@ -3558,12 +3585,7 @@ static int ata_hsm_move(struct ata_port *ap, struct ata_queued_cmd *qc,
* like DMA polling into the workqueue. Notice that
* in_wq is not equivalent to (qc->tf.flags & ATA_TFLAG_POLLING).
*/
WARN_ON(in_wq != ((qc->tf.flags & ATA_TFLAG_POLLING) ||
(ap->hsm_task_state == HSM_ST_FIRST &&
((qc->tf.protocol == ATA_PROT_PIO &&
(qc->tf.flags & ATA_TFLAG_WRITE)) ||
(is_atapi_taskfile(&qc->tf) &&
!(qc->dev->flags & ATA_DFLAG_CDB_INTR))))));
WARN_ON(in_wq != ata_hsm_ok_in_wq(ap, qc));

/* check error */
if (unlikely(status & (ATA_ERR | ATA_DF))) {
Expand Down

0 comments on commit c7f30fd

Please sign in to comment.