Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp229771imm; Mon, 21 May 2018 05:15:24 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqn2SEOa0ADp4rn8HMbmyUhfjs/k8s/REq9agD9baifSuCTAaTLIb0SB6NdKb/6NVkDRgXl X-Received: by 2002:a17:902:5610:: with SMTP id h16-v6mr20086754pli.140.1526904924751; Mon, 21 May 2018 05:15:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526904924; cv=none; d=google.com; s=arc-20160816; b=lfLLTB5P+arKgA4VvAP/1ccpZUTyPA6o3hTosCxHRVDhSkzXWbJtSGSyZK7IifJVlo j6v5u2UC5NtTZMCX5U3vopWjr41DNwNKxRgN/1/d6Z3sJifAaAdfBE+DHhfyUuefPAg+ JuFCBaPEv6UqW3BFE90qi9V6BEheJB5nMLkjuqY2QDb47tXrDtRAHssCu1iFl+bnL+Pj /CU5txcYFq/o9LGaaMRFud31UTXXRJehRcjBfuPlNQxV4Vwh6zt5J2zovWL45744DSfY kTEZkV1FFGeeuZKJ2g5F8nvSmfXZ8JLmzkgOJI4YG4Loz1upTl7VKxV+fPTxg9HxYdwb gwXA== 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=somYfXqqOkFH2ca+SxyAWY0iYBWTvKOuJTquaRlkjgQ=; b=FQxsUATTXIzp0AL6evq5vKzUfcsobEbLzM3ONDNtsTVmyXXMkwJpVTwMmE/CsrVvkw Yl+MDqdAI26tQreLkd1nwuZKubLB6Kx69B+WWL589n+Ej4l/hPnf1F3EFij+MXSAguAG 0bjn9KfCzgf7fBRfDJPueaES8YPvgiUzm8D/8K/BnAqEfB76zGrJDbBUrDh84c+y4WHw jUfmtuid9E/gzfoJA/rndJ4mueVjeVNMbPPM8Yqi+LkQKFaDGgKEPqP03qmq1NDjZzLS k5pIQzuvw6NuqNCUaa4bVvSXfoLtOs3aHm8ivyO0s2+7WFW5IxhNZN0D0dsrCtLduf1R y04Q== 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 e203-v6si13888122pfh.86.2018.05.21.05.15.10; Mon, 21 May 2018 05:15:24 -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 S1753108AbeEUMNU (ORCPT + 99 others); Mon, 21 May 2018 08:13:20 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:7713 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752973AbeEUMJT (ORCPT ); Mon, 21 May 2018 08:09:19 -0400 Received: from DGGEMS403-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 6D21B98FF756E; 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:08:58 +0800 From: Yisheng Xie To: CC: Yisheng Xie , Bartlomiej Zolnierkiewicz , Arvind Yadav , Subject: [PATCH 20/33] video: fbdev: pxafb: use match_string() helper Date: Mon, 21 May 2018 19:57:57 +0800 Message-ID: <1526903890-35761-21-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: Bartlomiej Zolnierkiewicz Cc: Arvind Yadav Cc: dri-devel@lists.freedesktop.org linux-fbdev@vger.kernel.org Signed-off-by: Yisheng Xie --- drivers/video/fbdev/pxafb.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/video/fbdev/pxafb.c b/drivers/video/fbdev/pxafb.c index c3d49e1..702193d 100644 --- a/drivers/video/fbdev/pxafb.c +++ b/drivers/video/fbdev/pxafb.c @@ -2115,10 +2115,8 @@ static int of_get_pxafb_display(struct device *dev, struct device_node *disp, if (ret) s = "color-tft"; - for (i = 0; lcd_types[i]; i++) - if (!strcmp(s, lcd_types[i])) - break; - if (!i || !lcd_types[i]) { + i = match_string(lcd_types, -1, s); + if (i <= 0) { dev_err(dev, "lcd-type %s is unknown\n", s); return -EINVAL; } -- 1.7.12.4