Skip to content

Commit 0824965

Browse files
rafaeljwbjorn-helgaas
authored andcommitted
PCI: Propagate the "ignore hotplug" setting to parent
Refine the mechanism introduced by commit f244d8b ("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: b440bde ("PCI: Add pci_ignore_hotplug() to ignore hotplug events for a device") Reported-and-tested-by: tiagdtd-lava <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]> Signed-off-by: Bjorn Helgaas <[email protected]> CC: [email protected] # v3.17+
1 parent d41be34 commit 0824965

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

drivers/pci/pci.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4324,6 +4324,17 @@ bool pci_device_is_present(struct pci_dev *pdev)
43244324
}
43254325
EXPORT_SYMBOL_GPL(pci_device_is_present);
43264326

4327+
void 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+
}
4336+
EXPORT_SYMBOL_GPL(pci_ignore_hotplug);
4337+
43274338
#define RESOURCE_ALIGNMENT_PARAM_SIZE COMMAND_LINE_SIZE
43284339
static char resource_alignment_param[RESOURCE_ALIGNMENT_PARAM_SIZE] = {0};
43294340
static DEFINE_SPINLOCK(resource_alignment_lock);

include/linux/pci.h

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1006,6 +1006,7 @@ int __must_check pci_assign_resource(struct pci_dev *dev, int i);
10061006
int __must_check pci_reassign_resource(struct pci_dev *dev, int i, resource_size_t add_size, resource_size_t align);
10071007
int pci_select_bars(struct pci_dev *dev, unsigned long flags);
10081008
bool pci_device_is_present(struct pci_dev *pdev);
1009+
void pci_ignore_hotplug(struct pci_dev *dev);
10091010

10101011
/* ROM control related routines */
10111012
int pci_enable_rom(struct pci_dev *pdev);
@@ -1043,11 +1044,6 @@ bool pci_dev_run_wake(struct pci_dev *dev);
10431044
bool pci_check_pme_status(struct pci_dev *dev);
10441045
void pci_pme_wakeup_bus(struct pci_bus *bus);
10451046

1046-
static inline void pci_ignore_hotplug(struct pci_dev *dev)
1047-
{
1048-
dev->ignore_hotplug = 1;
1049-
}
1050-
10511047
static inline int pci_enable_wake(struct pci_dev *dev, pci_power_t state,
10521048
bool enable)
10531049
{

0 commit comments

Comments
 (0)