Skip to contentSkip to conversation

powerpc/pci: reorder pci bus/bridge unregistration during PHB removal

PATCH New Tyrel Datwyler 1 participant 1 message Jul 29, 2014 PowerPC

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 powerpc/pci: reorder pci bus/bridge unregistration during PHB removal

Commit bcdde7e made __sysfs_remove_dir() recursive and introduced a BUG_ON during PHB removal while attempting to delete the power managment attribute group of the bus. This is a result of tearing the bridge and bus devices down out of order in remove_phb_dynamic. Since, the the bus resides below the bridge in the sysfs device tree it should be torn down first.

This patch simply moves the device_unregister call for the PHB bridge device after the device_unregister call for the PHB bus.

Fixes bcdde7e221a8 ("sysfs: make __sysfs_remove_dir() recursive")

---
v2:
- Included stable kernel list on Cc per comment by mpe

 arch/powerpc/platforms/pseries/pci_dlpar.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/powerpc/platforms/pseries/pci_dlpar.c +2 -2
index 203cbf0..89e2381 100644
@@ -118,10 +118,10 @@ int remove_phb_dynamic(struct pci_controller *phb)
 		}
 	}
 
-	/* Unregister the bridge device from sysfs and remove the PCI bus */
-	device_unregister(b->bridge);
+	/* Remove the PCI bus and unregister the bridge device from sysfs */
 	phb->bus = NULL;
 	pci_remove_bus(b);
+	device_unregister(b->bridge);
 
 	/* Now release the IO resource */
 	if (res->flags & IORESOURCE_IO)
Signature · 1 line
1.7.12.4