From patchwork Thu May 3 18:04:23 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 10378815 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id E04DD6037D for ; Thu, 3 May 2018 18:04:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DA4F829114 for ; Thu, 3 May 2018 18:04:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CD648291B4; Thu, 3 May 2018 18:04:37 +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=-7.9 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 331B229114 for ; Thu, 3 May 2018 18:04:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751277AbeECSEg (ORCPT ); Thu, 3 May 2018 14:04:36 -0400 Received: from mga04.intel.com ([192.55.52.120]:9613 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751236AbeECSE2 (ORCPT ); Thu, 3 May 2018 14:04:28 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 03 May 2018 11:04:27 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,359,1520924400"; d="scan'208";a="38465432" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga008.jf.intel.com with ESMTP; 03 May 2018 11:04:25 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 2240BCE; Thu, 3 May 2018 21:04:23 +0300 (EEST) From: Andy Shevchenko To: Arvind Yadav , linux-fbdev@vger.kernel.org, Bartlomiej Zolnierkiewicz Cc: Andy Shevchenko Subject: [PATCH v1] video: fbdev: pxafb: Convert to use match_string() helper Date: Thu, 3 May 2018 21:04:23 +0300 Message-Id: <20180503180423.21710-1-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.17.0 Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The new helper returns index of the matching string in an array. We are going to use it here. Signed-off-by: Andy Shevchenko --- drivers/video/fbdev/pxafb.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/drivers/video/fbdev/pxafb.c b/drivers/video/fbdev/pxafb.c index c3d49e13643c..0c013f1efe81 100644 --- a/drivers/video/fbdev/pxafb.c +++ b/drivers/video/fbdev/pxafb.c @@ -2099,7 +2099,7 @@ static void pxafb_check_options(struct device *dev, struct pxafb_mach_info *inf) #if defined(CONFIG_OF) static const char * const lcd_types[] = { - "unknown", "mono-stn", "mono-dstn", "color-stn", "color-dstn", + "mono-stn", "mono-dstn", "color-stn", "color-dstn", "color-tft", "smart-panel", NULL }; @@ -2115,12 +2115,10 @@ 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; + return i; } info->lcd_conn |= LCD_CONN_TYPE(i); info->lcd_conn |= LCD_CONN_WIDTH(bus_width);