Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp226053imm; Mon, 21 May 2018 05:11:37 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqgNlBwSq1mn1fP+B7dV3JXTlb47ykExSrWMSSlBVRGbcQWGyYlS6QTj84nZuw/hXibdfTK X-Received: by 2002:a17:902:8494:: with SMTP id c20-v6mr20428410plo.66.1526904696993; Mon, 21 May 2018 05:11:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526904696; cv=none; d=google.com; s=arc-20160816; b=VcoxAzPVLYkC1mcy+v9/Kcuvi28/o8ySaXW0iS0tXDBVHP2UygG/D1/FlLlBU+cWrN JFC0bn+3h/dJKYg8H5RjWqgitPHBvf01Ea2rCRScu4g9gTII+91g3VxDc+YUuq9i3qzW yQgc1/9k+YdSOETEgGLBFgQPeNhFzqmRFz6YYYH6oYsz40VKIFQPRrFtS20vchJd5jHG 3+e9Vc10GWTgdeLnOm5ovOKT6Al2wmU6epcyurCiOueQPGQLM79k1JBNyWnT9PRtX8Pn /aQwXJ7dkZJaE/gUK6Waa6ijtnPkcyMu/mRVFsQFLe4fa/+CU6x+Bg2w2SFc3QzalCLc 5sjg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:arc-authentication-results; bh=r139ZmYtOdJgs1zpaKZ5xhDecv44BTQ//R7xT4LrqoE=; b=yBi+mP8aUGKO57NnNr9C53vFEMXNpEMRVP4rHQ25k3xYmM6olvupeUwmDeDuXU+PQ0 sMQNhkUw7g1lxtEQTcwPCpxBvOdPxpfnzpq/lks3Lt4A4aimQJ1LxEfYkIiJ8XfGDQ1A N6UfQxLIFT0dLfgBRzjCfSSu0H4zB239/kpGdJ3TjRwy7AzLlJExwdoPfWZZ5LUk2+St 2WrDL18aSTBAo7oWMopzvz+B+ROG9eCR778uenGbcPGIxsRqh8Ql6NHNgHPsfbXwCOzw wKsYM5n0X9rlCb99WM4HdgQO0KcyTBQzIdakD2GotgYhNXr0GJzma4X3zkTDE6m/y8q2 9jlQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y13-v6si11335025pgr.654.2018.05.21.05.11.21; Mon, 21 May 2018 05:11:36 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752044AbeEUMJc (ORCPT + 99 others); Mon, 21 May 2018 08:09:32 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:7720 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753000AbeEUMJZ (ORCPT ); Mon, 21 May 2018 08:09:25 -0400 Received: from DGGEMS403-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id CF7367D5AA9FB; Mon, 21 May 2018 20:09:06 +0800 (CST) Received: from linux-ibm.site (10.175.102.37) by DGGEMS403-HUB.china.huawei.com (10.3.19.203) with Microsoft SMTP Server id 14.3.382.0; Mon, 21 May 2018 20:09:00 +0800 From: Yisheng Xie To: CC: Yisheng Xie , Gustavo Padovan , Maarten Lankhorst , Sean Paul , David Airlie , Subject: [PATCH 24/33] drm: use match_string() helper Date: Mon, 21 May 2018 19:58:01 +0800 Message-ID: <1526903890-35761-25-git-send-email-xieyisheng1@huawei.com> X-Mailer: git-send-email 1.7.12.4 In-Reply-To: <1526903890-35761-1-git-send-email-xieyisheng1@huawei.com> References: <1526903890-35761-1-git-send-email-xieyisheng1@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.175.102.37] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org match_string() returns the index of an array for a matching string, which can be used intead of open coded variant. Cc: Gustavo Padovan Cc: Maarten Lankhorst Cc: Sean Paul Cc: David Airlie Cc: dri-devel@lists.freedesktop.org Signed-off-by: Yisheng Xie --- drivers/gpu/drm/drm_panel_orientation_quirks.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/drm_panel_orientation_quirks.c b/drivers/gpu/drm/drm_panel_orientation_quirks.c index 902cc1a..3367c36 100644 --- a/drivers/gpu/drm/drm_panel_orientation_quirks.c +++ b/drivers/gpu/drm/drm_panel_orientation_quirks.c @@ -136,7 +136,6 @@ int drm_get_panel_orientation_quirk(int width, int height) const struct dmi_system_id *match; const struct drm_dmi_panel_orientation_data *data; const char *bios_date; - int i; for (match = dmi_first_match(orientation_data); match; @@ -154,10 +153,8 @@ int drm_get_panel_orientation_quirk(int width, int height) if (!bios_date) continue; - for (i = 0; data->bios_dates[i]; i++) { - if (!strcmp(data->bios_dates[i], bios_date)) - return data->orientation; - } + if (match_string(data->bios_dates, -1, bios_date) >= 0) + return data->orientation; } return DRM_MODE_PANEL_ORIENTATION_UNKNOWN; -- 1.7.12.4