ahci: compile out msi/msix infrastructure
PATCH 1/1 ahci: compile out msi/msix infrastructure
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.
--- drivers/ata/ahci.h | 25 +++++++++++++++++++++++-- drivers/ata/libahci.c | 7 +------ 2 files changed, 24 insertions(+), 8 deletions(-)
drivers/ata/ahci.h +23 -2
@@ -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[];
drivers/ata/libahci.c +1 -6
@@ -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) {
PATCH 1/1 ahci: compile out msi/msix infrastructure
Quoted 9 lines · On Friday 04 December 2015 11:58:30 Dan Williams wrote:
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 whenCONFIG_PCIis 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 'structmsix_entry'ata/libahci.c:2475:21: error: dereferencing pointer to incomplete type 'structmsix_entry'
Quoted 7 lines
Add ifdef
CONFIG_PCI_MSIinfrastructure to compile out the mutli-msi and multi-msix code.Reported-by Arnd Bergmann <[email protected]>Reported-by Paul Gortmaker <[email protected]>Fixes d684a90d38e2 ("ahci: per-port msix support")Signed-off-by Dan Williams <[email protected]>
Thanks a lot, looks good. I've verified that this fixes the build on the configuration that failed earlier.
PATCH 1/1 ahci: compile out msi/msix infrastructure
In reply to Dan Williamsdrivers/ata/ahci.h struct ahci_host_priv { · line 371
Quoted 9 lines · On Friday 04 December 2015 11:58:30 Dan Williams wrote:
drivers/ata/ahci.h +8
-0+#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; +}
My randconfig tests now noticed that 'i' is undeclared here. I suppose it should be 'port' instead of 'i'?
Arnd
PATCH 1/1 ahci: compile out msi/msix infrastructure
Quoted 14 lines · On Saturday 05 December 2015 23:22:49 Arnd Bergmann wrote:
Review
Quoted 9 lines · On Friday 04 December 2015 11:58:30 Dan Williams wrote:
(quoted diff) +8
-0+#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; +}My randconfig tests now noticed that 'i' is undeclared here. I suppose it should be 'port' instead of 'i'?
and one more:
In file included from /git/arm-soc/drivers/ata/ahci_platform.c:25:0:
/git/arm-soc/drivers/ata/ahci.h: In function 'ahci_irq_vector':
/git/arm-soc/drivers/ata/ahci.h:368:3: error: invalid use of undefined type 'struct msix_entry'
return hpriv->msix[port].vector;
^
/git/arm-soc/drivers/ata/ahci.h:368:21: error: dereferencing pointer to incomplete type 'struct msix_entry'
return hpriv->msix[port].vector;
drivers/ata/ahci.h +1 -0
@@ -37,6 +37,7 @@#include <linux/clk.h> #include <linux/libata.h> +#include <linux/pci.h> #include <linux/phy/phy.h> #include <linux/regulator/consumer.h>
PATCH 1/1 ahci: compile out msi/msix infrastructure
Quoted 32 lines · Arnd Bergmann
Quoted 14 lines · On Saturday 05 December 2015 23:22:49 Arnd Bergmann wrote:
Review
Quoted 9 lines · On Friday 04 December 2015 11:58:30 Dan Williams wrote:
(quoted diff) +8
-0+#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; +}My randconfig tests now noticed that 'i' is undeclared here. I suppose it should be 'port' instead of 'i'?
and one more:
In file included from /git/arm-soc/drivers/ata/ahci_platform.c:25:0:
/git/arm-soc/drivers/ata/ahci.h: In function 'ahci_irq_vector':
/git/arm-soc/drivers/ata/ahci.h:368:3: error: invalid use of undefined type 'structmsix_entry'return hpriv->msix[port].vector; ^/git/arm-soc/drivers/ata/ahci.h:368:21: error: dereferencing pointer to incomplete type 'struct
msix_entry'
return hpriv->msix[port].vector;drivers/ata/ahci.h +0
-0
drivers/ata/ahci.h line 43
Quoted 7 lines
drivers/ata/ahci.h +1
-0@@ -37,6 +37,7 @@#include <linux/clk.h> #include <linux/libata.h> +#include <linux/pci.h> #include <linux/phy/phy.h> #include <linux/regulator/consumer.h>
I'll resend, sloppy on my part.