}
EXPORT_SYMBOL(drm_mode_find_dmt);
-static bool is_display_descriptor(const u8 d[18], u8 tag)
+static bool is_display_descriptor(const struct detailed_timing *descriptor, u8 type)
{
- return d[0] == 0x00 && d[1] == 0x00 &&
- d[2] == 0x00 && d[3] == tag;
+ BUILD_BUG_ON(offsetof(typeof(*descriptor), pixel_clock) != 0);
+ BUILD_BUG_ON(offsetof(typeof(*descriptor), data.other_data.pad1) != 2);
+ BUILD_BUG_ON(offsetof(typeof(*descriptor), data.other_data.type) != 3);
+
+ return descriptor->pixel_clock == 0 &&
+ descriptor->data.other_data.pad1 == 0 &&
+ descriptor->data.other_data.type == type;
}
static bool is_detailed_timing_descriptor(const u8 d[18])
{
u8 *r = (u8 *)t;
- if (!is_display_descriptor(r, EDID_DETAIL_MONITOR_RANGE))
+ if (!is_display_descriptor(t, EDID_DETAIL_MONITOR_RANGE))
return;
if (r[10] == DRM_EDID_CVT_SUPPORT_FLAG && r[15] & 0x10)
{
u8 *r = (u8 *)t;
- if (!is_display_descriptor(r, EDID_DETAIL_MONITOR_RANGE))
+ if (!is_display_descriptor(t, EDID_DETAIL_MONITOR_RANGE))
return;
if (r[10] == 0x02)
struct detailed_non_pixel *data = &timing->data.other_data;
struct detailed_data_monitor_range *range = &data->data.range;
- if (!is_display_descriptor((const u8 *)timing, EDID_DETAIL_MONITOR_RANGE))
+ if (!is_display_descriptor(timing, EDID_DETAIL_MONITOR_RANGE))
return;
closure->modes += drm_dmt_modes_for_range(closure->connector,
{
struct detailed_mode_closure *closure = c;
- if (!is_display_descriptor((const u8 *)timing, EDID_DETAIL_EST_TIMINGS))
+ if (!is_display_descriptor(timing, EDID_DETAIL_EST_TIMINGS))
return;
closure->modes += drm_est3_modes(closure->connector, timing);
struct edid *edid = closure->edid;
int i;
- if (!is_display_descriptor((const u8 *)timing, EDID_DETAIL_STD_MODES))
+ if (!is_display_descriptor(timing, EDID_DETAIL_STD_MODES))
return;
for (i = 0; i < 6; i++) {
{
struct detailed_mode_closure *closure = c;
- if (!is_display_descriptor((const u8 *)timing, EDID_DETAIL_CVT_3BYTE))
+ if (!is_display_descriptor(timing, EDID_DETAIL_CVT_3BYTE))
return;
closure->modes += drm_cvt_modes(closure->connector, timing);
static void
monitor_name(struct detailed_timing *t, void *data)
{
- if (!is_display_descriptor((const u8 *)t, EDID_DETAIL_MONITOR_NAME))
+ if (!is_display_descriptor(t, EDID_DETAIL_MONITOR_NAME))
return;
*(u8 **)data = t->data.other_data.data.str.str;
const struct detailed_non_pixel *data = &timing->data.other_data;
const struct detailed_data_monitor_range *range = &data->data.range;
- if (!is_display_descriptor((const u8 *)timing, EDID_DETAIL_MONITOR_RANGE))
+ if (!is_display_descriptor(timing, EDID_DETAIL_MONITOR_RANGE))
return;
/*