Skip to content

Commit

Permalink
[PATCH] PCI: Add pci shutdown ability
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Greg KH committed May 4, 2005
1 parent 4c0619a commit c895817
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
9 changes: 9 additions & 0 deletions drivers/pci/pci-driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,14 @@ static int pci_device_resume(struct device * dev)
return 0;
}

static void pci_device_shutdown(struct device *dev)
{
struct pci_dev *pci_dev = to_pci_dev(dev);
struct pci_driver *drv = pci_dev->driver;

if (drv && drv->shutdown)
drv->shutdown(pci_dev);
}

#define kobj_to_pci_driver(obj) container_of(obj, struct device_driver, kobj)
#define attr_to_driver_attribute(obj) container_of(obj, struct driver_attribute, attr)
Expand Down Expand Up @@ -385,6 +393,7 @@ 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,
drv->driver.owner = drv->owner;
drv->driver.kobj.ktype = &pci_driver_kobj_type;
pci_init_dynids(&drv->dynids);
Expand Down
1 change: 1 addition & 0 deletions include/linux/pci.h
Original file line number Diff line number Diff line change
Expand Up @@ -671,6 +671,7 @@ struct pci_driver {
int (*suspend) (struct pci_dev *dev, pm_message_t state); /* Device suspended */
int (*resume) (struct pci_dev *dev); /* Device woken up */
int (*enable_wake) (struct pci_dev *dev, pci_power_t state, int enable); /* Enable wake event */
void (*shutdown) (struct pci_dev *dev);

struct device_driver driver;
struct pci_dynids dynids;
Expand Down

0 comments on commit c895817

Please sign in to comment.