From patchwork Thu Nov 8 00:23:53 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Souza, Jose" X-Patchwork-Id: 10673263 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 39DBA13A4 for ; Thu, 8 Nov 2018 00:24:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2C30A29C0D for ; Thu, 8 Nov 2018 00:24:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2A2232D43D; Thu, 8 Nov 2018 00:24:05 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id E33902D43C for ; Thu, 8 Nov 2018 00:24:04 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 97A586E234; Thu, 8 Nov 2018 00:24:00 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by gabe.freedesktop.org (Postfix) with ESMTPS id B6C066E234; Thu, 8 Nov 2018 00:23:57 +0000 (UTC) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 07 Nov 2018 16:23:57 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,477,1534834800"; d="scan'208";a="94510885" Received: from josouza-mobl.jf.intel.com ([10.24.11.2]) by FMSMGA003.fm.intel.com with ESMTP; 07 Nov 2018 16:23:57 -0800 From: =?utf-8?q?Jos=C3=A9_Roberto_de_Souza?= To: intel-gfx@lists.freedesktop.org Subject: [PATCH 2/2] drm/edid: Parse manufacturer id only once per sink Date: Wed, 7 Nov 2018 16:23:53 -0800 Message-Id: <20181108002353.19020-2-jose.souza@intel.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181108002353.19020-1-jose.souza@intel.com> References: <20181108002353.19020-1-jose.souza@intel.com> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Jos=C3=A9_Roberto_de_Souza?= , dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP It was parsing the manufacturer id of the sink for each entry in quirk list. Signed-off-by: José Roberto de Souza --- drivers/gpu/drm/drm_edid.c | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) 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; }