diff options
author | Alexander Gordeev <agordeev@redhat.com> | 2014-09-29 12:25:59 -0400 |
---|---|---|
committer | Tejun Heo <tj@kernel.org> | 2014-10-06 11:43:35 -0400 |
commit | d1028e2f95b75acab4f1046acae1b1ca7d7b2577 (patch) | |
tree | 6f04701879c51f7fb6fbee6ac588790d2e077efe /drivers/ata/libahci.c | |
parent | 1c62854f5f7321b3ee8c08d34d7c1e615608566d (diff) |
AHCI: Move host activation code into ahci_host_activate()
Currently host activation done by calling either function
ahci_host_activate() or ata_host_activate(). Consolidate
the code by only calling ahci_host_activate() for all AHCI
devices.
Signed-off-by: Alexander Gordeev <agordeev@redhat.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: linux-ide@vger.kernel.org
Diffstat (limited to 'drivers/ata/libahci.c')
-rw-r--r-- | drivers/ata/libahci.c | 59 |
1 files changed, 35 insertions, 24 deletions
diff --git a/drivers/ata/libahci.c b/drivers/ata/libahci.c index 21bb427d9df4..0080551f6e33 100644 --- a/drivers/ata/libahci.c +++ b/drivers/ata/libahci.c | |||
@@ -1789,7 +1789,7 @@ static void ahci_port_intr(struct ata_port *ap) | |||
1789 | ahci_handle_port_interrupt(ap, port_mmio, status); | 1789 | ahci_handle_port_interrupt(ap, port_mmio, status); |
1790 | } | 1790 | } |
1791 | 1791 | ||
1792 | irqreturn_t ahci_thread_fn(int irq, void *dev_instance) | 1792 | static irqreturn_t ahci_thread_fn(int irq, void *dev_instance) |
1793 | { | 1793 | { |
1794 | struct ata_port *ap = dev_instance; | 1794 | struct ata_port *ap = dev_instance; |
1795 | struct ahci_port_priv *pp = ap->private_data; | 1795 | struct ahci_port_priv *pp = ap->private_data; |
@@ -1809,7 +1809,6 @@ irqreturn_t ahci_thread_fn(int irq, void *dev_instance) | |||
1809 | 1809 | ||
1810 | return IRQ_HANDLED; | 1810 | return IRQ_HANDLED; |
1811 | } | 1811 | } |
1812 | EXPORT_SYMBOL_GPL(ahci_thread_fn); | ||
1813 | 1812 | ||
1814 | static void ahci_hw_port_interrupt(struct ata_port *ap) | 1813 | static void ahci_hw_port_interrupt(struct ata_port *ap) |
1815 | { | 1814 | { |
@@ -1823,7 +1822,7 @@ static void ahci_hw_port_interrupt(struct ata_port *ap) | |||
1823 | pp->intr_status |= status; | 1822 | pp->intr_status |= status; |
1824 | } | 1823 | } |
1825 | 1824 | ||
1826 | irqreturn_t ahci_hw_interrupt(int irq, void *dev_instance) | 1825 | static irqreturn_t ahci_hw_interrupt(int irq, void *dev_instance) |
1827 | { | 1826 | { |
1828 | struct ata_port *ap_this = dev_instance; | 1827 | struct ata_port *ap_this = dev_instance; |
1829 | struct ahci_port_priv *pp = ap_this->private_data; | 1828 | struct ahci_port_priv *pp = ap_this->private_data; |
@@ -1877,9 +1876,8 @@ irqreturn_t ahci_hw_interrupt(int irq, void *dev_instance) | |||
1877 | 1876 | ||
1878 | return IRQ_WAKE_THREAD; | 1877 | return IRQ_WAKE_THREAD; |
1879 | } | 1878 | } |
1880 | EXPORT_SYMBOL_GPL(ahci_hw_interrupt); | ||
1881 | 1879 | ||
1882 | irqreturn_t ahci_interrupt(int irq, void *dev_instance) | 1880 | static irqreturn_t ahci_interrupt(int irq, void *dev_instance) |
1883 | { | 1881 | { |
1884 | struct ata_host *host = dev_instance; | 1882 | struct ata_host *host = dev_instance; |
1885 | struct ahci_host_priv *hpriv; | 1883 | struct ahci_host_priv *hpriv; |
@@ -1938,7 +1936,6 @@ irqreturn_t ahci_interrupt(int irq, void *dev_instance) | |||
1938 | 1936 | ||
1939 | return IRQ_RETVAL(handled); | 1937 | return IRQ_RETVAL(handled); |
1940 | } | 1938 | } |
1941 | EXPORT_SYMBOL_GPL(ahci_interrupt); | ||
1942 | 1939 | ||
1943 | unsigned int ahci_qc_issue(struct ata_queued_cmd *qc) | 1940 | unsigned int ahci_qc_issue(struct ata_queued_cmd *qc) |
1944 | { | 1941 | { |
@@ -2472,24 +2469,8 @@ void ahci_set_em_messages(struct ahci_host_priv *hpriv, | |||
2472 | } | 2469 | } |
2473 | EXPORT_SYMBOL_GPL(ahci_set_em_messages); | 2470 | EXPORT_SYMBOL_GPL(ahci_set_em_messages); |
2474 | 2471 | ||
2475 | /** | 2472 | static int ahci_host_activate_multi_irqs(struct ata_host *host, int irq, |
2476 | * ahci_host_activate - start AHCI host, request IRQs and register it | 2473 | struct scsi_host_template *sht) |
2477 | * @host: target ATA host | ||
2478 | * @irq: base IRQ number to request | ||
2479 | * @sht: scsi_host_template to use when registering the host | ||
2480 | * | ||
2481 | * Similar to ata_host_activate, but requests IRQs according to AHCI-1.1 | ||
2482 | * when multiple MSIs were allocated. That is one MSI per port, starting | ||
2483 | * from @irq. | ||
2484 | * | ||
2485 | * LOCKING: | ||
2486 | * Inherited from calling layer (may sleep). | ||
2487 | * | ||
2488 | * RETURNS: | ||
2489 | * 0 on success, -errno otherwise. | ||
2490 | */ | ||
2491 | int ahci_host_activate(struct ata_host *host, int irq, | ||
2492 | struct scsi_host_template *sht) | ||
2493 | { | 2474 | { |
2494 | int i, rc; | 2475 | int i, rc; |
2495 | 2476 | ||
@@ -2531,6 +2512,36 @@ out_free_irqs: | |||
2531 | 2512 | ||
2532 | return rc; | 2513 | return rc; |
2533 | } | 2514 | } |
2515 | |||
2516 | /** | ||
2517 | * ahci_host_activate - start AHCI host, request IRQs and register it | ||
2518 | * @host: target ATA host | ||
2519 | * @irq: base IRQ number to request | ||
2520 | * @sht: scsi_host_template to use when registering the host | ||
2521 | * | ||
2522 | * Similar to ata_host_activate, but requests IRQs according to AHCI-1.1 | ||
2523 | * when multiple MSIs were allocated. That is one MSI per port, starting | ||
2524 | * from @irq. | ||
2525 | * | ||
2526 | * LOCKING: | ||
2527 | * Inherited from calling layer (may sleep). | ||
2528 | * | ||
2529 | * RETURNS: | ||
2530 | * 0 on success, -errno otherwise. | ||
2531 | */ | ||
2532 | int ahci_host_activate(struct ata_host *host, int irq, | ||
2533 | struct scsi_host_template *sht) | ||
2534 | { | ||
2535 | struct ahci_host_priv *hpriv = host->private_data; | ||
2536 | int rc; | ||
2537 | |||
2538 | if (hpriv->flags & AHCI_HFLAG_MULTI_MSI) | ||
2539 | rc = ahci_host_activate_multi_irqs(host, irq, sht); | ||
2540 | else | ||
2541 | rc = ata_host_activate(host, irq, ahci_interrupt, | ||
2542 | IRQF_SHARED, sht); | ||
2543 | return rc; | ||
2544 | } | ||
2534 | EXPORT_SYMBOL_GPL(ahci_host_activate); | 2545 | EXPORT_SYMBOL_GPL(ahci_host_activate); |
2535 | 2546 | ||
2536 | MODULE_AUTHOR("Jeff Garzik"); | 2547 | MODULE_AUTHOR("Jeff Garzik"); |