diff options
author | Bjorn Helgaas <bhelgaas@google.com> | 2014-01-13 19:01:11 -0500 |
---|---|---|
committer | Bjorn Helgaas <bhelgaas@google.com> | 2014-01-13 19:01:11 -0500 |
commit | 4c85980429f2769bd11c91c7cd90d297aef31fbd (patch) | |
tree | 2a73c4e6e09a6047128e56f48102c83671b42a39 | |
parent | 597db6f38c4bcb90406d4e2f56446ba5a5dc20c6 (diff) |
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>
-rw-r--r-- | drivers/pci/pci-label.c | 57 | ||||
-rw-r--r-- | include/linux/pci.h | 46 |
2 files changed, 48 insertions, 55 deletions
diff --git a/drivers/pci/pci-label.c b/drivers/pci/pci-label.c index d51f45aa669e..6f5d343d251c 100644 --- a/drivers/pci/pci-label.c +++ b/drivers/pci/pci-label.c | |||
@@ -34,21 +34,7 @@ | |||
34 | 34 | ||
35 | #define DEVICE_LABEL_DSM 0x07 | 35 | #define DEVICE_LABEL_DSM 0x07 |
36 | 36 | ||
37 | #ifndef CONFIG_DMI | 37 | #ifdef 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 | |||
52 | enum smbios_attr_enum { | 38 | enum smbios_attr_enum { |
53 | SMBIOS_ATTR_NONE = 0, | 39 | SMBIOS_ATTR_NONE = 0, |
54 | SMBIOS_ATTR_LABEL_SHOW, | 40 | SMBIOS_ATTR_LABEL_SHOW, |
@@ -156,31 +142,20 @@ pci_remove_smbiosname_file(struct pci_dev *pdev) | |||
156 | { | 142 | { |
157 | sysfs_remove_group(&pdev->dev.kobj, &smbios_attr_group); | 143 | sysfs_remove_group(&pdev->dev.kobj, &smbios_attr_group); |
158 | } | 144 | } |
159 | 145 | #else | |
160 | #endif | ||
161 | |||
162 | #ifndef CONFIG_ACPI | ||
163 | |||
164 | static inline int | ||
165 | pci_create_acpi_index_label_files(struct pci_dev *pdev) | ||
166 | { | ||
167 | return -1; | ||
168 | } | ||
169 | |||
170 | static inline int | 146 | static inline int |
171 | pci_remove_acpi_index_label_files(struct pci_dev *pdev) | 147 | pci_create_smbiosname_file(struct pci_dev *pdev) |
172 | { | 148 | { |
173 | return -1; | 149 | return -1; |
174 | } | 150 | } |
175 | 151 | ||
176 | static inline bool | 152 | static inline void |
177 | device_has_dsm(struct device *dev) | 153 | pci_remove_smbiosname_file(struct pci_dev *pdev) |
178 | { | 154 | { |
179 | return false; | ||
180 | } | 155 | } |
156 | #endif | ||
181 | 157 | ||
182 | #else | 158 | #ifdef CONFIG_ACPI |
183 | |||
184 | static const char device_label_dsm_uuid[] = { | 159 | static const char device_label_dsm_uuid[] = { |
185 | 0xD0, 0x37, 0xC9, 0xE5, 0x53, 0x35, 0x7A, 0x4D, | 160 | 0xD0, 0x37, 0xC9, 0xE5, 0x53, 0x35, 0x7A, 0x4D, |
186 | 0x91, 0x17, 0xEA, 0x4D, 0x19, 0xC3, 0x43, 0x4D | 161 | 0x91, 0x17, 0xEA, 0x4D, 0x19, 0xC3, 0x43, 0x4D |
@@ -364,6 +339,24 @@ pci_remove_acpi_index_label_files(struct pci_dev *pdev) | |||
364 | sysfs_remove_group(&pdev->dev.kobj, &acpi_attr_group); | 339 | sysfs_remove_group(&pdev->dev.kobj, &acpi_attr_group); |
365 | return 0; | 340 | return 0; |
366 | } | 341 | } |
342 | #else | ||
343 | static inline int | ||
344 | pci_create_acpi_index_label_files(struct pci_dev *pdev) | ||
345 | { | ||
346 | return -1; | ||
347 | } | ||
348 | |||
349 | static inline int | ||
350 | pci_remove_acpi_index_label_files(struct pci_dev *pdev) | ||
351 | { | ||
352 | return -1; | ||
353 | } | ||
354 | |||
355 | static inline bool | ||
356 | device_has_dsm(struct device *dev) | ||
357 | { | ||
358 | return false; | ||
359 | } | ||
367 | #endif | 360 | #endif |
368 | 361 | ||
369 | void pci_create_firmware_label_files(struct pci_dev *pdev) | 362 | void pci_create_firmware_label_files(struct pci_dev *pdev) |
diff --git a/include/linux/pci.h b/include/linux/pci.h index eba7764b1586..39a3609c8cda 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h | |||
@@ -1149,7 +1149,22 @@ struct msix_entry { | |||
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 | static inline int pci_msi_vec_count(struct pci_dev *dev) | 1168 | static inline int pci_msi_vec_count(struct pci_dev *dev) |
1154 | { | 1169 | { |
1155 | return -ENOSYS; | 1170 | return -ENOSYS; |
@@ -1200,21 +1215,6 @@ static inline int pci_enable_msix_range(struct pci_dev *dev, | |||
1200 | { | 1215 | { |
1201 | return -ENOSYS; | 1216 | return -ENOSYS; |
1202 | } | 1217 | } |
1203 | #else | ||
1204 | int pci_msi_vec_count(struct pci_dev *dev); | ||
1205 | int pci_enable_msi_block(struct pci_dev *dev, int nvec); | ||
1206 | void pci_msi_shutdown(struct pci_dev *dev); | ||
1207 | void pci_disable_msi(struct pci_dev *dev); | ||
1208 | int pci_msix_vec_count(struct pci_dev *dev); | ||
1209 | int pci_enable_msix(struct pci_dev *dev, struct msix_entry *entries, int nvec); | ||
1210 | void pci_msix_shutdown(struct pci_dev *dev); | ||
1211 | void pci_disable_msix(struct pci_dev *dev); | ||
1212 | void msi_remove_pci_irq_vectors(struct pci_dev *dev); | ||
1213 | void pci_restore_msi_state(struct pci_dev *dev); | ||
1214 | int pci_msi_enabled(void); | ||
1215 | int pci_enable_msi_range(struct pci_dev *dev, int minvec, int maxvec); | ||
1216 | int pci_enable_msix_range(struct pci_dev *dev, struct msix_entry *entries, | ||
1217 | int minvec, int maxvec); | ||
1218 | #endif | 1218 | #endif |
1219 | 1219 | ||
1220 | #ifdef CONFIG_PCIEPORTBUS | 1220 | #ifdef CONFIG_PCIEPORTBUS |
@@ -1225,10 +1225,10 @@ extern bool pcie_ports_auto; | |||
1225 | #define pcie_ports_auto false | 1225 | #define pcie_ports_auto false |
1226 | #endif | 1226 | #endif |
1227 | 1227 | ||
1228 | #ifndef CONFIG_PCIEASPM | 1228 | #ifdef CONFIG_PCIEASPM |
1229 | static inline bool pcie_aspm_support_enabled(void) { return false; } | ||
1230 | #else | ||
1231 | bool pcie_aspm_support_enabled(void); | 1229 | bool pcie_aspm_support_enabled(void); |
1230 | #else | ||
1231 | static inline bool pcie_aspm_support_enabled(void) { return false; } | ||
1232 | #endif | 1232 | #endif |
1233 | 1233 | ||
1234 | #ifdef CONFIG_PCIEAER | 1234 | #ifdef CONFIG_PCIEAER |
@@ -1239,15 +1239,15 @@ static inline void pci_no_aer(void) { } | |||
1239 | static inline bool pci_aer_available(void) { return false; } | 1239 | static inline bool pci_aer_available(void) { return false; } |
1240 | #endif | 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 | static inline void pcie_set_ecrc_checking(struct pci_dev *dev) | 1246 | static inline void pcie_set_ecrc_checking(struct pci_dev *dev) |
1244 | { | 1247 | { |
1245 | return; | 1248 | return; |
1246 | } | 1249 | } |
1247 | static inline void pcie_ecrc_get_policy(char *str) {}; | 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 | #endif | 1251 | #endif |
1252 | 1252 | ||
1253 | #define pci_enable_msi(pdev) pci_enable_msi_block(pdev, 1) | 1253 | #define pci_enable_msi(pdev) pci_enable_msi_block(pdev, 1) |