Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp230078imm; Mon, 21 May 2018 05:15:44 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqDxtTvDut/vSkQbP3/U6NpvmXd4jAfYb4HSF5sTvypLU6thNMwW0mGVuuwKEgV4CD44goQ X-Received: by 2002:a62:6756:: with SMTP id b83-v6mr19918587pfc.76.1526904944237; Mon, 21 May 2018 05:15:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526904944; cv=none; d=google.com; s=arc-20160816; b=Kh6L1Z/PhkmyUtqqXQ/DrgCLsURtrNPcgvAgucMw1ZzGRglI0fNJnE2LxqhHixmIVa 1h5rjfkdIOSU4oJxa727rkj/+ImzPW6XNgzShtiq3EUboZQEes0Ec8P5DPYvEV0zOX2u Hx0XoU9VNyvQynwYzmrhidscmix1vOvlMxVwuOXWB6YZTmqvIHgSWtBQm9KG30n12j9E +onUpqZTYUgZ6+MobpR1yfBdaDIk67heb3D/NAdrW6wIidWVn3lOgUmoCennjZAaaa/4 9NxwVIB7pywhb/mrFDI29oyr5VoSVT5eS6ydzrdCVf7snow2vA0kP7Efg1Wxd9MPC4bQ nDmg== 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=Yc9P4JNkbkZUjYUfqGeRPw2y8pgwgd76wmmSIwprszA=; b=yboS+8rb1uPXLXvFyiaXzDoMCPXpaecvOTl0dDM+8Lyk+qPpAv+a6CkRzBZ1va1Kbv lwQyQv9dSQa/s0cqcgLndTtNum2/OR/ff4cdm5q1fJsuz97UDsb65jCRFuoGDh0VXeyu 1Gd1RYjw4Gppp1tUU1GqZZap74vx4e8xczs0KSLXfbEecIkT47QztNfQWlZa9rXZVoS+ d9/YGWQJSEZ7NBZfVX40kXtNP2paIDSrU+Torcc+yLhcDj4MTpPaqtdMN4GGv8PLYQWV KRKHcdyf9yhh4T6a7nxi4hk6MaEysyasVpQB3tMeDy9UAB+RD1Dl7rMBz1ZE8LHz3z2e Tzzg== 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 a15-v6si8863196pgd.421.2018.05.21.05.15.28; Mon, 21 May 2018 05:15:44 -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 S1752968AbeEUMJT (ORCPT + 99 others); Mon, 21 May 2018 08:09:19 -0400 Received: from szxga07-in.huawei.com ([45.249.212.35]:38664 "EHLO huawei.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1752815AbeEUMJC (ORCPT ); Mon, 21 May 2018 08:09:02 -0400 Received: from DGGEMS403-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 15D9ABF0ABFB3; Mon, 21 May 2018 20:08:56 +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:50 +0800 From: Yisheng Xie To: CC: Yisheng Xie , Jaroslav Kysela , Subject: [PATCH 06/33] hp100: use match_string() helper Date: Mon, 21 May 2018 19:57:43 +0800 Message-ID: <1526903890-35761-7-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: Jaroslav Kysela Cc: netdev@vger.kernel.org Signed-off-by: Yisheng Xie --- 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