Skip to contentSkip to conversation

PCI: don't override drv->shutdown unconditionally

PATCH New Greg KH 1 participant 1 message Jun 17, 2005 PCI

lore
Share & tools
lore

Greg KH

author
#0 lore raw

PATCH 1/1 PCI: don't override drv->shutdown unconditionally

There are many drivers that have been setting the generic driver model level shutdown callback, and pci thus must not override it.

Without this patch we can have really bad data loss on various raid controllers.

From: Christoph Hellwig <[email protected]>

---
 drivers/pci/pci-driver.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletion(-)
drivers/pci/pci-driver.c +4 -1
@@ -395,7 +395,10 @@
 	drv->driver.bus = &pci_bus_type;
 	drv->driver.probe = pci_device_probe;
 	drv->driver.remove = pci_device_remove;
-	drv->driver.shutdown = pci_device_shutdown,
+	/* FIXME, once all of the existing PCI drivers have been fixed to set
+	 * the pci shutdown function, this test can go away. */
+	if (!drv->driver.shutdown)
+		drv->driver.shutdown = pci_device_shutdown,
 	drv->driver.owner = drv->owner;
 	drv->driver.kobj.ktype = &pci_driver_kobj_type;
 	pci_init_dynids(&drv->dynids);