Skip to content

Commit dfe96dd

Browse files
danvetrobclark
authored andcommitted
omapdrm: simplify locking in the fb debugfs file
We don't need to hold onto mode_config.mutex any more to keep the fb objects around. And locking dev->struct_mutex is also not required, since omap_gem_describe only reads data anyway. And for a debug interface it's better to grab fewer locks in case the driver is deadlocked already ... The only thing we need is to hold onto mode_config.fb_lock to ensure the user-created fbs don't disappear. The fbcon fb doesn't need any protection, since it lives as long as the driver (and so the debugfs files) itself. And if the teardown/setup isn't following the right sequence grabbing locks won't prevent a NULL deref on priv->fbdev if the fb is not yet (or no longer) there. Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> Signed-off-by: Rob Clark <robdclark@gmail.com>
1 parent 16ef3df commit dfe96dd

1 file changed

Lines changed: 0 additions & 14 deletions

File tree

‎drivers/gpu/drm/omapdrm/omap_debugfs.c‎

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -57,17 +57,6 @@ static int fb_show(struct seq_file *m, void *arg)
5757
struct drm_device *dev = node->minor->dev;
5858
struct omap_drm_private *priv = dev->dev_private;
5959
struct drm_framebuffer *fb;
60-
int ret;
61-
62-
ret = mutex_lock_interruptible(&dev->mode_config.mutex);
63-
if (ret)
64-
return ret;
65-
66-
ret = mutex_lock_interruptible(&dev->struct_mutex);
67-
if (ret) {
68-
mutex_unlock(&dev->mode_config.mutex);
69-
return ret;
70-
}
7160

7261
seq_printf(m, "fbcon ");
7362
omap_framebuffer_describe(priv->fbdev->fb, m);
@@ -82,9 +71,6 @@ static int fb_show(struct seq_file *m, void *arg)
8271
}
8372
mutex_unlock(&dev->mode_config.fb_lock);
8473

85-
mutex_unlock(&dev->struct_mutex);
86-
mutex_unlock(&dev->mode_config.mutex);
87-
8874
return 0;
8975
}
9076

0 commit comments

Comments
 (0)