From: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
To: shaoqin.huang@intel.com
Cc: linux-kernel@vger.kernel.org,
virtualization@lists.linux-foundation.org, mst@redhat.com,
jasowang@redhat.com
Subject: Re: [PATCH 1/2] virtio_pci: use helper function is_power_of_2()
Date: Mon, 24 Oct 2022 19:33:10 +0800 [thread overview]
Message-ID: <1666611190.2063382-1-xuanzhuo@linux.alibaba.com> (raw)
In-Reply-To: <20221021062734.228881-2-shaoqin.huang@intel.com>
On Thu, 20 Oct 2022 23:27:33 -0700, shaoqin.huang@intel.com wrote:
> From: Shaoqin Huang <shaoqin.huang@intel.com>
>
> Use helper function is_power_of_2() to check if num is power of two.
> Minor readability improvement.
>
> Signed-off-by: Shaoqin Huang <shaoqin.huang@intel.com>
Reviewed-by: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
> ---
> drivers/virtio/virtio_pci_modern.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/virtio/virtio_pci_modern.c b/drivers/virtio/virtio_pci_modern.c
> index c3b9f2761849..207294bd7b9d 100644
> --- a/drivers/virtio/virtio_pci_modern.c
> +++ b/drivers/virtio/virtio_pci_modern.c
> @@ -310,7 +310,7 @@ static struct virtqueue *setup_vq(struct virtio_pci_device *vp_dev,
> if (!num || vp_modern_get_queue_enable(mdev, index))
> return ERR_PTR(-ENOENT);
>
> - if (num & (num - 1)) {
> + if (!is_power_of_2(num)) {
> dev_warn(&vp_dev->pci_dev->dev, "bad queue size %u", num);
> return ERR_PTR(-EINVAL);
> }
> --
> 2.34.1
>
> _______________________________________________
> Virtualization mailing list
> Virtualization@lists.linux-foundation.org
> https://lists.linuxfoundation.org/mailman/listinfo/virtualization
next prev parent reply other threads:[~2022-10-24 11:35 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-21 6:27 [PATCH 0/2] virtio: " shaoqin.huang
2022-10-21 6:27 ` [PATCH 1/2] virtio_pci: " shaoqin.huang
2022-10-21 8:47 ` Philippe Mathieu-Daudé
2022-10-24 11:33 ` Xuan Zhuo [this message]
2022-10-21 6:27 ` [PATCH 2/2] virtio_ring: " shaoqin.huang
2022-10-21 8:53 ` Philippe Mathieu-Daudé
2022-10-22 12:31 ` Huang, Shaoqin
2022-10-24 11:33 ` Xuan Zhuo
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=1666611190.2063382-1-xuanzhuo@linux.alibaba.com \
--to=xuanzhuo@linux.alibaba.com \
--cc=jasowang@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mst@redhat.com \
--cc=shaoqin.huang@intel.com \
--cc=virtualization@lists.linux-foundation.org \
/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
all inboxes | Powered by JetHome®