All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@intel.com>
To: dri-devel@lists.freedesktop.org
Cc: intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org,
	jani.nikula@intel.com
Subject: [PATCH 5/7] drm/edid: avoid drm_edid_find_extension() internally
Date: Mon,  8 Apr 2024 11:56:06 +0300	[thread overview]
Message-ID: <1d5009116442d72b710897c2c389afb24e01a02f.1712565984.git.jani.nikula@intel.com> (raw)
In-Reply-To: <cover.1712565984.git.jani.nikula@intel.com>

Prefer the EDID iterators over drm_edid_find_extension() in
drm_edid_has_cta_extension(), even if this leads to more code. The key
is to use the same patterns as much as possible.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
 drivers/gpu/drm/drm_edid.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
index 6a31a3af20dd..02f0a5fd819a 100644
--- a/drivers/gpu/drm/drm_edid.c
+++ b/drivers/gpu/drm/drm_edid.c
@@ -4171,11 +4171,21 @@ static bool drm_edid_has_cta_extension(const struct drm_edid *drm_edid)
 {
 	const struct displayid_block *block;
 	struct displayid_iter iter;
-	int ext_index = 0;
+	struct drm_edid_iter edid_iter;
+	const u8 *ext;
 	bool found = false;
 
 	/* Look for a top level CEA extension block */
-	if (drm_edid_find_extension(drm_edid, CEA_EXT, &ext_index))
+	drm_edid_iter_begin(drm_edid, &edid_iter);
+	drm_edid_iter_for_each(ext, &edid_iter) {
+		if (ext[0] == CEA_EXT) {
+			found = true;
+			break;
+		}
+	}
+	drm_edid_iter_end(&edid_iter);
+
+	if (found)
 		return true;
 
 	/* CEA blocks can also be found embedded in a DisplayID block */
-- 
2.39.2


  parent reply	other threads:[~2024-04-08  8:56 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-08  8:56 [PATCH 0/7] drm/edid: cleanups, resend Jani Nikula
2024-04-08  8:56 ` [PATCH 1/7] drm/displayid: move drm_displayid.h to drm_displayd_internal.h Jani Nikula
2024-04-08  8:56 ` [PATCH 2/7] drm/edid: move all internal declarations to drm_crtc_internal.h Jani Nikula
2024-04-08  8:56 ` [PATCH 3/7] drm/edid: group struct drm_edid based declarations together Jani Nikula
2024-04-08  8:56 ` [PATCH 4/7] drm/edid: rename drm_find_edid_extension() to drm_edid_find_extension() Jani Nikula
2024-04-08  8:56 ` Jani Nikula [this message]
2024-04-08  8:56 ` [PATCH 6/7] drm/edid: make drm_edid_are_equal() static Jani Nikula
2024-04-08  8:56 ` [PATCH 7/7] drm/edid: make drm_edid_are_equal() more convenient for its single user Jani Nikula
2024-04-08 13:28 ` ✓ CI.Patch_applied: success for drm/edid: cleanups, resend Patchwork
2024-04-08 13:29 ` ✗ CI.checkpatch: warning " Patchwork
2024-04-08 13:30 ` ✓ CI.KUnit: success " Patchwork
2024-04-08 13:41 ` ✓ CI.Build: " Patchwork
2024-04-08 13:44 ` ✓ CI.Hooks: " Patchwork
2024-04-08 13:45 ` ✗ CI.checksparse: warning " Patchwork
2024-04-08 14:06 ` ✓ CI.BAT: success " Patchwork
2024-04-08 15:14 ` ✗ CI.FULL: failure " Patchwork
2024-04-08 18:12 ` ✗ Fi.CI.CHECKPATCH: warning " Patchwork
2024-04-08 18:12 ` ✗ Fi.CI.SPARSE: " Patchwork
2024-04-08 18:17 ` ✓ Fi.CI.BAT: success " Patchwork
2024-04-10  2:11 ` ✗ Fi.CI.IGT: failure " Patchwork

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=1d5009116442d72b710897c2c389afb24e01a02f.1712565984.git.jani.nikula@intel.com \
    --to=jani.nikula@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=intel-xe@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.