Skip to content

Commit

Permalink
PCI: PCIe AER: Introduce pci_aer_available()
Browse files Browse the repository at this point in the history
Introduce a function allowing the caller to check whether to try to
enable PCIe AER.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
  • Loading branch information
Rafael J. Wysocki authored and Jesse Barnes committed Aug 24, 2010
1 parent 23b90cf commit f1a7bfa
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 2 additions & 0 deletions drivers/pci/pci.h
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,10 @@ static inline void pci_msi_init_pci_dev(struct pci_dev *dev) { }

#ifdef CONFIG_PCIEAER
void pci_no_aer(void);
bool pci_aer_available(void);
#else
static inline void pci_no_aer(void) { }
static inline bool pci_aer_available(void) { return false; }
#endif

static inline int pci_no_d1d2(struct pci_dev *dev)
Expand Down
9 changes: 6 additions & 3 deletions drivers/pci/pcie/aer/aerdrv.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,11 @@ void pci_no_aer(void)
pcie_aer_disable = 1; /* has priority over 'forceload' */
}

bool pci_aer_available(void)
{
return !pcie_aer_disable && pci_msi_enabled();
}

static int set_device_error_reporting(struct pci_dev *dev, void *data)
{
bool enable = *((bool *)data);
Expand Down Expand Up @@ -411,9 +416,7 @@ static void aer_error_resume(struct pci_dev *dev)
*/
static int __init aer_service_init(void)
{
if (pcie_aer_disable)
return -ENXIO;
if (!pci_msi_enabled())
if (!pci_aer_available())
return -ENXIO;
return pcie_port_service_register(&aerdriver);
}
Expand Down

0 comments on commit f1a7bfa

Please sign in to comment.