Skip to content

Commit 4c85980

Browse files
committed
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 <[email protected]>
1 parent 597db6f commit 4c85980

File tree

2 files changed

+48
-55
lines changed

2 files changed

+48
-55
lines changed

drivers/pci/pci-label.c

Lines changed: 25 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -34,21 +34,7 @@
3434

3535
#define DEVICE_LABEL_DSM 0x07
3636

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
5238
enum smbios_attr_enum {
5339
SMBIOS_ATTR_NONE = 0,
5440
SMBIOS_ATTR_LABEL_SHOW,
@@ -156,31 +142,20 @@ pci_remove_smbiosname_file(struct pci_dev *pdev)
156142
{
157143
sysfs_remove_group(&pdev->dev.kobj, &smbios_attr_group);
158144
}
159-
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-
145+
#else
170146
static inline int
171-
pci_remove_acpi_index_label_files(struct pci_dev *pdev)
147+
pci_create_smbiosname_file(struct pci_dev *pdev)
172148
{
173149
return -1;
174150
}
175151

176-
static inline bool
177-
device_has_dsm(struct device *dev)
152+
static inline void
153+
pci_remove_smbiosname_file(struct pci_dev *pdev)
178154
{
179-
return false;
180155
}
156+
#endif
181157

182-
#else
183-
158+
#ifdef CONFIG_ACPI
184159
static const char device_label_dsm_uuid[] = {
185160
0xD0, 0x37, 0xC9, 0xE5, 0x53, 0x35, 0x7A, 0x4D,
186161
0x91, 0x17, 0xEA, 0x4D, 0x19, 0xC3, 0x43, 0x4D
@@ -364,6 +339,24 @@ pci_remove_acpi_index_label_files(struct pci_dev *pdev)
364339
sysfs_remove_group(&pdev->dev.kobj, &acpi_attr_group);
365340
return 0;
366341
}
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+
}
367360
#endif
368361

369362
void pci_create_firmware_label_files(struct pci_dev *pdev)

include/linux/pci.h

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1149,7 +1149,22 @@ struct msix_entry {
11491149
};
11501150

11511151

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
11531168
static inline int pci_msi_vec_count(struct pci_dev *dev)
11541169
{
11551170
return -ENOSYS;
@@ -1200,21 +1215,6 @@ static inline int pci_enable_msix_range(struct pci_dev *dev,
12001215
{
12011216
return -ENOSYS;
12021217
}
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);
12181218
#endif
12191219

12201220
#ifdef CONFIG_PCIEPORTBUS
@@ -1225,10 +1225,10 @@ extern bool pcie_ports_auto;
12251225
#define pcie_ports_auto false
12261226
#endif
12271227

1228-
#ifndef CONFIG_PCIEASPM
1229-
static inline bool pcie_aspm_support_enabled(void) { return false; }
1230-
#else
1228+
#ifdef CONFIG_PCIEASPM
12311229
bool pcie_aspm_support_enabled(void);
1230+
#else
1231+
static inline bool pcie_aspm_support_enabled(void) { return false; }
12321232
#endif
12331233

12341234
#ifdef CONFIG_PCIEAER
@@ -1239,15 +1239,15 @@ static inline void pci_no_aer(void) { }
12391239
static inline bool pci_aer_available(void) { return false; }
12401240
#endif
12411241

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
12431246
static inline void pcie_set_ecrc_checking(struct pci_dev *dev)
12441247
{
12451248
return;
12461249
}
12471250
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);
12511251
#endif
12521252

12531253
#define pci_enable_msi(pdev) pci_enable_msi_block(pdev, 1)

0 commit comments

Comments
 (0)