On Fri, May 06, 2022 at 01:10:09PM +0300, Jani Nikula wrote: > 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@xxxxxxxxx> Reviewed-by: Ville Syrjälä <ville.syrjala@xxxxxxxxxxxxxxx> > --- > drivers/gpu/drm/drm_edid.c | 8 +++++--- > 1 file changed, 5 insertions(+), 3 deletions(-) > > diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c > index efc1999b9573..dcef92c8887a 100644 > --- a/drivers/gpu/drm/drm_edid.c > +++ b/drivers/gpu/drm/drm_edid.c > @@ -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 > -- > 2.30.2 -- Ville Syrjälä Intel