diff mbox series

[v3,3/6] hw/net/virtio-net: make some VirtIONet const

Message ID 91f7437bab18dff4b1bb300c80f1367e492db7ca.1685623090.git.yin31149@gmail.com (mailing list archive)
State New, archived
Headers show
Series Vhost-vdpa Shadow Virtqueue Offloads support | expand

Commit Message

Hawkins Jiawei June 1, 2023, 1:48 p.m. UTC
The VirtIONet structure is not modified in
virtio_net_supported_guest_offloads().
Therefore, make it const to allow this function to
accept const variables.

Signed-off-by: Hawkins Jiawei <yin31149@gmail.com>
---
 hw/net/virtio-net.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Eugenio Perez Martin June 1, 2023, 2:15 p.m. UTC | #1
On Thu, Jun 1, 2023 at 3:49 PM Hawkins Jiawei <yin31149@gmail.com> wrote:
>
> The VirtIONet structure is not modified in
> virtio_net_supported_guest_offloads().
> Therefore, make it const to allow this function to
> accept const variables.
>
> Signed-off-by: Hawkins Jiawei <yin31149@gmail.com>

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

> ---
>  hw/net/virtio-net.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
> index 6df6b7329d..7b27dad6c4 100644
> --- a/hw/net/virtio-net.c
> +++ b/hw/net/virtio-net.c
> @@ -874,7 +874,7 @@ static uint64_t virtio_net_guest_offloads_by_features(uint32_t features)
>      return guest_offloads_mask & features;
>  }
>
> -static inline uint64_t virtio_net_supported_guest_offloads(VirtIONet *n)
> +static inline uint64_t virtio_net_supported_guest_offloads(const VirtIONet *n)
>  {
>      VirtIODevice *vdev = VIRTIO_DEVICE(n);
>      return virtio_net_guest_offloads_by_features(vdev->guest_features);
> --
> 2.25.1
>
diff mbox series

Patch

diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
index 6df6b7329d..7b27dad6c4 100644
--- a/hw/net/virtio-net.c
+++ b/hw/net/virtio-net.c
@@ -874,7 +874,7 @@  static uint64_t virtio_net_guest_offloads_by_features(uint32_t features)
     return guest_offloads_mask & features;
 }
 
-static inline uint64_t virtio_net_supported_guest_offloads(VirtIONet *n)
+static inline uint64_t virtio_net_supported_guest_offloads(const VirtIONet *n)
 {
     VirtIODevice *vdev = VIRTIO_DEVICE(n);
     return virtio_net_guest_offloads_by_features(vdev->guest_features);