Skip to content

Commit 5ef88dc

Browse files
committed
drm/edid: use the new displayid iterator for detailed modes
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/f6c69c545c553c4a616887540660a4b8aecf0f7f.1617024940.git.jani.nikula@intel.com
1 parent 1a24c36 commit 5ef88dc

File tree

1 file changed

+6
-17
lines changed

1 file changed

+6
-17
lines changed

drivers/gpu/drm/drm_edid.c

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5333,27 +5333,16 @@ static int add_displayid_detailed_1_modes(struct drm_connector *connector,
53335333
static int add_displayid_detailed_modes(struct drm_connector *connector,
53345334
struct edid *edid)
53355335
{
5336-
const u8 *displayid;
5337-
int length, idx;
53385336
const struct displayid_block *block;
5337+
struct displayid_iter iter;
53395338
int num_modes = 0;
5340-
int ext_index = 0;
5341-
5342-
for (;;) {
5343-
displayid = drm_find_displayid_extension(edid, &length, &idx,
5344-
&ext_index);
5345-
if (!displayid)
5346-
break;
53475339

5348-
idx += sizeof(struct displayid_hdr);
5349-
for_each_displayid_db(displayid, block, idx, length) {
5350-
switch (block->tag) {
5351-
case DATA_BLOCK_TYPE_1_DETAILED_TIMING:
5352-
num_modes += add_displayid_detailed_1_modes(connector, block);
5353-
break;
5354-
}
5355-
}
5340+
displayid_iter_edid_begin(edid, &iter);
5341+
displayid_iter_for_each(block, &iter) {
5342+
if (block->tag == DATA_BLOCK_TYPE_1_DETAILED_TIMING)
5343+
num_modes += add_displayid_detailed_1_modes(connector, block);
53565344
}
5345+
displayid_iter_end(&iter);
53575346

53585347
return num_modes;
53595348
}

0 commit comments

Comments
 (0)