Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp903950imm; Tue, 5 Jun 2018 06:21:24 -0700 (PDT) X-Google-Smtp-Source: ADUXVKL79w3zw4nmRhqgEFTdVaBE5v6AJvQDn+KAL/WHOxtI+1BQSEV61ysf59HZrNtEu/z3KSFy X-Received: by 2002:a17:902:8a:: with SMTP id a10-v6mr26169335pla.89.1528204884659; Tue, 05 Jun 2018 06:21:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528204884; cv=none; d=google.com; s=arc-20160816; b=olXIWmtLkmHf+dgICO7CZtZagoMZLMD57JtwFT5Bp/sItIqks7VjRn22nHCEt85mFS ZIygnpApruNWJQSwDA84jXBQQBEM4adEjtwt4W4L5HZzSfsQNZ0jts3FsNZaIQYg5OdJ YlvbZ0fhgkjhMBckHx7wRPLs6yAwn8p5DWsxpNChrfXgmrbY3mRlfFe9kypfYCWv19d9 nnhqm0qqF+0IHkh53oTSf0ZUt2VyEL99oxrboG+CqYGShsHhLjaGgRMHnz0lo770E1MV iQ0+59yOprPY7I5LBKNRWmLmiyZulFjH6QmLosKPCXsrSKOzZWAbClCY6n139LPFMM3O AEpQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=sS8eqySSG9KUYw2PHSbPv4LTy6lW2st8+YUQ1ERb7sc=; b=KTP82rpnW4cXpYt/MKx8reB56rKW5iw7+l7zdVzE24YtOIjFVDRcnwVFCxGr3bo77l jP9QwhTiYIgzJNP+YsufQqS4TxuSvQmXyPPlv76yr0pAod1j7AD6VVZIEa0Pg1E7atFD i4B8/Y40Y5qRIW+2IHtI07RT5uLGnPVoBkf2QzPinAHjzPH7xsO7Y82o6ISTOhcYH6hi YCZpoD2TG9bqjsHVzbadHLwL2g+z0BqxCSLucmHF/trl4/AeJUxsbbWrkBnFE36QOlq1 Lki6uMueo3sFTw//WlxT+FNVmjGDWkpL9g2kKL0ZTgAa0Rm8ttVXK7NgQedEsHzpy95h 95pw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=vbyguryS; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b67-v6si50248039plb.262.2018.06.05.06.21.10; Tue, 05 Jun 2018 06:21:24 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=vbyguryS; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751940AbeFENTX (ORCPT + 99 others); Tue, 5 Jun 2018 09:19:23 -0400 Received: from mail-qt0-f196.google.com ([209.85.216.196]:37438 "EHLO mail-qt0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751775AbeFENTV (ORCPT ); Tue, 5 Jun 2018 09:19:21 -0400 Received: by mail-qt0-f196.google.com with SMTP id q13-v6so2314849qtp.4; Tue, 05 Jun 2018 06:19:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=sS8eqySSG9KUYw2PHSbPv4LTy6lW2st8+YUQ1ERb7sc=; b=vbygurySF5upAR1OtY5anm0lnEHfZ8N/LiA58HcuoXwqJaYBZldI2cKW/JLe8NiD1F RRM7l4zM0Yh7ZgVpLVztvlZl/MCbRHrTCpnEi827tF0vGEJNpLO+xT32SN1amhoDsoyA XNY3WmAvl8GVkZP1FOeSJPNl3nVhDJKe14Zl6uKH4CpW5YwFgdzDZS9AjFbKjuqO+PYY lGsjDIpQ3YYrwrTUgcR+f8UbSRHPSOBgRPOXmOzYl6NTCOYIrwCcMAhCtLYylVDY4biW ToqahekumED7TaCB1CXGd7W1SgDhO/rw+6TdlRrt/eA4tAyTeAsvobXgEjQA/IbeemXp re2A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=sS8eqySSG9KUYw2PHSbPv4LTy6lW2st8+YUQ1ERb7sc=; b=sDjqGGKlZoHU4Ymt5sQAr+MQjcJjsT4mdCBHV/W9saymPzeDBWCI3yDw469HVVu0hk KgnGTfdK+VF6id9JRfUqEFIQPLWzRGT0H5y1SCynJLw+ttz6jxO93vfFZ6hVsfYEzTkE wBfHFj7O7fC/yIoRrcGkWBRvCnAM6dB4eSHiZO5sBQ47wZ4fERKAkncJocNhmXuVrDX2 zc614EccawGLBUhF2Z6WdtVTU26uAdqFsXMwynHz0/BrlpVawoIIidBBfMSL8PyqGJYI TTsYGlMiqdyVixat6nlWXput6L9xmyaf1rummgE9DR1CvjX86I5nj2INKxVqvBg/NPpW YdNA== X-Gm-Message-State: APt69E3VItNnuRuP/jmCkIVhpPuRwBBbR/x7wh7ImT0DysBbE4VkVewb R97QVvq60QIfj3vcVv5x4ulIXfjbniVqWNJuO9M= X-Received: by 2002:ac8:190c:: with SMTP id t12-v6mr25586150qtj.278.1528204760816; Tue, 05 Jun 2018 06:19:20 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a0c:98f9:0:0:0:0:0 with HTTP; Tue, 5 Jun 2018 06:19:20 -0700 (PDT) In-Reply-To: <1527765086-19873-7-git-send-email-xieyisheng1@huawei.com> References: <1527765086-19873-1-git-send-email-xieyisheng1@huawei.com> <1527765086-19873-7-git-send-email-xieyisheng1@huawei.com> From: Andy Shevchenko Date: Tue, 5 Jun 2018 16:19:20 +0300 Message-ID: Subject: Re: [PATCH v2 06/21] iwlwifi: mvm: use match_string() helper To: Yisheng Xie Cc: Linux Kernel Mailing List , Kalle Valo , Intel Linux Wireless , Johannes Berg , Emmanuel Grumbach , "open list:TI WILINK WIRELES..." , netdev Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, May 31, 2018 at 2:11 PM, Yisheng Xie wrote: > 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: 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 > --- > v2: > - let ret get return value of match_string - per Andy > > drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c | 13 ++++--------- > 1 file changed, 4 insertions(+), 9 deletions(-) > > diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c b/drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c > index 0e6401c..d7ac511 100644 > --- a/drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c > +++ b/drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c > @@ -671,16 +671,11 @@ 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)) > - return -EINVAL; > + ret = match_string(modes_str, ARRAY_SIZE(modes_str), buf); > + if (ret < 0) > + return ret; > > + bt_force_ant_mode = ret; > ret = 0; > mutex_lock(&mvm->mutex); > if (mvm->bt_force_ant_mode == bt_force_ant_mode) > -- > 1.7.12.4 > -- With Best Regards, Andy Shevchenko