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 <chris@chris-wilson.co.uk>
Cc: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
diff --git a/drivers/gpu/drm/drm_auth.c b/drivers/gpu/drm/drm_auth.c
index 2794a4f..dc33387 100644
--- a/drivers/gpu/drm/drm_auth.c
+++ b/drivers/gpu/drm/drm_auth.c
@@ -183,7 +183,7 @@
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 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 @@
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 @@
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);