summaryrefslogtreecommitdiffstats
path: root/include/drm
diff options
context:
space:
mode:
authorDavid Herrmann <dh.herrmann@gmail.com>2014-07-22 18:46:09 +0200
committerDavid Herrmann <dh.herrmann@gmail.com>2014-08-05 16:07:50 +0200
commit48ba813701eb14b3008edefef4a0789b328e278c (patch)
treecab45fc97db3eb800338196add945c6f47643cee /include/drm
parent9f8d21ea276177547725a60cefc1b6da742f14d3 (diff)
downloadlinux-48ba813701eb14b3008edefef4a0789b328e278c.tar.bz2
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 'include/drm')
-rw-r--r--include/drm/drmP.h19
1 files changed, 16 insertions, 3 deletions
diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index 80889982d196..6ede53712d7b 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -387,8 +387,6 @@ struct drm_prime_file_private {
struct drm_file {
unsigned always_authenticated :1;
unsigned authenticated :1;
- /* Whether we're master for a minor. Protected by master_mutex */
- unsigned is_master :1;
/* true when the client has asked us to expose stereo 3D mode flags */
unsigned stereo_allowed :1;
/*
@@ -1034,7 +1032,7 @@ struct drm_device {
/** \name Locks */
/*@{ */
struct mutex struct_mutex; /**< For others */
- struct mutex master_mutex; /**< For drm_minor::master and drm_file::is_master */
+ struct mutex master_mutex; /**< For drm_minor::master */
/*@} */
/** \name Usage Counters */
@@ -1172,6 +1170,21 @@ static inline bool drm_is_primary_client(const struct drm_file *file_priv)
return file_priv->minor->type == DRM_MINOR_LEGACY;
}
+/**
+ * drm_is_master() - Check whether a DRM open-file is DRM-Master
+ * @file: DRM open-file context
+ *
+ * This checks whether a DRM open-file context is owner of the master context
+ * attached to it. If a file owns a master context, it's called DRM-Master.
+ * Per DRM device, only one such file can be DRM-Master at a time.
+ *
+ * Returns: True if the file is DRM-Master, otherwise false.
+ */
+static inline bool drm_is_master(const struct drm_file *file)
+{
+ return file->master && file->master == file->minor->master;
+}
+
/******************************************************************/
/** \name Internal function definitions */
/*@{*/