Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp232765imm; Mon, 21 May 2018 05:18:26 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpraKc1gS8tpuWF8vqk/n7hQqVgCz13xb9SvdGFSNDQveNISOBsC2vM9zAIZ5LZGiIbdNiH X-Received: by 2002:a17:902:bd46:: with SMTP id b6-v6mr20260877plx.170.1526905106360; Mon, 21 May 2018 05:18:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526905106; cv=none; d=google.com; s=arc-20160816; b=ppRandnnNWKjb5TDLueruvWomnTRfhuDPWRCLCfEqWx5JiUbyib+GHBqC4Xk1UGk3n BjOeV5HJjWAsSUwaae9s7xz2QNg6BY2pSe3Y9NcCUTge6K+kJmrbalj5gOPv6FjTk34z ak5eCCl9rcL8RN5jInC7HCXNBvyc86AqUlQq0Dt0adHNoSmP6KT2PateQmOrF1pALmgG XsAQoVSUbwpgGN/BfHHtfKMD1s+8UDSEUh0PokDiyjIwnoqy6Z+PGWmL4gJ9rHCmKL/z hP5LBHJBoAlwXY6UoDAJ62wTgPrU7J/KOFbEWMXDiOuygibFltGH7IwOQdtakAcCunnY IpAQ== 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=8srObhHtMrozkg+4jK621GZH5l/lNSN+1kuradLSS9c=; b=eMxrPmOS3Dlnc8nVntbg2Vei/vT4c+8IbpHqOVZxWfmXdOh32Tf0DJNO+weCTA2Ass 1/TFEuRZD/ZYvdbbBxFoYfzcwr4vx64iLbDRNHRthYgQEdijFhkQK0O9B18sCDO0uTLO Q5McuvnGjYUJvKonwElbKGezvSDp1wCdkuhz9mcfZBbfNHn3XG7EJTsxCdWdPLh2lrr3 gUfIy+RC8QrvMr2ddUeu6sStG7M9m74MgGap8jO4RdvEizPMkrMPnLIPJBkmzuwBwpix KiPHR+JkbXjXEZ/HNl8ImEkuXaoZpU6XHm0J6zTKHZqGJPZ4CMwPUXYSRdAi6YAyz9SW Jf3Q== 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 b67-v6si14276123pfa.71.2018.05.21.05.18.12; Mon, 21 May 2018 05:18:26 -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 S1752781AbeEUMRI (ORCPT + 99 others); Mon, 21 May 2018 08:17:08 -0400 Received: from szxga07-in.huawei.com ([45.249.212.35]:38651 "EHLO huawei.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1752645AbeEUMJB (ORCPT ); Mon, 21 May 2018 08:09:01 -0400 Received: from DGGEMS403-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 4D74E32B2FE69; 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:51 +0800 From: Yisheng Xie To: CC: Yisheng Xie , Kalle Valo , Intel Linux Wireless , Johannes Berg , Emmanuel Grumbach , , Subject: [PATCH 07/33] iwlwifi: mvm: use match_string() helper Date: Mon, 21 May 2018 19:57:44 +0800 Message-ID: <1526903890-35761-8-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: Kalle Valo Cc: Intel Linux Wireless Cc: Johannes Berg Cc: Emmanuel Grumbach Cc: linux-wireless@vger.kernel.org Cc: netdev@vger.kernel.org Signed-off-by: Yisheng Xie --- drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c b/drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c index 0e6401c..e8249a6 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c @@ -671,14 +671,9 @@ static ssize_t iwl_dbgfs_bt_cmd_read(struct file *file, char __user *user_buf, }; int ret, bt_force_ant_mode; - for (bt_force_ant_mode = 0; - bt_force_ant_mode < ARRAY_SIZE(modes_str); - bt_force_ant_mode++) { - if (!strcmp(buf, modes_str[bt_force_ant_mode])) - break; - } - - if (bt_force_ant_mode >= ARRAY_SIZE(modes_str)) + bt_force_ant_mode = match_string(modes_str, + ARRAY_SIZE(modes_str), buf); + if (bt_force_ant_mode < 0) return -EINVAL; ret = 0; -- 1.7.12.4