From: Andy Shevchenko <andy.shevchenko@gmail.com>
To: Yisheng Xie <xieyisheng1@huawei.com>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Kalle Valo <kvalo@codeaurora.org>,
Intel Linux Wireless <linuxwifi@intel.com>,
Johannes Berg <johannes.berg@intel.com>,
Emmanuel Grumbach <emmanuel.grumbach@intel.com>,
"open list:TI WILINK WIRELES..." <linux-wireless@vger.kernel.org>,
netdev <netdev@vger.kernel.org>
Subject: Re: [PATCH 07/33] iwlwifi: mvm: use match_string() helper
Date: Tue, 22 May 2018 00:43:21 +0300 [thread overview]
Message-ID: <CAHp75VeFiEMN+q0FPuk4qTVEW_1oovHzVkV_Ydcm22SEMarvUA@mail.gmail.com> (raw)
In-Reply-To: <1526903890-35761-8-git-send-email-xieyisheng1@huawei.com>
On Mon, May 21, 2018 at 2:57 PM, Yisheng Xie <xieyisheng1@huawei.com> wrote:
> match_string() returns the index of an array for a matching string,
> which can be used intead of open coded variant.
> 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);
One line?
> + if (bt_force_ant_mode < 0)
> return -EINVAL;
I would rather use
ret = match_string();
if (ret < 0)
return ret;
bt_force_... = ret;
But it's up tu Loca.
>
> ret = 0;
--
With Best Regards,
Andy Shevchenko
next prev parent reply other threads:[~2018-05-21 21:43 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1526903890-35761-1-git-send-email-xieyisheng1@huawei.com>
2018-05-21 11:57 ` [PATCH 05/33] cxgb4: use match_string() helper Yisheng Xie
2018-05-21 21:39 ` Andy Shevchenko
2018-05-22 0:55 ` Yisheng Xie
2018-05-21 11:57 ` [PATCH 06/33] hp100: " Yisheng Xie
2018-05-21 11:57 ` [PATCH 07/33] iwlwifi: mvm: " Yisheng Xie
2018-05-21 20:12 ` Luca Coelho
2018-05-21 21:43 ` Andy Shevchenko [this message]
2018-05-22 3:30 ` Yisheng Xie
2018-05-22 20:41 ` Andy Shevchenko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAHp75VeFiEMN+q0FPuk4qTVEW_1oovHzVkV_Ydcm22SEMarvUA@mail.gmail.com \
--to=andy.shevchenko@gmail.com \
--cc=emmanuel.grumbach@intel.com \
--cc=johannes.berg@intel.com \
--cc=kvalo@codeaurora.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=linuxwifi@intel.com \
--cc=netdev@vger.kernel.org \
--cc=xieyisheng1@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).