diff options
author | Tejun Heo <tj@kernel.org> | 2010-06-25 09:03:34 -0400 |
---|---|---|
committer | Jeff Garzik <jgarzik@redhat.com> | 2010-10-21 20:21:03 -0400 |
commit | 1aadf5c3bbbbb0db09dcb5aa26c61326e0d3e9e7 (patch) | |
tree | 6aff1f6dc2761f85488be2ed2be5e7f4c92c907c /drivers/ata/libata-core.c | |
parent | d9027470b88631d0956ac37cdadfdeb9cdcf2c99 (diff) |
libata: always use ata_qc_complete_multiple() for NCQ command completions
Currently, sata_fsl, mv and nv call ata_qc_complete() multiple times
from their interrupt handlers to indicate completion of NCQ commands.
This limits the visibility the libata core layer has into how commands
are being executed and completed, which is necessary to support IRQ
expecting in generic way. libata already has an interface to complete
multiple commands at once - ata_qc_complete_multiple() which ahci and
sata_sil24 already use.
This patch updates the three drivers to use ata_qc_complete_multiple()
too and updates comments on ata_qc_complete[_multiple]() regarding
their usages with NCQ completions. This change not only provides
better visibility into command execution to the core layer but also
simplifies low level drivers.
* sata_fsl: It already builds done_mask. Conversion is straight
forward.
* sata_mv: mv_process_crpb_response() no longer checks for illegal
completions, it just returns whether the tag is completed or not.
mv_process_crpb_entries() builds done_mask from it and passes it to
ata_qc_complete_multiple() which will check for illegal completions.
* sata_nv adma: Similar to sata_mv. nv_adma_check_cpb() now just
returns the tag status and nv_adma_interrupt() builds done_mask from
it and passes it to ata_qc_complete_multiple().
* sata_nv swncq: It already builds done_mask. Drop unnecessary
illegal transition checks and call ata_qc_complete_multiple().
In the long run, it might be a good idea to make ata_qc_complete()
whine if called when multiple NCQ commands are in flight.
Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Ashish Kalra <ashish.kalra@freescale.com>
Cc: Saeed Bishara <saeed@marvell.com>
Cc: Mark Lord <liml@rtr.ca>
Cc: Robert Hancock <hancockr@shaw.ca>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Diffstat (limited to 'drivers/ata/libata-core.c')
-rw-r--r-- | drivers/ata/libata-core.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index 4012b33e8b8a..92cd5f375b8f 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c | |||
@@ -4943,8 +4943,13 @@ static void ata_verify_xfer(struct ata_queued_cmd *qc) | |||
4943 | * ata_qc_complete - Complete an active ATA command | 4943 | * ata_qc_complete - Complete an active ATA command |
4944 | * @qc: Command to complete | 4944 | * @qc: Command to complete |
4945 | * | 4945 | * |
4946 | * Indicate to the mid and upper layers that an ATA | 4946 | * Indicate to the mid and upper layers that an ATA command has |
4947 | * command has completed, with either an ok or not-ok status. | 4947 | * completed, with either an ok or not-ok status. |
4948 | * | ||
4949 | * Refrain from calling this function multiple times when | ||
4950 | * successfully completing multiple NCQ commands. | ||
4951 | * ata_qc_complete_multiple() should be used instead, which will | ||
4952 | * properly update IRQ expect state. | ||
4948 | * | 4953 | * |
4949 | * LOCKING: | 4954 | * LOCKING: |
4950 | * spin_lock_irqsave(host lock) | 4955 | * spin_lock_irqsave(host lock) |
@@ -5037,6 +5042,10 @@ void ata_qc_complete(struct ata_queued_cmd *qc) | |||
5037 | * requests normally. ap->qc_active and @qc_active is compared | 5042 | * requests normally. ap->qc_active and @qc_active is compared |
5038 | * and commands are completed accordingly. | 5043 | * and commands are completed accordingly. |
5039 | * | 5044 | * |
5045 | * Always use this function when completing multiple NCQ commands | ||
5046 | * from IRQ handlers instead of calling ata_qc_complete() | ||
5047 | * multiple times to keep IRQ expect status properly in sync. | ||
5048 | * | ||
5040 | * LOCKING: | 5049 | * LOCKING: |
5041 | * spin_lock_irqsave(host lock) | 5050 | * spin_lock_irqsave(host lock) |
5042 | * | 5051 | * |