Commit 6b0084266c1d4917ad9259759a1e7bd623cb3888

Authored by Jonas Bonn
Committed by Dave Airlie
1 parent 77d26dc9b9

drm: set/clear is_master when master changed

The variable is_master is being used to track the drm_file that is currently
master, so its value needs to be updated accordingly when the master is
changed.

Signed-off-by: Jonas Bonn <jonas@southpole.se>
Signed-off-by: Dave Airlie <airlied@redhat.com>

Showing 1 changed file with 7 additions and 1 deletions Side-by-side Diff

drivers/gpu/drm/drm_stub.c
... ... @@ -159,6 +159,9 @@
159 159 int drm_setmaster_ioctl(struct drm_device *dev, void *data,
160 160 struct drm_file *file_priv)
161 161 {
  162 + if (file_priv->is_master)
  163 + return 0;
  164 +
162 165 if (file_priv->minor->master && file_priv->minor->master != file_priv->master)
163 166 return -EINVAL;
164 167  
... ... @@ -169,6 +172,7 @@
169 172 file_priv->minor->master != file_priv->master) {
170 173 mutex_lock(&dev->struct_mutex);
171 174 file_priv->minor->master = drm_master_get(file_priv->master);
  175 + file_priv->is_master = 1;
172 176 mutex_unlock(&dev->struct_mutex);
173 177 }
174 178  
175 179  
176 180  
... ... @@ -178,10 +182,12 @@
178 182 int drm_dropmaster_ioctl(struct drm_device *dev, void *data,
179 183 struct drm_file *file_priv)
180 184 {
181   - if (!file_priv->master)
  185 + if (!file_priv->is_master)
182 186 return -EINVAL;
  187 +
183 188 mutex_lock(&dev->struct_mutex);
184 189 drm_master_put(&file_priv->minor->master);
  190 + file_priv->is_master = 0;
185 191 mutex_unlock(&dev->struct_mutex);
186 192 return 0;
187 193 }