[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 08/11] net: smc91c111: convert SysBus init metho
From: |
Peter Maydell |
Subject: |
Re: [Qemu-devel] [PATCH 08/11] net: smc91c111: convert SysBus init method to a realize method |
Date: |
Fri, 28 Sep 2018 16:53:58 +0100 |
On 28 September 2018 at 16:10, Cédric Le Goater <address@hidden> wrote:
> On 9/28/18 4:45 PM, Peter Maydell wrote:
>> On 28 September 2018 at 14:50, Cédric Le Goater <address@hidden> wrote:
>>> void smc91c111_init(NICInfo *nd, uint32_t base, qemu_irq irq)
>>> {
>>> - DeviceState *dev;
>>> - SysBusDevice *s;
>>> + Object *obj;
>>>
>>> qemu_check_nic_model(nd, "smc91c111");
>>> - dev = qdev_create(NULL, TYPE_SMC91C111);
>>> - qdev_set_nic_properties(dev, nd);
>>> - qdev_init_nofail(dev);
>>> - s = SYS_BUS_DEVICE(dev);
>>> - sysbus_mmio_map(s, 0, base);
>>> - sysbus_connect_irq(s, 0, irq);
>>> + obj = object_new(TYPE_SMC91C111);
>>> + qdev_set_nic_properties(DEVICE(obj), nd);
>>> + qdev_init_nofail(DEVICE(obj));
>>> + sysbus_mmio_map(SYS_BUS_DEVICE(obj), 0, base);
>>> + sysbus_connect_irq(SYS_BUS_DEVICE(obj), 0, irq);
>>
>> I'm not sure why you've changed this function as well?
>
> Initially to stop using the qdev_ routines but I ended up rewriting them
> with object_ routines and only kept the object_new() call.
>
> Shall I drop the change then ?
I would drop it, I think -- we're not really trying to get
rid of the qdev APIs. (I'm tending towards a style of not using
this sort of helper function and instead just embedding
devices directly in their users, but when we have a helper
function there's no particular need to avoid qdev_ calls in it.)
thanks
-- PMM