diff mbox series

[07/11] net: opencores_eth: convert SysBus init method to a realize method

Message ID 20180928135003.8650-8-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: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Cédric Le Goater <clg@kaod.org>
---
 hw/net/opencores_eth.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 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: Max Filippov <jcmvbkbc@gmail.com>
> Signed-off-by: Cédric Le Goater <clg@kaod.org>
> ---
>  hw/net/opencores_eth.c | 8 +++-----
>  1 file changed, 3 insertions(+), 5 deletions(-)

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

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

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

> ---
>  hw/net/opencores_eth.c | 8 +++-----
>  1 file changed, 3 insertions(+), 5 deletions(-)
> 
> diff --git a/hw/net/opencores_eth.c b/hw/net/opencores_eth.c
> index d42b79c08c6a..d6f54f8d8208 100644
> --- a/hw/net/opencores_eth.c
> +++ b/hw/net/opencores_eth.c
> @@ -715,9 +715,9 @@ static const MemoryRegionOps open_eth_desc_ops = {
>      .write = open_eth_desc_write,
>  };
>  
> -static int sysbus_open_eth_init(SysBusDevice *sbd)
> +static void sysbus_open_eth_realize(DeviceState *dev, Error **errp)
>  {
> -    DeviceState *dev = DEVICE(sbd);
> +    SysBusDevice *sbd = SYS_BUS_DEVICE(dev);
>      OpenEthState *s = OPEN_ETH(dev);
>  
>      memory_region_init_io(&s->reg_io, OBJECT(dev), &open_eth_reg_ops, s,
> @@ -732,7 +732,6 @@ static int sysbus_open_eth_init(SysBusDevice *sbd)
>  
>      s->nic = qemu_new_nic(&net_open_eth_info, &s->conf,
>                            object_get_typename(OBJECT(s)), dev->id, s);
> -    return 0;
>  }
>  
>  static void qdev_open_eth_reset(DeviceState *dev)
> @@ -750,9 +749,8 @@ static Property open_eth_properties[] = {
>  static void open_eth_class_init(ObjectClass *klass, void *data)
>  {
>      DeviceClass *dc = DEVICE_CLASS(klass);
> -    SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
>  
> -    k->init = sysbus_open_eth_init;
> +    dc->realize = sysbus_open_eth_realize;
>      set_bit(DEVICE_CATEGORY_NETWORK, dc->categories);
>      dc->desc = "Opencores 10/100 Mbit Ethernet";
>      dc->reset = qdev_open_eth_reset;
>
diff mbox series

Patch

diff --git a/hw/net/opencores_eth.c b/hw/net/opencores_eth.c
index d42b79c08c6a..d6f54f8d8208 100644
--- a/hw/net/opencores_eth.c
+++ b/hw/net/opencores_eth.c
@@ -715,9 +715,9 @@  static const MemoryRegionOps open_eth_desc_ops = {
     .write = open_eth_desc_write,
 };
 
-static int sysbus_open_eth_init(SysBusDevice *sbd)
+static void sysbus_open_eth_realize(DeviceState *dev, Error **errp)
 {
-    DeviceState *dev = DEVICE(sbd);
+    SysBusDevice *sbd = SYS_BUS_DEVICE(dev);
     OpenEthState *s = OPEN_ETH(dev);
 
     memory_region_init_io(&s->reg_io, OBJECT(dev), &open_eth_reg_ops, s,
@@ -732,7 +732,6 @@  static int sysbus_open_eth_init(SysBusDevice *sbd)
 
     s->nic = qemu_new_nic(&net_open_eth_info, &s->conf,
                           object_get_typename(OBJECT(s)), dev->id, s);
-    return 0;
 }
 
 static void qdev_open_eth_reset(DeviceState *dev)
@@ -750,9 +749,8 @@  static Property open_eth_properties[] = {
 static void open_eth_class_init(ObjectClass *klass, void *data)
 {
     DeviceClass *dc = DEVICE_CLASS(klass);
-    SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
 
-    k->init = sysbus_open_eth_init;
+    dc->realize = sysbus_open_eth_realize;
     set_bit(DEVICE_CATEGORY_NETWORK, dc->categories);
     dc->desc = "Opencores 10/100 Mbit Ethernet";
     dc->reset = qdev_open_eth_reset;