mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Iker Pedrosa <ikerpedrosam@gmail.com>
To: Javier Martinez Canillas <javierm@redhat.com>,
	 Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
	 Maxime Ripard <mripard@kernel.org>,
	Thomas Zimmermann <tzimmermann@suse.de>,
	 David Airlie <airlied@gmail.com>,
	Simona Vetter <simona@ffwll.ch>
Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
	 Iker Pedrosa <ikerpedrosam@gmail.com>
Subject: [PATCH 4/5] drm/solomon: Simplify get_modes() using DRM helper
Date: Fri, 12 Sep 2025 18:42:12 +0200	[thread overview]
Message-ID: <20250912-improve-ssd130x-v1-4-bc9389ed299e@gmail.com> (raw)
In-Reply-To: <20250912-improve-ssd130x-v1-0-bc9389ed299e@gmail.com>

The ssd130x_connector_get_modes function contains a manual implementation
to manage modes.

This pattern is common for simple displays, and the DRM core already
provides the drm_connector_helper_get_modes_fixed() helper for this exact
use case.

Signed-off-by: Iker Pedrosa <ikerpedrosam@gmail.com>
---
 drivers/gpu/drm/solomon/ssd130x.c | 14 +-------------
 1 file changed, 1 insertion(+), 13 deletions(-)

diff --git a/drivers/gpu/drm/solomon/ssd130x.c b/drivers/gpu/drm/solomon/ssd130x.c
index 2058d188159c3eae28de1614b9fffb06ac5551be..7bdccb5140195a45d8ffd01e139dd4eb2e3cc327 100644
--- a/drivers/gpu/drm/solomon/ssd130x.c
+++ b/drivers/gpu/drm/solomon/ssd130x.c
@@ -1729,20 +1729,8 @@ static const struct drm_encoder_funcs ssd130x_encoder_funcs = {
 static int ssd130x_connector_get_modes(struct drm_connector *connector)
 {
 	struct ssd130x_device *ssd130x = drm_to_ssd130x(connector->dev);
-	struct drm_display_mode *mode;
-	struct device *dev = ssd130x->dev;
-
-	mode = drm_mode_duplicate(connector->dev, &ssd130x->mode);
-	if (!mode) {
-		dev_err(dev, "Failed to duplicated mode\n");
-		return 0;
-	}
-
-	drm_mode_probed_add(connector, mode);
-	drm_set_preferred_mode(connector, mode->hdisplay, mode->vdisplay);
 
-	/* There is only a single mode */
-	return 1;
+	return drm_connector_helper_get_modes_fixed(connector, &ssd130x->mode);
 }
 
 static const struct drm_connector_helper_funcs ssd130x_connector_helper_funcs = {

-- 
2.51.0


  parent reply	other threads:[~2025-09-12 16:42 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-12 16:42 [PATCH 0/5] drm/solomon: Code improvements and DRM helper adoption Iker Pedrosa
2025-09-12 16:42 ` [PATCH 1/5] drm/solomon: Move calls to drm_gem_fb_end_cpu*() Iker Pedrosa
2025-09-17  9:06   ` Javier Martinez Canillas
2025-09-17  9:20     ` Thomas Zimmermann
2025-09-12 16:42 ` [PATCH 2/5] drm/solomon: Use drm_WARN_ON_ONCE instead of WARN_ON Iker Pedrosa
2025-09-17  9:23   ` Javier Martinez Canillas
2025-09-12 16:42 ` [PATCH 3/5] drm/solomon: Simplify mode_valid() using DRM helper Iker Pedrosa
2025-09-17  9:27   ` Javier Martinez Canillas
2025-09-12 16:42 ` Iker Pedrosa [this message]
2025-09-17  9:28   ` [PATCH 4/5] drm/solomon: Simplify get_modes() " Javier Martinez Canillas
2025-09-12 16:42 ` [PATCH 5/5] drm/solomon: Enforce one assignment per line Iker Pedrosa
2025-09-17  9:29   ` Javier Martinez Canillas
2025-09-15 11:24 ` [PATCH 0/5] drm/solomon: Code improvements and DRM helper adoption Thomas Zimmermann

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=20250912-improve-ssd130x-v1-4-bc9389ed299e@gmail.com \
    --to=ikerpedrosam@gmail.com \
    --cc=airlied@gmail.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=javierm@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mripard@kernel.org \
    --cc=simona@ffwll.ch \
    --cc=tzimmermann@suse.de \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®