From: Alex Williamson <alex.williamson@redhat.com>
To: Yisheng Xie <xieyisheng1@huawei.com>
Cc: <linux-kernel@vger.kernel.org>, <kvm@vger.kernel.org>
Subject: Re: [PATCH 08/33] vfio: use match_string() helper
Date: Fri, 25 May 2018 14:55:32 -0600 [thread overview]
Message-ID: <20180525145532.1de2e94f@w520.home> (raw)
In-Reply-To: <1526903890-35761-9-git-send-email-xieyisheng1@huawei.com>
On Mon, 21 May 2018 19:57:45 +0800
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.
>
> Cc: Alex Williamson <alex.williamson@redhat.com>
> Cc: kvm@vger.kernel.org
> Signed-off-by: Yisheng Xie <xieyisheng1@huawei.com>
> ---
> drivers/vfio/vfio.c | 11 +++--------
> 1 file changed, 3 insertions(+), 8 deletions(-)
Applied to the vfio next branch for v4.18 with Andy's R-b. Thanks,
Alex
> diff --git a/drivers/vfio/vfio.c b/drivers/vfio/vfio.c
> index 721f97f..6483387 100644
> --- a/drivers/vfio/vfio.c
> +++ b/drivers/vfio/vfio.c
> @@ -630,8 +630,6 @@ static struct vfio_device *vfio_group_get_device(struct vfio_group *group,
>
> static bool vfio_dev_whitelisted(struct device *dev, struct device_driver *drv)
> {
> - int i;
> -
> if (dev_is_pci(dev)) {
> struct pci_dev *pdev = to_pci_dev(dev);
>
> @@ -639,12 +637,9 @@ static bool vfio_dev_whitelisted(struct device *dev, struct device_driver *drv)
> return true;
> }
>
> - for (i = 0; i < ARRAY_SIZE(vfio_driver_whitelist); i++) {
> - if (!strcmp(drv->name, vfio_driver_whitelist[i]))
> - return true;
> - }
> -
> - return false;
> + return match_string(vfio_driver_whitelist,
> + ARRAY_SIZE(vfio_driver_whitelist),
> + drv->name) >= 0;
> }
>
> /*
prev parent reply other threads:[~2018-05-25 20:55 UTC|newest]
Thread overview: 2+ 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 08/33] vfio: use match_string() helper Yisheng Xie
2018-05-25 20:55 ` Alex Williamson [this message]
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=20180525145532.1de2e94f@w520.home \
--to=alex.williamson@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@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