aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>2015-04-13 10:23:36 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2015-07-21 13:10:05 -0400
commit7044198591216ee701f98eeefecabc9d0ad6c2ef (patch)
treeb45882ed408dd9753ef946546818d57cc343419e
parent4aa339cddbcc05b7f8ff4f0960550929aa77213e (diff)
PCI: Propagate the "ignore hotplug" setting to parent
commit 0824965140fff1bf640a987dc790d1594a8e0699 upstream. Refine the mechanism introduced by commit f244d8b623da ("ACPIPHP / radeon / nouveau: Fix VGA switcheroo problem related to hotplug") to propagate the ignore_hotplug setting of the device to its parent bridge in case hotplug notifications related to the graphics adapter switching are given for the bridge rather than for the device itself (they need to be ignored in both cases). Link: https://bugzilla.kernel.org/show_bug.cgi?id=61891 Link: https://bugs.freedesktop.org/show_bug.cgi?id=88927 Fixes: b440bde74f04 ("PCI: Add pci_ignore_hotplug() to ignore hotplug events for a device") Reported-and-tested-by: tiagdtd-lava <tiagdtd-lava@yahoo.de> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/pci/pci.c11
-rw-r--r--include/linux/pci.h6
2 files changed, 12 insertions, 5 deletions
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index acc4b6ef78c4..c44393f26fd3 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -4324,6 +4324,17 @@ bool pci_device_is_present(struct pci_dev *pdev)
4324} 4324}
4325EXPORT_SYMBOL_GPL(pci_device_is_present); 4325EXPORT_SYMBOL_GPL(pci_device_is_present);
4326 4326
4327void pci_ignore_hotplug(struct pci_dev *dev)
4328{
4329 struct pci_dev *bridge = dev->bus->self;
4330
4331 dev->ignore_hotplug = 1;
4332 /* Propagate the "ignore hotplug" setting to the parent bridge. */
4333 if (bridge)
4334 bridge->ignore_hotplug = 1;
4335}
4336EXPORT_SYMBOL_GPL(pci_ignore_hotplug);
4337
4327#define RESOURCE_ALIGNMENT_PARAM_SIZE COMMAND_LINE_SIZE 4338#define RESOURCE_ALIGNMENT_PARAM_SIZE COMMAND_LINE_SIZE
4328static char resource_alignment_param[RESOURCE_ALIGNMENT_PARAM_SIZE] = {0}; 4339static char resource_alignment_param[RESOURCE_ALIGNMENT_PARAM_SIZE] = {0};
4329static DEFINE_SPINLOCK(resource_alignment_lock); 4340static DEFINE_SPINLOCK(resource_alignment_lock);
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 353db8dc4c6e..ef45ffe9ca88 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -1006,6 +1006,7 @@ int __must_check pci_assign_resource(struct pci_dev *dev, int i);
1006int __must_check pci_reassign_resource(struct pci_dev *dev, int i, resource_size_t add_size, resource_size_t align); 1006int __must_check pci_reassign_resource(struct pci_dev *dev, int i, resource_size_t add_size, resource_size_t align);
1007int pci_select_bars(struct pci_dev *dev, unsigned long flags); 1007int pci_select_bars(struct pci_dev *dev, unsigned long flags);
1008bool pci_device_is_present(struct pci_dev *pdev); 1008bool pci_device_is_present(struct pci_dev *pdev);
1009void pci_ignore_hotplug(struct pci_dev *dev);
1009 1010
1010/* ROM control related routines */ 1011/* ROM control related routines */
1011int pci_enable_rom(struct pci_dev *pdev); 1012int pci_enable_rom(struct pci_dev *pdev);
@@ -1043,11 +1044,6 @@ bool pci_dev_run_wake(struct pci_dev *dev);
1043bool pci_check_pme_status(struct pci_dev *dev); 1044bool pci_check_pme_status(struct pci_dev *dev);
1044void pci_pme_wakeup_bus(struct pci_bus *bus); 1045void pci_pme_wakeup_bus(struct pci_bus *bus);
1045 1046
1046static inline void pci_ignore_hotplug(struct pci_dev *dev)
1047{
1048 dev->ignore_hotplug = 1;
1049}
1050
1051static inline int pci_enable_wake(struct pci_dev *dev, pci_power_t state, 1047static inline int pci_enable_wake(struct pci_dev *dev, pci_power_t state,
1052 bool enable) 1048 bool enable)
1053{ 1049{