public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH] ahci: compile out msi/msix infrastructure
@ 2015-12-04 19:58 Dan Williams
  2015-12-04 21:46 ` Arnd Bergmann
  2015-12-05 22:22 ` Arnd Bergmann
  0 siblings, 2 replies; 5+ messages in thread
From: Dan Williams @ 2015-12-04 19:58 UTC (permalink / raw)
  To: linux-arm-kernel

Quoting Arnd:
    The AHCI driver is used for some on-chip devices that do not use PCI
    for probing, and it can be built even when CONFIG_PCI is disabled, but
    that now results in a build failure:

    ata/libahci.c: In function 'ahci_host_activate_multi_irqs':
    ata/libahci.c:2475:4: error: invalid use of undefined type 'struct msix_entry'
    ata/libahci.c:2475:21: error: dereferencing pointer to incomplete type 'struct msix_entry'

Add ifdef CONFIG_PCI_MSI infrastructure to compile out the mutli-msi and
multi-msix code.

Reported-by: Arnd Bergmann <arnd@arndb.de>
Reported-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Fixes: d684a90d38e2 ("ahci: per-port msix support")
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
 drivers/ata/ahci.h    |   25 +++++++++++++++++++++++--
 drivers/ata/libahci.c |    7 +------
 2 files changed, 24 insertions(+), 8 deletions(-)

diff --git a/drivers/ata/ahci.h b/drivers/ata/ahci.h
index 878470f9c3e2..e3d888d4b6d0 100644
--- a/drivers/ata/ahci.h
+++ b/drivers/ata/ahci.h
@@ -237,12 +237,18 @@ enum {
 	AHCI_HFLAG_DELAY_ENGINE		= (1 << 15), /* do not start engine on
 						        port start (wait until
 						        error-handling stage) */
-	AHCI_HFLAG_MULTI_MSI		= (1 << 16), /* multiple PCI MSIs */
 	AHCI_HFLAG_NO_DEVSLP		= (1 << 17), /* no device sleep */
 	AHCI_HFLAG_NO_FBS		= (1 << 18), /* no FBS */
 	AHCI_HFLAG_EDGE_IRQ		= (1 << 19), /* HOST_IRQ_STAT behaves as
 							Edge Triggered */
-	AHCI_HFLAG_MULTI_MSIX		= (1 << 20), /* per-port MSI-X */
+#ifdef CONFIG_PCI_MSI
+	AHCI_HFLAG_MULTI_MSI		= (1 << 20), /* multiple PCI MSIs */
+	AHCI_HFLAG_MULTI_MSIX		= (1 << 21), /* per-port MSI-X */
+#else
+	/* compile out MSI infrastructure */
+	AHCI_HFLAG_MULTI_MSI		= 0,
+	AHCI_HFLAG_MULTI_MSIX		= 0,
+#endif
 
 	/* ap->flags bits */
 
@@ -355,6 +361,21 @@ struct ahci_host_priv {
 	void			(*start_engine)(struct ata_port *ap);
 };
 
+#ifdef CONFIG_PCI_MSI
+static inline int ahci_irq_vector(struct ahci_host_priv *hpriv, int port)
+{
+	if (hpriv->flags & AHCI_HFLAG_MULTI_MSIX)
+		return hpriv->msix[i].vector;
+	else
+		return hpriv->irq + i;
+}
+#else
+static inline int ahci_irq_vector(struct ahci_host_priv *hpriv, int port)
+{
+	return hpriv->irq;
+}
+#endif
+
 extern int ahci_ignore_sss;
 
 extern struct device_attribute *ahci_shost_attrs[];
diff --git a/drivers/ata/libahci.c b/drivers/ata/libahci.c
index 1b6c7cc415bf..eda3cf2163bb 100644
--- a/drivers/ata/libahci.c
+++ b/drivers/ata/libahci.c
@@ -2469,12 +2469,7 @@ static int ahci_host_activate_multi_irqs(struct ata_host *host,
 	 */
 	for (i = 0; i < host->n_ports; i++) {
 		struct ahci_port_priv *pp = host->ports[i]->private_data;
-		int irq;
-
-		if (hpriv->flags & AHCI_HFLAG_MULTI_MSIX)
-			irq = hpriv->msix[i].vector;
-		else
-			irq = hpriv->irq + i;
+		int irq = ahci_irq_vector(hpriv, i);
 
 		/* Do not receive interrupts sent by dummy ports */
 		if (!pp) {

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-12-06  0:05 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-04 19:58 [PATCH] ahci: compile out msi/msix infrastructure Dan Williams
2015-12-04 21:46 ` Arnd Bergmann
2015-12-05 22:22 ` Arnd Bergmann
2015-12-05 22:25   ` Arnd Bergmann
2015-12-06  0:05     ` Dan Williams

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox