Commit 54871968 authored by Michael S. Tsirkin's avatar Michael S. Tsirkin
Browse files

virtio_ring: sparse warning fixup



virtio_store_mb was built with split ring in mind so it accepts
__virtio16 arguments. Packed ring uses __le16 values, so sparse
complains.  It's just a store with some barriers so let's convert it to
a macro, we don't loose too much type safety by doing that.

Signed-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>
Acked-by: default avatarCornelia Huck <cohuck@redhat.com>
parent 8875bbba
Loading
Loading
Loading
Loading
+9 −10
Original line number Original line Diff line number Diff line
@@ -46,16 +46,15 @@ static inline void virtio_wmb(bool weak_barriers)
		dma_wmb();
		dma_wmb();
}
}


static inline void virtio_store_mb(bool weak_barriers,
#define virtio_store_mb(weak_barriers, p, v) \
				   __virtio16 *p, __virtio16 v)
do { \
{
	if (weak_barriers) { \
	if (weak_barriers) {
		virt_store_mb(*p, v); \
		virt_store_mb(*p, v);
	} else { \
	} else {
		WRITE_ONCE(*p, v); \
		WRITE_ONCE(*p, v);
		mb(); \
		mb();
	} \
	}
} while (0) \
}


struct virtio_device;
struct virtio_device;
struct virtqueue;
struct virtqueue;