aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/virtio_net.c
diff options
context:
space:
mode:
authorSasha Levin <levinsasha928@gmail.com>2011-08-14 10:52:33 -0400
committerRusty Russell <rusty@rustcorp.com.au>2011-11-01 21:10:58 -0400
commit77dd7693c52d002d24be6842fb0b766116a6079f (patch)
tree5717a04c0cc07d94c744a1162abcbff70a3102c6 /drivers/net/virtio_net.c
parent3ead6f4d42e2866a48d7abf9bc98553f1110b6df (diff)
virtio-net: Use virtio_config_val() for retrieving config
This patch modifies virtio-net to use virtio_config_val() instead of a 'if(virtio_has_feature()) vdev->config->get()' construct to retrieve optional values from the config space. Cc: Amit Shah <amit.shah@redhat.com> Cc: "Michael S. Tsirkin" <mst@redhat.com> Cc: Rusty Russell <rusty@rustcorp.com.au> Cc: virtualization@lists.linux-foundation.org Signed-off-by: Sasha Levin <levinsasha928@gmail.com> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Diffstat (limited to 'drivers/net/virtio_net.c')
-rw-r--r--drivers/net/virtio_net.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index 91039ab16728..6ee8410443c4 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -925,12 +925,10 @@ static void virtnet_update_status(struct virtnet_info *vi)
925{ 925{
926 u16 v; 926 u16 v;
927 927
928 if (!virtio_has_feature(vi->vdev, VIRTIO_NET_F_STATUS)) 928 if (virtio_config_val(vi->vdev, VIRTIO_NET_F_STATUS,
929 return;
930
931 vi->vdev->config->get(vi->vdev,
932 offsetof(struct virtio_net_config, status), 929 offsetof(struct virtio_net_config, status),
933 &v, sizeof(v)); 930 &v) < 0)
931 return;
934 932
935 /* Ignore unknown (future) status bits */ 933 /* Ignore unknown (future) status bits */
936 v &= VIRTIO_NET_S_LINK_UP; 934 v &= VIRTIO_NET_S_LINK_UP;
@@ -1006,11 +1004,9 @@ static int virtnet_probe(struct virtio_device *vdev)
1006 } 1004 }
1007 1005
1008 /* Configuration may specify what MAC to use. Otherwise random. */ 1006 /* Configuration may specify what MAC to use. Otherwise random. */
1009 if (virtio_has_feature(vdev, VIRTIO_NET_F_MAC)) { 1007 if (virtio_config_val_len(vdev, VIRTIO_NET_F_MAC,
1010 vdev->config->get(vdev,
1011 offsetof(struct virtio_net_config, mac), 1008 offsetof(struct virtio_net_config, mac),
1012 dev->dev_addr, dev->addr_len); 1009 dev->dev_addr, dev->addr_len) < 0)
1013 } else
1014 random_ether_addr(dev->dev_addr); 1010 random_ether_addr(dev->dev_addr);
1015 1011
1016 /* Set up our device-specific information */ 1012 /* Set up our device-specific information */