aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBjorn Helgaas <bhelgaas@google.com>2014-01-13 19:01:11 -0500
committerBjorn Helgaas <bhelgaas@google.com>2014-01-13 19:01:11 -0500
commit4c85980429f2769bd11c91c7cd90d297aef31fbd (patch)
tree2a73c4e6e09a6047128e56f48102c83671b42a39
parent597db6f38c4bcb90406d4e2f56446ba5a5dc20c6 (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.c57
-rw-r--r--include/linux/pci.h46
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
39static inline int
40pci_create_smbiosname_file(struct pci_dev *pdev)
41{
42 return -1;
43}
44
45static inline void
46pci_remove_smbiosname_file(struct pci_dev *pdev)
47{
48}
49
50#else
51
52enum smbios_attr_enum { 38enum 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
164static inline int
165pci_create_acpi_index_label_files(struct pci_dev *pdev)
166{
167 return -1;
168}
169
170static inline int 146static inline int
171pci_remove_acpi_index_label_files(struct pci_dev *pdev) 147pci_create_smbiosname_file(struct pci_dev *pdev)
172{ 148{
173 return -1; 149 return -1;
174} 150}
175 151
176static inline bool 152static inline void
177device_has_dsm(struct device *dev) 153pci_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
184static const char device_label_dsm_uuid[] = { 159static 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
343static inline int
344pci_create_acpi_index_label_files(struct pci_dev *pdev)
345{
346 return -1;
347}
348
349static inline int
350pci_remove_acpi_index_label_files(struct pci_dev *pdev)
351{
352 return -1;
353}
354
355static inline bool
356device_has_dsm(struct device *dev)
357{
358 return false;
359}
367#endif 360#endif
368 361
369void pci_create_firmware_label_files(struct pci_dev *pdev) 362void 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
1153int pci_msi_vec_count(struct pci_dev *dev);
1154int pci_enable_msi_block(struct pci_dev *dev, int nvec);
1155void pci_msi_shutdown(struct pci_dev *dev);
1156void pci_disable_msi(struct pci_dev *dev);
1157int pci_msix_vec_count(struct pci_dev *dev);
1158int pci_enable_msix(struct pci_dev *dev, struct msix_entry *entries, int nvec);
1159void pci_msix_shutdown(struct pci_dev *dev);
1160void pci_disable_msix(struct pci_dev *dev);
1161void msi_remove_pci_irq_vectors(struct pci_dev *dev);
1162void pci_restore_msi_state(struct pci_dev *dev);
1163int pci_msi_enabled(void);
1164int pci_enable_msi_range(struct pci_dev *dev, int minvec, int maxvec);
1165int pci_enable_msix_range(struct pci_dev *dev, struct msix_entry *entries,
1166 int minvec, int maxvec);
1167#else
1153static inline int pci_msi_vec_count(struct pci_dev *dev) 1168static 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
1204int pci_msi_vec_count(struct pci_dev *dev);
1205int pci_enable_msi_block(struct pci_dev *dev, int nvec);
1206void pci_msi_shutdown(struct pci_dev *dev);
1207void pci_disable_msi(struct pci_dev *dev);
1208int pci_msix_vec_count(struct pci_dev *dev);
1209int pci_enable_msix(struct pci_dev *dev, struct msix_entry *entries, int nvec);
1210void pci_msix_shutdown(struct pci_dev *dev);
1211void pci_disable_msix(struct pci_dev *dev);
1212void msi_remove_pci_irq_vectors(struct pci_dev *dev);
1213void pci_restore_msi_state(struct pci_dev *dev);
1214int pci_msi_enabled(void);
1215int pci_enable_msi_range(struct pci_dev *dev, int minvec, int maxvec);
1216int 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
1229static inline bool pcie_aspm_support_enabled(void) { return false; }
1230#else
1231bool pcie_aspm_support_enabled(void); 1229bool pcie_aspm_support_enabled(void);
1230#else
1231static 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) { }
1239static inline bool pci_aer_available(void) { return false; } 1239static inline bool pci_aer_available(void) { return false; }
1240#endif 1240#endif
1241 1241
1242#ifndef CONFIG_PCIE_ECRC 1242#ifdef CONFIG_PCIE_ECRC
1243void pcie_set_ecrc_checking(struct pci_dev *dev);
1244void pcie_ecrc_get_policy(char *str);
1245#else
1243static inline void pcie_set_ecrc_checking(struct pci_dev *dev) 1246static inline void pcie_set_ecrc_checking(struct pci_dev *dev)
1244{ 1247{
1245 return; 1248 return;
1246} 1249}
1247static inline void pcie_ecrc_get_policy(char *str) {}; 1250static inline void pcie_ecrc_get_policy(char *str) {};
1248#else
1249void pcie_set_ecrc_checking(struct pci_dev *dev);
1250void 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)