Commit 4c859804 authored by Bjorn Helgaas's avatar Bjorn Helgaas

PCI: Reorder so actual code comes before stubs

Consistently use the:

    #ifdef CONFIG_PCI_FOO
    int pci_foo(...);
    #else
    static inline int pci_foo(...) { return -1; }
    #endif

pattern, instead of sometimes using "#ifndef CONFIG_PCI_FOO".

No functional change.
Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
parent 597db6f3
...@@ -34,21 +34,7 @@ ...@@ -34,21 +34,7 @@
#define DEVICE_LABEL_DSM 0x07 #define DEVICE_LABEL_DSM 0x07
#ifndef CONFIG_DMI #ifdef CONFIG_DMI
static inline int
pci_create_smbiosname_file(struct pci_dev *pdev)
{
return -1;
}
static inline void
pci_remove_smbiosname_file(struct pci_dev *pdev)
{
}
#else
enum smbios_attr_enum { enum smbios_attr_enum {
SMBIOS_ATTR_NONE = 0, SMBIOS_ATTR_NONE = 0,
SMBIOS_ATTR_LABEL_SHOW, SMBIOS_ATTR_LABEL_SHOW,
...@@ -156,31 +142,20 @@ pci_remove_smbiosname_file(struct pci_dev *pdev) ...@@ -156,31 +142,20 @@ pci_remove_smbiosname_file(struct pci_dev *pdev)
{ {
sysfs_remove_group(&pdev->dev.kobj, &smbios_attr_group); sysfs_remove_group(&pdev->dev.kobj, &smbios_attr_group);
} }
#else
#endif
#ifndef CONFIG_ACPI
static inline int
pci_create_acpi_index_label_files(struct pci_dev *pdev)
{
return -1;
}
static inline int static inline int
pci_remove_acpi_index_label_files(struct pci_dev *pdev) pci_create_smbiosname_file(struct pci_dev *pdev)
{ {
return -1; return -1;
} }
static inline bool static inline void
device_has_dsm(struct device *dev) pci_remove_smbiosname_file(struct pci_dev *pdev)
{ {
return false;
} }
#endif
#else #ifdef CONFIG_ACPI
static const char device_label_dsm_uuid[] = { static const char device_label_dsm_uuid[] = {
0xD0, 0x37, 0xC9, 0xE5, 0x53, 0x35, 0x7A, 0x4D, 0xD0, 0x37, 0xC9, 0xE5, 0x53, 0x35, 0x7A, 0x4D,
0x91, 0x17, 0xEA, 0x4D, 0x19, 0xC3, 0x43, 0x4D 0x91, 0x17, 0xEA, 0x4D, 0x19, 0xC3, 0x43, 0x4D
...@@ -364,6 +339,24 @@ pci_remove_acpi_index_label_files(struct pci_dev *pdev) ...@@ -364,6 +339,24 @@ pci_remove_acpi_index_label_files(struct pci_dev *pdev)
sysfs_remove_group(&pdev->dev.kobj, &acpi_attr_group); sysfs_remove_group(&pdev->dev.kobj, &acpi_attr_group);
return 0; return 0;
} }
#else
static inline int
pci_create_acpi_index_label_files(struct pci_dev *pdev)
{
return -1;
}
static inline int
pci_remove_acpi_index_label_files(struct pci_dev *pdev)
{
return -1;
}
static inline bool
device_has_dsm(struct device *dev)
{
return false;
}
#endif #endif
void pci_create_firmware_label_files(struct pci_dev *pdev) void pci_create_firmware_label_files(struct pci_dev *pdev)
......
...@@ -1149,7 +1149,22 @@ struct msix_entry { ...@@ -1149,7 +1149,22 @@ struct msix_entry {
}; };
#ifndef CONFIG_PCI_MSI #ifdef CONFIG_PCI_MSI
int pci_msi_vec_count(struct pci_dev *dev);
int pci_enable_msi_block(struct pci_dev *dev, int nvec);
void pci_msi_shutdown(struct pci_dev *dev);
void pci_disable_msi(struct pci_dev *dev);
int pci_msix_vec_count(struct pci_dev *dev);
int pci_enable_msix(struct pci_dev *dev, struct msix_entry *entries, int nvec);
void pci_msix_shutdown(struct pci_dev *dev);
void pci_disable_msix(struct pci_dev *dev);
void msi_remove_pci_irq_vectors(struct pci_dev *dev);
void pci_restore_msi_state(struct pci_dev *dev);
int pci_msi_enabled(void);
int pci_enable_msi_range(struct pci_dev *dev, int minvec, int maxvec);
int pci_enable_msix_range(struct pci_dev *dev, struct msix_entry *entries,
int minvec, int maxvec);
#else
static inline int pci_msi_vec_count(struct pci_dev *dev) static inline int pci_msi_vec_count(struct pci_dev *dev)
{ {
return -ENOSYS; return -ENOSYS;
...@@ -1200,21 +1215,6 @@ static inline int pci_enable_msix_range(struct pci_dev *dev, ...@@ -1200,21 +1215,6 @@ static inline int pci_enable_msix_range(struct pci_dev *dev,
{ {
return -ENOSYS; return -ENOSYS;
} }
#else
int pci_msi_vec_count(struct pci_dev *dev);
int pci_enable_msi_block(struct pci_dev *dev, int nvec);
void pci_msi_shutdown(struct pci_dev *dev);
void pci_disable_msi(struct pci_dev *dev);
int pci_msix_vec_count(struct pci_dev *dev);
int pci_enable_msix(struct pci_dev *dev, struct msix_entry *entries, int nvec);
void pci_msix_shutdown(struct pci_dev *dev);
void pci_disable_msix(struct pci_dev *dev);
void msi_remove_pci_irq_vectors(struct pci_dev *dev);
void pci_restore_msi_state(struct pci_dev *dev);
int pci_msi_enabled(void);
int pci_enable_msi_range(struct pci_dev *dev, int minvec, int maxvec);
int pci_enable_msix_range(struct pci_dev *dev, struct msix_entry *entries,
int minvec, int maxvec);
#endif #endif
#ifdef CONFIG_PCIEPORTBUS #ifdef CONFIG_PCIEPORTBUS
...@@ -1225,10 +1225,10 @@ extern bool pcie_ports_auto; ...@@ -1225,10 +1225,10 @@ extern bool pcie_ports_auto;
#define pcie_ports_auto false #define pcie_ports_auto false
#endif #endif
#ifndef CONFIG_PCIEASPM #ifdef CONFIG_PCIEASPM
static inline bool pcie_aspm_support_enabled(void) { return false; }
#else
bool pcie_aspm_support_enabled(void); bool pcie_aspm_support_enabled(void);
#else
static inline bool pcie_aspm_support_enabled(void) { return false; }
#endif #endif
#ifdef CONFIG_PCIEAER #ifdef CONFIG_PCIEAER
...@@ -1239,15 +1239,15 @@ static inline void pci_no_aer(void) { } ...@@ -1239,15 +1239,15 @@ static inline void pci_no_aer(void) { }
static inline bool pci_aer_available(void) { return false; } static inline bool pci_aer_available(void) { return false; }
#endif #endif
#ifndef CONFIG_PCIE_ECRC #ifdef CONFIG_PCIE_ECRC
void pcie_set_ecrc_checking(struct pci_dev *dev);
void pcie_ecrc_get_policy(char *str);
#else
static inline void pcie_set_ecrc_checking(struct pci_dev *dev) static inline void pcie_set_ecrc_checking(struct pci_dev *dev)
{ {
return; return;
} }
static inline void pcie_ecrc_get_policy(char *str) {}; static inline void pcie_ecrc_get_policy(char *str) {};
#else
void pcie_set_ecrc_checking(struct pci_dev *dev);
void pcie_ecrc_get_policy(char *str);
#endif #endif
#define pci_enable_msi(pdev) pci_enable_msi_block(pdev, 1) #define pci_enable_msi(pdev) pci_enable_msi_block(pdev, 1)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment