aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/libata-core.c
diff options
context:
space:
mode:
authorAlbert Lee <albertcc@tw.ibm.com>2006-03-25 17:58:38 +0800
committerJeff Garzik <jeff@garzik.org>2006-03-29 17:21:54 -0500
commitc234fb00ea8999076728137d96603b713ad8b53f (patch)
tree7490f2ff6546c493a41e85fbc36571f4c5b5e6c9 /drivers/scsi/libata-core.c
parentc2bbc551615c21a4c280c797987dbb50f2701594 (diff)
downloadlinux-c234fb00ea8999076728137d96603b713ad8b53f.tar.gz
[PATCH] libata-dev: Make the the in_wq check as an inline function
Make the the in_wq check easier to read as an inline function. Signed-off-by: Albert Lee <albertcc@tw.ibm.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/scsi/libata-core.c')
-rw-r--r--drivers/scsi/libata-core.c34
1 files changed, 28 insertions, 6 deletions
diff --git a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c
index 61c120dae74d0..27078c06119a7 100644
--- a/drivers/scsi/libata-core.c
+++ b/drivers/scsi/libata-core.c
@@ -3536,6 +3536,33 @@ err_out:
}
/**
+ * 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
* @qc: qc on going
@@ -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))) {