aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Gordeev <agordeev@redhat.com>2014-09-25 09:13:21 -0400
committerTejun Heo <tj@kernel.org>2014-09-28 11:43:56 -0400
commitc3ebd6a9b614ef1fbb5a44a3a33cd639ff4694bf (patch)
treedf33c8be5ae2ac6d0bbd21400a643df9b8de9b5f
parent6d8ca28fa688a9354bc9fbc935bdaeb3651b6677 (diff)
AHCI: Cleanup checking of multiple MSIs/SLM modes
Sharing Last Message (SLM) mode is currently checked in two functions: ahci_host_activate() and ahci_init_interrupts(). This update consolidates SLM mode check with activation of multiple MSIs mode. Signed-off-by: Alexander Gordeev <agordeev@redhat.com> Signed-off-by: Tejun Heo <tj@kernel.org> Cc: linux-ide@vger.kernel.org
-rw-r--r--drivers/ata/ahci.c18
-rw-r--r--drivers/ata/ahci.h2
2 files changed, 8 insertions, 12 deletions
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
index c880699a7d0b..f68a995ec3fd 100644
--- a/drivers/ata/ahci.c
+++ b/drivers/ata/ahci.c
@@ -1211,6 +1211,9 @@ static int ahci_init_interrupts(struct pci_dev *pdev, unsigned int n_ports,
1211 goto single_msi; 1211 goto single_msi;
1212 } 1212 }
1213 1213
1214 if (nvec > 1)
1215 hpriv->flags |= AHCI_HFLAG_MULTI_MSI;
1216
1214 return nvec; 1217 return nvec;
1215 1218
1216single_msi: 1219single_msi:
@@ -1227,7 +1230,6 @@ intx:
1227 * ahci_host_activate - start AHCI host, request IRQs and register it 1230 * ahci_host_activate - start AHCI host, request IRQs and register it
1228 * @host: target ATA host 1231 * @host: target ATA host
1229 * @irq: base IRQ number to request 1232 * @irq: base IRQ number to request
1230 * @n_msis: number of MSIs allocated for this host
1231 * @irq_handler: irq_handler used when requesting IRQs 1233 * @irq_handler: irq_handler used when requesting IRQs
1232 * @irq_flags: irq_flags used when requesting IRQs 1234 * @irq_flags: irq_flags used when requesting IRQs
1233 * 1235 *
@@ -1241,14 +1243,10 @@ intx:
1241 * RETURNS: 1243 * RETURNS:
1242 * 0 on success, -errno otherwise. 1244 * 0 on success, -errno otherwise.
1243 */ 1245 */
1244int ahci_host_activate(struct ata_host *host, int irq, unsigned int n_msis) 1246int ahci_host_activate(struct ata_host *host, int irq)
1245{ 1247{
1246 int i, rc; 1248 int i, rc;
1247 1249
1248 /* Sharing Last Message among several ports is not supported */
1249 if (n_msis < host->n_ports)
1250 return -EINVAL;
1251
1252 rc = ata_host_start(host); 1250 rc = ata_host_start(host);
1253 if (rc) 1251 if (rc)
1254 return rc; 1252 return rc;
@@ -1296,7 +1294,7 @@ static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
1296 struct device *dev = &pdev->dev; 1294 struct device *dev = &pdev->dev;
1297 struct ahci_host_priv *hpriv; 1295 struct ahci_host_priv *hpriv;
1298 struct ata_host *host; 1296 struct ata_host *host;
1299 int n_ports, n_msis, i, rc; 1297 int n_ports, i, rc;
1300 int ahci_pci_bar = AHCI_PCI_BAR_STANDARD; 1298 int ahci_pci_bar = AHCI_PCI_BAR_STANDARD;
1301 1299
1302 VPRINTK("ENTER\n"); 1300 VPRINTK("ENTER\n");
@@ -1437,9 +1435,7 @@ static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
1437 */ 1435 */
1438 n_ports = max(ahci_nr_ports(hpriv->cap), fls(hpriv->port_map)); 1436 n_ports = max(ahci_nr_ports(hpriv->cap), fls(hpriv->port_map));
1439 1437
1440 n_msis = ahci_init_interrupts(pdev, n_ports, hpriv); 1438 ahci_init_interrupts(pdev, n_ports, hpriv);
1441 if (n_msis > 1)
1442 hpriv->flags |= AHCI_HFLAG_MULTI_MSI;
1443 1439
1444 host = ata_host_alloc_pinfo(&pdev->dev, ppi, n_ports); 1440 host = ata_host_alloc_pinfo(&pdev->dev, ppi, n_ports);
1445 if (!host) 1441 if (!host)
@@ -1492,7 +1488,7 @@ static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
1492 pci_set_master(pdev); 1488 pci_set_master(pdev);
1493 1489
1494 if (hpriv->flags & AHCI_HFLAG_MULTI_MSI) 1490 if (hpriv->flags & AHCI_HFLAG_MULTI_MSI)
1495 return ahci_host_activate(host, pdev->irq, n_msis); 1491 return ahci_host_activate(host, pdev->irq);
1496 1492
1497 return ata_host_activate(host, pdev->irq, ahci_interrupt, IRQF_SHARED, 1493 return ata_host_activate(host, pdev->irq, ahci_interrupt, IRQF_SHARED,
1498 &ahci_sht); 1494 &ahci_sht);
diff --git a/drivers/ata/ahci.h b/drivers/ata/ahci.h
index 90156ff1e9cb..a074c7301504 100644
--- a/drivers/ata/ahci.h
+++ b/drivers/ata/ahci.h
@@ -392,7 +392,7 @@ irqreturn_t ahci_interrupt(int irq, void *dev_instance);
392irqreturn_t ahci_hw_interrupt(int irq, void *dev_instance); 392irqreturn_t ahci_hw_interrupt(int irq, void *dev_instance);
393irqreturn_t ahci_thread_fn(int irq, void *dev_instance); 393irqreturn_t ahci_thread_fn(int irq, void *dev_instance);
394void ahci_print_info(struct ata_host *host, const char *scc_s); 394void ahci_print_info(struct ata_host *host, const char *scc_s);
395int ahci_host_activate(struct ata_host *host, int irq, unsigned int n_msis); 395int ahci_host_activate(struct ata_host *host, int irq);
396void ahci_error_handler(struct ata_port *ap); 396void ahci_error_handler(struct ata_port *ap);
397 397
398static inline void __iomem *__ahci_port_base(struct ata_host *host, 398static inline void __iomem *__ahci_port_base(struct ata_host *host,