diff options
author | Jani Nikula <jani.nikula@intel.com> | 2022-03-28 17:34:25 +0300 |
---|---|---|
committer | Jani Nikula <jani.nikula@intel.com> | 2022-03-29 14:51:29 +0300 |
commit | a9b1f15f53313f967edd5088a60970cc829ab5a6 (patch) | |
tree | 29e2005878d0e536bf2bb3374aed29a91d8c19b1 /drivers/gpu/drm/drm_edid.c | |
parent | e379814b5fb719b22c01c7a81f14b98cbaac3c42 (diff) | |
download | linux-a9b1f15f53313f967edd5088a60970cc829ab5a6.tar.xz |
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: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://patchwork.freedesktop.org/patch/msgid/0b5213383e14f11c6a505b10a7342fb2ff4f2a11.1648477901.git.jani.nikula@intel.com
Diffstat (limited to 'drivers/gpu/drm/drm_edid.c')
-rw-r--r-- | drivers/gpu/drm/drm_edid.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c index f6b9b818aaf9..1ebf434b2f0b 100644 --- a/drivers/gpu/drm/drm_edid.c +++ b/drivers/gpu/drm/drm_edid.c @@ -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, |