aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/drm_auth.c
diff options
context:
space:
mode:
authorDaniel Vetter <[email protected]>2016-06-21 08:54:20 +0000
committerDaniel Vetter <[email protected]>2016-06-21 19:58:12 +0000
commitb3ac9f2591061e4470834028f563ef1fd86098cf (patch)
tree25e5f421535067a589de53f10c2aee5fd7d98604 /drivers/gpu/drm/drm_auth.c
parentdrm: Refactor drop/set master code a bit (diff)
downloadkernel-b3ac9f2591061e4470834028f563ef1fd86098cf.tar.gz
kernel-b3ac9f2591061e4470834028f563ef1fd86098cf.zip
drm: Extract drm_is_current_master
Just rolling out a bit of abstraction to be able to clean up the master logic in the next step. Cc: Chris Wilson <[email protected]> Cc: Thomas Hellstrom <[email protected]> Reviewed-by: Chris Wilson <[email protected]> Reviewed-by: Emil Velikov <[email protected]> Signed-off-by: Daniel Vetter <[email protected]>
Diffstat (limited to 'drivers/gpu/drm/drm_auth.c')
-rw-r--r--drivers/gpu/drm/drm_auth.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/drivers/gpu/drm/drm_auth.c b/drivers/gpu/drm/drm_auth.c
index 2794a4f3a105..dc33387519cb 100644
--- a/drivers/gpu/drm/drm_auth.c
+++ b/drivers/gpu/drm/drm_auth.c
@@ -183,7 +183,7 @@ int drm_setmaster_ioctl(struct drm_device *dev, void *data,
int ret = 0;
mutex_lock(&dev->master_mutex);
- if (file_priv->is_master)
+ if (drm_is_current_master(file_priv))
goto out_unlock;
if (dev->master) {
@@ -222,7 +222,7 @@ int drm_dropmaster_ioctl(struct drm_device *dev, void *data,
int ret = -EINVAL;
mutex_lock(&dev->master_mutex);
- if (!file_priv->is_master)
+ if (!drm_is_current_master(file_priv))
goto out_unlock;
if (!dev->master)
@@ -261,7 +261,7 @@ void drm_master_release(struct drm_file *file_priv)
if (file_priv->magic)
idr_remove(&file_priv->master->magic_map, file_priv->magic);
- if (!file_priv->is_master)
+ if (!drm_is_current_master(file_priv))
goto out;
if (!drm_core_check_feature(dev, DRIVER_MODESET)) {
@@ -289,6 +289,12 @@ out:
mutex_unlock(&dev->master_mutex);
}
+bool drm_is_current_master(struct drm_file *fpriv)
+{
+ return fpriv->is_master;
+}
+EXPORT_SYMBOL(drm_is_current_master);
+
struct drm_master *drm_master_get(struct drm_master *master)
{
kref_get(&master->refcount);