aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/caif
diff options
context:
space:
mode:
authorRusty Russell <rusty@rustcorp.com.au>2013-10-14 03:41:51 -0400
committerRusty Russell <rusty@rustcorp.com.au>2013-10-16 20:25:37 -0400
commit855e0c5288177bcb193f6f6316952d2490478e1c (patch)
tree7c5cfed44c9def1a7ca3388f37a9520de52af44b /drivers/net/caif
parent0b90d0622ad290b3717a13489b396af52aea9d2d (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/net/caif')
-rw-r--r--drivers/net/caif/caif_virtio.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/drivers/net/caif/caif_virtio.c b/drivers/net/caif/caif_virtio.c
index b9ed1288ce2d..985608634f8c 100644
--- a/drivers/net/caif/caif_virtio.c
+++ b/drivers/net/caif/caif_virtio.c
@@ -686,18 +686,19 @@ static int cfv_probe(struct virtio_device *vdev)
686 goto err; 686 goto err;
687 687
688 /* Get the CAIF configuration from virtio config space, if available */ 688 /* Get the CAIF configuration from virtio config space, if available */
689#define GET_VIRTIO_CONFIG_OPS(_v, _var, _f) \
690 ((_v)->config->get(_v, offsetof(struct virtio_caif_transf_config, _f), \
691 &_var, \
692 FIELD_SIZEOF(struct virtio_caif_transf_config, _f)))
693
694 if (vdev->config->get) { 689 if (vdev->config->get) {
695 GET_VIRTIO_CONFIG_OPS(vdev, cfv->tx_hr, headroom); 690 virtio_cread(vdev, struct virtio_caif_transf_config, headroom,
696 GET_VIRTIO_CONFIG_OPS(vdev, cfv->rx_hr, headroom); 691 &cfv->tx_hr);
697 GET_VIRTIO_CONFIG_OPS(vdev, cfv->tx_tr, tailroom); 692 virtio_cread(vdev, struct virtio_caif_transf_config, headroom,
698 GET_VIRTIO_CONFIG_OPS(vdev, cfv->rx_tr, tailroom); 693 &cfv->rx_hr);
699 GET_VIRTIO_CONFIG_OPS(vdev, cfv->mtu, mtu); 694 virtio_cread(vdev, struct virtio_caif_transf_config, tailroom,
700 GET_VIRTIO_CONFIG_OPS(vdev, cfv->mru, mtu); 695 &cfv->tx_tr);
696 virtio_cread(vdev, struct virtio_caif_transf_config, tailroom,
697 &cfv->rx_tr);
698 virtio_cread(vdev, struct virtio_caif_transf_config, mtu,
699 &cfv->mtu);
700 virtio_cread(vdev, struct virtio_caif_transf_config, mtu,
701 &cfv->mru);
701 } else { 702 } else {
702 cfv->tx_hr = CFV_DEF_HEADROOM; 703 cfv->tx_hr = CFV_DEF_HEADROOM;
703 cfv->rx_hr = CFV_DEF_HEADROOM; 704 cfv->rx_hr = CFV_DEF_HEADROOM;