diff mbox series

[06/11] net: mipsnet: convert SysBus init method to a realize method

Message ID 20180928135003.8650-7-clg@kaod.org (mailing list archive)
State New, archived
Headers show
Series net: convert SysBus init method to a realize method | expand

Commit Message

Cédric Le Goater Sept. 28, 2018, 1:49 p.m. UTC
Cc: Aleksandar Markovic <amarkovic@wavecomp.com>
Signed-off-by: Cédric Le Goater <clg@kaod.org>
---
 hw/net/mipsnet.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

Comments

Peter Maydell Sept. 28, 2018, 2:50 p.m. UTC | #1
On 28 September 2018 at 14:49, Cédric Le Goater <clg@kaod.org> wrote:
> Cc: Aleksandar Markovic <amarkovic@wavecomp.com>
> Signed-off-by: Cédric Le Goater <clg@kaod.org>
> ---
>  hw/net/mipsnet.c | 9 +++------
>  1 file changed, 3 insertions(+), 6 deletions(-)
>

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>

thanks
-- PMM
Philippe Mathieu-Daudé Sept. 28, 2018, 3:11 p.m. UTC | #2
On 28/09/2018 15:49, Cédric Le Goater wrote:
> Cc: Aleksandar Markovic <amarkovic@wavecomp.com>
> Signed-off-by: Cédric Le Goater <clg@kaod.org>

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>

> ---
>  hw/net/mipsnet.c | 9 +++------
>  1 file changed, 3 insertions(+), 6 deletions(-)
> 
> diff --git a/hw/net/mipsnet.c b/hw/net/mipsnet.c
> index 5a63df7ccb91..03b310427860 100644
> --- a/hw/net/mipsnet.c
> +++ b/hw/net/mipsnet.c
> @@ -236,9 +236,9 @@ static const MemoryRegionOps mipsnet_ioport_ops = {
>      .impl.max_access_size = 4,
>  };
>  
> -static int mipsnet_sysbus_init(SysBusDevice *sbd)
> +static void mipsnet_realize(DeviceState *dev, Error **errp)
>  {
> -    DeviceState *dev = DEVICE(sbd);
> +    SysBusDevice *sbd = SYS_BUS_DEVICE(dev);
>      MIPSnetState *s = MIPS_NET(dev);
>  
>      memory_region_init_io(&s->io, OBJECT(dev), &mipsnet_ioport_ops, s,
> @@ -249,8 +249,6 @@ static int mipsnet_sysbus_init(SysBusDevice *sbd)
>      s->nic = qemu_new_nic(&net_mipsnet_info, &s->conf,
>                            object_get_typename(OBJECT(dev)), dev->id, s);
>      qemu_format_nic_info_str(qemu_get_queue(s->nic), s->conf.macaddr.a);
> -
> -    return 0;
>  }
>  
>  static void mipsnet_sysbus_reset(DeviceState *dev)
> @@ -267,9 +265,8 @@ static Property mipsnet_properties[] = {
>  static void mipsnet_class_init(ObjectClass *klass, void *data)
>  {
>      DeviceClass *dc = DEVICE_CLASS(klass);
> -    SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
>  
> -    k->init = mipsnet_sysbus_init;
> +    dc->realize = mipsnet_realize;
>      set_bit(DEVICE_CATEGORY_NETWORK, dc->categories);
>      dc->desc = "MIPS Simulator network device";
>      dc->reset = mipsnet_sysbus_reset;
>
diff mbox series

Patch

diff --git a/hw/net/mipsnet.c b/hw/net/mipsnet.c
index 5a63df7ccb91..03b310427860 100644
--- a/hw/net/mipsnet.c
+++ b/hw/net/mipsnet.c
@@ -236,9 +236,9 @@  static const MemoryRegionOps mipsnet_ioport_ops = {
     .impl.max_access_size = 4,
 };
 
-static int mipsnet_sysbus_init(SysBusDevice *sbd)
+static void mipsnet_realize(DeviceState *dev, Error **errp)
 {
-    DeviceState *dev = DEVICE(sbd);
+    SysBusDevice *sbd = SYS_BUS_DEVICE(dev);
     MIPSnetState *s = MIPS_NET(dev);
 
     memory_region_init_io(&s->io, OBJECT(dev), &mipsnet_ioport_ops, s,
@@ -249,8 +249,6 @@  static int mipsnet_sysbus_init(SysBusDevice *sbd)
     s->nic = qemu_new_nic(&net_mipsnet_info, &s->conf,
                           object_get_typename(OBJECT(dev)), dev->id, s);
     qemu_format_nic_info_str(qemu_get_queue(s->nic), s->conf.macaddr.a);
-
-    return 0;
 }
 
 static void mipsnet_sysbus_reset(DeviceState *dev)
@@ -267,9 +265,8 @@  static Property mipsnet_properties[] = {
 static void mipsnet_class_init(ObjectClass *klass, void *data)
 {
     DeviceClass *dc = DEVICE_CLASS(klass);
-    SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
 
-    k->init = mipsnet_sysbus_init;
+    dc->realize = mipsnet_realize;
     set_bit(DEVICE_CATEGORY_NETWORK, dc->categories);
     dc->desc = "MIPS Simulator network device";
     dc->reset = mipsnet_sysbus_reset;