As struct drm_edid is opaque, drivers can't directly memcmp() the contained data. Add a helper to provide this functionality. Signed-off-by: Thomas Weißschuh <linux@xxxxxxxxxxxxxx> --- drivers/gpu/drm/drm_edid.c | 18 ++++++++++++++++++ include/drm/drm_edid.h | 1 + 2 files changed, 19 insertions(+) diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c index 69fb11741abd..c2493c983a64 100644 --- a/drivers/gpu/drm/drm_edid.c +++ b/drivers/gpu/drm/drm_edid.c @@ -1840,6 +1840,24 @@ static bool drm_edid_eq(const struct drm_edid *drm_edid, return true; } +/** + * drm_edid_equal - compare two EDID + * @drm_edid_a: First EDID data + * @drm_edid_b: Second EDID data + * + * Compare two EDIDs for equality (including extensions) + * + * Return: True if the EDIDs are equal, false otherwise. + */ +bool drm_edid_equal(const struct drm_edid *drm_edid_a, const struct drm_edid *drm_edid_b) +{ + if (!drm_edid_b) + return !drm_edid_a; + + return drm_edid_eq(drm_edid_a, drm_edid_b->edid, drm_edid_b->size); +} +EXPORT_SYMBOL(drm_edid_equal); + enum edid_block_status { EDID_BLOCK_OK = 0, EDID_BLOCK_READ_FAIL, diff --git a/include/drm/drm_edid.h b/include/drm/drm_edid.h index a5b377c4a342..35b40a9d3350 100644 --- a/include/drm/drm_edid.h +++ b/include/drm/drm_edid.h @@ -456,6 +456,7 @@ drm_display_mode_from_cea_vic(struct drm_device *dev, const struct drm_edid *drm_edid_alloc(const void *edid, size_t size); const struct drm_edid *drm_edid_dup(const struct drm_edid *drm_edid); void drm_edid_free(const struct drm_edid *drm_edid); +bool drm_edid_equal(const struct drm_edid *drm_edid_a, const struct drm_edid *drm_edid_b); bool drm_edid_valid(const struct drm_edid *drm_edid); const struct edid *drm_edid_raw(const struct drm_edid *drm_edid); const struct drm_edid *drm_edid_read(struct drm_connector *connector); -- 2.46.0