diff mbox series

[3/4] vhost: Fix lines over 80 characters

Message ID 20221028160251.268607-4-eperezma@redhat.com (mailing list archive)
State New, archived
Headers show
Series Endianess and coding style fixes for SVQ event idx support | expand

Commit Message

Eugenio Perez Martin Oct. 28, 2022, 4:02 p.m. UTC
By qemu coding style.

Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
---
 hw/virtio/vhost-shadow-virtqueue.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

Comments

Michael S. Tsirkin Oct. 28, 2022, 4:45 p.m. UTC | #1
On Fri, Oct 28, 2022 at 06:02:50PM +0200, Eugenio Pérez wrote:
> By qemu coding style.
> 
> Signed-off-by: Eugenio Pérez <eperezma@redhat.com>

You wrote this code originally so I don't mind but just to note I don't
want a flurry of patches "fixing" lines over 80 chars.

> ---
>  hw/virtio/vhost-shadow-virtqueue.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/hw/virtio/vhost-shadow-virtqueue.c b/hw/virtio/vhost-shadow-virtqueue.c
> index 467099f5d9..18a49e1ecb 100644
> --- a/hw/virtio/vhost-shadow-virtqueue.c
> +++ b/hw/virtio/vhost-shadow-virtqueue.c
> @@ -228,8 +228,11 @@ static void vhost_svq_kick(VhostShadowVirtqueue *svq)
>      smp_mb();
>  
>      if (virtio_vdev_has_feature(svq->vdev, VIRTIO_RING_F_EVENT_IDX)) {
> -        uint16_t avail_event = *(uint16_t *)(&svq->vring.used->ring[svq->vring.num]);
> -        needs_kick = vring_need_event(avail_event, svq->shadow_avail_idx, svq->shadow_avail_idx - 1);
> +        size_t num = svq->vring.num;
> +        uint16_t *avail_event = (uint16_t *)&svq->vring.used->ring[num];
> +
> +        needs_kick = vring_need_event(*avail_event, svq->shadow_avail_idx,
> +                                      svq->shadow_avail_idx - 1);
>      } else {
>          needs_kick = !(svq->vring.used->flags & VRING_USED_F_NO_NOTIFY);
>      }
> -- 
> 2.31.1
Eugenio Perez Martin Oct. 31, 2022, 7:43 a.m. UTC | #2
On Fri, Oct 28, 2022 at 6:45 PM Michael S. Tsirkin <mst@redhat.com> wrote:
>
> On Fri, Oct 28, 2022 at 06:02:50PM +0200, Eugenio Pérez wrote:
> > By qemu coding style.
> >
> > Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
>
> You wrote this code originally so I don't mind but just to note I don't
> want a flurry of patches "fixing" lines over 80 chars.
>

My bad, I didn't realize it the first time I sent it. I probably
missed to run checkpatch.

This patch can be merged with the next one if it is more convenient.

> > ---
> >  hw/virtio/vhost-shadow-virtqueue.c | 7 +++++--
> >  1 file changed, 5 insertions(+), 2 deletions(-)
> >
> > diff --git a/hw/virtio/vhost-shadow-virtqueue.c b/hw/virtio/vhost-shadow-virtqueue.c
> > index 467099f5d9..18a49e1ecb 100644
> > --- a/hw/virtio/vhost-shadow-virtqueue.c
> > +++ b/hw/virtio/vhost-shadow-virtqueue.c
> > @@ -228,8 +228,11 @@ static void vhost_svq_kick(VhostShadowVirtqueue *svq)
> >      smp_mb();
> >
> >      if (virtio_vdev_has_feature(svq->vdev, VIRTIO_RING_F_EVENT_IDX)) {
> > -        uint16_t avail_event = *(uint16_t *)(&svq->vring.used->ring[svq->vring.num]);
> > -        needs_kick = vring_need_event(avail_event, svq->shadow_avail_idx, svq->shadow_avail_idx - 1);
> > +        size_t num = svq->vring.num;
> > +        uint16_t *avail_event = (uint16_t *)&svq->vring.used->ring[num];
> > +
> > +        needs_kick = vring_need_event(*avail_event, svq->shadow_avail_idx,
> > +                                      svq->shadow_avail_idx - 1);
> >      } else {
> >          needs_kick = !(svq->vring.used->flags & VRING_USED_F_NO_NOTIFY);
> >      }
> > --
> > 2.31.1
>
diff mbox series

Patch

diff --git a/hw/virtio/vhost-shadow-virtqueue.c b/hw/virtio/vhost-shadow-virtqueue.c
index 467099f5d9..18a49e1ecb 100644
--- a/hw/virtio/vhost-shadow-virtqueue.c
+++ b/hw/virtio/vhost-shadow-virtqueue.c
@@ -228,8 +228,11 @@  static void vhost_svq_kick(VhostShadowVirtqueue *svq)
     smp_mb();
 
     if (virtio_vdev_has_feature(svq->vdev, VIRTIO_RING_F_EVENT_IDX)) {
-        uint16_t avail_event = *(uint16_t *)(&svq->vring.used->ring[svq->vring.num]);
-        needs_kick = vring_need_event(avail_event, svq->shadow_avail_idx, svq->shadow_avail_idx - 1);
+        size_t num = svq->vring.num;
+        uint16_t *avail_event = (uint16_t *)&svq->vring.used->ring[num];
+
+        needs_kick = vring_need_event(*avail_event, svq->shadow_avail_idx,
+                                      svq->shadow_avail_idx - 1);
     } else {
         needs_kick = !(svq->vring.used->flags & VRING_USED_F_NO_NOTIFY);
     }