summaryrefslogtreecommitdiffstats
path: root/drivers/ata/ahci.c
diff options
context:
space:
mode:
authorRobert Richter <rrichter@cavium.com>2015-05-31 07:55:18 -0400
committerTejun Heo <tj@kernel.org>2015-06-03 01:37:49 -0400
commit21bfd1aa9527811408d6073d45e5ac8283a28b72 (patch)
tree0a7320b2bfebf9e567175c1e4b86bd95f81d7238 /drivers/ata/ahci.c
parenta1c823117894ed79943a87b1c718139cc1be1b6a (diff)
ahci: Store irq number in struct ahci_host_priv
Currently, ahci supports only msi and intx. To also support msix the handling of the irq number need to be changed. The irq number for msix devices is taken from msi_list instead of pci_dev. Thus, the irq number of a device needs to be stored in struct ahci_host_priv now. This allows the host controller to be activated in a generic way. This change is only intended for ahci drivers. For that reason the irq number is stored in struct ahci_host_priv used only by ahci drivers. Thus, the ABI changes only for ahci_host_activate(), but existing ata drivers (about 50) are unaffected and keep unchanged. All users of ahci_host_activate() have been updated. While touching drivers/ata/libahci.c, doing a small code cleanup in ahci_port_start(). Signed-off-by: Robert Richter <rrichter@cavium.com> Signed-off-by: Tejun Heo <tj@kernel.org>
Diffstat (limited to 'drivers/ata/ahci.c')
-rw-r--r--drivers/ata/ahci.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
index 7ba5332476c6..a3c66c3bb76e 100644
--- a/drivers/ata/ahci.c
+++ b/drivers/ata/ahci.c
@@ -1237,14 +1237,18 @@ static int ahci_init_msi(struct pci_dev *pdev, unsigned int n_ports,
1237 if (nvec > 1) 1237 if (nvec > 1)
1238 hpriv->flags |= AHCI_HFLAG_MULTI_MSI; 1238 hpriv->flags |= AHCI_HFLAG_MULTI_MSI;
1239 1239
1240 return nvec; 1240 goto out;
1241 1241
1242single_msi: 1242single_msi:
1243 nvec = 1;
1244
1243 rc = pci_enable_msi(pdev); 1245 rc = pci_enable_msi(pdev);
1244 if (rc < 0) 1246 if (rc < 0)
1245 return rc; 1247 return rc;
1248out:
1249 hpriv->irq = pdev->irq;
1246 1250
1247 return 1; 1251 return nvec;
1248} 1252}
1249 1253
1250static int ahci_init_interrupts(struct pci_dev *pdev, unsigned int n_ports, 1254static int ahci_init_interrupts(struct pci_dev *pdev, unsigned int n_ports,
@@ -1258,6 +1262,7 @@ static int ahci_init_interrupts(struct pci_dev *pdev, unsigned int n_ports,
1258 1262
1259 /* lagacy intx interrupts */ 1263 /* lagacy intx interrupts */
1260 pci_intx(pdev, 1); 1264 pci_intx(pdev, 1);
1265 hpriv->irq = pdev->irq;
1261 1266
1262 return 0; 1267 return 0;
1263} 1268}
@@ -1423,13 +1428,13 @@ static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
1423 */ 1428 */
1424 n_ports = max(ahci_nr_ports(hpriv->cap), fls(hpriv->port_map)); 1429 n_ports = max(ahci_nr_ports(hpriv->cap), fls(hpriv->port_map));
1425 1430
1426 ahci_init_interrupts(pdev, n_ports, hpriv);
1427
1428 host = ata_host_alloc_pinfo(&pdev->dev, ppi, n_ports); 1431 host = ata_host_alloc_pinfo(&pdev->dev, ppi, n_ports);
1429 if (!host) 1432 if (!host)
1430 return -ENOMEM; 1433 return -ENOMEM;
1431 host->private_data = hpriv; 1434 host->private_data = hpriv;
1432 1435
1436 ahci_init_interrupts(pdev, n_ports, hpriv);
1437
1433 if (!(hpriv->cap & HOST_CAP_SSS) || ahci_ignore_sss) 1438 if (!(hpriv->cap & HOST_CAP_SSS) || ahci_ignore_sss)
1434 host->flags |= ATA_HOST_PARALLEL_SCAN; 1439 host->flags |= ATA_HOST_PARALLEL_SCAN;
1435 else 1440 else
@@ -1475,7 +1480,7 @@ static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
1475 1480
1476 pci_set_master(pdev); 1481 pci_set_master(pdev);
1477 1482
1478 return ahci_host_activate(host, pdev->irq, &ahci_sht); 1483 return ahci_host_activate(host, &ahci_sht);
1479} 1484}
1480 1485
1481module_pci_driver(ahci_pci_driver); 1486module_pci_driver(ahci_pci_driver);