diff options
author | Mark Rutland <mark.rutland@arm.com> | 2016-11-24 05:25:14 -0500 |
---|---|---|
committer | Michael S. Tsirkin <mst@redhat.com> | 2016-12-15 17:13:37 -0500 |
commit | ea9156fb3b71d9f7e383253eaff9dd7498b23276 (patch) | |
tree | 5a15cacee7e8f723c8a59533c7a89c3950257dfa | |
parent | 9d1b972f8a25bba01ecfc1d90d7a2fbf1923d052 (diff) |
tools/virtio: use {READ,WRITE}_ONCE() in uaccess.h
As a step towards killing off ACCESS_ONCE, use {READ,WRITE}_ONCE() for the
virtio tools uaccess primitives, pulling these in from <linux/compiler.h>.
With this done, we can kill off the now-unused ACCESS_ONCE() definition.
Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Cc: Jason Wang <jasowang@redhat.com>
Cc: Michael S. Tsirkin <mst@redhat.com>
Cc: linux-kernel@vger.kernel.org
Cc: virtualization@lists.linux-foundation.org
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Reviewed-by: Jason Wang <jasowang@redhat.com>
-rw-r--r-- | tools/virtio/linux/uaccess.h | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/tools/virtio/linux/uaccess.h b/tools/virtio/linux/uaccess.h index 0a578fe18653..fa05d01b2c90 100644 --- a/tools/virtio/linux/uaccess.h +++ b/tools/virtio/linux/uaccess.h | |||
@@ -1,8 +1,9 @@ | |||
1 | #ifndef UACCESS_H | 1 | #ifndef UACCESS_H |
2 | #define UACCESS_H | 2 | #define UACCESS_H |
3 | extern void *__user_addr_min, *__user_addr_max; | ||
4 | 3 | ||
5 | #define ACCESS_ONCE(x) (*(volatile typeof(x) *)&(x)) | 4 | #include <linux/compiler.h> |
5 | |||
6 | extern void *__user_addr_min, *__user_addr_max; | ||
6 | 7 | ||
7 | static inline void __chk_user_ptr(const volatile void *p, size_t size) | 8 | static inline void __chk_user_ptr(const volatile void *p, size_t size) |
8 | { | 9 | { |
@@ -13,7 +14,7 @@ static inline void __chk_user_ptr(const volatile void *p, size_t size) | |||
13 | ({ \ | 14 | ({ \ |
14 | typeof(ptr) __pu_ptr = (ptr); \ | 15 | typeof(ptr) __pu_ptr = (ptr); \ |
15 | __chk_user_ptr(__pu_ptr, sizeof(*__pu_ptr)); \ | 16 | __chk_user_ptr(__pu_ptr, sizeof(*__pu_ptr)); \ |
16 | ACCESS_ONCE(*(__pu_ptr)) = x; \ | 17 | WRITE_ONCE(*(__pu_ptr), x); \ |
17 | 0; \ | 18 | 0; \ |
18 | }) | 19 | }) |
19 | 20 | ||
@@ -21,7 +22,7 @@ static inline void __chk_user_ptr(const volatile void *p, size_t size) | |||
21 | ({ \ | 22 | ({ \ |
22 | typeof(ptr) __pu_ptr = (ptr); \ | 23 | typeof(ptr) __pu_ptr = (ptr); \ |
23 | __chk_user_ptr(__pu_ptr, sizeof(*__pu_ptr)); \ | 24 | __chk_user_ptr(__pu_ptr, sizeof(*__pu_ptr)); \ |
24 | x = ACCESS_ONCE(*(__pu_ptr)); \ | 25 | x = READ_ONCE(*(__pu_ptr)); \ |
25 | 0; \ | 26 | 0; \ |
26 | }) | 27 | }) |
27 | 28 | ||