From: Christoph Hellwig Date: Fri, 17 Jun 2005 19:25:25 +0000 (-0700) Subject: [PATCH] PCI: don't override drv->shutdown unconditionally X-Git-Tag: v2.6.12~2 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=794f5bfa77955c4455f6d72d8b0e2bee25f1ff0c;p=linux-2.6 [PATCH] 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. Signed-off-by: Greg Kroah-Hartman Signed-off-by: Linus Torvalds --- diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c index fe98553c97..f315df2005 100644 --- a/drivers/pci/pci-driver.c +++ b/drivers/pci/pci-driver.c @@ -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);