Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 multi-msi and
multi-msix code.

Reported-by: Arnd Bergmann <arnd@arndb.de>
Tested--by: Arnd Bergmann <arnd@arndb.de>
[arnd: fix up pci enabled case]
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>
Signed-off-by: Tejun Heo <tj@kernel.org>

authored by

Dan Williams and committed by
Tejun Heo
f893180b 7e22c002

+25 -8
+24 -2
drivers/ata/ahci.h
··· 35 35 #ifndef _AHCI_H 36 36 #define _AHCI_H 37 37 38 + #include <linux/pci.h> 38 39 #include <linux/clk.h> 39 40 #include <linux/libata.h> 40 41 #include <linux/phy/phy.h> ··· 238 237 AHCI_HFLAG_DELAY_ENGINE = (1 << 15), /* do not start engine on 239 238 port start (wait until 240 239 error-handling stage) */ 241 - AHCI_HFLAG_MULTI_MSI = (1 << 16), /* multiple PCI MSIs */ 242 240 AHCI_HFLAG_NO_DEVSLP = (1 << 17), /* no device sleep */ 243 241 AHCI_HFLAG_NO_FBS = (1 << 18), /* no FBS */ 244 242 AHCI_HFLAG_EDGE_IRQ = (1 << 19), /* HOST_IRQ_STAT behaves as 245 243 Edge Triggered */ 246 - AHCI_HFLAG_MULTI_MSIX = (1 << 20), /* per-port MSI-X */ 244 + #ifdef CONFIG_PCI_MSI 245 + AHCI_HFLAG_MULTI_MSI = (1 << 20), /* multiple PCI MSIs */ 246 + AHCI_HFLAG_MULTI_MSIX = (1 << 21), /* per-port MSI-X */ 247 + #else 248 + /* compile out MSI infrastructure */ 249 + AHCI_HFLAG_MULTI_MSI = 0, 250 + AHCI_HFLAG_MULTI_MSIX = 0, 251 + #endif 247 252 248 253 /* ap->flags bits */ 249 254 ··· 361 354 */ 362 355 void (*start_engine)(struct ata_port *ap); 363 356 }; 357 + 358 + #ifdef CONFIG_PCI_MSI 359 + static inline int ahci_irq_vector(struct ahci_host_priv *hpriv, int port) 360 + { 361 + if (hpriv->flags & AHCI_HFLAG_MULTI_MSIX) 362 + return hpriv->msix[port].vector; 363 + else 364 + return hpriv->irq + port; 365 + } 366 + #else 367 + static inline int ahci_irq_vector(struct ahci_host_priv *hpriv, int port) 368 + { 369 + return hpriv->irq; 370 + } 371 + #endif 364 372 365 373 extern int ahci_ignore_sss; 366 374
+1 -6
drivers/ata/libahci.c
··· 2469 2469 */ 2470 2470 for (i = 0; i < host->n_ports; i++) { 2471 2471 struct ahci_port_priv *pp = host->ports[i]->private_data; 2472 - int irq; 2473 - 2474 - if (hpriv->flags & AHCI_HFLAG_MULTI_MSIX) 2475 - irq = hpriv->msix[i].vector; 2476 - else 2477 - irq = hpriv->irq + i; 2472 + int irq = ahci_irq_vector(hpriv, i); 2478 2473 2479 2474 /* Do not receive interrupts sent by dummy ports */ 2480 2475 if (!pp) {