All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel.vetter@ffwll.ch>
To: DRI Development <dri-devel@lists.freedesktop.org>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Subject: [PATCH 02/16] omapdrm: simply locking in the fb debugfs file
Date: Thu, 24 Jan 2013 17:20:34 +0100	[thread overview]
Message-ID: <1359044448-3861-3-git-send-email-daniel.vetter@ffwll.ch> (raw)
In-Reply-To: <1359044448-3861-1-git-send-email-daniel.vetter@ffwll.ch>

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>
---
 drivers/staging/omapdrm/omap_debugfs.c |   14 --------------
 1 file changed, 14 deletions(-)

diff --git a/drivers/staging/omapdrm/omap_debugfs.c b/drivers/staging/omapdrm/omap_debugfs.c
index e95540b..2bf0664 100644
--- a/drivers/staging/omapdrm/omap_debugfs.c
+++ b/drivers/staging/omapdrm/omap_debugfs.c
@@ -57,17 +57,6 @@ static int fb_show(struct seq_file *m, void *arg)
 	struct drm_device *dev = node->minor->dev;
 	struct omap_drm_private *priv = dev->dev_private;
 	struct drm_framebuffer *fb;
-	int ret;
-
-	ret = mutex_lock_interruptible(&dev->mode_config.mutex);
-	if (ret)
-		return ret;
-
-	ret = mutex_lock_interruptible(&dev->struct_mutex);
-	if (ret) {
-		mutex_unlock(&dev->mode_config.mutex);
-		return ret;
-	}
 
 	seq_printf(m, "fbcon ");
 	omap_framebuffer_describe(priv->fbdev->fb, m);
@@ -82,9 +71,6 @@ static int fb_show(struct seq_file *m, void *arg)
 	}
 	mutex_unlock(&dev->mode_config.fb_lock);
 
-	mutex_unlock(&dev->struct_mutex);
-	mutex_unlock(&dev->mode_config.mutex);
-
 	return 0;
 }
 
-- 
1.7.10.4

  parent reply	other threads:[~2013-01-24 16:20 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-24 16:20 [PATCH 00/16] [RFC] drm fb helper cleanups Daniel Vetter
2013-01-24 16:20 ` [PATCH 01/16] omapdrm: only take crtc->mutex in crtc callbacks Daniel Vetter
2013-01-24 16:45   ` Rob Clark
2013-01-24 16:20 ` Daniel Vetter [this message]
2013-01-24 16:46   ` [PATCH 02/16] omapdrm: simply locking in the fb debugfs file Rob Clark
2013-01-24 16:20 ` [PATCH 03/16] drm: review locking for drm_fb_helper_restore_fbdev_mode Daniel Vetter
2013-02-11 22:10   ` Rob Clark
2013-01-24 16:20 ` [PATCH 04/16] drm/fb-helper: kill drm_fb_helper_restore Daniel Vetter
2013-02-11 22:08   ` Rob Clark
2013-01-24 16:20 ` [PATCH 05/16] drm/fb-helper: unexport drm_fb_helper_panic Daniel Vetter
2013-02-11 22:11   ` Rob Clark
2013-01-24 16:20 ` [PATCH 06/16] drm/fb-helper: inline drm_fb_helper_single_add_all_connectors Daniel Vetter
2013-01-24 21:27   ` Dave Airlie
2013-01-24 22:50     ` Daniel Vetter
2013-01-24 16:20 ` [PATCH 07/16] drm/fb-helper: unexport drm_fb_helper_single_fb_probe Daniel Vetter
2013-02-11 22:14   ` Rob Clark
2013-01-24 16:20 ` [PATCH 08/16] drm/tegra: don't set up initial fbcon config twice Daniel Vetter
2013-01-24 16:20 ` [PATCH 09/16] drm/fb-helper: don't disable everything in initial_config Daniel Vetter
2013-01-27 17:41   ` [PATCH] " Daniel Vetter
2013-02-12  0:49     ` Rob Clark
2013-01-24 16:20 ` [PATCH 10/16] drm/i915: rip out helper->disable noop functions Daniel Vetter
2013-01-24 16:20 ` [PATCH 11/16] drm/fb-helper: fixup up set_config semantics Daniel Vetter
2013-02-11 23:15   ` Rob Clark
2013-02-12  0:24     ` [PATCH] drm/fb-helper: fixup " Daniel Vetter
2013-02-12  0:24     ` [PATCH] drm/fb-helper: remove unused members of struct drm_fb_helper Daniel Vetter
2013-02-12  0:25     ` [PATCH] drm/fb-helper: fixup set_config semantics Daniel Vetter
2013-02-12  0:33       ` Rob Clark
2013-01-24 16:20 ` [PATCH 12/16] drm/fb-helper: directly call set_par from the hotplug handler Daniel Vetter
2013-02-12  0:16   ` Rob Clark
2013-01-24 16:20 ` [PATCH 13/16] drm/fb-helper: streamline drm_fb_helper_single_fb_probe Daniel Vetter
2013-02-12  0:24   ` Rob Clark
2013-02-12  0:33     ` Daniel Vetter
2013-02-12  0:35       ` Rob Clark
2013-01-24 16:20 ` [PATCH 14/16] drm/<drivers>: simplify ->fb_probe callback Daniel Vetter
2013-02-13 21:51   ` Rob Clark
2013-01-24 16:20 ` [PATCH 15/16] drm/fb-helper: improve kerneldoc Daniel Vetter
2013-01-27 17:42   ` [PATCH] " Daniel Vetter
2013-02-01 12:21     ` Laurent Pinchart
2013-02-05 21:43       ` Daniel Vetter
2013-01-24 16:20 ` [PATCH 16/16] drm/fb-helper: don't sleep for screen unblank when an oopps is in progress Daniel Vetter
2013-01-27 17:42   ` [PATCH] " Daniel Vetter
2013-02-13 21:59     ` Rob Clark
2013-01-24 16:53 ` [PATCH 00/16] [RFC] drm fb helper cleanups Rob Clark
2013-01-24 21:00   ` Greg KH

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1359044448-3861-3-git-send-email-daniel.vetter@ffwll.ch \
    --to=daniel.vetter@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.