All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Zimmermann <tzimmermann@suse.de>
To: maarten.lankhorst@linux.intel.com, mripard@kernel.org,
	airlied@gmail.com, simona@ffwll.ch, jani.nikula@linux.intel.com,
	airlied@redhat.com, jfalempe@redhat.com
Cc: dri-devel@lists.freedesktop.org, Thomas Zimmermann <tzimmermann@suse.de>
Subject: [PATCH 1/7] drm/probe-helper: Call connector detect functions in single helper
Date: Fri, 11 Oct 2024 08:43:06 +0200	[thread overview]
Message-ID: <20241011065705.6728-2-tzimmermann@suse.de> (raw)
In-Reply-To: <20241011065705.6728-1-tzimmermann@suse.de>

Move the logic to call the connector's detect helper into a single
internal function. Reduces code duplication.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Acked-by: Maxime Ripard <mripard@kernel.org>
---
 drivers/gpu/drm/drm_probe_helper.c | 33 +++++++++++++++---------------
 1 file changed, 17 insertions(+), 16 deletions(-)

diff --git a/drivers/gpu/drm/drm_probe_helper.c b/drivers/gpu/drm/drm_probe_helper.c
index 92f21764246f..62a2e5bcb315 100644
--- a/drivers/gpu/drm/drm_probe_helper.c
+++ b/drivers/gpu/drm/drm_probe_helper.c
@@ -338,10 +338,23 @@ void drm_kms_helper_poll_reschedule(struct drm_device *dev)
 }
 EXPORT_SYMBOL(drm_kms_helper_poll_reschedule);
 
+static int detect_connector_status(struct drm_connector *connector,
+				   struct drm_modeset_acquire_ctx *ctx,
+				   bool force)
+{
+	const struct drm_connector_helper_funcs *funcs = connector->helper_private;
+
+	if (funcs->detect_ctx)
+		return funcs->detect_ctx(connector, ctx, force);
+	else if (connector->funcs->detect)
+		return connector->funcs->detect(connector, force);
+
+	return connector_status_connected;
+}
+
 static enum drm_connector_status
 drm_helper_probe_detect_ctx(struct drm_connector *connector, bool force)
 {
-	const struct drm_connector_helper_funcs *funcs = connector->helper_private;
 	struct drm_modeset_acquire_ctx ctx;
 	int ret;
 
@@ -349,14 +362,8 @@ drm_helper_probe_detect_ctx(struct drm_connector *connector, bool force)
 
 retry:
 	ret = drm_modeset_lock(&connector->dev->mode_config.connection_mutex, &ctx);
-	if (!ret) {
-		if (funcs->detect_ctx)
-			ret = funcs->detect_ctx(connector, &ctx, force);
-		else if (connector->funcs->detect)
-			ret = connector->funcs->detect(connector, force);
-		else
-			ret = connector_status_connected;
-	}
+	if (!ret)
+		ret = detect_connector_status(connector, &ctx, force);
 
 	if (ret == -EDEADLK) {
 		drm_modeset_backoff(&ctx);
@@ -390,7 +397,6 @@ drm_helper_probe_detect(struct drm_connector *connector,
 			struct drm_modeset_acquire_ctx *ctx,
 			bool force)
 {
-	const struct drm_connector_helper_funcs *funcs = connector->helper_private;
 	struct drm_device *dev = connector->dev;
 	int ret;
 
@@ -401,12 +407,7 @@ drm_helper_probe_detect(struct drm_connector *connector,
 	if (ret)
 		return ret;
 
-	if (funcs->detect_ctx)
-		ret = funcs->detect_ctx(connector, ctx, force);
-	else if (connector->funcs->detect)
-		ret = connector->funcs->detect(connector, force);
-	else
-		ret = connector_status_connected;
+	ret = detect_connector_status(connector, ctx, force);
 
 	if (ret != connector->status)
 		connector->epoch_counter += 1;
-- 
2.46.0


  reply	other threads:[~2024-10-11  6:57 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-11  6:43 [PATCH 0/7] drm: Add physical status and BMC support to conenctor Thomas Zimmermann
2024-10-11  6:43 ` Thomas Zimmermann [this message]
2024-10-11  6:43 ` [PATCH 2/7] drm: Add physical status to connector Thomas Zimmermann
2024-10-11  8:51   ` Jani Nikula
2024-10-11  9:01     ` Thomas Zimmermann
2024-10-11  6:43 ` [PATCH 3/7] drm: Add bmc_attached flag " Thomas Zimmermann
2024-10-11  9:01   ` Jani Nikula
2024-10-11  6:43 ` [PATCH 4/7] drm/ast: sil164: Clear EDID if no display is connected Thomas Zimmermann
2024-10-11  6:43 ` [PATCH 5/7] drm/ast: vga: " Thomas Zimmermann
2024-10-11  6:43 ` [PATCH 6/7] drm/ast: Track physical connector status in struct drm_connector Thomas Zimmermann
2024-10-11  9:05   ` Jani Nikula
2024-10-11  6:43 ` [PATCH 7/7] drm/mgag200: " Thomas Zimmermann
2024-10-11  9:08 ` [PATCH 0/7] drm: Add physical status and BMC support to conenctor Jani Nikula
2024-10-11 10:52 ` Maxime Ripard
  -- strict thread matches above, loose matches on Subject: below --
2024-07-15  9:38 [PATCH 0/7] drm/probe-helpers: Work around multi-outputs-per-CRTC problem Thomas Zimmermann
2024-07-15  9:38 ` [PATCH 1/7] drm/probe-helper: Call connector detect functions in single helper Thomas Zimmermann
2024-07-16  8:21   ` Maxime Ripard

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=20241011065705.6728-2-tzimmermann@suse.de \
    --to=tzimmermann@suse.de \
    --cc=airlied@gmail.com \
    --cc=airlied@redhat.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jani.nikula@linux.intel.com \
    --cc=jfalempe@redhat.com \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mripard@kernel.org \
    --cc=simona@ffwll.ch \
    /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.