virtio_ring: Use const to annotate read-only pointer params
authorFeng Liu <feliu@nvidia.com>
Fri, 10 Mar 2023 05:34:28 +0000 (07:34 +0200)
committerMichael S. Tsirkin <mst@redhat.com>
Fri, 21 Apr 2023 07:02:30 +0000 (03:02 -0400)
commit4b6ec919b84830949313c805c586fb34f141ce0c
tree9ea84e743a3153a851b64387c5c4f1523782aba7
parent1adbd6b2fc0c09645c4c30c5eb47beaa3e6ea4b4
virtio_ring: Use const to annotate read-only pointer params

Add const to make the read-only pointer parameters clear, similar to
many existing functions.

To implement this change, the commit also introduces the use of
`container_of_const` to implement `to_vvq`, which ensures the const-ness
of read-only parameters and avoids accidental modification of their
members.

Signed-off-by: Feng Liu <feliu@nvidia.com>
Reviewed-by: Jiri Pirko <jiri@nvidia.com>
Reviewed-by: Parav Pandit <parav@nvidia.com>
Reviewed-by: Gavin Li <gavinl@nvidia.com>
Reviewed-by: Bodong Wang <bodong@nvidia.com>
Message-Id: <20230310053428.3376-4-feliu@nvidia.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
drivers/virtio/virtio_ring.c
include/linux/virtio.h