Browse Source

Merge branch 'pci/misc' into next

* pci/misc:
  PCI: Fix kernel-doc build warning
  PCI: Move PCI_QUIRKS to the PCI bus menu
  alpha/PCI: Make pdev_save_srm_config() static
  PCI: Remove unused declarations
  PCI: Remove redundant pci_dev, pci_bus, resource declarations
  PCI: Remove redundant pcibios_set_master() declarations
  PCI/PME: Handle invalid data when reading Root Status
  x86/pci/intel_mid_pci: Constify intel_mid_pci_ops and make it __initconst
  PCI: Constify pci_dev_type structure
Bjorn Helgaas 7 years ago
parent
commit
65a129d784

+ 0 - 5
arch/alpha/include/asm/pci.h

@@ -12,9 +12,6 @@
  * The following structure is used to manage multiple PCI busses.
  * The following structure is used to manage multiple PCI busses.
  */
  */
 
 
-struct pci_dev;
-struct pci_bus;
-struct resource;
 struct pci_iommu_arena;
 struct pci_iommu_arena;
 struct page;
 struct page;
 
 
@@ -56,8 +53,6 @@ struct pci_controller {
 #define PCIBIOS_MIN_IO		alpha_mv.min_io_address
 #define PCIBIOS_MIN_IO		alpha_mv.min_io_address
 #define PCIBIOS_MIN_MEM		alpha_mv.min_mem_address
 #define PCIBIOS_MIN_MEM		alpha_mv.min_mem_address
 
 
-extern void pcibios_set_master(struct pci_dev *dev);
-
 /* IOMMU controls.  */
 /* IOMMU controls.  */
 
 
 /* The PCI address space does not equal the physical memory address space.
 /* The PCI address space does not equal the physical memory address space.

+ 10 - 1
arch/alpha/kernel/pci.c

@@ -196,9 +196,16 @@ pcibios_init(void)
 subsys_initcall(pcibios_init);
 subsys_initcall(pcibios_init);
 
 
 #ifdef ALPHA_RESTORE_SRM_SETUP
 #ifdef ALPHA_RESTORE_SRM_SETUP
+/* Store PCI device configuration left by SRM here. */
+struct pdev_srm_saved_conf
+{
+	struct pdev_srm_saved_conf *next;
+	struct pci_dev *dev;
+};
+
 static struct pdev_srm_saved_conf *srm_saved_configs;
 static struct pdev_srm_saved_conf *srm_saved_configs;
 
 
-void pdev_save_srm_config(struct pci_dev *dev)
+static void pdev_save_srm_config(struct pci_dev *dev)
 {
 {
 	struct pdev_srm_saved_conf *tmp;
 	struct pdev_srm_saved_conf *tmp;
 	static int printed = 0;
 	static int printed = 0;
@@ -238,6 +245,8 @@ pci_restore_srm_config(void)
 		pci_restore_state(tmp->dev);
 		pci_restore_state(tmp->dev);
 	}
 	}
 }
 }
+#else
+#define pdev_save_srm_config(dev)	do {} while (0)
 #endif
 #endif
 
 
 void pcibios_fixup_bus(struct pci_bus *bus)
 void pcibios_fixup_bus(struct pci_bus *bus)

+ 0 - 8
arch/alpha/kernel/pci_impl.h

@@ -156,16 +156,8 @@ struct pci_iommu_arena
 #endif
 #endif
 
 
 #ifdef ALPHA_RESTORE_SRM_SETUP
 #ifdef ALPHA_RESTORE_SRM_SETUP
-/* Store PCI device configuration left by SRM here. */
-struct pdev_srm_saved_conf
-{
-	struct pdev_srm_saved_conf *next;
-	struct pci_dev *dev;
-};
-
 extern void pci_restore_srm_config(void);
 extern void pci_restore_srm_config(void);
 #else
 #else
-#define pdev_save_srm_config(dev)	do {} while (0)
 #define pci_restore_srm_config()	do {} while (0)
 #define pci_restore_srm_config()	do {} while (0)
 #endif
 #endif
 
 

+ 0 - 9
arch/cris/include/asm/pci.h

