From: Christoph Hellwig Date: Thu, 1 May 2025 14:22:30 +0000 (-0500) Subject: vringh: use bvec_kmap_local X-Git-Tag: v6.16-rc1~128^2~5 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=169294a14b3f80ce184fe832ff640b67a1b9eb3b;p=thirdparty%2Fkernel%2Flinux.git vringh: use bvec_kmap_local Use the bvec_kmap_local helper rather than digging into the bvec internals. Signed-off-by: Christoph Hellwig Message-Id: <20250501142244.2888227-1-hch@lst.de> Signed-off-by: Michael S. Tsirkin Reviewed-by: Chaitanya Kulkarni --- diff --git a/drivers/vhost/vringh.c b/drivers/vhost/vringh.c index 93735fc5c5b40..bbce654527013 100644 --- a/drivers/vhost/vringh.c +++ b/drivers/vhost/vringh.c @@ -1290,11 +1290,10 @@ static inline int getu16_iotlb(const struct vringh *vrh, if (ret) return ret; } else { - void *kaddr = kmap_local_page(ivec.iov.bvec[0].bv_page); - void *from = kaddr + ivec.iov.bvec[0].bv_offset; + __virtio16 *from = bvec_kmap_local(&ivec.iov.bvec[0]); - tmp = READ_ONCE(*(__virtio16 *)from); - kunmap_local(kaddr); + tmp = READ_ONCE(*from); + kunmap_local(from); } *val = vringh16_to_cpu(vrh, tmp); @@ -1329,11 +1328,10 @@ static inline int putu16_iotlb(const struct vringh *vrh, if (ret) return ret; } else { - void *kaddr = kmap_local_page(ivec.iov.bvec[0].bv_page); - void *to = kaddr + ivec.iov.bvec[0].bv_offset; + __virtio16 *to = bvec_kmap_local(&ivec.iov.bvec[0]); - WRITE_ONCE(*(__virtio16 *)to, tmp); - kunmap_local(kaddr); + WRITE_ONCE(*to, tmp); + kunmap_local(to); } return 0;