Skip to content

Commit 1ba63ca

Browse files
committed
drm/edid: use the new displayid iterator for finding CEA extension
Neatly reduce displayid boilerplate in code. No functional changes. Reviewed-by: Ville Syrjälä <[email protected]> Signed-off-by: Jani Nikula <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/e50f876cecbfee369da887ad19350eee0d89b87f.1617024940.git.jani.nikula@intel.com
1 parent 5ef88dc commit 1ba63ca

File tree

1 file changed

+9
-16
lines changed

1 file changed

+9
-16
lines changed

drivers/gpu/drm/drm_edid.c

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3266,35 +3266,28 @@ const u8 *drm_find_edid_extension(const struct edid *edid,
32663266

32673267
static const u8 *drm_find_cea_extension(const struct edid *edid)
32683268
{
3269-
int length, idx;
32703269
const struct displayid_block *block;
3270+
struct displayid_iter iter;
32713271
const u8 *cea;
3272-
const u8 *displayid;
3273-
int ext_index;
3272+
int ext_index = 0;
32743273

32753274
/* Look for a top level CEA extension block */
32763275
/* FIXME: make callers iterate through multiple CEA ext blocks? */
3277-
ext_index = 0;
32783276
cea = drm_find_edid_extension(edid, CEA_EXT, &ext_index);
32793277
if (cea)
32803278
return cea;
32813279

32823280
/* CEA blocks can also be found embedded in a DisplayID block */
3283-
ext_index = 0;
3284-
for (;;) {
3285-
displayid = drm_find_displayid_extension(edid, &length, &idx,
3286-
&ext_index);
3287-
if (!displayid)
3288-
return NULL;
3289-
3290-
idx += sizeof(struct displayid_hdr);
3291-
for_each_displayid_db(displayid, block, idx, length) {
3292-
if (block->tag == DATA_BLOCK_CTA)
3293-
return (const u8 *)block;
3281+
displayid_iter_edid_begin(edid, &iter);
3282+
displayid_iter_for_each(block, &iter) {
3283+
if (block->tag == DATA_BLOCK_CTA) {
3284+
cea = (const u8 *)block;
3285+
break;
32943286
}
32953287
}
3288+
displayid_iter_end(&iter);
32963289

3297-
return NULL;
3290+
return cea;
32983291
}
32993292

33003293
static __always_inline const struct drm_display_mode *cea_mode_for_vic(u8 vic)

0 commit comments

Comments
 (0)