Commit a9b1f15f authored by Jani Nikula's avatar Jani Nikula

drm/edid: pass a timing pointer to is_detailed_timing_descriptor()

Use struct member access instead of direct offsets to avoid a cast.

Use BUILD_BUG_ON() for sanity check.

Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: default avatarJani Nikula <jani.nikula@intel.com>
Reviewed-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: default avatarEmil Velikov <emil.l.velikov@gmail.com>
Link: https://patchwork.freedesktop.org/patch/msgid/0b5213383e14f11c6a505b10a7342fb2ff4f2a11.1648477901.git.jani.nikula@intel.com
parent e379814b
......@@ -2342,9 +2342,11 @@ static bool is_display_descriptor(const struct detailed_timing *descriptor, u8 t
descriptor->data.other_data.type == type;
}
static bool is_detailed_timing_descriptor(const u8 d[18])
static bool is_detailed_timing_descriptor(const struct detailed_timing *descriptor)
{
return d[0] != 0x00 || d[1] != 0x00;
BUILD_BUG_ON(offsetof(typeof(*descriptor), pixel_clock) != 0);
return descriptor->pixel_clock != 0;
}
typedef void detailed_cb(struct detailed_timing *timing, void *closure);
......@@ -3266,7 +3268,7 @@ do_detailed_mode(struct detailed_timing *timing, void *c)
struct detailed_mode_closure *closure = c;
struct drm_display_mode *newmode;
if (!is_detailed_timing_descriptor((const u8 *)timing))
if (!is_detailed_timing_descriptor(timing))
return;
newmode = drm_mode_detailed(closure->connector->dev,
......
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