[PATCH] PCI: don't override drv->shutdown unconditionally
authorChristoph Hellwig <hch@lst.de>
Fri, 17 Jun 2005 19:25:25 +0000 (12:25 -0700)
committerLinus Torvalds <torvalds@ppc970.osdl.org>
Fri, 17 Jun 2005 19:34:20 +0000 (12:34 -0700)
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.

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
drivers/pci/pci-driver.c

index fe98553c978f335dae47646cee5df32c8f69b42e..f315df2005bca0ca85e4c2bfaa531641ba983933 100644 (file)
@@ -393,7 +393,10 @@ int pci_register_driver(struct pci_driver *drv)
        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);