diff options
author | Andreas Färber <afaerber@suse.de> | 2013-07-30 05:02:48 +0200 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2013-12-09 21:46:49 +0100 |
commit | 284a32f0b33dce4e77e896168387b8dca90c4bea (patch) | |
tree | 1fa7478fd40c7019599f998648f5899511051081 /hw/net/virtio-net.c | |
parent | b1a20c3fcab96832c3813e9e7162748f325e0c82 (diff) |
virtio-net: QOM realize preparations
Rename variable qdev -> dev since that's what realize's argument is
called by convention.
Avoid duplicate VIRTIO_DEVICE() cast.
Signed-off-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'hw/net/virtio-net.c')
-rw-r--r-- | hw/net/virtio-net.c | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c index 93a81ebefd..a669f834e7 100644 --- a/hw/net/virtio-net.c +++ b/hw/net/virtio-net.c @@ -1488,14 +1488,12 @@ void virtio_net_set_netclient_name(VirtIONet *n, const char *name, static int virtio_net_device_init(VirtIODevice *vdev) { - int i; - - DeviceState *qdev = DEVICE(vdev); - VirtIONet *n = VIRTIO_NET(vdev); + DeviceState *dev = DEVICE(vdev); + VirtIONet *n = VIRTIO_NET(dev); NetClientState *nc; + int i; - virtio_init(VIRTIO_DEVICE(n), "virtio-net", VIRTIO_ID_NET, - n->config_size); + virtio_init(vdev, "virtio-net", VIRTIO_ID_NET, n->config_size); n->max_queues = MAX(n->nic_conf.queues, 1); n->vqs = g_malloc0(sizeof(VirtIONetQueue) * n->max_queues); @@ -1535,7 +1533,7 @@ static int virtio_net_device_init(VirtIODevice *vdev) n->netclient_type, n->netclient_name, n); } else { n->nic = qemu_new_nic(&net_virtio_info, &n->nic_conf, - object_get_typename(OBJECT(qdev)), qdev->id, n); + object_get_typename(OBJECT(dev)), dev->id, n); } peer_test_vnet_hdr(n); @@ -1562,11 +1560,11 @@ static int virtio_net_device_init(VirtIODevice *vdev) nc = qemu_get_queue(n->nic); nc->rxfilter_notify_enabled = 1; - n->qdev = qdev; - register_savevm(qdev, "virtio-net", -1, VIRTIO_NET_VM_VERSION, + n->qdev = dev; + register_savevm(dev, "virtio-net", -1, VIRTIO_NET_VM_VERSION, virtio_net_save, virtio_net_load, n); - add_boot_device_path(n->nic_conf.bootindex, qdev, "/ethernet-phy@0"); + add_boot_device_path(n->nic_conf.bootindex, dev, "/ethernet-phy@0"); return 0; } |