[PATCH 09/12] drm/edid: simplify block check when filtering invalid blocks
Jani Nikula
jani.nikula at intel.com
Tue Mar 29 18:42:16 UTC 2022
There's no need to handle complicated scenarios or debug log when
filtering blocks that have already been identified as invalid. Simplify
by adding an edid_block_valid() helper that operates on const data and
prints nothing.
(Finally, here's the justification for the previously added separate
edid_block_status_valid() function!)
Cc: Ville Syrjälä <ville.syrjala at linux.intel.com>
Signed-off-by: Jani Nikula <jani.nikula at intel.com>
---
drivers/gpu/drm/drm_edid.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
index 235d3cde2e97..a1be5c3a80e5 100644
--- a/drivers/gpu/drm/drm_edid.c
+++ b/drivers/gpu/drm/drm_edid.c
@@ -1713,6 +1713,12 @@ static bool edid_block_status_valid(enum edid_block_status status, int tag)
(status == EDID_BLOCK_CHECKSUM && tag == CEA_EXT);
}
+static bool edid_block_valid(const void *block, bool base)
+{
+ return edid_block_status_valid(edid_block_check(block, base),
+ edid_block_tag(block));
+}
+
/**
* drm_edid_block_valid - Sanity check the EDID block (base or extension)
* @raw_edid: pointer to raw EDID block
@@ -2081,7 +2087,7 @@ struct edid *drm_do_get_edid(struct drm_connector *connector,
for (i = 0; i <= edid->extensions; i++) {
void *block = edid + i;
- if (!drm_edid_block_valid(block, i, false, NULL))
+ if (!edid_block_valid(block, i == 0))
continue;
memcpy(base, block, EDID_LENGTH);
--
2.30.2
More information about the dri-devel
mailing list