diff options
author | Dave Airlie <airlied@redhat.com> | 2012-02-20 14:18:07 +0000 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2012-03-15 13:35:33 +0000 |
commit | 2c07a21d6fb0be47fda696a618b726ea258ed1dd (patch) | |
tree | 8ab0b7541ee4f9f75397d3da190426041dc08c6e /include/drm/drmP.h | |
parent | cbc7e22151d99ed1dd7649d268ad3d81b9e6255a (diff) | |
download | talos-op-linux-2c07a21d6fb0be47fda696a618b726ea258ed1dd.tar.gz talos-op-linux-2c07a21d6fb0be47fda696a618b726ea258ed1dd.zip |
drm: add core support for unplugging a device (v2)
Two parts to this, one is simple unplug from sysfs for the device node.
The second adds an unplugged state, if we have device opens, we
just set the unplugged state and return, if we have no device
opens we drop the drm device.
If after a lastclose we discover we are unplugged we then
drop the drm device.
v2: use an atomic for unplugged and wrap it for users,
add checks on open + mmap + ioctl entry points.
Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'include/drm/drmP.h')
-rw-r--r-- | include/drm/drmP.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/include/drm/drmP.h b/include/drm/drmP.h index cfd921ff0cc4..574bd1c81ebd 100644 --- a/include/drm/drmP.h +++ b/include/drm/drmP.h @@ -1170,6 +1170,8 @@ struct drm_device { struct idr object_name_idr; /*@} */ int switch_power_state; + + atomic_t unplugged; /* device has been unplugged or gone away */ }; #define DRM_SWITCH_POWER_ON 0 @@ -1235,6 +1237,19 @@ static inline int drm_mtrr_del(int handle, unsigned long offset, } #endif +static inline void drm_device_set_unplugged(struct drm_device *dev) +{ + smp_wmb(); + atomic_set(&dev->unplugged, 1); +} + +static inline int drm_device_is_unplugged(struct drm_device *dev) +{ + int ret = atomic_read(&dev->unplugged); + smp_rmb(); + return ret; +} + /******************************************************************/ /** \name Internal function definitions */ /*@{*/ @@ -1455,6 +1470,7 @@ extern void drm_master_put(struct drm_master **master); extern void drm_put_dev(struct drm_device *dev); extern int drm_put_minor(struct drm_minor **minor); +extern void drm_unplug_dev(struct drm_device *dev); extern unsigned int drm_debug; extern unsigned int drm_vblank_offdelay; |