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 30/34] drm/crtc-helper: remove LOCKING from kerneldoc
Date: Tue, 11 Mar 2014 11:30:26 +0100	[thread overview]
Message-ID: <1394533830-30150-31-git-send-email-daniel.vetter@ffwll.ch> (raw)
In-Reply-To: <1394533830-30150-1-git-send-email-daniel.vetter@ffwll.ch>

- It yells.
- WARNing about incorrect locking is harder to ignore, so better
  than kerneldoc.
- Since those have been written per-crtc locks were added ...

So remove them and replace them by appropriate WARNs.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
---
 drivers/gpu/drm/drm_crtc_helper.c | 31 ++++++++++++-------------------
 1 file changed, 12 insertions(+), 19 deletions(-)

diff --git a/drivers/gpu/drm/drm_crtc_helper.c b/drivers/gpu/drm/drm_crtc_helper.c
index ae2fd5cd8dfa..44d50f56afa3 100644
--- a/drivers/gpu/drm/drm_crtc_helper.c
+++ b/drivers/gpu/drm/drm_crtc_helper.c
@@ -105,9 +105,6 @@ static void drm_mode_validate_flag(struct drm_connector *connector,
  * @maxX: max width for modes
  * @maxY: max height for modes
  *
- * LOCKING:
- * Caller must hold mode config lock.
- *
  * Based on the helper callbacks implemented by @connector try to detect all
  * valid modes.  Modes will first be added to the connector's probed_modes list,
  * then culled (based on validity and the @maxX, @maxY parameters) and put into
@@ -131,6 +128,8 @@ int drm_helper_probe_single_connector_modes(struct drm_connector *connector,
 	int mode_flags = 0;
 	bool verbose_prune = true;
 
+	WARN_ON(!mutex_is_locked(&dev->mode_config.mutex));
+
 	DRM_DEBUG_KMS("[CONNECTOR:%d:%s]\n", connector->base.id,
 			drm_get_connector_name(connector));
 	/* set all modes to the unverified state */
@@ -218,9 +217,6 @@ EXPORT_SYMBOL(drm_helper_probe_single_connector_modes);
  * drm_helper_encoder_in_use - check if a given encoder is in use
  * @encoder: encoder to check
  *
- * LOCKING:
- * Caller must hold mode config lock.
- *
  * Walk @encoders's DRM device's mode_config and see if it's in use.
  *
  * RETURNS:
@@ -230,6 +226,8 @@ bool drm_helper_encoder_in_use(struct drm_encoder *encoder)
 {
 	struct drm_connector *connector;
 	struct drm_device *dev = encoder->dev;
+
+	WARN_ON(!mutex_is_locked(&dev->mode_config.mutex));
 	list_for_each_entry(connector, &dev->mode_config.connector_list, head)
 		if (connector->encoder == encoder)
 			return true;
@@ -241,9 +239,6 @@ EXPORT_SYMBOL(drm_helper_encoder_in_use);
  * drm_helper_crtc_in_use - check if a given CRTC is in a mode_config
  * @crtc: CRTC to check
  *
- * LOCKING:
- * Caller must hold mode config lock.
- *
  * Walk @crtc's DRM device's mode_config and see if it's in use.
  *
  * RETURNS:
@@ -253,7 +248,8 @@ bool drm_helper_crtc_in_use(struct drm_crtc *crtc)
 {
 	struct drm_encoder *encoder;
 	struct drm_device *dev = crtc->dev;
-	/* FIXME: Locking around list access? */
+
+	WARN_ON(!mutex_is_locked(&dev->mode_config.mutex));
 	list_for_each_entry(encoder, &dev->mode_config.encoder_list, head)
 		if (encoder->crtc == crtc && drm_helper_encoder_in_use(encoder))
 			return true;
@@ -282,9 +278,6 @@ drm_encoder_disable(struct drm_encoder *encoder)
  * drm_helper_disable_unused_functions - disable unused objects
  * @dev: DRM device
  *
- * LOCKING:
- * Caller must hold mode config lock.
- *
  * If an connector or CRTC isn't part of @dev's mode_config, it can be disabled
  * by calling its dpms function, which should power it off.
  */
@@ -294,6 +287,8 @@ void drm_helper_disable_unused_functions(struct drm_device *dev)
 	struct drm_connector *connector;
 	struct drm_crtc *crtc;
 
+	drm_warn_on_modeset_not_all_locked(dev);
+
 	list_for_each_entry(connector, &dev->mode_config.connector_list, head) {
 		if (!connector->encoder)
 			continue;
@@ -354,9 +349,6 @@ drm_crtc_prepare_encoders(struct drm_device *dev)
  * @y: vertical offset into the surface
  * @old_fb: old framebuffer, for cleanup
  *
- * LOCKING:
- * Caller must hold mode config lock.
- *
  * Try to set @mode on @crtc.  Give @crtc and its associated connectors a chance
  * to fixup or reject the mode prior to trying to set it. This is an internal
  * helper that drivers could e.g. use to update properties that require the
@@ -383,6 +375,8 @@ bool drm_crtc_helper_set_mode(struct drm_crtc *crtc,
 	struct drm_encoder *encoder;
 	bool ret = true;
 
+	drm_warn_on_modeset_not_all_locked(dev);
+
 	saved_enabled = crtc->enabled;
 	crtc->enabled = drm_helper_crtc_in_use(crtc);
 	if (!crtc->enabled)
@@ -559,9 +553,6 @@ drm_crtc_helper_disable(struct drm_crtc *crtc)
  * drm_crtc_helper_set_config - set a new config from userspace
  * @set: mode set configuration
  *
- * LOCKING:
- * Caller must hold mode config lock.
- *
  * Setup a new configuration, provided by the upper layers (either an ioctl call
  * from userspace or internally e.g. from the fbdev suppport code) in @set, and
  * enable it. This is the main helper functions for drivers that implement
@@ -611,6 +602,8 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set)
 
 	dev = set->crtc->dev;
 
+	drm_warn_on_modeset_not_all_locked(dev);
+
 	/*
 	 * Allocate space for the backup of all (non-pointer) encoder and
 	 * connector data.
-- 
1.8.5.2

  parent reply	other threads:[~2014-03-11 10:31 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-11 10:29 [PATCH 00/34] drm: moar kerneldoc and cleanups Daniel Vetter
2014-03-11 10:29 ` [PATCH 01/34] drm/doc: Clarify the dumb object interfaces Daniel Vetter
2014-03-11 10:29 ` [PATCH 02/34] drm/doc: Fix up kerneldoc in drm_edid.c Daniel Vetter
2014-03-11 10:29 ` [PATCH 03/34] drm/doc: Clean up and integrate kerneldoc for drm_gem.c Daniel Vetter
2014-03-11 10:30 ` [PATCH 04/34] drm/doc: Remove <term> from rendernode docs Daniel Vetter
2014-03-11 10:30 ` [PATCH 05/34] drm/doc: Reorganize driver documentation Daniel Vetter
2014-03-11 10:30 ` [PATCH 06/34] drm/doc: Move the vma offset manager to the right spot Daniel Vetter
2014-03-11 10:30 ` [PATCH 07/34] drm/doc: Remove the "command submissin and fencing" section Daniel Vetter
2014-03-11 10:30 ` [PATCH 08/34] drm/doc: No more drm perf counters Daniel Vetter
2014-03-11 10:30 ` [PATCH 09/34] drm/doc: Document drm_helper_resume_force_mode Daniel Vetter
2014-03-11 10:30 ` [PATCH 10/34] drm/doc: Hide legacy horrors better Daniel Vetter
2014-03-11 10:30 ` [PATCH 11/34] drm/docs: Include hdmi infoframe helper reference Daniel Vetter
2014-03-11 10:30 ` [PATCH 12/34] drm/doc: Clarify PRIME documentation Daniel Vetter
2014-03-11 10:30 ` [PATCH 13/34] drm/doc: Add PRIME function references Daniel Vetter
2014-03-11 10:30 ` [PATCH 14/34] drm/doc: Update copyright Daniel Vetter
2014-03-11 10:30 ` [PATCH 15/34] drm/mm: Remove MM_UNUSED_TARGET Daniel Vetter
2014-03-11 10:30 ` [PATCH 16/34] drm/doc: Overview documentation for drm_mm.c Daniel Vetter
2014-03-11 10:30 ` [PATCH 17/34] drm/doc: Add fucntion reference " Daniel Vetter
2014-03-11 10:30 ` [PATCH 18/34] drm/kms: rip out drm_mode_connector_detach_encoder Daniel Vetter
2014-03-11 10:30 ` [PATCH 19/34] drm/doc: Integrate drm_modes.c kerneldoc Daniel Vetter
2014-03-11 10:30 ` [PATCH 20/34] drm/doc: Repleace LOCKING kerneldoc sections in drm_modes.c Daniel Vetter
2014-03-20  1:31   ` Dave Airlie
2014-03-22  6:45     ` Ben Widawsky
2014-03-23  8:19       ` Daniel Vetter
2014-03-11 10:30 ` [PATCH 21/34] drm: move drm_mode related functions into drm_modes.c Daniel Vetter
2014-03-11 10:30 ` [PATCH 22/34] drm: extract drm_modes.h for drm_modes.c functions Daniel Vetter
2014-03-11 10:30 ` [PATCH 23/34] drm/modes: remove drm_mode_height/width Daniel Vetter
2014-03-11 10:30 ` [PATCH 24/34] drm/modes: drop return value from drm_display_mode_from_videomode Daniel Vetter
2014-03-11 10:30 ` [PATCH 25/34] drm/modes: drop maxPitch from drm_mode_validate_size Daniel Vetter
2014-03-11 10:30 ` [PATCH 26/34] drm: polish function kerneldoc for drm_modes.[hc] Daniel Vetter
2014-03-11 10:30 ` [PATCH 27/34] drm: remove drm_display_mode->private_size Daniel Vetter
2014-03-11 10:30 ` [PATCH 28/34] drm/doc: Fix misplaced </para> Daniel Vetter
2014-03-11 10:30 ` [PATCH 29/34] drm: remove return value from drm_helper_mode_fill_fb_struct Daniel Vetter
2014-03-11 10:30 ` Daniel Vetter [this message]
2014-03-11 10:30 ` [PATCH 31/34] drm: drop error code for drm_helper_resume_force_mode Daniel Vetter
2014-03-11 10:30 ` [PATCH 32/34] drm: kerneldoc polish for drm_crtc_helper.c Daniel Vetter
2014-03-11 10:30 ` [PATCH 33/34] drm: kerneldoc polish for drm_crtc.c Daniel Vetter
2014-03-11 10:30 ` [PATCH 34/34] drm/kms: don't export drm_mode_group_init_legacy_group Daniel Vetter
2014-03-11 14:16 ` [PATCH 00/34] drm: moar kerneldoc and cleanups Alex Deucher
2014-03-15 11:15 ` [PATCH] drm/imx: remove drm_mode_connector_detach_encoder harder Daniel Vetter
2014-03-15 11:23   ` Russell King - ARM Linux
2014-03-15 11:35     ` Daniel Vetter
2014-03-17 21:48   ` Greg Kroah-Hartman

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=1394533830-30150-31-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.