* [PATCH] ahci: don't use MSI when PCI is disabled
@ 2015-11-23 9:47 Arnd Bergmann
2015-11-23 17:25 ` Dan Williams
0 siblings, 1 reply; 5+ messages in thread
From: Arnd Bergmann @ 2015-11-23 9:47 UTC (permalink / raw)
To: linux-arm-kernel
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'
This adds an #ifdef so we use that code only if actual PCI MSI
is available.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Fixes: d684a90d38e2 ("ahci: per-port msix support")
diff --git a/drivers/ata/libahci.c b/drivers/ata/libahci.c
index 1b6c7cc415bf..54fe01d8145b 100644
--- a/drivers/ata/libahci.c
+++ b/drivers/ata/libahci.c
@@ -1796,7 +1796,8 @@ static void ahci_port_intr(struct ata_port *ap)
ahci_handle_port_interrupt(ap, port_mmio, status);
}
-static irqreturn_t ahci_multi_irqs_intr_hard(int irq, void *dev_instance)
+static irqreturn_t __maybe_unused ahci_multi_irqs_intr_hard(int irq,
+ void *dev_instance)
{
struct ata_port *ap = dev_instance;
void __iomem *port_mmio = ahci_port_base(ap);
@@ -2454,6 +2455,7 @@ void ahci_set_em_messages(struct ahci_host_priv *hpriv,
}
EXPORT_SYMBOL_GPL(ahci_set_em_messages);
+#ifdef CONFIG_PCI_MSI
static int ahci_host_activate_multi_irqs(struct ata_host *host,
struct scsi_host_template *sht)
{
@@ -2492,6 +2494,7 @@ static int ahci_host_activate_multi_irqs(struct ata_host *host,
return ata_host_register(host, sht);
}
+#endif
/**
* ahci_host_activate - start AHCI host, request IRQs and register it
@@ -2510,9 +2513,12 @@ int ahci_host_activate(struct ata_host *host, struct scsi_host_template *sht)
int irq = hpriv->irq;
int rc;
+#ifdef CONFIG_PCI_MSI
if (hpriv->flags & (AHCI_HFLAG_MULTI_MSI | AHCI_HFLAG_MULTI_MSIX))
rc = ahci_host_activate_multi_irqs(host, sht);
- else if (hpriv->flags & AHCI_HFLAG_EDGE_IRQ)
+ else
+#endif
+ if (hpriv->flags & AHCI_HFLAG_EDGE_IRQ)
rc = ata_host_activate(host, irq, ahci_single_edge_irq_intr,
IRQF_SHARED, sht);
else
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH] ahci: don't use MSI when PCI is disabled
2015-11-23 9:47 [PATCH] ahci: don't use MSI when PCI is disabled Arnd Bergmann
@ 2015-11-23 17:25 ` Dan Williams
2015-11-23 19:34 ` Arnd Bergmann
0 siblings, 1 reply; 5+ messages in thread
From: Dan Williams @ 2015-11-23 17:25 UTC (permalink / raw)
To: linux-arm-kernel
On Mon, Nov 23, 2015 at 1:47 AM, Arnd Bergmann <arnd@arndb.de> wrote:
> 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'
>
> This adds an #ifdef so we use that code only if actual PCI MSI
> is available.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> Fixes: d684a90d38e2 ("ahci: per-port msix support")
>
> diff --git a/drivers/ata/libahci.c b/drivers/ata/libahci.c
> index 1b6c7cc415bf..54fe01d8145b 100644
> --- a/drivers/ata/libahci.c
> +++ b/drivers/ata/libahci.c
> @@ -1796,7 +1796,8 @@ static void ahci_port_intr(struct ata_port *ap)
> ahci_handle_port_interrupt(ap, port_mmio, status);
> }
>
> -static irqreturn_t ahci_multi_irqs_intr_hard(int irq, void *dev_instance)
> +static irqreturn_t __maybe_unused ahci_multi_irqs_intr_hard(int irq,
> + void *dev_instance)
> {
> struct ata_port *ap = dev_instance;
> void __iomem *port_mmio = ahci_port_base(ap);
> @@ -2454,6 +2455,7 @@ void ahci_set_em_messages(struct ahci_host_priv *hpriv,
> }
> EXPORT_SYMBOL_GPL(ahci_set_em_messages);
>
> +#ifdef CONFIG_PCI_MSI
> static int ahci_host_activate_multi_irqs(struct ata_host *host,
> struct scsi_host_template *sht)
> {
> @@ -2492,6 +2494,7 @@ static int ahci_host_activate_multi_irqs(struct ata_host *host,
>
> return ata_host_register(host, sht);
> }
> +#endif
>
> /**
> * ahci_host_activate - start AHCI host, request IRQs and register it
> @@ -2510,9 +2513,12 @@ int ahci_host_activate(struct ata_host *host, struct scsi_host_template *sht)
> int irq = hpriv->irq;
> int rc;
>
> +#ifdef CONFIG_PCI_MSI
> if (hpriv->flags & (AHCI_HFLAG_MULTI_MSI | AHCI_HFLAG_MULTI_MSIX))
> rc = ahci_host_activate_multi_irqs(host, sht);
> - else if (hpriv->flags & AHCI_HFLAG_EDGE_IRQ)
> + else
> +#endif
> + if (hpriv->flags & AHCI_HFLAG_EDGE_IRQ)
> rc = ata_host_activate(host, irq, ahci_single_edge_irq_intr,
> IRQF_SHARED, sht);
> else
>
If we had an "static inline ahci_irq_vector(int port)" helper to
compile out the struct msix_entry de-reference would that be
sufficient?
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH] ahci: don't use MSI when PCI is disabled
2015-11-23 17:25 ` Dan Williams
@ 2015-11-23 19:34 ` Arnd Bergmann
2015-12-04 16:34 ` Arnd Bergmann
0 siblings, 1 reply; 5+ messages in thread
From: Arnd Bergmann @ 2015-11-23 19:34 UTC (permalink / raw)
To: linux-arm-kernel
On Monday 23 November 2015 09:25:38 Dan Williams wrote:
>
> If we had an "static inline ahci_irq_vector(int port)" helper to
> compile out the struct msix_entry de-reference would that be
> sufficient?
Yes, that is probably a nicer way to do it. We should then also do
something like this:
@@ -2510,7 +2513,8 @@ int ahci_host_activate(struct ata_host *host, struct scsi_host_template *sht)
int irq = hpriv->irq;
int rc;
- if (hpriv->flags & (AHCI_HFLAG_MULTI_MSI | AHCI_HFLAG_MULTI_MSIX))
+ if (IS_ENABLED(CONFIG_PCI_MSI) && \
+ hpriv->flags & (AHCI_HFLAG_MULTI_MSI | AHCI_HFLAG_MULTI_MSIX))
rc = ahci_host_activate_multi_irqs(host, sht);
else if (hpriv->flags & AHCI_HFLAG_EDGE_IRQ)
rc = ata_host_activate(host, irq, ahci_single_edge_irq_intr,
which will let gcc leave out the entire ahci_host_activate_multi_irqs()
function but still flag compile errors in it even if CONFIG_PCI is
disabled.
Arnd
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH] ahci: don't use MSI when PCI is disabled
2015-11-23 19:34 ` Arnd Bergmann
@ 2015-12-04 16:34 ` Arnd Bergmann
2015-12-04 16:37 ` Dan Williams
0 siblings, 1 reply; 5+ messages in thread
From: Arnd Bergmann @ 2015-12-04 16:34 UTC (permalink / raw)
To: linux-arm-kernel
On Monday 23 November 2015 20:34:30 Arnd Bergmann wrote:
> On Monday 23 November 2015 09:25:38 Dan Williams wrote:
> >
> > If we had an "static inline ahci_irq_vector(int port)" helper to
> > compile out the struct msix_entry de-reference would that be
> > sufficient?
>
> Yes, that is probably a nicer way to do it. We should then also do
> something like this:
>
> @@ -2510,7 +2513,8 @@ int ahci_host_activate(struct ata_host *host, struct scsi_host_template *sht)
> int irq = hpriv->irq;
> int rc;
>
> - if (hpriv->flags & (AHCI_HFLAG_MULTI_MSI | AHCI_HFLAG_MULTI_MSIX))
> + if (IS_ENABLED(CONFIG_PCI_MSI) && \
> + hpriv->flags & (AHCI_HFLAG_MULTI_MSI | AHCI_HFLAG_MULTI_MSIX))
> rc = ahci_host_activate_multi_irqs(host, sht);
> else if (hpriv->flags & AHCI_HFLAG_EDGE_IRQ)
> rc = ata_host_activate(host, irq, ahci_single_edge_irq_intr,
>
> which will let gcc leave out the entire ahci_host_activate_multi_irqs()
> function but still flag compile errors in it even if CONFIG_PCI is
> disabled.
>
Dan, are you going to do the ahci_irq_vector patch, or should we use my
original patch to fix up the build error?
Chen-Yu Tsai just stumbled over the same problem that I noticed, and I'm
sure others have run into it too.
Arnd
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH] ahci: don't use MSI when PCI is disabled
2015-12-04 16:34 ` Arnd Bergmann
@ 2015-12-04 16:37 ` Dan Williams
0 siblings, 0 replies; 5+ messages in thread
From: Dan Williams @ 2015-12-04 16:37 UTC (permalink / raw)
To: linux-arm-kernel
On Fri, Dec 4, 2015 at 8:34 AM, Arnd Bergmann <arnd@arndb.de> wrote:
> On Monday 23 November 2015 20:34:30 Arnd Bergmann wrote:
>> On Monday 23 November 2015 09:25:38 Dan Williams wrote:
>> >
>> > If we had an "static inline ahci_irq_vector(int port)" helper to
>> > compile out the struct msix_entry de-reference would that be
>> > sufficient?
>>
>> Yes, that is probably a nicer way to do it. We should then also do
>> something like this:
>>
>> @@ -2510,7 +2513,8 @@ int ahci_host_activate(struct ata_host *host, struct scsi_host_template *sht)
>> int irq = hpriv->irq;
>> int rc;
>>
>> - if (hpriv->flags & (AHCI_HFLAG_MULTI_MSI | AHCI_HFLAG_MULTI_MSIX))
>> + if (IS_ENABLED(CONFIG_PCI_MSI) && \
>> + hpriv->flags & (AHCI_HFLAG_MULTI_MSI | AHCI_HFLAG_MULTI_MSIX))
>> rc = ahci_host_activate_multi_irqs(host, sht);
>> else if (hpriv->flags & AHCI_HFLAG_EDGE_IRQ)
>> rc = ata_host_activate(host, irq, ahci_single_edge_irq_intr,
>>
>> which will let gcc leave out the entire ahci_host_activate_multi_irqs()
>> function but still flag compile errors in it even if CONFIG_PCI is
>> disabled.
>>
>
> Dan, are you going to do the ahci_irq_vector patch, or should we use my
> original patch to fix up the build error?
Ah, I was about to ask you the same question. No worries, I'll send
out a patch with the above approach today.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2015-12-04 16:37 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-23 9:47 [PATCH] ahci: don't use MSI when PCI is disabled Arnd Bergmann
2015-11-23 17:25 ` Dan Williams
2015-11-23 19:34 ` Arnd Bergmann
2015-12-04 16:34 ` Arnd Bergmann
2015-12-04 16:37 ` Dan Williams
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).