Commit 2c54f87c authored by Jani Nikula's avatar Jani Nikula

drm/edid: convert get_monitor_name() to drm_edid

We'll need to propagate drm_edid everywhere.

v2: Drop incorrect NULL name check (Dan Carpenter)
Signed-off-by: default avatarJani Nikula <jani.nikula@intel.com>
Reviewed-by: default avatarAnkit Nautiyal <ankit.k.nautiyal@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/c940aad14f323ef3a7907a0fb534011deb1589a9.1652097712.git.jani.nikula@intel.com
parent 874d98ee
...@@ -4830,15 +4830,15 @@ monitor_name(const struct detailed_timing *timing, void *data) ...@@ -4830,15 +4830,15 @@ monitor_name(const struct detailed_timing *timing, void *data)
*res = timing->data.other_data.data.str.str; *res = timing->data.other_data.data.str.str;
} }
static int get_monitor_name(const struct edid *edid, char name[13]) static int get_monitor_name(const struct drm_edid *drm_edid, char name[13])
{ {
const char *edid_name = NULL; const char *edid_name = NULL;
int mnl; int mnl;
if (!edid || !name) if (!drm_edid || !name)
return 0; return 0;
drm_for_each_detailed_block(edid, monitor_name, &edid_name); drm_for_each_detailed_block(drm_edid->edid, monitor_name, &edid_name);
for (mnl = 0; edid_name && mnl < 13; mnl++) { for (mnl = 0; edid_name && mnl < 13; mnl++) {
if (edid_name[mnl] == 0x0a) if (edid_name[mnl] == 0x0a)
break; break;
...@@ -4858,14 +4858,22 @@ static int get_monitor_name(const struct edid *edid, char name[13]) ...@@ -4858,14 +4858,22 @@ static int get_monitor_name(const struct edid *edid, char name[13])
*/ */
void drm_edid_get_monitor_name(const struct edid *edid, char *name, int bufsize) void drm_edid_get_monitor_name(const struct edid *edid, char *name, int bufsize)
{ {
int name_length; int name_length = 0;
char buf[13];
if (bufsize <= 0) if (bufsize <= 0)
return; return;
name_length = min(get_monitor_name(edid, buf), bufsize - 1); if (edid) {
char buf[13];
struct drm_edid drm_edid = {
.edid = edid,
.size = edid_size(edid),
};
name_length = min(get_monitor_name(&drm_edid, buf), bufsize - 1);
memcpy(name, buf, name_length); memcpy(name, buf, name_length);
}
name[name_length] = '\0'; name[name_length] = '\0';
} }
EXPORT_SYMBOL(drm_edid_get_monitor_name); EXPORT_SYMBOL(drm_edid_get_monitor_name);
...@@ -4905,7 +4913,7 @@ static void drm_edid_to_eld(struct drm_connector *connector, ...@@ -4905,7 +4913,7 @@ static void drm_edid_to_eld(struct drm_connector *connector,
if (!drm_edid) if (!drm_edid)
return; return;
mnl = get_monitor_name(drm_edid->edid, &eld[DRM_ELD_MONITOR_NAME_STRING]); mnl = get_monitor_name(drm_edid, &eld[DRM_ELD_MONITOR_NAME_STRING]);
DRM_DEBUG_KMS("ELD monitor %s\n", &eld[DRM_ELD_MONITOR_NAME_STRING]); DRM_DEBUG_KMS("ELD monitor %s\n", &eld[DRM_ELD_MONITOR_NAME_STRING]);
eld[DRM_ELD_CEA_EDID_VER_MNL] = info->cea_rev << DRM_ELD_CEA_EDID_VER_SHIFT; eld[DRM_ELD_CEA_EDID_VER_MNL] = info->cea_rev << DRM_ELD_CEA_EDID_VER_SHIFT;
......
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