summaryrefslogtreecommitdiff
path: root/include/linux/virtio_ring.h
diff options
context:
space:
mode:
authorMichael S. Tsirkin <mst@redhat.com>2020-07-10 06:46:04 -0400
committerMichael S. Tsirkin <mst@redhat.com>2020-08-05 09:30:19 -0400
commit5487196878bc926a1ee15069c13aa48b9a894fab (patch)
treeae2abb8bd9ae75b0e5633ea7dbdb88ba0114519c /include/linux/virtio_ring.h
parent8875bbba97087bf4a677071723d04fc00730f1e7 (diff)
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: Michael S. Tsirkin <mst@redhat.com> Acked-by: Cornelia Huck <cohuck@redhat.com>
Diffstat (limited to 'include/linux/virtio_ring.h')
-rw-r--r--include/linux/virtio_ring.h19
1 files changed, 9 insertions, 10 deletions
diff --git a/include/linux/virtio_ring.h b/include/linux/virtio_ring.h
index 3dc70adfe5f5..b485b13fa50b 100644
--- a/include/linux/virtio_ring.h
+++ b/include/linux/virtio_ring.h
@@ -46,16 +46,15 @@ static inline void virtio_wmb(bool weak_barriers)
dma_wmb();
}
-static inline void virtio_store_mb(bool weak_barriers,
- __virtio16 *p, __virtio16 v)
-{
- if (weak_barriers) {
- virt_store_mb(*p, v);
- } else {
- WRITE_ONCE(*p, v);
- mb();
- }
-}
+#define virtio_store_mb(weak_barriers, p, v) \
+do { \
+ if (weak_barriers) { \
+ virt_store_mb(*p, v); \
+ } else { \
+ WRITE_ONCE(*p, v); \
+ mb(); \
+ } \
+} while (0) \
struct virtio_device;
struct virtqueue;