diff mbox series

[05/11] net: milkymist_minimac2: convert SysBus init method to a realize method

Message ID 20180928135003.8650-6-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: Michael Walle <michael@walle.cc>
Signed-off-by: Cédric Le Goater <clg@kaod.org>
---
 hw/net/milkymist-minimac2.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

Comments

Peter Maydell Sept. 28, 2018, 2:49 p.m. UTC | #1
On 28 September 2018 at 14:49, Cédric Le Goater <clg@kaod.org> wrote:
> Cc: Michael Walle <michael@walle.cc>
> Signed-off-by: Cédric Le Goater <clg@kaod.org>
> ---
>  hw/net/milkymist-minimac2.c | 9 +++------
>  1 file changed, 3 insertions(+), 6 deletions(-)
>
> diff --git a/hw/net/milkymist-minimac2.c b/hw/net/milkymist-minimac2.c
> index 3eaa19dfde92..5e7304a26a50 100644
> --- a/hw/net/milkymist-minimac2.c
> +++ b/hw/net/milkymist-minimac2.c
> @@ -452,9 +452,9 @@ static NetClientInfo net_milkymist_minimac2_info = {
>      .receive = minimac2_rx,
>  };
>
> -static int milkymist_minimac2_init(SysBusDevice *sbd)
> +static void milkymist_minimac2_realize(DeviceState *dev, Error **errp)
>  {
> -    DeviceState *dev = DEVICE(sbd);
> +   SysBusDevice *sbd = SYS_BUS_DEVICE(dev);

Looks like wrong indent, maybe ?

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

thanks
-- PMM
Philippe Mathieu-Daudé Sept. 28, 2018, 3:13 p.m. UTC | #2
On 28/09/2018 15:49, Cédric Le Goater wrote:
> Cc: Michael Walle <michael@walle.cc>
> Signed-off-by: Cédric Le Goater <clg@kaod.org>

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

> ---
>  hw/net/milkymist-minimac2.c | 9 +++------
>  1 file changed, 3 insertions(+), 6 deletions(-)
> 
> diff --git a/hw/net/milkymist-minimac2.c b/hw/net/milkymist-minimac2.c
> index 3eaa19dfde92..5e7304a26a50 100644
> --- a/hw/net/milkymist-minimac2.c
> +++ b/hw/net/milkymist-minimac2.c
> @@ -452,9 +452,9 @@ static NetClientInfo net_milkymist_minimac2_info = {
>      .receive = minimac2_rx,
>  };
>  
> -static int milkymist_minimac2_init(SysBusDevice *sbd)
> +static void milkymist_minimac2_realize(DeviceState *dev, Error **errp)
>  {
> -    DeviceState *dev = DEVICE(sbd);
> +   SysBusDevice *sbd = SYS_BUS_DEVICE(dev);
>      MilkymistMinimac2State *s = MILKYMIST_MINIMAC2(dev);
>      size_t buffers_size = TARGET_PAGE_ALIGN(3 * MINIMAC2_BUFFER_SIZE);
>  
> @@ -479,8 +479,6 @@ static int milkymist_minimac2_init(SysBusDevice *sbd)
>      s->nic = qemu_new_nic(&net_milkymist_minimac2_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 const VMStateDescription vmstate_milkymist_minimac2_mdio = {
> @@ -521,9 +519,8 @@ static Property milkymist_minimac2_properties[] = {
>  static void milkymist_minimac2_class_init(ObjectClass *klass, void *data)
>  {
>      DeviceClass *dc = DEVICE_CLASS(klass);
> -    SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
>  
> -    k->init = milkymist_minimac2_init;
> +    dc->realize = milkymist_minimac2_realize;
>      dc->reset = milkymist_minimac2_reset;
>      dc->vmsd = &vmstate_milkymist_minimac2;
>      dc->props = milkymist_minimac2_properties;
>
Cédric Le Goater Sept. 28, 2018, 3:17 p.m. UTC | #3
On 9/28/18 4:49 PM, Peter Maydell wrote:
> On 28 September 2018 at 14:49, Cédric Le Goater <clg@kaod.org> wrote:
>> Cc: Michael Walle <michael@walle.cc>
>> Signed-off-by: Cédric Le Goater <clg@kaod.org>
>> ---
>>  hw/net/milkymist-minimac2.c | 9 +++------
>>  1 file changed, 3 insertions(+), 6 deletions(-)
>>
>> diff --git a/hw/net/milkymist-minimac2.c b/hw/net/milkymist-minimac2.c
>> index 3eaa19dfde92..5e7304a26a50 100644
>> --- a/hw/net/milkymist-minimac2.c
>> +++ b/hw/net/milkymist-minimac2.c
>> @@ -452,9 +452,9 @@ static NetClientInfo net_milkymist_minimac2_info = {
>>      .receive = minimac2_rx,
>>  };
>>
>> -static int milkymist_minimac2_init(SysBusDevice *sbd)
>> +static void milkymist_minimac2_realize(DeviceState *dev, Error **errp)
>>  {
>> -    DeviceState *dev = DEVICE(sbd);
>> +   SysBusDevice *sbd = SYS_BUS_DEVICE(dev);
> 
> Looks like wrong indent, maybe ?

ah my bad. I did a copy paste for this one.

I Will fix in next round.

Thanks,

C. 

 
> 
> Otherwise
> Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
> 
> thanks
> -- PMM
>
diff mbox series

Patch

diff --git a/hw/net/milkymist-minimac2.c b/hw/net/milkymist-minimac2.c
index 3eaa19dfde92..5e7304a26a50 100644
--- a/hw/net/milkymist-minimac2.c
+++ b/hw/net/milkymist-minimac2.c
@@ -452,9 +452,9 @@  static NetClientInfo net_milkymist_minimac2_info = {
     .receive = minimac2_rx,
 };
 
-static int milkymist_minimac2_init(SysBusDevice *sbd)
+static void milkymist_minimac2_realize(DeviceState *dev, Error **errp)
 {
-    DeviceState *dev = DEVICE(sbd);
+   SysBusDevice *sbd = SYS_BUS_DEVICE(dev);
     MilkymistMinimac2State *s = MILKYMIST_MINIMAC2(dev);
     size_t buffers_size = TARGET_PAGE_ALIGN(3 * MINIMAC2_BUFFER_SIZE);
 
@@ -479,8 +479,6 @@  static int milkymist_minimac2_init(SysBusDevice *sbd)
     s->nic = qemu_new_nic(&net_milkymist_minimac2_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 const VMStateDescription vmstate_milkymist_minimac2_mdio = {
@@ -521,9 +519,8 @@  static Property milkymist_minimac2_properties[] = {
 static void milkymist_minimac2_class_init(ObjectClass *klass, void *data)
 {
     DeviceClass *dc = DEVICE_CLASS(klass);
-    SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
 
-    k->init = milkymist_minimac2_init;
+    dc->realize = milkymist_minimac2_realize;
     dc->reset = milkymist_minimac2_reset;
     dc->vmsd = &vmstate_milkymist_minimac2;
     dc->props = milkymist_minimac2_properties;