@@ -16,13 +16,6 @@
 
 
 #define PCIBIOS_MIN_CARDBUS_IO	0x4000
 #define PCIBIOS_MIN_CARDBUS_IO	0x4000
 
 
-void pcibios_config_init(void);
-struct pci_bus * pcibios_scan_root(int bus);
-
-void pcibios_set_master(struct pci_dev *dev);
-struct irq_routing_table *pcibios_get_irq_routing_table(void);
-int pcibios_set_irq_routing(struct pci_dev *dev, int pin, int irq);
-
 /* Dynamic DMA mapping stuff.
 /* Dynamic DMA mapping stuff.
  * i386 has everything mapped statically.
  * i386 has everything mapped statically.
  */
  */
@@ -33,8 +26,6 @@ int pcibios_set_irq_routing(struct pci_dev *dev, int pin, int irq);
 #include <linux/string.h>
 #include <linux/string.h>
 #include <asm/io.h>
 #include <asm/io.h>
 
 
-struct pci_dev;
-
 /* The PCI address space does equal the physical memory
 /* The PCI address space does equal the physical memory
  * address space.  The networking and block device layers use
  * address space.  The networking and block device layers use
  * this boolean for bounce buffer decisions.
  * this boolean for bounce buffer decisions.

+ 0 - 4
arch/frv/include/asm/pci.h

@@ -17,12 +17,8 @@
 #include <linux/scatterlist.h>
 #include <linux/scatterlist.h>
 #include <asm-generic/pci.h>
 #include <asm-generic/pci.h>
 
 
-struct pci_dev;
-
 #define pcibios_assign_all_busses()	0
 #define pcibios_assign_all_busses()	0
 
 
-extern void pcibios_set_master(struct pci_dev *dev);
-
 #ifdef CONFIG_MMU
 #ifdef CONFIG_MMU
 extern void *consistent_alloc(gfp_t gfp, size_t size, dma_addr_t *dma_handle);
 extern void *consistent_alloc(gfp_t gfp, size_t size, dma_addr_t *dma_handle);
 extern void consistent_free(void *vaddr);
 extern void consistent_free(void *vaddr);

+ 0 - 4
arch/ia64/include/asm/pci.h

@@ -29,10 +29,6 @@ struct pci_vector_struct {
 #define PCIBIOS_MIN_IO		0x1000
 #define PCIBIOS_MIN_IO		0x1000
 #define PCIBIOS_MIN_MEM		0x10000000
 #define PCIBIOS_MIN_MEM		0x10000000
 
 
-void pcibios_config_init(void);
-
-struct pci_dev;
-
 /*
 /*
  * PCI_DMA_BUS_IS_PHYS should be set to 1 if there is _necessarily_ a direct
  * PCI_DMA_BUS_IS_PHYS should be set to 1 if there is _necessarily_ a direct
  * correspondence between device bus addresses and CPU physical addresses.
  * correspondence between device bus addresses and CPU physical addresses.

+ 0 - 4
arch/mips/include/asm/pci.h

@@ -106,8 +106,6 @@ extern unsigned long PCIBIOS_MIN_MEM;
 
 
 #define PCIBIOS_MIN_CARDBUS_IO	0x4000
 #define PCIBIOS_MIN_CARDBUS_IO	0x4000
 
 
-extern void pcibios_set_master(struct pci_dev *dev);
-
 #define HAVE_PCI_MMAP
 #define HAVE_PCI_MMAP
 #define ARCH_GENERIC_PCI_MMAP_RESOURCE
 #define ARCH_GENERIC_PCI_MMAP_RESOURCE
 #define HAVE_ARCH_PCI_RESOURCE_TO_USER
 #define HAVE_ARCH_PCI_RESOURCE_TO_USER
@@ -123,8 +121,6 @@ extern void pcibios_set_master(struct pci_dev *dev);
 #include <linux/string.h>
 #include <linux/string.h>
 #include <asm/io.h>
 #include <asm/io.h>
 
 
-struct pci_dev;
-
 /*
 /*
  * The PCI address space does equal the physical memory address space.
  * The PCI address space does equal the physical memory address space.
  * The networking and block device layers use this boolean for bounce
  * The networking and block device layers use this boolean for bounce

+ 0 - 4
arch/mn10300/include/asm/pci.h

@@ -47,8 +47,6 @@ extern void unit_pci_init(void);
 #define PCIBIOS_MIN_IO		0xBE000004
 #define PCIBIOS_MIN_IO		0xBE000004
 #define PCIBIOS_MIN_MEM		0xB8000000
 #define PCIBIOS_MIN_MEM		0xB8000000
 
 
-void pcibios_set_master(struct pci_dev *dev);
-
 /* Dynamic DMA mapping stuff.
 /* Dynamic DMA mapping stuff.
  * i386 has everything mapped statically.
  * i386 has everything mapped statically.
  */
  */
