Commit dd3abfe4 authored by Ville Syrjälä's avatar Ville Syrjälä

drm/edid: Make version checks less convoluted

Get rid of the confusing version_greater() stuff and
simply compare edid->revision directly everwhere. Half
the places already did it this way, and since we actually
reject any EDID with edid->version!=1 it's a perfectly
sane thing to do.
Reviewed-by: default avatarJani Nikula <jani.nikula@intel.com>
Signed-off-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20220927170006.27855-9-ville.syrjala@linux.intel.com
parent f72f9529
......@@ -1572,15 +1572,6 @@ struct drm_edid {
const struct edid *edid;
};
static bool version_greater(const struct drm_edid *drm_edid,
u8 version, u8 revision)
{
const struct edid *edid = drm_edid->edid;
return edid->version > version ||
(edid->version == version && edid->revision > revision);
}
static int edid_hfeeodb_extension_block_count(const struct edid *edid);
static int edid_hfeeodb_block_count(const struct edid *edid)
......@@ -3652,7 +3643,7 @@ do_inferred_modes(const struct detailed_timing *timing, void *c)
closure->drm_edid,
timing);
if (!version_greater(closure->drm_edid, 1, 1))
if (closure->drm_edid->edid->revision < 2)
return; /* GTF not defined yet */
switch (range->flags) {
......@@ -3667,7 +3658,7 @@ do_inferred_modes(const struct detailed_timing *timing, void *c)
timing);
break;
case DRM_EDID_CVT_SUPPORT_FLAG:
if (!version_greater(closure->drm_edid, 1, 3))
if (closure->drm_edid->edid->revision < 4)
break;
closure->modes += drm_cvt_modes_for_range(closure->connector,
......@@ -3688,7 +3679,7 @@ static int add_inferred_modes(struct drm_connector *connector,
.drm_edid = drm_edid,
};
if (version_greater(drm_edid, 1, 0))
if (drm_edid->edid->revision >= 1)
drm_for_each_detailed_block(drm_edid, do_inferred_modes, &closure);
return closure.modes;
......@@ -3765,7 +3756,7 @@ static int add_established_modes(struct drm_connector *connector,
}
}
if (version_greater(drm_edid, 1, 0))
if (edid->revision >= 1)
drm_for_each_detailed_block(drm_edid, do_established_modes,
&closure);
......@@ -3820,7 +3811,7 @@ static int add_standard_modes(struct drm_connector *connector,
}
}
if (version_greater(drm_edid, 1, 0))
if (drm_edid->edid->revision >= 1)
drm_for_each_detailed_block(drm_edid, do_standard_modes,
&closure);
......@@ -3900,7 +3891,7 @@ add_cvt_modes(struct drm_connector *connector, const struct drm_edid *drm_edid)
.drm_edid = drm_edid,
};
if (version_greater(drm_edid, 1, 2))
if (drm_edid->edid->revision >= 3)
drm_for_each_detailed_block(drm_edid, do_cvt_mode, &closure);
/* XXX should also look for CVT codes in VTB blocks */
......@@ -3955,7 +3946,7 @@ static int add_detailed_modes(struct drm_connector *connector,
.quirks = quirks,
};
if (version_greater(drm_edid, 1, 3))
if (drm_edid->edid->revision >= 4)
closure.preferred = true; /* first detailed timing is always preferred */
else
closure.preferred =
......@@ -6152,7 +6143,7 @@ static void drm_get_monitor_range(struct drm_connector *connector,
{
struct drm_display_info *info = &connector->display_info;
if (!version_greater(drm_edid, 1, 3))
if (drm_edid->edid->revision < 4)
return;
if (!(drm_edid->edid->features & DRM_EDID_FEATURE_CONTINUOUS_FREQ))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment