virtio: use size-based config accessors.
This lets the transport do endian conversion if necessary, and insulates the drivers from the difference. Most drivers can use the simple helpers virtio_cread() and virtio_cwrite(). Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
@@ -275,9 +275,8 @@ static inline s64 towards_target(struct virtio_balloon *vb)
|
||||
__le32 v;
|
||||
s64 target;
|
||||
|
||||
vb->vdev->config->get(vb->vdev,
|
||||
offsetof(struct virtio_balloon_config, num_pages),
|
||||
&v, sizeof(v));
|
||||
virtio_cread(vb->vdev, struct virtio_balloon_config, num_pages, &v);
|
||||
|
||||
target = le32_to_cpu(v);
|
||||
return target - vb->num_pages;
|
||||
}
|
||||
@@ -286,9 +285,8 @@ static void update_balloon_size(struct virtio_balloon *vb)
|
||||
{
|
||||
__le32 actual = cpu_to_le32(vb->num_pages);
|
||||
|
||||
vb->vdev->config->set(vb->vdev,
|
||||
offsetof(struct virtio_balloon_config, actual),
|
||||
&actual, sizeof(actual));
|
||||
virtio_cwrite(vb->vdev, struct virtio_balloon_config, num_pages,
|
||||
&actual);
|
||||
}
|
||||
|
||||
static int balloon(void *_vballoon)
|
||||
|
Reference in New Issue
Block a user