diff options
author | Greg KH <gregkh@suse.de> | 2005-04-08 01:53:31 -0400 |
---|---|---|
committer | Greg KH <gregkh@suse.de> | 2005-05-04 02:45:15 -0400 |
commit | c8958177224622411b9979eabb5610e30b06034b (patch) | |
tree | 09ceb4ce69813c9ac2a3e3c7ea6eff9d5361fe9c | |
parent | 4c0619add8c3a8b28e7fae8b15cc7b62de2f8148 (diff) |
[PATCH] PCI: Add pci shutdown ability
Now pci drivers can know when the system is going down without having to
add a reboot notifier event.
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r-- | drivers/pci/pci-driver.c | 9 | ||||
-rw-r--r-- | include/linux/pci.h | 1 |
2 files changed, 10 insertions, 0 deletions
diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c index 37b7961efc44..b42466ccbb30 100644 --- a/drivers/pci/pci-driver.c +++ b/drivers/pci/pci-driver.c | |||
@@ -318,6 +318,14 @@ static int pci_device_resume(struct device * dev) | |||
318 | return 0; | 318 | return 0; |
319 | } | 319 | } |
320 | 320 | ||
321 | static void pci_device_shutdown(struct device *dev) | ||
322 | { | ||
323 | struct pci_dev *pci_dev = to_pci_dev(dev); | ||
324 | struct pci_driver *drv = pci_dev->driver; | ||
325 | |||
326 | if (drv && drv->shutdown) | ||
327 | drv->shutdown(pci_dev); | ||
328 | } | ||
321 | 329 | ||
322 | #define kobj_to_pci_driver(obj) container_of(obj, struct device_driver, kobj) | 330 | #define kobj_to_pci_driver(obj) container_of(obj, struct device_driver, kobj) |
323 | #define attr_to_driver_attribute(obj) container_of(obj, struct driver_attribute, attr) | 331 | #define attr_to_driver_attribute(obj) container_of(obj, struct driver_attribute, attr) |
@@ -385,6 +393,7 @@ int pci_register_driver(struct pci_driver *drv) | |||
385 | drv->driver.bus = &pci_bus_type; | 393 | drv->driver.bus = &pci_bus_type; |
386 | drv->driver.probe = pci_device_probe; | 394 | drv->driver.probe = pci_device_probe; |
387 | drv->driver.remove = pci_device_remove; | 395 | drv->driver.remove = pci_device_remove; |
396 | drv->driver.shutdown = pci_device_shutdown, | ||
388 | drv->driver.owner = drv->owner; | 397 | drv->driver.owner = drv->owner; |
389 | drv->driver.kobj.ktype = &pci_driver_kobj_type; | 398 | drv->driver.kobj.ktype = &pci_driver_kobj_type; |
390 | pci_init_dynids(&drv->dynids); | 399 | pci_init_dynids(&drv->dynids); |
diff --git a/include/linux/pci.h b/include/linux/pci.h index 3c89148ae28a..cff5ba3ac8ce 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h | |||
@@ -671,6 +671,7 @@ struct pci_driver { | |||
671 | int (*suspend) (struct pci_dev *dev, pm_message_t state); /* Device suspended */ | 671 | int (*suspend) (struct pci_dev *dev, pm_message_t state); /* Device suspended */ |
672 | int (*resume) (struct pci_dev *dev); /* Device woken up */ | 672 | int (*resume) (struct pci_dev *dev); /* Device woken up */ |
673 | int (*enable_wake) (struct pci_dev *dev, pci_power_t state, int enable); /* Enable wake event */ | 673 | int (*enable_wake) (struct pci_dev *dev, pci_power_t state, int enable); /* Enable wake event */ |
674 | void (*shutdown) (struct pci_dev *dev); | ||
674 | 675 | ||
675 | struct device_driver driver; | 676 | struct device_driver driver; |
676 | struct pci_dynids dynids; | 677 | struct pci_dynids dynids; |