PCI: Make the pci_dev_present() stub a static inline
Subsystems (2)
PATCH 1/1 PCI: Make the pci_dev_present() stub a static inline
Change the pci_dev_present() stub which is used when CONFIG_PCI is not set from a #define to a static inline stub.
Thix should fix clang -Werror builds failing due to errors like this:
drivers/platform/x86/thinkpad_acpi.c:4475:35:
error: unused variable 'fwbug_cards_ids' [-Werror,-Wunused-const-variable]
Where fwbug_cards_ids is an array if pci_device_id-s passed to pci_dev_present() during a quirk check.
Fixing this in include/linux/pci.h should ensure that the same issue is also fixed in any other drivers hitting the same -Werror issue.
---
Note the commit message says "should fix" because I could not actually be bothered to verify this. The whole notion of combining:
1. clang
2. -Werror
3. -Wunused-const-variable
Is frankly a bit crazy, causing way too much noise and has already cost me too much time IMHO.
--- include/linux/pci.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
include/linux/pci.h +4 -1
@@ -1775,7 +1775,10 @@ static inline struct pci_dev *pci_get_class(unsigned int class, struct pci_dev *from) {return NULL ; } -#define pci_dev_present (ids) (0) + +static inline int pci_dev_present (const struct pci_device_id *ids) +{return 0 ; } +#define no_pci_devices () (1)#define pci_dev_put (dev) do { } while (0)
Signature · 1 line
2.31.1
Quoted 6 lines · Hans de Goede
Change the
pci_dev_present()stub which is used whenCONFIG_PCIis not set from a #define to a static inline stub.Thix should fix clang -Werror builds failing due to errors like this:
Quoted 8 lines
drivers/platform/x86/thinkpad_acpi.c:4475:35:
error: unused variable 'fwbug_cards_ids' [-Werror,-Wunused-const-variable]Where
fwbug_cards_idsis an array if pci_device_id-s passed topci_dev_present()during a quirk check.Fixing this in
include/linux/pci.hshould ensure that the same issue is also fixed in any other drivers hitting the same -Werror issue.
FWIW,
Quoted 34 lines
Reported-by kernel test robot <[email protected]>Signed-off-by Hans de Goede <[email protected]>---
Note the commit message says "should fix" because I could not actually be bothered to verify this. The whole notion of combining:
1. clang
2. -Werror
3. -Wunused-const-variable
Is frankly a bit crazy, causing way too much noise and has already cost me too much time IMHO.--- include/linux/pci.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)include/linux/pci.h +4
-2@@ -1775,7 +1775,10 @@ static inline struct pci_dev *pci_get_class(unsigned int class, struct pci_dev *from) {return NULL ; } -#define pci_dev_present (ids) (0) + +static inline int pci_dev_present (const struct pci_device_id *ids) +{return 0 ; } +#define no_pci_devices () (1)#define pci_dev_put (dev) do { } while (0) --2.31.1
Signature · 2 lines
With Best Regards, Andy Shevchenko