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/scsi | |
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/scsi')
-rw-r--r-- | drivers/scsi/virtio_scsi.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/drivers/scsi/virtio_scsi.c b/drivers/scsi/virtio_scsi.c index 2a110391f8ce..e6bb2352df40 100644 --- a/drivers/scsi/virtio_scsi.c +++ b/drivers/scsi/virtio_scsi.c | |||
@@ -710,19 +710,15 @@ static struct scsi_host_template virtscsi_host_template_multi = { | |||
710 | #define virtscsi_config_get(vdev, fld) \ | 710 | #define virtscsi_config_get(vdev, fld) \ |
711 | ({ \ | 711 | ({ \ |
712 | typeof(((struct virtio_scsi_config *)0)->fld) __val; \ | 712 | typeof(((struct virtio_scsi_config *)0)->fld) __val; \ |
713 | vdev->config->get(vdev, \ | 713 | virtio_cread(vdev, struct virtio_scsi_config, fld, &__val); \ |
714 | offsetof(struct virtio_scsi_config, fld), \ | ||
715 | &__val, sizeof(__val)); \ | ||
716 | __val; \ | 714 | __val; \ |
717 | }) | 715 | }) |
718 | 716 | ||
719 | #define virtscsi_config_set(vdev, fld, val) \ | 717 | #define virtscsi_config_set(vdev, fld, val) \ |
720 | (void)({ \ | 718 | do { \ |
721 | typeof(((struct virtio_scsi_config *)0)->fld) __val = (val); \ | 719 | typeof(((struct virtio_scsi_config *)0)->fld) __val = (val); \ |
722 | vdev->config->set(vdev, \ | 720 | virtio_cwrite(vdev, struct virtio_scsi_config, fld, &__val); \ |
723 | offsetof(struct virtio_scsi_config, fld), \ | 721 | } while(0) |
724 | &__val, sizeof(__val)); \ | ||
725 | }) | ||
726 | 722 | ||
727 | static void __virtscsi_set_affinity(struct virtio_scsi *vscsi, bool affinity) | 723 | static void __virtscsi_set_affinity(struct virtio_scsi *vscsi, bool affinity) |
728 | { | 724 | { |