Commit de9d4fa4 authored by Patrick Mochel's avatar Patrick Mochel

driver model: add struct device_driver::shutdown() method and device_present() helper.

->shutdown() is added to be explicitly called during reboot transitions by 
device_shutdown(). Drivers implementing this method should use it solely to quiesce
the device. Drivers do not have to free memory allocated by the driver, as it is 
implied that the system is rebooting; and, they must not fuss with the reference
counts. Devices are guaranteed not to disappear during the call, though their 
validity may be checked using device_present().
parent d9b24a11
...@@ -120,7 +120,7 @@ struct device_driver { ...@@ -120,7 +120,7 @@ struct device_driver {
int (*probe) (struct device * dev); int (*probe) (struct device * dev);
int (*remove) (struct device * dev); int (*remove) (struct device * dev);
void (*shutdown) (struct device * dev);
int (*suspend) (struct device * dev, u32 state, u32 level); int (*suspend) (struct device * dev, u32 state, u32 level);
int (*resume) (struct device * dev, u32 level); int (*resume) (struct device * dev, u32 level);
...@@ -361,6 +361,11 @@ extern int (*platform_notify)(struct device * dev); ...@@ -361,6 +361,11 @@ extern int (*platform_notify)(struct device * dev);
extern int (*platform_notify_remove)(struct device * dev); extern int (*platform_notify_remove)(struct device * dev);
static inline int device_present(struct device * dev)
{
return (dev && dev->present == 1);
}
/* device and bus locking helpers. /* device and bus locking helpers.
* *
* FIXME: Is there anything else we need to do? * FIXME: Is there anything else we need to do?
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment