diff options
| author | Albert Lee <albertcc@tw.ibm.com> | 2006-03-25 04:58:38 -0500 |
|---|---|---|
| committer | Jeff Garzik <jeff@garzik.org> | 2006-03-29 17:21:54 -0500 |
| commit | c234fb00ea8999076728137d96603b713ad8b53f (patch) | |
| tree | 7490f2ff6546c493a41e85fbc36571f4c5b5e6c9 | |
| parent | c2bbc551615c21a4c280c797987dbb50f2701594 (diff) | |
[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>
| -rw-r--r-- | drivers/scsi/libata-core.c | 34 |
1 files changed, 28 insertions, 6 deletions
diff --git a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c index 61c120dae74d..27078c06119a 100644 --- a/drivers/scsi/libata-core.c +++ b/drivers/scsi/libata-core.c | |||
| @@ -3536,6 +3536,33 @@ err_out: | |||
| 3536 | } | 3536 | } |
| 3537 | 3537 | ||
| 3538 | /** | 3538 | /** |
| 3539 | * ata_hsm_ok_in_wq - Check if the qc can be handled in the workqueue. | ||
| 3540 | * @ap: the target ata_port | ||
| 3541 | * @qc: qc on going | ||
| 3542 | * | ||
| 3543 | * RETURNS: | ||
| 3544 | * 1 if ok in workqueue, 0 otherwise. | ||
| 3545 | */ | ||
| 3546 | |||
| 3547 | static inline int ata_hsm_ok_in_wq(struct ata_port *ap, struct ata_queued_cmd *qc) | ||
| 3548 | { | ||
| 3549 | if (qc->tf.flags & ATA_TFLAG_POLLING) | ||
| 3550 | return 1; | ||
| 3551 | |||
| 3552 | if (ap->hsm_task_state == HSM_ST_FIRST) { | ||
| 3553 | if (qc->tf.protocol == ATA_PROT_PIO && | ||
| 3554 | (qc->tf.flags & ATA_TFLAG_WRITE)) | ||
| 3555 | return 1; | ||
| 3556 | |||
| 3557 | if (is_atapi_taskfile(&qc->tf) && | ||
| 3558 | !(qc->dev->flags & ATA_DFLAG_CDB_INTR)) | ||
| 3559 | return 1; | ||
| 3560 | } | ||
| 3561 | |||
| 3562 | return 0; | ||
| 3563 | } | ||
| 3564 | |||
| 3565 | /** | ||
| 3539 | * ata_hsm_move - move the HSM to the next state. | 3566 | * ata_hsm_move - move the HSM to the next state. |
| 3540 | * @ap: the target ata_port | 3567 | * @ap: the target ata_port |
| 3541 | * @qc: qc on going | 3568 | * @qc: qc on going |
| @@ -3558,12 +3585,7 @@ static int ata_hsm_move(struct ata_port *ap, struct ata_queued_cmd *qc, | |||
| 3558 | * like DMA polling into the workqueue. Notice that | 3585 | * like DMA polling into the workqueue. Notice that |
| 3559 | * in_wq is not equivalent to (qc->tf.flags & ATA_TFLAG_POLLING). | 3586 | * in_wq is not equivalent to (qc->tf.flags & ATA_TFLAG_POLLING). |
| 3560 | */ | 3587 | */ |
| 3561 | WARN_ON(in_wq != ((qc->tf.flags & ATA_TFLAG_POLLING) || | 3588 | WARN_ON(in_wq != ata_hsm_ok_in_wq(ap, qc)); |
| 3562 | (ap->hsm_task_state == HSM_ST_FIRST && | ||
| 3563 | ((qc->tf.protocol == ATA_PROT_PIO && | ||
| 3564 | (qc->tf.flags & ATA_TFLAG_WRITE)) || | ||
| 3565 | (is_atapi_taskfile(&qc->tf) && | ||
| 3566 | !(qc->dev->flags & ATA_DFLAG_CDB_INTR)))))); | ||
| 3567 | 3589 | ||
| 3568 | /* check error */ | 3590 | /* check error */ |
| 3569 | if (unlikely(status & (ATA_ERR | ATA_DF))) { | 3591 | if (unlikely(status & (ATA_ERR | ATA_DF))) { |
