Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

+9 -10
+9 -10
include/linux/virtio_ring.h
··· 46 46 dma_wmb(); 47 47 } 48 48 49 - static inline void virtio_store_mb(bool weak_barriers, 50 - __virtio16 *p, __virtio16 v) 51 - { 52 - if (weak_barriers) { 53 - virt_store_mb(*p, v); 54 - } else { 55 - WRITE_ONCE(*p, v); 56 - mb(); 57 - } 58 - } 49 + #define virtio_store_mb(weak_barriers, p, v) \ 50 + do { \ 51 + if (weak_barriers) { \ 52 + virt_store_mb(*p, v); \ 53 + } else { \ 54 + WRITE_ONCE(*p, v); \ 55 + mb(); \ 56 + } \ 57 + } while (0) \ 59 58 60 59 struct virtio_device; 61 60 struct virtqueue;