mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-04 08:08:54 +00:00
drm: Only do the hw.lock cleanup in master_relase for !MODESET
Another place gone where modern drivers could have hit dev->struct_mutex. To avoid too deeply nesting control flow rework it a bit. v2: Review from Chris: - remove spurious newline. - fix file_priv->master like for the !file_priv->is_master case. Cc: Chris Wilson <chris@chris-wilson.co.uk> 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@intel.com> Link: http://patchwork.freedesktop.org/patch/msgid/1466148814-8194-2-git-send-email-daniel.vetter@ffwll.ch
This commit is contained in:
parent
e4245ea898
commit
0de4cc99c6
1 changed files with 11 additions and 9 deletions
|
@ -246,11 +246,13 @@ int drm_master_open(struct drm_file *file_priv)
|
||||||
void drm_master_release(struct drm_file *file_priv)
|
void drm_master_release(struct drm_file *file_priv)
|
||||||
{
|
{
|
||||||
struct drm_device *dev = file_priv->minor->dev;
|
struct drm_device *dev = file_priv->minor->dev;
|
||||||
|
|
||||||
mutex_lock(&dev->master_mutex);
|
|
||||||
if (file_priv->is_master) {
|
|
||||||
struct drm_master *master = file_priv->master;
|
struct drm_master *master = file_priv->master;
|
||||||
|
|
||||||
|
mutex_lock(&dev->master_mutex);
|
||||||
|
if (!file_priv->is_master)
|
||||||
|
goto out;
|
||||||
|
|
||||||
|
if (!drm_core_check_feature(dev, DRIVER_MODESET)) {
|
||||||
/*
|
/*
|
||||||
* Since the master is disappearing, so is the
|
* Since the master is disappearing, so is the
|
||||||
* possibility to lock.
|
* possibility to lock.
|
||||||
|
@ -264,6 +266,7 @@ void drm_master_release(struct drm_file *file_priv)
|
||||||
wake_up_interruptible_all(&master->lock.lock_queue);
|
wake_up_interruptible_all(&master->lock.lock_queue);
|
||||||
}
|
}
|
||||||
mutex_unlock(&dev->struct_mutex);
|
mutex_unlock(&dev->struct_mutex);
|
||||||
|
}
|
||||||
|
|
||||||
if (file_priv->minor->master == file_priv->master) {
|
if (file_priv->minor->master == file_priv->master) {
|
||||||
/* drop the reference held my the minor */
|
/* drop the reference held my the minor */
|
||||||
|
@ -271,8 +274,7 @@ void drm_master_release(struct drm_file *file_priv)
|
||||||
dev->driver->master_drop(dev, file_priv, true);
|
dev->driver->master_drop(dev, file_priv, true);
|
||||||
drm_master_put(&file_priv->minor->master);
|
drm_master_put(&file_priv->minor->master);
|
||||||
}
|
}
|
||||||
}
|
out:
|
||||||
|
|
||||||
/* drop the master reference held by the file priv */
|
/* drop the master reference held by the file priv */
|
||||||
if (file_priv->master)
|
if (file_priv->master)
|
||||||
drm_master_put(&file_priv->master);
|
drm_master_put(&file_priv->master);
|
||||||
|
|
Loading…
Reference in a new issue