@@ -59,8 +57,6 @@ void pcibios_set_master(struct pci_dev *dev);
 #include <linux/string.h>
 #include <linux/string.h>
 #include <asm/io.h>
 #include <asm/io.h>
 
 
-struct pci_dev;
-
 /* The PCI address space does equal the physical memory
 /* The PCI address space does equal the physical memory
  * address space.  The networking and block device layers use
  * address space.  The networking and block device layers use
  * this boolean for bounce buffer decisions.
  * this boolean for bounce buffer decisions.

+ 0 - 3
arch/mn10300/unit-asb2305/pci-asb2305.h

@@ -30,9 +30,6 @@ extern void pcibios_resource_survey(void);
 
 
 extern struct pci_ops *pci_root_ops;
 extern struct pci_ops *pci_root_ops;
 
 
-extern struct irq_routing_table *pcibios_get_irq_routing_table(void);
-extern int pcibios_set_irq_routing(struct pci_dev *dev, int pin, int irq);
-
 /* pci-irq.c */
 /* pci-irq.c */
 
 
 struct irq_info {
 struct irq_info {

+ 0 - 8
arch/parisc/include/asm/pci.h

@@ -86,13 +86,6 @@ struct pci_hba_data {
 #define PCI_F_EXTEND		0UL
 #define PCI_F_EXTEND		0UL
 #endif /* !CONFIG_64BIT */
 #endif /* !CONFIG_64BIT */
 
 
-/*
-** KLUGE: linux/pci.h include asm/pci.h BEFORE declaring struct pci_bus
-** (This eliminates some of the warnings).
-*/
-struct pci_bus;
-struct pci_dev;
-
 /*
 /*
  * If the PCI device's view of memory is the same as the CPU's view of memory,
  * If the PCI device's view of memory is the same as the CPU's view of memory,
  * PCI_DMA_BUS_IS_PHYS is true.  The networking and block device layers use
  * PCI_DMA_BUS_IS_PHYS is true.  The networking and block device layers use
@@ -161,7 +154,6 @@ extern struct pci_bios_ops *pci_bios;
 
 
 #ifdef CONFIG_PCI
 #ifdef CONFIG_PCI
 extern void pcibios_register_hba(struct pci_hba_data *);
 extern void pcibios_register_hba(struct pci_hba_data *);
-extern void pcibios_set_master(struct pci_dev *);
 #else
 #else
 static inline void pcibios_register_hba(struct pci_hba_data *x)
 static inline void pcibios_register_hba(struct pci_hba_data *x)
 {
 {

+ 0 - 2
arch/powerpc/include/asm/pci.h

@@ -28,8 +28,6 @@
 #define PCIBIOS_MIN_IO		0x1000
 #define PCIBIOS_MIN_IO		0x1000
 #define PCIBIOS_MIN_MEM		0x10000000
 #define PCIBIOS_MIN_MEM		0x10000000
 
 
-struct pci_dev;
-
 /* Values for the `which' argument to sys_pciconfig_iobase syscall.  */
 /* Values for the `which' argument to sys_pciconfig_iobase syscall.  */
 #define IOBASE_BRIDGE_NUMBER	0
 #define IOBASE_BRIDGE_NUMBER	0
 #define IOBASE_MEMORY		1
 #define IOBASE_MEMORY		1

+ 0 - 4
arch/sh/include/asm/pci.h

@@ -63,13 +63,9 @@ extern int pci_is_66mhz_capable(struct pci_channel *hose,
 
 
 extern unsigned long PCIBIOS_MIN_IO, PCIBIOS_MIN_MEM;
 extern unsigned long PCIBIOS_MIN_IO, PCIBIOS_MIN_MEM;
 
 
-struct pci_dev;
-
 #define HAVE_PCI_MMAP
 #define HAVE_PCI_MMAP
 #define ARCH_GENERIC_PCI_MMAP_RESOURCE
 #define ARCH_GENERIC_PCI_MMAP_RESOURCE
 
 
-extern void pcibios_set_master(struct pci_dev *dev);
-
 /* Dynamic DMA mapping stuff.
 /* Dynamic DMA mapping stuff.
  * SuperH has everything mapped statically like x86.
  * SuperH has everything mapped statically like x86.
  */
  */

+ 0 - 2
arch/sparc/include/asm/pci_32.h

@@ -20,8 +20,6 @@
  */
  */
 #define PCI_DMA_BUS_IS_PHYS	(0)
 #define PCI_DMA_BUS_IS_PHYS	(0)
 
 
-struct pci_dev;
-
 #endif /* __KERNEL__ */
 #endif /* __KERNEL__ */
 
 
 #ifndef CONFIG_LEON_PCI
 #ifndef CONFIG_LEON_PCI

+ 0 - 2
arch/x86/include/asm/pci.h

@@ -88,10 +88,8 @@ extern unsigned long pci_mem_start;
 #define PCIBIOS_MIN_CARDBUS_IO	0x4000
 #define PCIBIOS_MIN_CARDBUS_IO	0x4000
 
 
 extern int pcibios_enabled;
 extern int pcibios_enabled;
-void pcibios_config_init(void);
 void pcibios_scan_root(int bus);
 void pcibios_scan_root(int bus);
 
 
-void pcibios_set_master(struct pci_dev *dev);
 struct irq_routing_table *pcibios_get_irq_routing_table(void);
 struct irq_routing_table *pcibios_get_irq_routing_table(void);
 int pcibios_set_irq_routing(struct pci_dev *dev, int pin, int irq);
 int pcibios_set_irq_routing(struct pci_dev *dev, int pin, int irq);
 
 

+ 1 - 1
arch/x86/pci/intel_mid_pci.c

@@ -279,7 +279,7 @@ static void intel_mid_pci_irq_disable(struct pci_dev *dev)
 	}
 	}
 }
 }
 
 
-static struct pci_ops intel_mid_pci_ops = {
+static const struct pci_ops intel_mid_pci_ops __initconst = {
 	.read = pci_read,
 	.read = pci_read,
 	.write = pci_write,
 	.write = pci_write,
 };
 };

+ 0 - 2
arch/xtensa/include/asm/pci.h

@@ -37,8 +37,6 @@ extern struct pci_controller* pcibios_alloc_controller(void);
 #include <linux/string.h>
 #include <linux/string.h>
 #include <asm/io.h>
 #include <asm/io.h>
 
 
-struct pci_dev;
-
 /* The PCI address space does equal the physical memory address space.
 /* The PCI address space does equal the physical memory address space.
  * The networking and block device layers use this boolean for bounce buffer
  * The networking and block device layers use this boolean for bounce buffer
  * decisions.
  * decisions.

+ 9 - 0
drivers/pci/Kconfig

@@ -29,6 +29,15 @@ config PCI_MSI_IRQ_DOMAIN
 	depends on PCI_MSI
 	depends on PCI_MSI
 	select GENERIC_MSI_IRQ_DOMAIN
 	select GENERIC_MSI_IRQ_DOMAIN
 
 
+config PCI_QUIRKS
+	default y
+	bool "Enable PCI quirk workarounds" if EXPERT
+	depends on PCI
+	help
+	  This enables workarounds for various PCI chipset bugs/quirks.
+	  Disable this only if your target machine is unaffected by PCI
+	  quirks.
+
 config PCI_DEBUG
 config PCI_DEBUG
 	bool "PCI Debugging"
 	bool "PCI Debugging"
 	depends on PCI && DEBUG_KERNEL
 	depends on PCI && DEBUG_KERNEL

+ 1 - 1
drivers/pci/pci-sysfs.c

@@ -1795,6 +1795,6 @@ static const struct attribute_group *pci_dev_attr_groups[] = {
 	NULL,
 	NULL,
 };
 };
 
 
-struct device_type pci_dev_type = {
+const struct device_type pci_dev_type = {
 	.groups = pci_dev_attr_groups,
 	.groups = pci_dev_attr_groups,
 };
 };

+ 1 - 1
drivers/pci/pci.c

@@ -3471,7 +3471,7 @@ EXPORT_SYMBOL(devm_pci_remap_cfgspace);
  * All operations are managed and will be undone on driver detach.
  * All operations are managed and will be undone on driver detach.
  *
  *
  * Returns a pointer to the remapped memory or an ERR_PTR() encoded error code
  * Returns a pointer to the remapped memory or an ERR_PTR() encoded error code
- * on failure. Usage example:
+ * on failure. Usage example::
  *
  *
  *	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
  *	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
  *	base = devm_pci_remap_cfg_resource(&pdev->dev, res);
  *	base = devm_pci_remap_cfg_resource(&pdev->dev, res);

+ 1 - 1
drivers/pci/pci.h

@@ -192,7 +192,7 @@ static inline int pci_no_d1d2(struct pci_dev *dev)
 }
 }
 extern const struct attribute_group *pci_dev_groups[];
 extern const struct attribute_group *pci_dev_groups[];
 extern const struct attribute_group *pcibus_groups[];
 extern const struct attribute_group *pcibus_groups[];
-extern struct device_type pci_dev_type;
+extern const struct device_type pci_dev_type;
 extern const struct attribute_group *pci_bus_groups[];
 extern const struct attribute_group *pci_bus_groups[];
 
 
 
 

+ 4 - 1
drivers/pci/pcie/pme.c

@@ -226,6 +226,9 @@ static void pcie_pme_work_fn(struct work_struct *work)
 			break;
 			break;
 
 
 		pcie_capability_read_dword(port, PCI_EXP_RTSTA, &rtsta);
 		pcie_capability_read_dword(port, PCI_EXP_RTSTA, &rtsta);
+		if (rtsta == (u32) ~0)
+			break;
+
 		if (rtsta & PCI_EXP_RTSTA_PME) {
 		if (rtsta & PCI_EXP_RTSTA_PME) {
 			/*
 			/*
 			 * Clear PME status of the port.  If there are other
 			 * Clear PME status of the port.  If there are other
@@ -273,7 +276,7 @@ static irqreturn_t pcie_pme_irq(int irq, void *context)
 	spin_lock_irqsave(&data->lock, flags);
 	spin_lock_irqsave(&data->lock, flags);
 	pcie_capability_read_dword(port, PCI_EXP_RTSTA, &rtsta);
 	pcie_capability_read_dword(port, PCI_EXP_RTSTA, &rtsta);
 
 
-	if (!(rtsta & PCI_EXP_RTSTA_PME)) {
+	if (rtsta == (u32) ~0 || !(rtsta & PCI_EXP_RTSTA_PME)) {
 		spin_unlock_irqrestore(&data->lock, flags);
 		spin_unlock_irqrestore(&data->lock, flags);
 		return IRQ_NONE;
 		return IRQ_NONE;
 	}
 	}

+ 0 - 9
init/Kconfig

@@ -1379,15 +1379,6 @@ config USERFAULTFD
 	  Enable the userfaultfd() system call that allows to intercept and
 	  Enable the userfaultfd() system call that allows to intercept and
 	  handle page faults in userland.
 	  handle page faults in userland.
 
 
-config PCI_QUIRKS
-	default y
-	bool "Enable PCI quirk workarounds" if EXPERT
-	depends on PCI
-	help
-	  This enables workarounds for various PCI chipset
-	  bugs/quirks. Disable this only if your target machine is
-	  unaffected by PCI quirks.
-
 config MEMBARRIER
 config MEMBARRIER
 	bool "Enable membarrier() system call" if EXPERT
 	bool "Enable membarrier() system call" if EXPERT
 	default y
 	default y