From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751682AbeEUMJT (ORCPT ); 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 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 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