summaryrefslogtreecommitdiffstats
path: root/drivers/ata/libahci.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/libahci.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/libahci.c')
-rw-r--r--drivers/ata/libahci.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/drivers/ata/libahci.c b/drivers/ata/libahci.c
index 1add5baec584..1c99402a1017 100644
--- a/drivers/ata/libahci.c
+++ b/drivers/ata/libahci.c
@@ -2344,7 +2344,7 @@ static int ahci_port_start(struct ata_port *ap)
2344 /* 2344 /*
2345 * Switch to per-port locking in case each port has its own MSI vector. 2345 * Switch to per-port locking in case each port has its own MSI vector.
2346 */ 2346 */
2347 if ((hpriv->flags & AHCI_HFLAG_MULTI_MSI)) { 2347 if (hpriv->flags & AHCI_HFLAG_MULTI_MSI) {
2348 spin_lock_init(&pp->lock); 2348 spin_lock_init(&pp->lock);
2349 ap->lock = &pp->lock; 2349 ap->lock = &pp->lock;
2350 } 2350 }
@@ -2472,7 +2472,10 @@ static int ahci_host_activate_multi_irqs(struct ata_host *host, int irq,
2472 rc = ata_host_start(host); 2472 rc = ata_host_start(host);
2473 if (rc) 2473 if (rc)
2474 return rc; 2474 return rc;
2475 2475 /*
2476 * Requests IRQs according to AHCI-1.1 when multiple MSIs were
2477 * allocated. That is one MSI per port, starting from @irq.
2478 */
2476 for (i = 0; i < host->n_ports; i++) { 2479 for (i = 0; i < host->n_ports; i++) {
2477 struct ahci_port_priv *pp = host->ports[i]->private_data; 2480 struct ahci_port_priv *pp = host->ports[i]->private_data;
2478 2481
@@ -2511,23 +2514,18 @@ out_free_irqs:
2511/** 2514/**
2512 * ahci_host_activate - start AHCI host, request IRQs and register it 2515 * ahci_host_activate - start AHCI host, request IRQs and register it
2513 * @host: target ATA host 2516 * @host: target ATA host
2514 * @irq: base IRQ number to request
2515 * @sht: scsi_host_template to use when registering the host 2517 * @sht: scsi_host_template to use when registering the host
2516 * 2518 *
2517 * Similar to ata_host_activate, but requests IRQs according to AHCI-1.1
2518 * when multiple MSIs were allocated. That is one MSI per port, starting
2519 * from @irq.
2520 *
2521 * LOCKING: 2519 * LOCKING:
2522 * Inherited from calling layer (may sleep). 2520 * Inherited from calling layer (may sleep).
2523 * 2521 *
2524 * RETURNS: 2522 * RETURNS:
2525 * 0 on success, -errno otherwise. 2523 * 0 on success, -errno otherwise.
2526 */ 2524 */
2527int ahci_host_activate(struct ata_host *host, int irq, 2525int ahci_host_activate(struct ata_host *host, struct scsi_host_template *sht)
2528 struct scsi_host_template *sht)
2529{ 2526{
2530 struct ahci_host_priv *hpriv = host->private_data; 2527 struct ahci_host_priv *hpriv = host->private_data;
2528 int irq = hpriv->irq;
2531 int rc; 2529 int rc;
2532 2530
2533 if (hpriv->flags & AHCI_HFLAG_MULTI_MSI) 2531 if (hpriv->flags & AHCI_HFLAG_MULTI_MSI)