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

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: Bjorn Helgaas <bhelgaas@google.com>

+53 -60
+30 -37
drivers/pci/pci-label.c
··· 34 34 35 35 #define DEVICE_LABEL_DSM 0x07 36 36 37 - #ifndef CONFIG_DMI 38 - 39 - static inline int 40 - pci_create_smbiosname_file(struct pci_dev *pdev) 41 - { 42 - return -1; 43 - } 44 - 45 - static inline void 46 - pci_remove_smbiosname_file(struct pci_dev *pdev) 47 - { 48 - } 49 - 50 - #else 51 - 37 + #ifdef CONFIG_DMI 52 38 enum smbios_attr_enum { 53 39 SMBIOS_ATTR_NONE = 0, 54 40 SMBIOS_ATTR_LABEL_SHOW, ··· 142 156 { 143 157 sysfs_remove_group(&pdev->dev.kobj, &smbios_attr_group); 144 158 } 159 + #else 160 + static inline int 161 + pci_create_smbiosname_file(struct pci_dev *pdev) 162 + { 163 + return -1; 164 + } 145 165 166 + static inline void 167 + pci_remove_smbiosname_file(struct pci_dev *pdev) 168 + { 169 + } 146 170 #endif 147 171 148 - #ifndef CONFIG_ACPI 149 - 150 - static inline int 151 - pci_create_acpi_index_label_files(struct pci_dev *pdev) 152 - { 153 - return -1; 154 - } 155 - 156 - static inline int 157 - pci_remove_acpi_index_label_files(struct pci_dev *pdev) 158 - { 159 - return -1; 160 - } 161 - 162 - static inline bool 163 - device_has_dsm(struct device *dev) 164 - { 165 - return false; 166 - } 167 - 168 - #else 169 - 172 + #ifdef CONFIG_ACPI 170 173 static const char device_label_dsm_uuid[] = { 171 174 0xD0, 0x37, 0xC9, 0xE5, 0x53, 0x35, 0x7A, 0x4D, 172 175 0x91, 0x17, 0xEA, 0x4D, 0x19, 0xC3, 0x43, 0x4D ··· 338 363 { 339 364 sysfs_remove_group(&pdev->dev.kobj, &acpi_attr_group); 340 365 return 0; 366 + } 367 + #else 368 + static inline int 369 + pci_create_acpi_index_label_files(struct pci_dev *pdev) 370 + { 371 + return -1; 372 + } 373 + 374 + static inline int 375 + pci_remove_acpi_index_label_files(struct pci_dev *pdev) 376 + { 377 + return -1; 378 + } 379 + 380 + static inline bool 381 + device_has_dsm(struct device *dev) 382 + { 383 + return false; 341 384 } 342 385 #endif 343 386
+23 -23
include/linux/pci.h
··· 1149 1149 }; 1150 1150 1151 1151 1152 - #ifndef CONFIG_PCI_MSI 1152 + #ifdef CONFIG_PCI_MSI 1153 + int pci_msi_vec_count(struct pci_dev *dev); 1154 + int pci_enable_msi_block(struct pci_dev *dev, int nvec); 1155 + void pci_msi_shutdown(struct pci_dev *dev); 1156 + void pci_disable_msi(struct pci_dev *dev); 1157 + int pci_msix_vec_count(struct pci_dev *dev); 1158 + int pci_enable_msix(struct pci_dev *dev, struct msix_entry *entries, int nvec); 1159 + void pci_msix_shutdown(struct pci_dev *dev); 1160 + void pci_disable_msix(struct pci_dev *dev); 1161 + void msi_remove_pci_irq_vectors(struct pci_dev *dev); 1162 + void pci_restore_msi_state(struct pci_dev *dev); 1163 + int pci_msi_enabled(void); 1164 + int pci_enable_msi_range(struct pci_dev *dev, int minvec, int maxvec); 1165 + int pci_enable_msix_range(struct pci_dev *dev, struct msix_entry *entries, 1166 + int minvec, int maxvec); 1167 + #else 1153 1168 static inline int pci_msi_vec_count(struct pci_dev *dev) 1154 1169 { 1155 1170 return -ENOSYS; ··· 1215 1200 { 1216 1201 return -ENOSYS; 1217 1202 } 1218 - #else 1219 - int pci_msi_vec_count(struct pci_dev *dev); 1220 - int pci_enable_msi_block(struct pci_dev *dev, int nvec); 1221 - void pci_msi_shutdown(struct pci_dev *dev); 1222 - void pci_disable_msi(struct pci_dev *dev); 1223 - int pci_msix_vec_count(struct pci_dev *dev); 1224 - int pci_enable_msix(struct pci_dev *dev, struct msix_entry *entries, int nvec); 1225 - void pci_msix_shutdown(struct pci_dev *dev); 1226 - void pci_disable_msix(struct pci_dev *dev); 1227 - void msi_remove_pci_irq_vectors(struct pci_dev *dev); 1228 - void pci_restore_msi_state(struct pci_dev *dev); 1229 - int pci_msi_enabled(void); 1230 - int pci_enable_msi_range(struct pci_dev *dev, int minvec, int maxvec); 1231 - int pci_enable_msix_range(struct pci_dev *dev, struct msix_entry *entries, 1232 - int minvec, int maxvec); 1233 1203 #endif 1234 1204 1235 1205 #ifdef CONFIG_PCIEPORTBUS ··· 1225 1225 #define pcie_ports_auto false 1226 1226 #endif 1227 1227 1228 - #ifndef CONFIG_PCIEASPM 1229 - static inline bool pcie_aspm_support_enabled(void) { return false; } 1230 - #else 1228 + #ifdef CONFIG_PCIEASPM 1231 1229 bool pcie_aspm_support_enabled(void); 1230 + #else 1231 + static inline bool pcie_aspm_support_enabled(void) { return false; } 1232 1232 #endif 1233 1233 1234 1234 #ifdef CONFIG_PCIEAER ··· 1239 1239 static inline bool pci_aer_available(void) { return false; } 1240 1240 #endif 1241 1241 1242 - #ifndef CONFIG_PCIE_ECRC 1242 + #ifdef CONFIG_PCIE_ECRC 1243 + void pcie_set_ecrc_checking(struct pci_dev *dev); 1244 + void pcie_ecrc_get_policy(char *str); 1245 + #else 1243 1246 static inline void pcie_set_ecrc_checking(struct pci_dev *dev) 1244 1247 { 1245 1248 return; 1246 1249 } 1247 1250 static inline void pcie_ecrc_get_policy(char *str) {}; 1248 - #else 1249 - void pcie_set_ecrc_checking(struct pci_dev *dev); 1250 - void pcie_ecrc_get_policy(char *str); 1251 1251 #endif 1252 1252 1253 1253 #define pci_enable_msi(pdev) pci_enable_msi_block(pdev, 1)