Commit 23b03867 authored by Ville Syrjälä's avatar Ville Syrjälä

drm/edid: Return DispID length from drm_find_displayid_extension()

As with the byte offset (idx) drm_find_displayid_extension() is
the only one who actually knows how much data the resulting DispID
block can contain. So return the length from therein instead of
assuming it's the EDID block length all over.
Signed-off-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200313162054.16009-5-ville.syrjala@linux.intel.comReviewed-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 36881184
...@@ -3212,13 +3212,15 @@ static u8 *drm_find_edid_extension(const struct edid *edid, int ext_id) ...@@ -3212,13 +3212,15 @@ static u8 *drm_find_edid_extension(const struct edid *edid, int ext_id)
} }
static u8 *drm_find_displayid_extension(const struct edid *edid, int *idx) static u8 *drm_find_displayid_extension(const struct edid *edid,
int *length, int *idx)
{ {
u8 *displayid = drm_find_edid_extension(edid, DISPLAYID_EXT); u8 *displayid = drm_find_edid_extension(edid, DISPLAYID_EXT);
if (!displayid) if (!displayid)
return NULL; return NULL;
*length = EDID_LENGTH;
*idx = 1; *idx = 1;
return displayid; return displayid;
...@@ -3227,8 +3229,7 @@ static u8 *drm_find_displayid_extension(const struct edid *edid, int *idx) ...@@ -3227,8 +3229,7 @@ static u8 *drm_find_displayid_extension(const struct edid *edid, int *idx)
static u8 *drm_find_cea_extension(const struct edid *edid) static u8 *drm_find_cea_extension(const struct edid *edid)
{ {
int ret; int ret;
int idx; int length, idx;
int length = EDID_LENGTH;
struct displayid_block *block; struct displayid_block *block;
u8 *cea; u8 *cea;
u8 *displayid; u8 *displayid;
...@@ -3239,7 +3240,7 @@ static u8 *drm_find_cea_extension(const struct edid *edid) ...@@ -3239,7 +3240,7 @@ static u8 *drm_find_cea_extension(const struct edid *edid)
return cea; return cea;
/* CEA blocks can also be found embedded in a DisplayID block */ /* CEA blocks can also be found embedded in a DisplayID block */
displayid = drm_find_displayid_extension(edid, &idx); displayid = drm_find_displayid_extension(edid, &length, &idx);
if (!displayid) if (!displayid)
return NULL; return NULL;
...@@ -5188,12 +5189,11 @@ static int add_displayid_detailed_modes(struct drm_connector *connector, ...@@ -5188,12 +5189,11 @@ static int add_displayid_detailed_modes(struct drm_connector *connector,
{ {
u8 *displayid; u8 *displayid;
int ret; int ret;
int idx; int length, idx;
int length = EDID_LENGTH;
struct displayid_block *block; struct displayid_block *block;
int num_modes = 0; int num_modes = 0;
displayid = drm_find_displayid_extension(edid, &idx); displayid = drm_find_displayid_extension(edid, &length, &idx);
if (!displayid) if (!displayid)
return 0; return 0;
...@@ -5881,17 +5881,17 @@ static void drm_get_displayid(struct drm_connector *connector, ...@@ -5881,17 +5881,17 @@ static void drm_get_displayid(struct drm_connector *connector,
struct edid *edid) struct edid *edid)
{ {
void *displayid = NULL; void *displayid = NULL;
int idx; int length, idx;
int ret; int ret;
connector->has_tile = false; connector->has_tile = false;
displayid = drm_find_displayid_extension(edid, &idx); displayid = drm_find_displayid_extension(edid, &length, &idx);
if (!displayid) { if (!displayid) {
/* drop reference to any tile group we had */ /* drop reference to any tile group we had */
goto out_drop_ref; goto out_drop_ref;
} }
ret = drm_parse_display_id(connector, displayid, EDID_LENGTH, idx); ret = drm_parse_display_id(connector, displayid, length, idx);
if (ret < 0) if (ret < 0)
goto out_drop_ref; goto out_drop_ref;
if (!connector->has_tile) if (!connector->has_tile)
......
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