Skip to content

Commit

Permalink
vringh: kill off ACCESS_ONCE()
Browse files Browse the repository at this point in the history
Despite living under drivers/ vringh.c is also used as part of the userspace
virtio tools. Before we can kill off the ACCESS_ONCE()definition in the tools,
we must convert vringh.c to use {READ,WRITE}_ONCE().

This patch does so, along with the required include of <linux/compiler.h> for
the relevant definitions. The userspace tools provide their own definitions in
their own <linux/compiler.h>.

Signed-off-by: Mark Rutland <[email protected]>
Cc: Jason Wang <[email protected]>
Cc: Michael S. Tsirkin <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Signed-off-by: Michael S. Tsirkin <[email protected]>
Reviewed-by: Christian Borntraeger <[email protected]>
Reviewed-by: Cornelia Huck <[email protected]>
Reviewed-by: Jason Wang <[email protected]>
  • Loading branch information
Mark Rutland authored and mstsirkin committed Dec 15, 2016
1 parent 5da889c commit 9d1b972
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions drivers/vhost/vringh.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
*
* Since these may be in userspace, we use (inline) accessors.
*/
#include <linux/compiler.h>
#include <linux/module.h>
#include <linux/vringh.h>
#include <linux/virtio_ring.h>
Expand Down Expand Up @@ -820,13 +821,13 @@ EXPORT_SYMBOL(vringh_need_notify_user);
static inline int getu16_kern(const struct vringh *vrh,
u16 *val, const __virtio16 *p)
{
*val = vringh16_to_cpu(vrh, ACCESS_ONCE(*p));
*val = vringh16_to_cpu(vrh, READ_ONCE(*p));
return 0;
}

static inline int putu16_kern(const struct vringh *vrh, __virtio16 *p, u16 val)
{
ACCESS_ONCE(*p) = cpu_to_vringh16(vrh, val);
WRITE_ONCE(*p, cpu_to_vringh16(vrh, val));
return 0;
}

Expand Down

0 comments on commit 9d1b972

Please sign in to comment.