Message ID | 20180928135003.8650-5-clg@kaod.org (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | net: convert SysBus init method to a realize method | expand |
On 28 September 2018 at 14:49, Cédric Le Goater <clg@kaod.org> wrote: > Signed-off-by: Cédric Le Goater <clg@kaod.org> > --- > hw/net/lance.c | 8 +++----- > 1 file changed, 3 insertions(+), 5 deletions(-) > Reviewed-by: Peter Maydell <peter.maydell@linaro.org> thanks -- PMM
On 28/09/2018 15:49, Cédric Le Goater wrote: > Signed-off-by: Cédric Le Goater <clg@kaod.org> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> > --- > hw/net/lance.c | 8 +++----- > 1 file changed, 3 insertions(+), 5 deletions(-) > > diff --git a/hw/net/lance.c b/hw/net/lance.c > index a08d5ac6a848..f987b2fd180f 100644 > --- a/hw/net/lance.c > +++ b/hw/net/lance.c > @@ -97,9 +97,9 @@ static const VMStateDescription vmstate_lance = { > } > }; > > -static int lance_init(SysBusDevice *sbd) > +static void lance_realize(DeviceState *dev, Error **errp) > { > - DeviceState *dev = DEVICE(sbd); > + SysBusDevice *sbd = SYS_BUS_DEVICE(dev); > SysBusPCNetState *d = SYSBUS_PCNET(dev); > PCNetState *s = &d->state; > > @@ -115,7 +115,6 @@ static int lance_init(SysBusDevice *sbd) > s->phys_mem_read = ledma_memory_read; > s->phys_mem_write = ledma_memory_write; > pcnet_common_init(dev, s, &net_lance_info); > - return 0; > } > > static void lance_reset(DeviceState *dev) > @@ -144,9 +143,8 @@ static Property lance_properties[] = { > static void lance_class_init(ObjectClass *klass, void *data) > { > DeviceClass *dc = DEVICE_CLASS(klass); > - SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass); > > - k->init = lance_init; > + dc->realize = lance_realize; > set_bit(DEVICE_CATEGORY_NETWORK, dc->categories); > dc->fw_name = "ethernet"; > dc->reset = lance_reset; >
On 2018-09-28 15:49, Cédric Le Goater wrote: > Signed-off-by: Cédric Le Goater <clg@kaod.org> > --- > hw/net/lance.c | 8 +++----- > 1 file changed, 3 insertions(+), 5 deletions(-) > > diff --git a/hw/net/lance.c b/hw/net/lance.c > index a08d5ac6a848..f987b2fd180f 100644 > --- a/hw/net/lance.c > +++ b/hw/net/lance.c > @@ -97,9 +97,9 @@ static const VMStateDescription vmstate_lance = { > } > }; > > -static int lance_init(SysBusDevice *sbd) > +static void lance_realize(DeviceState *dev, Error **errp) > { > - DeviceState *dev = DEVICE(sbd); > + SysBusDevice *sbd = SYS_BUS_DEVICE(dev); > SysBusPCNetState *d = SYSBUS_PCNET(dev); > PCNetState *s = &d->state; > > @@ -115,7 +115,6 @@ static int lance_init(SysBusDevice *sbd) > s->phys_mem_read = ledma_memory_read; > s->phys_mem_write = ledma_memory_write; > pcnet_common_init(dev, s, &net_lance_info); > - return 0; > } > > static void lance_reset(DeviceState *dev) > @@ -144,9 +143,8 @@ static Property lance_properties[] = { > static void lance_class_init(ObjectClass *klass, void *data) > { > DeviceClass *dc = DEVICE_CLASS(klass); > - SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass); > > - k->init = lance_init; > + dc->realize = lance_realize; > set_bit(DEVICE_CATEGORY_NETWORK, dc->categories); > dc->fw_name = "ethernet"; > dc->reset = lance_reset; > Tested-by: Thomas Huth <thuth@redhat.com>
diff --git a/hw/net/lance.c b/hw/net/lance.c index a08d5ac6a848..f987b2fd180f 100644 --- a/hw/net/lance.c +++ b/hw/net/lance.c @@ -97,9 +97,9 @@ static const VMStateDescription vmstate_lance = { } }; -static int lance_init(SysBusDevice *sbd) +static void lance_realize(DeviceState *dev, Error **errp) { - DeviceState *dev = DEVICE(sbd); + SysBusDevice *sbd = SYS_BUS_DEVICE(dev); SysBusPCNetState *d = SYSBUS_PCNET(dev); PCNetState *s = &d->state; @@ -115,7 +115,6 @@ static int lance_init(SysBusDevice *sbd) s->phys_mem_read = ledma_memory_read; s->phys_mem_write = ledma_memory_write; pcnet_common_init(dev, s, &net_lance_info); - return 0; } static void lance_reset(DeviceState *dev) @@ -144,9 +143,8 @@ static Property lance_properties[] = { static void lance_class_init(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); - SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass); - k->init = lance_init; + dc->realize = lance_realize; set_bit(DEVICE_CATEGORY_NETWORK, dc->categories); dc->fw_name = "ethernet"; dc->reset = lance_reset;
Signed-off-by: Cédric Le Goater <clg@kaod.org> --- hw/net/lance.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)