mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-06-17 20:25:19 +00:00
drm: Clear up master tracking booleans
- is_master can be removed, we can compute this by checking allowed_master (which really just tracks whether a master struct has been allocated for this fpriv in either open or set_master), and whether the fpriv is the current master on the device. - that frees up is_master as a good replacement name for allowed_master. With that it's clear that it tracks whether the fpriv is a master (with possibly clients attached to it and authenticated against it), and that one of those fprivs with is_master set is the current master. v2: Fix kerneldoc for is_master (Emil). 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> Link: http://patchwork.freedesktop.org/patch/msgid/1466499262-18717-10-git-send-email-daniel.vetter@ffwll.ch
This commit is contained in:
parent
b3ac9f2591
commit
0aae5920a8
2 changed files with 5 additions and 10 deletions
|
@ -116,11 +116,9 @@ static int drm_set_master(struct drm_device *dev, struct drm_file *fpriv,
|
|||
int ret = 0;
|
||||
|
||||
dev->master = drm_master_get(fpriv->master);
|
||||
fpriv->is_master = 1;
|
||||
if (dev->driver->master_set) {
|
||||
ret = dev->driver->master_set(dev, fpriv, new_master);
|
||||
if (unlikely(ret != 0)) {
|
||||
fpriv->is_master = 0;
|
||||
drm_master_put(&dev->master);
|
||||
}
|
||||
}
|
||||
|
@ -157,7 +155,7 @@ static int drm_new_set_master(struct drm_device *dev, struct drm_file *fpriv)
|
|||
if (ret)
|
||||
goto out_err;
|
||||
}
|
||||
fpriv->allowed_master = 1;
|
||||
fpriv->is_master = 1;
|
||||
fpriv->authenticated = 1;
|
||||
|
||||
ret = drm_set_master(dev, fpriv, true);
|
||||
|
@ -196,7 +194,7 @@ int drm_setmaster_ioctl(struct drm_device *dev, void *data,
|
|||
goto out_unlock;
|
||||
}
|
||||
|
||||
if (!file_priv->allowed_master) {
|
||||
if (!file_priv->is_master) {
|
||||
ret = drm_new_set_master(dev, file_priv);
|
||||
goto out_unlock;
|
||||
}
|
||||
|
@ -213,7 +211,6 @@ static void drm_drop_master(struct drm_device *dev,
|
|||
if (dev->driver->master_drop)
|
||||
dev->driver->master_drop(dev, fpriv);
|
||||
drm_master_put(&dev->master);
|
||||
fpriv->is_master = 0;
|
||||
}
|
||||
|
||||
int drm_dropmaster_ioctl(struct drm_device *dev, void *data,
|
||||
|
@ -291,7 +288,7 @@ out:
|
|||
|
||||
bool drm_is_current_master(struct drm_file *fpriv)
|
||||
{
|
||||
return fpriv->is_master;
|
||||
return fpriv->is_master && fpriv->master == fpriv->minor->dev->master;
|
||||
}
|
||||
EXPORT_SYMBOL(drm_is_current_master);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue