Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp496276imm; Thu, 31 May 2018 04:29:42 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLBB0p+FyzEeHKHzLW1/bhmJkOv2UZYZasHzbV5CpXD8I9Krt6VRtF800vMYbRSvT5x2ZUb X-Received: by 2002:a65:52cc:: with SMTP id z12-v6mr5191943pgp.126.1527766182124; Thu, 31 May 2018 04:29:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527766182; cv=none; d=google.com; s=arc-20160816; b=G8QOO5ZHhId2GwFPlehxnNrw5IIHWZpd9zCTwf/2LH/8WAKN3iNUO3ViITQC83b8d4 fBuY8pUC/JIRWSmwGs4QhuS6MrTHxb7aVy04UDFxGM7bj9sMGzSqCQlnGOVQZknaFn6Q 4URf/4CtF3QwrFymUVTzhKJ0H04WEZq0YQOe2TmH6EACKjvT5YqknLl/Pt/eeNVkBsqZ j7aX8CcP21WXJi0lE8YRgICERQMlxorcrGOzFvMOfMxlky+F1Xp55C8G1Ayz7OKPZvpG TNJLMI2yTBeoshoifaTXwZNoPncTJyptpqaYoaCL+eY613a7xYwuUwSliZJHW647l2Kc P1Sg== 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=A3kwz6Dj9yAQ+g42Ohjq4ArFbqzLa2XBidjK77DydpI=; b=Nhq1+avTHAOAm8h1E/Mx0Phb5jrw7Cj3cQW1i13k+x+SQc2hDP31vfTzlEG94RHkA0 yLcyn2Fk7Xn9Q2djrKTVmxqU3KUwoSjCFL1lIpMA31hNlRY2IwmX+j0BVymNKmoZsQyb BOvv7fQharra1klZIFbTfcz56llPEx2hR5XRKI0WDFSQ4u1aRg5A8sYM5SbO5XX56Iik zme08Wjl+aHIQ6DrarA/cCHzp+Me91qT7tPKyv311iZ2jEqPtUOIWGsaIgmp+mdQntrw rX2CGiYYG8jv4d0CdSsYtMWWpAi+HcaU4/NhvDmvjlyrV5bF0xUdHtCWBdLvSzeUI+0K +Org== 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 w12-v6si36704401pfd.113.2018.05.31.04.29.28; Thu, 31 May 2018 04:29:42 -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 S1755065AbeEaL16 (ORCPT + 99 others); Thu, 31 May 2018 07:27:58 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:8223 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754600AbeEaLWi (ORCPT ); Thu, 31 May 2018 07:22:38 -0400 Received: from DGGEMS405-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id E384BBA34904D; Thu, 31 May 2018 19:22:24 +0800 (CST) Received: from linux-ibm.site (10.175.102.37) by DGGEMS405-HUB.china.huawei.com (10.3.19.205) with Microsoft SMTP Server id 14.3.382.0; Thu, 31 May 2018 19:22:19 +0800 From: Yisheng Xie To: CC: , Yisheng Xie , Jaroslav Kysela , Subject: [PATCH v2 05/21] hp100: use match_string() helper Date: Thu, 31 May 2018 19:11:10 +0800 Message-ID: <1527765086-19873-6-git-send-email-xieyisheng1@huawei.com> X-Mailer: git-send-email 1.7.12.4 In-Reply-To: <1527765086-19873-1-git-send-email-xieyisheng1@huawei.com> References: <1527765086-19873-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 instead of open coded variant. Reviewed-by: Andy Shevchenko Cc: Jaroslav Kysela Cc: netdev@vger.kernel.org Signed-off-by: Yisheng Xie --- v2: - add Reviewed-by tag. drivers/net/ethernet/hp/hp100.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/drivers/net/ethernet/hp/hp100.c b/drivers/net/ethernet/hp/hp100.c index c8c7ad2..84501b3 100644 --- a/drivers/net/ethernet/hp/hp100.c +++ b/drivers/net/ethernet/hp/hp100.c @@ -335,7 +335,6 @@ static const char *hp100_read_id(int ioaddr) static __init int hp100_isa_probe1(struct net_device *dev, int ioaddr) { const char *sig; - int i; if (!request_region(ioaddr, HP100_REGION_SIZE, "hp100")) goto err; @@ -351,13 +350,7 @@ static __init int hp100_isa_probe1(struct net_device *dev, int ioaddr) if (sig == NULL) goto err; - for (i = 0; i < ARRAY_SIZE(hp100_isa_tbl); i++) { - if (!strcmp(hp100_isa_tbl[i], sig)) - break; - - } - - if (i < ARRAY_SIZE(hp100_isa_tbl)) + if (match_string(hp100_isa_tbl, ARRAY_SIZE(hp100_isa_tbl), sig) >= 0) return hp100_probe1(dev, ioaddr, HP100_BUS_ISA, NULL); err: return -ENODEV; -- 1.7.12.4