]> git.baikalelectronics.ru Git - kernel.git/commitdiff
drm/edid: use the new displayid iterator for detailed modes
authorJani Nikula <jani.nikula@intel.com>
Mon, 29 Mar 2021 13:37:18 +0000 (16:37 +0300)
committerJani Nikula <jani.nikula@intel.com>
Wed, 31 Mar 2021 12:41:49 +0000 (15:41 +0300)
Neatly reduce displayid boilerplate in code. No functional changes.

Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/f6c69c545c553c4a616887540660a4b8aecf0f7f.1617024940.git.jani.nikula@intel.com
drivers/gpu/drm/drm_edid.c

index 58e61f792bc7dcd6d5eb946e206f9428909c802b..fbaa7d679cb20e6eca438d56f7e62120ad6c5fd2 100644 (file)
@@ -5333,27 +5333,16 @@ static int add_displayid_detailed_1_modes(struct drm_connector *connector,
 static int add_displayid_detailed_modes(struct drm_connector *connector,
                                        struct edid *edid)
 {
-       const u8 *displayid;
-       int length, idx;
        const struct displayid_block *block;
+       struct displayid_iter iter;
        int num_modes = 0;
-       int ext_index = 0;
-
-       for (;;) {
-               displayid = drm_find_displayid_extension(edid, &length, &idx,
-                                                        &ext_index);
-               if (!displayid)
-                       break;
 
-               idx += sizeof(struct displayid_hdr);
-               for_each_displayid_db(displayid, block, idx, length) {
-                       switch (block->tag) {
-                       case DATA_BLOCK_TYPE_1_DETAILED_TIMING:
-                               num_modes += add_displayid_detailed_1_modes(connector, block);
-                               break;
-                       }
-               }
+       displayid_iter_edid_begin(edid, &iter);
+       displayid_iter_for_each(block, &iter) {
+               if (block->tag == DATA_BLOCK_TYPE_1_DETAILED_TIMING)
+                       num_modes += add_displayid_detailed_1_modes(connector, block);
        }
+       displayid_iter_end(&iter);
 
        return num_modes;
 }