diff options
author | Suman Tripathi <stripathi@apm.com> | 2015-05-05 15:21:10 -0400 |
---|---|---|
committer | Tejun Heo <tj@kernel.org> | 2015-05-10 11:52:44 -0400 |
commit | a129db89d865b1b91995989bcdee783358d774a5 (patch) | |
tree | 014c149439ad346cb5ce3f11a6cdaad028375798 /drivers/ata | |
parent | 4b9d64ee04a4033213454b384d5ec2dcd5e25b84 (diff) |
libahci: Refactoring of ahci_single_irq_intr function.
This patch refactors the ahci_single_irq_intr function and also rename
it to ahci_single_level_irq_intr as it handles a level triggered latch.
Signed-off-by: Suman tripathi <stripathi@apm.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
Diffstat (limited to 'drivers/ata')
-rw-r--r-- | drivers/ata/libahci.c | 51 |
1 files changed, 30 insertions, 21 deletions
diff --git a/drivers/ata/libahci.c b/drivers/ata/libahci.c index 61a9c07e0dff..aa89c8eecd76 100644 --- a/drivers/ata/libahci.c +++ b/drivers/ata/libahci.c | |||
@@ -1826,27 +1826,9 @@ static irqreturn_t ahci_multi_irqs_intr(int irq, void *dev_instance) | |||
1826 | return IRQ_WAKE_THREAD; | 1826 | return IRQ_WAKE_THREAD; |
1827 | } | 1827 | } |
1828 | 1828 | ||
1829 | static irqreturn_t ahci_single_irq_intr(int irq, void *dev_instance) | 1829 | static u32 ahci_handle_port_intr(struct ata_host *host, u32 irq_masked) |
1830 | { | 1830 | { |
1831 | struct ata_host *host = dev_instance; | ||
1832 | struct ahci_host_priv *hpriv; | ||
1833 | unsigned int i, handled = 0; | 1831 | unsigned int i, handled = 0; |
1834 | void __iomem *mmio; | ||
1835 | u32 irq_stat, irq_masked; | ||
1836 | |||
1837 | VPRINTK("ENTER\n"); | ||
1838 | |||
1839 | hpriv = host->private_data; | ||
1840 | mmio = hpriv->mmio; | ||
1841 | |||
1842 | /* sigh. 0xffffffff is a valid return from h/w */ | ||
1843 | irq_stat = readl(mmio + HOST_IRQ_STAT); | ||
1844 | if (!irq_stat) | ||
1845 | return IRQ_NONE; | ||
1846 | |||
1847 | irq_masked = irq_stat & hpriv->port_map; | ||
1848 | |||
1849 | spin_lock(&host->lock); | ||
1850 | 1832 | ||
1851 | for (i = 0; i < host->n_ports; i++) { | 1833 | for (i = 0; i < host->n_ports; i++) { |
1852 | struct ata_port *ap; | 1834 | struct ata_port *ap; |
@@ -1868,6 +1850,33 @@ static irqreturn_t ahci_single_irq_intr(int irq, void *dev_instance) | |||
1868 | handled = 1; | 1850 | handled = 1; |
1869 | } | 1851 | } |
1870 | 1852 | ||
1853 | return handled; | ||
1854 | } | ||
1855 | |||
1856 | static irqreturn_t ahci_single_level_irq_intr(int irq, void *dev_instance) | ||
1857 | { | ||
1858 | struct ata_host *host = dev_instance; | ||
1859 | struct ahci_host_priv *hpriv; | ||
1860 | unsigned int rc = 0; | ||
1861 | void __iomem *mmio; | ||
1862 | u32 irq_stat, irq_masked; | ||
1863 | |||
1864 | VPRINTK("ENTER\n"); | ||
1865 | |||
1866 | hpriv = host->private_data; | ||
1867 | mmio = hpriv->mmio; | ||
1868 | |||
1869 | /* sigh. 0xffffffff is a valid return from h/w */ | ||
1870 | irq_stat = readl(mmio + HOST_IRQ_STAT); | ||
1871 | if (!irq_stat) | ||
1872 | return IRQ_NONE; | ||
1873 | |||
1874 | irq_masked = irq_stat & hpriv->port_map; | ||
1875 | |||
1876 | spin_lock(&host->lock); | ||
1877 | |||
1878 | rc = ahci_handle_port_intr(host, irq_masked); | ||
1879 | |||
1871 | /* HOST_IRQ_STAT behaves as level triggered latch meaning that | 1880 | /* HOST_IRQ_STAT behaves as level triggered latch meaning that |
1872 | * it should be cleared after all the port events are cleared; | 1881 | * it should be cleared after all the port events are cleared; |
1873 | * otherwise, it will raise a spurious interrupt after each | 1882 | * otherwise, it will raise a spurious interrupt after each |
@@ -1883,7 +1892,7 @@ static irqreturn_t ahci_single_irq_intr(int irq, void *dev_instance) | |||
1883 | 1892 | ||
1884 | VPRINTK("EXIT\n"); | 1893 | VPRINTK("EXIT\n"); |
1885 | 1894 | ||
1886 | return IRQ_RETVAL(handled); | 1895 | return IRQ_RETVAL(rc); |
1887 | } | 1896 | } |
1888 | 1897 | ||
1889 | unsigned int ahci_qc_issue(struct ata_queued_cmd *qc) | 1898 | unsigned int ahci_qc_issue(struct ata_queued_cmd *qc) |
@@ -2487,7 +2496,7 @@ int ahci_host_activate(struct ata_host *host, int irq, | |||
2487 | if (hpriv->flags & AHCI_HFLAG_MULTI_MSI) | 2496 | if (hpriv->flags & AHCI_HFLAG_MULTI_MSI) |
2488 | rc = ahci_host_activate_multi_irqs(host, irq, sht); | 2497 | rc = ahci_host_activate_multi_irqs(host, irq, sht); |
2489 | else | 2498 | else |
2490 | rc = ata_host_activate(host, irq, ahci_single_irq_intr, | 2499 | rc = ata_host_activate(host, irq, ahci_single_level_irq_intr, |
2491 | IRQF_SHARED, sht); | 2500 | IRQF_SHARED, sht); |
2492 | return rc; | 2501 | return rc; |
2493 | } | 2502 | } |