[PATCH v5 1/9] hw/virtio: Constify virtio_is_big_endian() argument

Pierrick Bouvier posted 9 patches 2 days, 19 hours ago
Maintainers: "Michael S. Tsirkin" <mst@redhat.com>, Stefano Garzarella <sgarzare@redhat.com>, Nicholas Piggin <npiggin@gmail.com>, Harsh Prateek Bora <harshpb@linux.ibm.com>
[PATCH v5 1/9] hw/virtio: Constify virtio_is_big_endian() argument
Posted by Pierrick Bouvier 2 days, 19 hours ago
From: Philippe Mathieu-Daudé <philmd@linaro.org>

VirtIODevice argument is accessed read-only, make it const.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
---
 include/hw/virtio/virtio.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/hw/virtio/virtio.h b/include/hw/virtio/virtio.h
index 27cd98d2fe1..65872f2c54c 100644
--- a/include/hw/virtio/virtio.h
+++ b/include/hw/virtio/virtio.h
@@ -468,7 +468,7 @@ static inline bool virtio_host_has_feature(VirtIODevice *vdev,
     return virtio_has_feature(vdev->host_features, fbit);
 }
 
-static inline bool virtio_is_big_endian(VirtIODevice *vdev)
+static inline bool virtio_is_big_endian(const VirtIODevice *vdev)
 {
     if (!virtio_vdev_has_feature(vdev, VIRTIO_F_VERSION_1)) {
         assert(vdev->device_endian != VIRTIO_DEVICE_ENDIAN_UNKNOWN);
-- 
2.47.3


Re: [PATCH v5 1/9] hw/virtio: Constify virtio_is_big_endian() argument
Posted by Richard Henderson 13 hours ago
On 2/7/26 08:19, Pierrick Bouvier wrote:
> From: Philippe Mathieu-Daudé <philmd@linaro.org>
> 
> VirtIODevice argument is accessed read-only, make it const.
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
> ---
>   include/hw/virtio/virtio.h | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

r~

> 
> diff --git a/include/hw/virtio/virtio.h b/include/hw/virtio/virtio.h
> index 27cd98d2fe1..65872f2c54c 100644
> --- a/include/hw/virtio/virtio.h
> +++ b/include/hw/virtio/virtio.h
> @@ -468,7 +468,7 @@ static inline bool virtio_host_has_feature(VirtIODevice *vdev,
>       return virtio_has_feature(vdev->host_features, fbit);
>   }
>   
> -static inline bool virtio_is_big_endian(VirtIODevice *vdev)
> +static inline bool virtio_is_big_endian(const VirtIODevice *vdev)
>   {
>       if (!virtio_vdev_has_feature(vdev, VIRTIO_F_VERSION_1)) {
>           assert(vdev->device_endian != VIRTIO_DEVICE_ENDIAN_UNKNOWN);