diff mbox series

[PULL,44/45] net: xgmac: convert SysBus init method to a realize method

Message ID 20181018200422.4358-45-ehabkost@redhat.com
State New
Headers show
Series [PULL,01/45] hostmem-file: fixed the memory leak while get pmem path. | expand

Commit Message

Eduardo Habkost Oct. 18, 2018, 8:04 p.m. UTC
From: Cédric Le Goater <clg@kaod.org>

Cc: Peter Maydell <peter.maydell@linaro.org>
Cc: qemu-arm@nongnu.org
Cc: Rob Herring <robh@kernel.org>
Signed-off-by: Cédric Le Goater <clg@kaod.org>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20181001063803.22330-12-clg@kaod.org>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
 hw/net/xgmac.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

Comments

David Gibson Oct. 23, 2018, 3:26 p.m. UTC | #1
On Thu, Oct 18, 2018 at 05:04:21PM -0300, Eduardo Habkost wrote:
> From: Cédric Le Goater <clg@kaod.org>
> 
> Cc: Peter Maydell <peter.maydell@linaro.org>
> Cc: qemu-arm@nongnu.org
> Cc: Rob Herring <robh@kernel.org>
> Signed-off-by: Cédric Le Goater <clg@kaod.org>
> Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> Message-Id: <20181001063803.22330-12-clg@kaod.org>
> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>

Reviewed-by: David Gibson <david@gibson.dropbear.id.au>

> ---
>  hw/net/xgmac.c | 9 +++------
>  1 file changed, 3 insertions(+), 6 deletions(-)
> 
> diff --git a/hw/net/xgmac.c b/hw/net/xgmac.c
> index fa001563d3..63f5a62ebf 100644
> --- a/hw/net/xgmac.c
> +++ b/hw/net/xgmac.c
> @@ -374,9 +374,9 @@ static NetClientInfo net_xgmac_enet_info = {
>      .receive = eth_rx,
>  };
>  
> -static int xgmac_enet_init(SysBusDevice *sbd)
> +static void xgmac_enet_realize(DeviceState *dev, Error **errp)
>  {
> -    DeviceState *dev = DEVICE(sbd);
> +    SysBusDevice *sbd = SYS_BUS_DEVICE(dev);
>      XgmacState *s = XGMAC(dev);
>  
>      memory_region_init_io(&s->iomem, OBJECT(s), &enet_mem_ops, s,
> @@ -397,8 +397,6 @@ static int xgmac_enet_init(SysBusDevice *sbd)
>                                   (s->conf.macaddr.a[2] << 16) |
>                                   (s->conf.macaddr.a[1] << 8) |
>                                    s->conf.macaddr.a[0];
> -
> -    return 0;
>  }
>  
>  static Property xgmac_properties[] = {
> @@ -408,10 +406,9 @@ static Property xgmac_properties[] = {
>  
>  static void xgmac_enet_class_init(ObjectClass *klass, void *data)
>  {
> -    SysBusDeviceClass *sbc = SYS_BUS_DEVICE_CLASS(klass);
>      DeviceClass *dc = DEVICE_CLASS(klass);
>  
> -    sbc->init = xgmac_enet_init;
> +    dc->realize = xgmac_enet_realize;
>      dc->vmsd = &vmstate_xgmac;
>      dc->props = xgmac_properties;
>  }
diff mbox series

Patch

diff --git a/hw/net/xgmac.c b/hw/net/xgmac.c
index fa001563d3..63f5a62ebf 100644
--- a/hw/net/xgmac.c
+++ b/hw/net/xgmac.c
@@ -374,9 +374,9 @@  static NetClientInfo net_xgmac_enet_info = {
     .receive = eth_rx,
 };
 
-static int xgmac_enet_init(SysBusDevice *sbd)
+static void xgmac_enet_realize(DeviceState *dev, Error **errp)
 {
-    DeviceState *dev = DEVICE(sbd);
+    SysBusDevice *sbd = SYS_BUS_DEVICE(dev);
     XgmacState *s = XGMAC(dev);
 
     memory_region_init_io(&s->iomem, OBJECT(s), &enet_mem_ops, s,
@@ -397,8 +397,6 @@  static int xgmac_enet_init(SysBusDevice *sbd)
                                  (s->conf.macaddr.a[2] << 16) |
                                  (s->conf.macaddr.a[1] << 8) |
                                   s->conf.macaddr.a[0];
-
-    return 0;
 }
 
 static Property xgmac_properties[] = {
@@ -408,10 +406,9 @@  static Property xgmac_properties[] = {
 
 static void xgmac_enet_class_init(ObjectClass *klass, void *data)
 {
-    SysBusDeviceClass *sbc = SYS_BUS_DEVICE_CLASS(klass);
     DeviceClass *dc = DEVICE_CLASS(klass);
 
-    sbc->init = xgmac_enet_init;
+    dc->realize = xgmac_enet_realize;
     dc->vmsd = &vmstate_xgmac;
     dc->props = xgmac_properties;
 }