[2/2] drm/edid: Parse manufacturer id only once per sink

Submitted by José Roberto de Souza on Nov. 8, 2018, 12:23 a.m.

Details

Message ID 20181108002353.19020-2-jose.souza@intel.com
State New
Headers show
Series "Series without cover letter" ( rev: 1 ) in DRI devel

Not browsing as part of any series.

Commit Message

José Roberto de Souza Nov. 8, 2018, 12:23 a.m.
It was parsing the manufacturer id of the sink for each entry in
quirk list.

Signed-off-by: José Roberto de Souza <jose.souza@intel.com>
---
 drivers/gpu/drm/drm_edid.c | 21 ++++-----------------
 1 file changed, 4 insertions(+), 17 deletions(-)

Patch hide | download patch | download mbox

diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
index 1a0ddf3d326b..69209fcc40f0 100644
--- a/drivers/gpu/drm/drm_edid.c
+++ b/drivers/gpu/drm/drm_edid.c
@@ -1770,22 +1770,6 @@  void drm_edid_manufacturer_parse(const struct edid *edid, char manufacturer[3])
 }
 EXPORT_SYMBOL(drm_edid_manufacturer_parse);
 
-/**
- * edid_vendor - match a string against EDID's obfuscated vendor field
- * @edid: EDID to match
- * @vendor: vendor string
- *
- * Returns true if @vendor is in @edid, false otherwise
- */
-static bool edid_vendor(const struct edid *edid, const char *vendor)
-{
-	char edid_vendor[3];
-
-	drm_edid_manufacturer_parse(edid, edid_vendor);
-
-	return !strncmp(edid_vendor, vendor, 3);
-}
-
 /**
  * edid_get_quirks - return quirk flags for a given EDID
  * @edid: EDID to process
@@ -1795,12 +1779,15 @@  static bool edid_vendor(const struct edid *edid, const char *vendor)
 static u32 edid_get_quirks(const struct edid *edid)
 {
 	const struct edid_quirk *quirk;
+	char edid_vendor[3];
 	int i;
 
+	drm_edid_manufacturer_parse(edid, edid_vendor);
+
 	for (i = 0; i < ARRAY_SIZE(edid_quirk_list); i++) {
 		quirk = &edid_quirk_list[i];
 
-		if (edid_vendor(edid, quirk->vendor) &&
+		if (!strncmp(edid_vendor, quirk->vendor, 3) &&
 		    (EDID_PRODUCT_ID(edid) == quirk->product_id))
 			return quirk->quirks;
 	}