diff options
author | David Herrmann <dh.herrmann@gmail.com> | 2014-07-22 20:46:09 +0400 |
---|---|---|
committer | David Herrmann <dh.herrmann@gmail.com> | 2014-08-05 18:07:50 +0400 |
commit | 48ba813701eb14b3008edefef4a0789b328e278c (patch) | |
tree | cab45fc97db3eb800338196add945c6f47643cee /drivers/gpu/drm/drm_stub.c | |
parent | 9f8d21ea276177547725a60cefc1b6da742f14d3 (diff) | |
download | linux-48ba813701eb14b3008edefef4a0789b328e278c.tar.xz |
drm: drop redundant drm_file->is_master
The drm_file->is_master field is redundant as it's equivalent to:
drm_file->master && drm_file->master == drm_file->minor->master
1) "=>"
Whenever we set drm_file->is_master, we also set:
drm_file->minor->master = drm_file->master;
Whenever we clear drm_file->is_master, we also call:
drm_master_put(&drm_file->minor->master);
which implicitly clears it to NULL.
2) "<="
minor->master cannot be set if it is non-NULL. Therefore, it stays as
is unless a file drops it.
If minor->master is NULL, it is only set by places that also adjust
drm_file->is_master.
Therefore, we can safely drop is_master and replace it by an inline helper
that matches:
drm_file->master && drm_file->master == drm_file->minor->master
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
Diffstat (limited to 'drivers/gpu/drm/drm_stub.c')
-rw-r--r-- | drivers/gpu/drm/drm_stub.c | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/drivers/gpu/drm/drm_stub.c b/drivers/gpu/drm/drm_stub.c index 233ea208c9fe..18c9b3d8201e 100644 --- a/drivers/gpu/drm/drm_stub.c +++ b/drivers/gpu/drm/drm_stub.c @@ -177,7 +177,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_master(file_priv)) goto out_unlock; if (file_priv->minor->master) { @@ -191,13 +191,10 @@ int drm_setmaster_ioctl(struct drm_device *dev, void *data, } file_priv->minor->master = drm_master_get(file_priv->master); - file_priv->is_master = 1; if (dev->driver->master_set) { ret = dev->driver->master_set(dev, file_priv, false); - if (unlikely(ret != 0)) { - file_priv->is_master = 0; + if (unlikely(ret != 0)) drm_master_put(&file_priv->minor->master); - } } out_unlock: @@ -211,7 +208,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_master(file_priv)) goto out_unlock; if (!file_priv->minor->master) @@ -221,7 +218,6 @@ int drm_dropmaster_ioctl(struct drm_device *dev, void *data, if (dev->driver->master_drop) dev->driver->master_drop(dev, file_priv, false); drm_master_put(&file_priv->minor->master); - file_priv->is_master = 0; out_unlock: mutex_unlock(&dev->master_mutex); |