History

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.

Sasha Levin committed 15 years ago

Commit 77dd7691 parent 3ead6f41 file · +5 −9Browse files

Unified · Split

drivers/net/virtio_net.c+5−9
@@ -925,12 +925,10 @@ static void virtnet_update_status(struct virtnet_info *vi) · 924 unmodified lines
925925 {
926926 u16 v;
927927
928− if (!virtio_has_feature(vi->vdev, VIRTIO_NET_F_STATUS))
929− return;
930−
931− vi->vdev->config->get(vi->vdev,
928+ if (virtio_config_val(vi->vdev, VIRTIO_NET_F_STATUS,
932929 offsetof(struct virtio_net_config, status),
933− &v, sizeof(v));
930+ &v) < 0)
931+ return;
934932
935933 /* Ignore unknown (future) status bits */
936934 v &= VIRTIO_NET_S_LINK_UP;
@@ -1006,11 +1004,9 @@ static int virtnet_probe(struct virtio_device *vdev) · 69 unmodified lines
10061004 }
10071005
10081006 /* Configuration may specify what MAC to use. Otherwise random. */
1009− if (virtio_has_feature(vdev, VIRTIO_NET_F_MAC)) {
1010− vdev->config->get(vdev,
1007+ if (virtio_config_val_len(vdev, VIRTIO_NET_F_MAC,
10111008 offsetof(struct virtio_net_config, mac),
1012− dev->dev_addr, dev->addr_len);
1013− } else
1009+ dev->dev_addr, dev->addr_len) < 0)
10141010 random_ether_addr(dev->dev_addr);
10151011
10161012 /* Set up our device-specific information */

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t