]> git.baikalelectronics.ru Git - kernel.git/commitdiff
drm/edid: convert drm_for_each_detailed_block() to edid iter
authorJani Nikula <jani.nikula@intel.com>
Mon, 9 May 2022 12:03:01 +0000 (15:03 +0300)
committerJani Nikula <jani.nikula@intel.com>
Fri, 13 May 2022 15:12:55 +0000 (18:12 +0300)
We have an iterator for this, use it. It does include the base block,
but its tag is 0 and will be skipped.

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

index efc1999b95739fd417f93c772a237ebd58661350..dcef92c8887abe3270d41c09e89cd65aa79b0a3c 100644 (file)
@@ -2574,6 +2574,8 @@ vtb_for_each_detailed_block(const u8 *ext, detailed_cb *cb, void *closure)
 static void
 drm_for_each_detailed_block(const struct edid *edid, detailed_cb *cb, void *closure)
 {
+       struct drm_edid_iter edid_iter;
+       const u8 *ext;
        int i;
 
        if (edid == NULL)
@@ -2582,9 +2584,8 @@ drm_for_each_detailed_block(const struct edid *edid, detailed_cb *cb, void *clos
        for (i = 0; i < EDID_DETAILED_TIMINGS; i++)
                cb(&(edid->detailed_timings[i]), closure);
 
-       for (i = 0; i < edid_extension_block_count(edid); i++) {
-               const u8 *ext = edid_extension_block_data(edid, i);
-
+       drm_edid_iter_begin(edid, &edid_iter);
+       drm_edid_iter_for_each(ext, &edid_iter) {
                switch (*ext) {
                case CEA_EXT:
                        cea_for_each_detailed_block(ext, cb, closure);
@@ -2596,6 +2597,7 @@ drm_for_each_detailed_block(const struct edid *edid, detailed_cb *cb, void *clos
                        break;
                }
        }
+       drm_edid_iter_end(&edid_iter);
 }
 
 static void