diff mbox

Fix for slot_no_hotplug bug in acpiphp system

Message ID 54EA3F6D.9010509@model-view.com
State New
Headers show

Commit Message

Jochen Leopold Feb. 22, 2015, 8:43 p.m. UTC
Hi!

Checking the subordinate devices in slot_no_hotplug fixes a crash bug on
some radeon laptop systems.

The radeon driver applies the ignore_hotplug flag on the radeon pci
device, but on some systems the function slot_no_hotplug did not reach
the device with this flag.

This patch should fix this crash bugs:
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1414789
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1414349

Signed-off-by: Jochen Leopold <jochen.leopold@model-view.com>
diff mbox

Patch

From d79a1db86278188c894581aac67fda5f9142ddcb Mon Sep 17 00:00:00 2001
From: Jochen Leopold <jochen.leopold@model-view.com>
Date: Sun, 22 Feb 2015 19:00:58 +0100
Subject: [PATCH] Fixed a slot_no_hotplug bug in acpiphp system

Checking the subordinate devices in slot_no_hotplug fixes a crash bug on some radeon laptop systems.
The radeon driver applies the ignore_hotplug flag on the radeon pci device, but on some systems the function slot_no_hotplug did not reach the device with this flag.

Signed-off-by: Jochen Leopold <jochen.leopold@model-view.com>
---
 drivers/pci/hotplug/acpiphp_glue.c | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)

diff --git a/drivers/pci/hotplug/acpiphp_glue.c b/drivers/pci/hotplug/acpiphp_glue.c
index bcb90e4..c057ede 100644
--- a/drivers/pci/hotplug/acpiphp_glue.c
+++ b/drivers/pci/hotplug/acpiphp_glue.c
@@ -559,14 +559,29 @@  static void disable_slot(struct acpiphp_slot *slot)
 	slot->flags &= (~SLOT_ENABLED);
 }
 
+static bool device_no_hotplug(struct pci_dev *dev)
+{
+	struct pci_bus *bus = dev->subordinate;
+	struct pci_dev *child;
+
+	if (!bus || dev->ignore_hotplug)
+		return dev->ignore_hotplug;
+
+	list_for_each_entry(child, &bus->devices, bus_list) {
+		if (device_no_hotplug(child))
+			return true;
+	}
+	return false;
+}
+
 static bool slot_no_hotplug(struct acpiphp_slot *slot)
 {
 	struct pci_bus *bus = slot->bus;
 	struct pci_dev *dev;
 
 	list_for_each_entry(dev, &bus->devices, bus_list) {
-		if (PCI_SLOT(dev->devfn) == slot->device && dev->ignore_hotplug)
-			return true;
+		if (PCI_SLOT(dev->devfn) == slot->device)
+			return device_no_hotplug(dev);
 	}
 	return false;
 }
-- 
1.9.1