mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH][next] virtio_vdpa: remove redundant check on desc
@ 2024-11-07 13:21 Colin Ian King
  2024-11-07 14:51 ` Eugenio Perez Martin
  0 siblings, 1 reply; 2+ messages in thread
From: Colin Ian King @ 2024-11-07 13:21 UTC (permalink / raw)
  To: Michael S . Tsirkin, Jason Wang, Xuan Zhuo, Eugenio Pérez,
	virtualization
  Cc: kernel-janitors, linux-kernel

The boolean variable has_affinity is true when desc is non-null and
ops->set_vq_affinity is non-null. Hence the call to create_affinity_masks
does not need to check for desc being non-null is redundant when
has_affinity is true, so it can be removed as well as the now unused
default_affd.

Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
---
 drivers/virtio/virtio_vdpa.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/virtio/virtio_vdpa.c b/drivers/virtio/virtio_vdpa.c
index 7364bd53e38d..1f60c9d5cb18 100644
--- a/drivers/virtio/virtio_vdpa.c
+++ b/drivers/virtio/virtio_vdpa.c
@@ -364,14 +364,13 @@ static int virtio_vdpa_find_vqs(struct virtio_device *vdev, unsigned int nvqs,
 	struct virtio_vdpa_device *vd_dev = to_virtio_vdpa_device(vdev);
 	struct vdpa_device *vdpa = vd_get_vdpa(vdev);
 	const struct vdpa_config_ops *ops = vdpa->config;
-	struct irq_affinity default_affd = { 0 };
 	struct cpumask *masks;
 	struct vdpa_callback cb;
 	bool has_affinity = desc && ops->set_vq_affinity;
 	int i, err, queue_idx = 0;
 
 	if (has_affinity) {
-		masks = create_affinity_masks(nvqs, desc ? desc : &default_affd);
+		masks = create_affinity_masks(nvqs, desc);
 		if (!masks)
 			return -ENOMEM;
 	}
-- 
2.39.5


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH][next] virtio_vdpa: remove redundant check on desc
  2024-11-07 13:21 [PATCH][next] virtio_vdpa: remove redundant check on desc Colin Ian King
@ 2024-11-07 14:51 ` Eugenio Perez Martin
  0 siblings, 0 replies; 2+ messages in thread
From: Eugenio Perez Martin @ 2024-11-07 14:51 UTC (permalink / raw)
  To: Colin Ian King
  Cc: Michael S . Tsirkin, Jason Wang, Xuan Zhuo, virtualization,
	kernel-janitors, linux-kernel

On Thu, Nov 7, 2024 at 2:21 PM Colin Ian King <colin.i.king@gmail.com> wrote:
>
> The boolean variable has_affinity is true when desc is non-null and
> ops->set_vq_affinity is non-null. Hence the call to create_affinity_masks
> does not need to check for desc being non-null is redundant when
> has_affinity is true, so it can be removed as well as the now unused
> default_affd.
>

Acked-by: Eugenio Pérez <eperezma@redhat.com>

Thanks!

> Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
> ---
>  drivers/virtio/virtio_vdpa.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/virtio/virtio_vdpa.c b/drivers/virtio/virtio_vdpa.c
> index 7364bd53e38d..1f60c9d5cb18 100644
> --- a/drivers/virtio/virtio_vdpa.c
> +++ b/drivers/virtio/virtio_vdpa.c
> @@ -364,14 +364,13 @@ static int virtio_vdpa_find_vqs(struct virtio_device *vdev, unsigned int nvqs,
>         struct virtio_vdpa_device *vd_dev = to_virtio_vdpa_device(vdev);
>         struct vdpa_device *vdpa = vd_get_vdpa(vdev);
>         const struct vdpa_config_ops *ops = vdpa->config;
> -       struct irq_affinity default_affd = { 0 };
>         struct cpumask *masks;
>         struct vdpa_callback cb;
>         bool has_affinity = desc && ops->set_vq_affinity;
>         int i, err, queue_idx = 0;
>
>         if (has_affinity) {
> -               masks = create_affinity_masks(nvqs, desc ? desc : &default_affd);
> +               masks = create_affinity_masks(nvqs, desc);
>                 if (!masks)
>                         return -ENOMEM;
>         }
> --
> 2.39.5
>


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-11-07 14:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-11-07 13:21 [PATCH][next] virtio_vdpa: remove redundant check on desc Colin Ian King
2024-11-07 14:51 ` Eugenio Perez Martin

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®