mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 19:21:31 -04:00
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 <[email protected]>
This commit is contained in:
parent
0b90d0622a
commit
855e0c5288
7 changed files with 79 additions and 95 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Reference in a new issue