int drm_load_edid_firmware(struct drm_connector *connector) { const char *connector_name = drm_get_connector_name(connector); char *edidname = edid_firmware, *last, *colon; int ret; struct edid *edid; if (*edidname == '\0') return 0; colon = strchr(edidname, ':'); if (colon != NULL) { if (strncmp(connector_name, edidname, colon - edidname)) return 0; edidname = colon + 1; if (*edidname == '\0') return 0; } last = edidname + strlen(edidname) - 1; if (*last == '\n') *last = '\0'; edid = (struct edid *) edid_load(connector, edidname, connector_name); if (IS_ERR_OR_NULL(edid)) return 0; drm_mode_connector_update_edid_property(connector, edid); ret = drm_add_edid_modes(connector, edid); kfree(edid); return ret; }
int drm_load_edid_firmware(struct drm_connector *connector) { char *connector_name = drm_get_connector_name(connector); char *edidname = edid_firmware, *last, *colon; int ret = 0; if (*edidname == '\0') return ret; colon = strchr(edidname, ':'); if (colon != NULL) { if (strncmp(connector_name, edidname, colon - edidname)) return ret; edidname = colon + 1; if (*edidname == '\0') return ret; } last = edidname + strlen(edidname) - 1; if (*last == '\n') *last = '\0'; ret = edid_load(connector, edidname, connector_name); if (ret) return 0; drm_mode_connector_update_edid_property(connector, (struct edid *) connector->display_info.raw_edid); return drm_add_edid_modes(connector, (struct edid *) connector->display_info.raw_edid); }
int drm_load_edid_firmware(struct drm_connector *connector) { const char *connector_name = connector->name; char *edidname, *last, *colon, *fwstr, *edidstr, *fallback = NULL; int ret; struct edid *edid; if (edid_firmware[0] == '\0') return 0; /* * If there are multiple edid files specified and separated * by commas, search through the list looking for one that * matches the connector. * * If there's one or more that don't't specify a connector, keep * the last one found one as a fallback. */ fwstr = kstrdup(edid_firmware, GFP_KERNEL); edidstr = fwstr; while ((edidname = strsep(&edidstr, ","))) { colon = strchr(edidname, ':'); if (colon != NULL) { if (strncmp(connector_name, edidname, colon - edidname)) continue; edidname = colon + 1; break; } if (*edidname != '\0') /* corner case: multiple ',' */ fallback = edidname; } if (!edidname) { if (!fallback) { kfree(fwstr); return 0; } edidname = fallback; } last = edidname + strlen(edidname) - 1; if (*last == '\n') *last = '\0'; edid = edid_load(connector, edidname, connector_name); kfree(fwstr); if (IS_ERR_OR_NULL(edid)) return 0; drm_mode_connector_update_edid_property(connector, edid); ret = drm_add_edid_modes(connector, edid); drm_edid_to_eld(connector, edid); kfree(edid); return ret; }