diff options
author | Rusty Russell <rusty@rustcorp.com.au> | 2013-10-14 03:41:51 -0400 |
---|---|---|
committer | Rusty Russell <rusty@rustcorp.com.au> | 2013-10-16 20:25:37 -0400 |
commit | 855e0c5288177bcb193f6f6316952d2490478e1c (patch) | |
tree | 7c5cfed44c9def1a7ca3388f37a9520de52af44b /drivers/virtio | |
parent | 0b90d0622ad290b3717a13489b396af52aea9d2d (diff) |
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>
Diffstat (limited to 'drivers/virtio')
-rw-r--r-- | drivers/virtio/virtio_balloon.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/drivers/virtio/virtio_balloon.c b/drivers/virtio/virtio_balloon.c index d6f681641606..c444654fc33f 100644 --- a/drivers/virtio/virtio_balloon.c +++ b/drivers/virtio/virtio_balloon.c | |||
@@ -275,9 +275,8 @@ static inline s64 towards_target(struct virtio_balloon *vb) | |||
275 | __le32 v; | 275 | __le32 v; |
276 | s64 target; | 276 | s64 target; |
277 | 277 | ||
278 | vb->vdev->config->get(vb->vdev, | 278 | virtio_cread(vb->vdev, struct virtio_balloon_config, num_pages, &v); |
279 | offsetof(struct virtio_balloon_config, num_pages), | 279 | |
280 | &v, sizeof(v)); | ||
281 | target = le32_to_cpu(v); | 280 | target = le32_to_cpu(v); |
282 | return target - vb->num_pages; | 281 | return target - vb->num_pages; |
283 | } | 282 | } |
@@ -286,9 +285,8 @@ static void update_balloon_size(struct virtio_balloon *vb) | |||
286 | { | 285 | { |
287 | __le32 actual = cpu_to_le32(vb->num_pages); | 286 | __le32 actual = cpu_to_le32(vb->num_pages); |
288 | 287 | ||
289 | vb->vdev->config->set(vb->vdev, | 288 | virtio_cwrite(vb->vdev, struct virtio_balloon_config, num_pages, |
290 | offsetof(struct virtio_balloon_config, actual), | 289 | &actual); |
291 | &actual, sizeof(actual)); | ||
292 | } | 290 | } |
293 | 291 | ||
294 | static int balloon(void *_vballoon) | 292 | static int balloon(void *_vballoon) |