diff options
author | imp <imp@FreeBSD.org> | 2004-12-31 20:47:51 +0000 |
---|---|---|
committer | imp <imp@FreeBSD.org> | 2004-12-31 20:47:51 +0000 |
commit | 58871563b42047c363403fc016399a46b3244742 (patch) | |
tree | d70aa4cbded2ddd880f385cb4a7a42e0e1433402 /sys/kern/device_if.m | |
parent | 0b07314057605333318596908beea6b5c4dbf7e0 (diff) | |
download | FreeBSD-src-58871563b42047c363403fc016399a46b3244742.zip FreeBSD-src-58871563b42047c363403fc016399a46b3244742.tar.gz |
Implement device_quiesce. This method means 'you are about to be
unloaded, cleanup, or return ebusy of that's inconvenient.' The
default module hanlder for newbus will now call this when we get a
MOD_QUIESCE event, but in the future may call this at other times.
This shouldn't change any actual behavior until drivers start to use it.
Diffstat (limited to 'sys/kern/device_if.m')
-rw-r--r-- | sys/kern/device_if.m | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/sys/kern/device_if.m b/sys/kern/device_if.m index 8b97f4e..d7609b9 100644 --- a/sys/kern/device_if.m +++ b/sys/kern/device_if.m @@ -57,6 +57,11 @@ CODE { { return 0; } + + static int null_quiesce(device_t dev) + { + return EOPNOTSUPP; + } }; /** @@ -283,3 +288,29 @@ METHOD int suspend { METHOD int resume { device_t dev; } DEFAULT null_resume; + +/** + * @brief This is called when the driver is asked to quiesce itself. + * + * The driver should arrange for the orderly shutdown of this device. + * All further access to the device should be curtailed. Soon there + * will be a request to detach, but there won't necessarily be one. + * + * To include this method in a device driver, use a line like this + * in the driver's method list: + * + * @code + * KOBJMETHOD(device_quiesce, foo_quiesce) + * @endcode + * + * @param dev the device being quiesced + * + * @retval 0 success + * @retval non-zero an error occurred while attempting to quiesce the + * device + * + * @see DEVICE_DETACH() + */ +METHOD int quiesce { + device_t dev; +} DEFAULT null_quiesce; |