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

PCI: Move pci_set_flags() from asm-generic/pci-bridge.h to linux/pci.h

The PCI flag management constants and functions were previously declared in
include/asm-generic/pci-bridge.h. But they are not specific to bridges,
and arches did not include pci-bridge.h consistently.

Move the following interfaces and related constants to include/linux/pci.h
and remove pci-bridge.h:

pci_set_flags()
pci_add_flags()
pci_clear_flags()
pci_has_flag()

This fixes these warnings when building for some arches:

drivers/pci/host/pcie-designware.c:562:20: error: 'PCI_PROBE_ONLY' undeclared (first use in this function)
drivers/pci/host/pcie-designware.c:562:7: error: implicit declaration of function 'pci_has_flag' [-Werror=implicit-function-declaration]

Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>

+29 -65
+7
drivers/pci/probe.c
··· 1803 1803 return 0; 1804 1804 if (pci_pcie_type(parent) == PCI_EXP_TYPE_ROOT_PORT) 1805 1805 return 1; 1806 + 1807 + /* 1808 + * PCIe downstream ports are bridges that normally lead to only a 1809 + * device 0, but if PCI_SCAN_ALL_PCIE_DEVS is set, scan all 1810 + * possible devices, not just device 0. See PCIe spec r3.0, 1811 + * sec 7.3.1. 1812 + */ 1806 1813 if (parent->has_secondary_link && 1807 1814 !pci_has_flag(PCI_SCAN_ALL_PCIE_DEVS)) 1808 1815 return 1;
-65
include/asm-generic/pci-bridge.h
··· 6 6 */ 7 7 #ifndef _ASM_GENERIC_PCI_BRIDGE_H 8 8 #define _ASM_GENERIC_PCI_BRIDGE_H 9 - 10 - #ifdef __KERNEL__ 11 - 12 - enum { 13 - /* Force re-assigning all resources (ignore firmware 14 - * setup completely) 15 - */ 16 - PCI_REASSIGN_ALL_RSRC = 0x00000001, 17 - 18 - /* Re-assign all bus numbers */ 19 - PCI_REASSIGN_ALL_BUS = 0x00000002, 20 - 21 - /* Do not try to assign, just use existing setup */ 22 - PCI_PROBE_ONLY = 0x00000004, 23 - 24 - /* Don't bother with ISA alignment unless the bridge has 25 - * ISA forwarding enabled 26 - */ 27 - PCI_CAN_SKIP_ISA_ALIGN = 0x00000008, 28 - 29 - /* Enable domain numbers in /proc */ 30 - PCI_ENABLE_PROC_DOMAINS = 0x00000010, 31 - /* ... except for domain 0 */ 32 - PCI_COMPAT_DOMAIN_0 = 0x00000020, 33 - 34 - /* PCIe downstream ports are bridges that normally lead to only a 35 - * device 0, but if this is set, we scan all possible devices, not 36 - * just device 0. 37 - */ 38 - PCI_SCAN_ALL_PCIE_DEVS = 0x00000040, 39 - }; 40 - 41 - #ifdef CONFIG_PCI 42 - extern unsigned int pci_flags; 43 - 44 - static inline void pci_set_flags(int flags) 45 - { 46 - pci_flags = flags; 47 - } 48 - 49 - static inline void pci_add_flags(int flags) 50 - { 51 - pci_flags |= flags; 52 - } 53 - 54 - static inline void pci_clear_flags(int flags) 55 - { 56 - pci_flags &= ~flags; 57 - } 58 - 59 - static inline int pci_has_flag(int flag) 60 - { 61 - return pci_flags & flag; 62 - } 63 - #else 64 - static inline void pci_set_flags(int flags) { } 65 - static inline void pci_add_flags(int flags) { } 66 - static inline void pci_clear_flags(int flags) { } 67 - static inline int pci_has_flag(int flag) 68 - { 69 - return 0; 70 - } 71 - #endif /* CONFIG_PCI */ 72 - 73 - #endif /* __KERNEL__ */ 74 9 #endif /* _ASM_GENERIC_PCI_BRIDGE_H */
+22
include/linux/pci.h
··· 746 746 .vendor = PCI_VENDOR_ID_##vend, .device = (dev), \ 747 747 .subvendor = PCI_ANY_ID, .subdevice = PCI_ANY_ID, 0, 0 748 748 749 + enum { 750 + PCI_REASSIGN_ALL_RSRC = 0x00000001, /* ignore firmware setup */ 751 + PCI_REASSIGN_ALL_BUS = 0x00000002, /* reassign all bus numbers */ 752 + PCI_PROBE_ONLY = 0x00000004, /* use existing setup */ 753 + PCI_CAN_SKIP_ISA_ALIGN = 0x00000008, /* don't do ISA alignment */ 754 + PCI_ENABLE_PROC_DOMAINS = 0x00000010, /* enable domains in /proc */ 755 + PCI_COMPAT_DOMAIN_0 = 0x00000020, /* ... except domain 0 */ 756 + PCI_SCAN_ALL_PCIE_DEVS = 0x00000040, /* scan all, not just dev 0 */ 757 + }; 758 + 749 759 /* these external functions are only available when PCI support is enabled */ 750 760 #ifdef CONFIG_PCI 761 + 762 + extern unsigned int pci_flags; 763 + 764 + static inline void pci_set_flags(int flags) { pci_flags = flags; } 765 + static inline void pci_add_flags(int flags) { pci_flags |= flags; } 766 + static inline void pci_clear_flags(int flags) { pci_flags &= ~flags; } 767 + static inline int pci_has_flag(int flag) { return pci_flags & flag; } 751 768 752 769 void pcie_bus_configure_settings(struct pci_bus *bus); 753 770 ··· 1421 1404 void pci_register_set_vga_state(arch_set_vga_state_t func); 1422 1405 1423 1406 #else /* CONFIG_PCI is not enabled */ 1407 + 1408 + static inline void pci_set_flags(int flags) { } 1409 + static inline void pci_add_flags(int flags) { } 1410 + static inline void pci_clear_flags(int flags) { } 1411 + static inline int pci_has_flag(int flag) { return 0; } 1424 1412 1425 1413 /* 1426 1414 * If the system does not have PCI, clearly these return errors. Define