[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] replace duplicated code.
From: |
Glauber Costa |
Subject: |
Re: [Qemu-devel] [PATCH] replace duplicated code. |
Date: |
Thu, 18 Jun 2009 10:59:50 -0300 |
User-agent: |
Jack Bauer |
On Thu, Jun 18, 2009 at 11:48:28AM +0200, Gerd Hoffmann wrote:
>> - dev = qdev_create(&bus->qbus, pci_nic_names[i]);
>> - qdev_set_prop_int(dev, "devfn", devfn);
>> - qdev_set_prop_ptr(dev, "name", (void *)pci_nic_names[i]);
>> - qdev_set_netdev(dev, nd);
>> - qdev_init(dev);
>
>> + d = pci_create_simple(bus, devfn, pci_nic_names[i]);
>> + qdev_set_netdev((DeviceState *)d, nd);
>
> You have changed the ordering of the qdev_set_netdev and qdev_init
> calls. I don't think this is correct, the init callback will not see
> the nicinfo then.
I see.
How would you feel about changing the nd field of qdev for a void * one,
call it private, or whatever?
then we could have a generic qdev_set_private(dev, p), that does it for
everybody. I must say I kinda dislike that specific dependency on nd for
net devices. Ideally, all devices should be treated as the same.