diff options
author | Tejun Heo <htejun@gmail.com> | 2007-08-06 05:36:23 -0400 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2007-10-12 14:55:31 -0400 |
commit | dbd826168d6267a26cf20cd233f6730f8d8047d6 (patch) | |
tree | 961486fededf27561a2d790ecab6dc50f94617a9 | |
parent | 4fb37a25b976e8d1b34461330b3f2c6d9b94c133 (diff) |
libata-link: implement ata_link_abort()
Implement ata_link_abort().
Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
-rw-r--r-- | drivers/ata/libata-core.c | 1 | ||||
-rw-r--r-- | drivers/ata/libata-eh.c | 50 | ||||
-rw-r--r-- | include/linux/libata.h | 1 |
3 files changed, 38 insertions, 14 deletions
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index 3da642bd2ee2..dcae590cc9b4 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c | |||
@@ -7050,6 +7050,7 @@ EXPORT_SYMBOL_GPL(ata_ehi_push_desc); | |||
7050 | EXPORT_SYMBOL_GPL(ata_ehi_clear_desc); | 7050 | EXPORT_SYMBOL_GPL(ata_ehi_clear_desc); |
7051 | EXPORT_SYMBOL_GPL(ata_eng_timeout); | 7051 | EXPORT_SYMBOL_GPL(ata_eng_timeout); |
7052 | EXPORT_SYMBOL_GPL(ata_port_schedule_eh); | 7052 | EXPORT_SYMBOL_GPL(ata_port_schedule_eh); |
7053 | EXPORT_SYMBOL_GPL(ata_link_abort); | ||
7053 | EXPORT_SYMBOL_GPL(ata_port_abort); | 7054 | EXPORT_SYMBOL_GPL(ata_port_abort); |
7054 | EXPORT_SYMBOL_GPL(ata_port_freeze); | 7055 | EXPORT_SYMBOL_GPL(ata_port_freeze); |
7055 | EXPORT_SYMBOL_GPL(ata_eh_freeze_port); | 7056 | EXPORT_SYMBOL_GPL(ata_eh_freeze_port); |
diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c index 733aa761f3ee..eb4c0593b406 100644 --- a/drivers/ata/libata-eh.c +++ b/drivers/ata/libata-eh.c | |||
@@ -719,19 +719,7 @@ void ata_port_schedule_eh(struct ata_port *ap) | |||
719 | DPRINTK("port EH scheduled\n"); | 719 | DPRINTK("port EH scheduled\n"); |
720 | } | 720 | } |
721 | 721 | ||
722 | /** | 722 | static int ata_do_link_abort(struct ata_port *ap, struct ata_link *link) |
723 | * ata_port_abort - abort all qc's on the port | ||
724 | * @ap: ATA port to abort qc's for | ||
725 | * | ||
726 | * Abort all active qc's of @ap and schedule EH. | ||
727 | * | ||
728 | * LOCKING: | ||
729 | * spin_lock_irqsave(host lock) | ||
730 | * | ||
731 | * RETURNS: | ||
732 | * Number of aborted qc's. | ||
733 | */ | ||
734 | int ata_port_abort(struct ata_port *ap) | ||
735 | { | 723 | { |
736 | int tag, nr_aborted = 0; | 724 | int tag, nr_aborted = 0; |
737 | 725 | ||
@@ -743,7 +731,7 @@ int ata_port_abort(struct ata_port *ap) | |||
743 | for (tag = 0; tag < ATA_MAX_QUEUE; tag++) { | 731 | for (tag = 0; tag < ATA_MAX_QUEUE; tag++) { |
744 | struct ata_queued_cmd *qc = ata_qc_from_tag(ap, tag); | 732 | struct ata_queued_cmd *qc = ata_qc_from_tag(ap, tag); |
745 | 733 | ||
746 | if (qc) { | 734 | if (qc && (!link || qc->dev->link == link)) { |
747 | qc->flags |= ATA_QCFLAG_FAILED; | 735 | qc->flags |= ATA_QCFLAG_FAILED; |
748 | ata_qc_complete(qc); | 736 | ata_qc_complete(qc); |
749 | nr_aborted++; | 737 | nr_aborted++; |
@@ -757,6 +745,40 @@ int ata_port_abort(struct ata_port *ap) | |||
757 | } | 745 | } |
758 | 746 | ||
759 | /** | 747 | /** |
748 | * ata_link_abort - abort all qc's on the link | ||
749 | * @link: ATA link to abort qc's for | ||
750 | * | ||
751 | * Abort all active qc's active on @link and schedule EH. | ||
752 | * | ||
753 | * LOCKING: | ||
754 | * spin_lock_irqsave(host lock) | ||
755 | * | ||
756 | * RETURNS: | ||
757 | * Number of aborted qc's. | ||
758 | */ | ||
759 | int ata_link_abort(struct ata_link *link) | ||
760 | { | ||
761 | return ata_do_link_abort(link->ap, link); | ||
762 | } | ||
763 | |||
764 | /** | ||
765 | * ata_port_abort - abort all qc's on the port | ||
766 | * @ap: ATA port to abort qc's for | ||
767 | * | ||
768 | * Abort all active qc's of @ap and schedule EH. | ||
769 | * | ||
770 | * LOCKING: | ||
771 | * spin_lock_irqsave(host_set lock) | ||
772 | * | ||
773 | * RETURNS: | ||
774 | * Number of aborted qc's. | ||
775 | */ | ||
776 | int ata_port_abort(struct ata_port *ap) | ||
777 | { | ||
778 | return ata_do_link_abort(ap, NULL); | ||
779 | } | ||
780 | |||
781 | /** | ||
760 | * __ata_port_freeze - freeze port | 782 | * __ata_port_freeze - freeze port |
761 | * @ap: ATA port to freeze | 783 | * @ap: ATA port to freeze |
762 | * | 784 | * |
diff --git a/include/linux/libata.h b/include/linux/libata.h index 74ced08d5989..bfa155789993 100644 --- a/include/linux/libata.h +++ b/include/linux/libata.h | |||
@@ -906,6 +906,7 @@ extern unsigned long ata_pci_default_filter(struct ata_device *, unsigned long); | |||
906 | extern void ata_eng_timeout(struct ata_port *ap); | 906 | extern void ata_eng_timeout(struct ata_port *ap); |
907 | 907 | ||
908 | extern void ata_port_schedule_eh(struct ata_port *ap); | 908 | extern void ata_port_schedule_eh(struct ata_port *ap); |
909 | extern int ata_link_abort(struct ata_link *link); | ||
909 | extern int ata_port_abort(struct ata_port *ap); | 910 | extern int ata_port_abort(struct ata_port *ap); |
910 | extern int ata_port_freeze(struct ata_port *ap); | 911 | extern int ata_port_freeze(struct ata_port *ap); |
911 | 912 | ||