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/char | |
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/char')
-rw-r--r-- | drivers/char/virtio_console.c | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c index 862fd54a0ffb..2a8d9a7a1834 100644 --- a/drivers/char/virtio_console.c +++ b/drivers/char/virtio_console.c | |||
@@ -1837,12 +1837,8 @@ static void config_intr(struct virtio_device *vdev) | |||
1837 | struct port *port; | 1837 | struct port *port; |
1838 | u16 rows, cols; | 1838 | u16 rows, cols; |
1839 | 1839 | ||
1840 | vdev->config->get(vdev, | 1840 | virtio_cread(vdev, struct virtio_console_config, cols, &cols); |
1841 | offsetof(struct virtio_console_config, cols), | 1841 | virtio_cread(vdev, struct virtio_console_config, rows, &rows); |
1842 | &cols, sizeof(u16)); | ||
1843 | vdev->config->get(vdev, | ||
1844 | offsetof(struct virtio_console_config, rows), | ||
1845 | &rows, sizeof(u16)); | ||
1846 | 1842 | ||
1847 | port = find_port_by_id(portdev, 0); | 1843 | port = find_port_by_id(portdev, 0); |
1848 | set_console_size(port, rows, cols); | 1844 | set_console_size(port, rows, cols); |
@@ -2014,10 +2010,9 @@ static int virtcons_probe(struct virtio_device *vdev) | |||
2014 | 2010 | ||
2015 | /* Don't test MULTIPORT at all if we're rproc: not a valid feature! */ | 2011 | /* Don't test MULTIPORT at all if we're rproc: not a valid feature! */ |
2016 | if (!is_rproc_serial(vdev) && | 2012 | if (!is_rproc_serial(vdev) && |
2017 | virtio_config_val(vdev, VIRTIO_CONSOLE_F_MULTIPORT, | 2013 | virtio_cread_feature(vdev, VIRTIO_CONSOLE_F_MULTIPORT, |
2018 | offsetof(struct virtio_console_config, | 2014 | struct virtio_console_config, max_nr_ports, |
2019 | max_nr_ports), | 2015 | &portdev->config.max_nr_ports) == 0) { |
2020 | &portdev->config.max_nr_ports) == 0) { | ||
2021 | multiport = true; | 2016 | multiport = true; |
2022 | } | 2017 | } |
2023 | 2018 | ||