diff mbox series

[10/11] net: stellaris_enet: add a reset method

Message ID 20180928135003.8650-11-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:50 p.m. UTC
Cc: Peter Maydell <peter.maydell@linaro.org>
Cc: qemu-arm@nongnu.org
Signed-off-by: Cédric Le Goater <clg@kaod.org>
---
 hw/net/stellaris_enet.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

Comments

Peter Maydell Sept. 28, 2018, 2:42 p.m. UTC | #1
On 28 September 2018 at 14:50, Cédric Le Goater <clg@kaod.org> wrote:
> Cc: Peter Maydell <peter.maydell@linaro.org>
> Cc: qemu-arm@nongnu.org
> Signed-off-by: Cédric Le Goater <clg@kaod.org>
> ---
>  hw/net/stellaris_enet.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
>

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

thanks
-- PMM
Philippe Mathieu-Daudé Sept. 28, 2018, 3:15 p.m. UTC | #2
On 28/09/2018 15:50, Cédric Le Goater wrote:
> Cc: Peter Maydell <peter.maydell@linaro.org>
> Cc: qemu-arm@nongnu.org
> Signed-off-by: Cédric Le Goater <clg@kaod.org>

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

> ---
>  hw/net/stellaris_enet.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/hw/net/stellaris_enet.c b/hw/net/stellaris_enet.c
> index 3ee1e0f8a43f..b3375ebb459c 100644
> --- a/hw/net/stellaris_enet.c
> +++ b/hw/net/stellaris_enet.c
> @@ -457,8 +457,10 @@ static const MemoryRegionOps stellaris_enet_ops = {
>      .endianness = DEVICE_NATIVE_ENDIAN,
>  };
>  
> -static void stellaris_enet_reset(stellaris_enet_state *s)
> +static void stellaris_enet_reset(DeviceState *dev)
>  {
> +    stellaris_enet_state *s =  STELLARIS_ENET(dev);
> +
>      s->mdv = 0x80;
>      s->rctl = SE_RCTL_BADCRC;
>      s->im = SE_INT_PHY | SE_INT_MD | SE_INT_RXER | SE_INT_FOV | SE_INT_TXEMP
> @@ -487,8 +489,6 @@ static void stellaris_enet_realize(DeviceState *dev, Error **errp)
>      s->nic = qemu_new_nic(&net_stellaris_enet_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);
> -
> -    stellaris_enet_reset(s);
>  }
>  
>  static Property stellaris_enet_properties[] = {
> @@ -501,6 +501,7 @@ static void stellaris_enet_class_init(ObjectClass *klass, void *data)
>      DeviceClass *dc = DEVICE_CLASS(klass);
>  
>      dc->realize = stellaris_enet_realize;
> +    dc->reset = stellaris_enet_reset;
>      dc->props = stellaris_enet_properties;
>      dc->vmsd = &vmstate_stellaris_enet;
>  }
>
diff mbox series

Patch

diff --git a/hw/net/stellaris_enet.c b/hw/net/stellaris_enet.c
index 3ee1e0f8a43f..b3375ebb459c 100644
--- a/hw/net/stellaris_enet.c
+++ b/hw/net/stellaris_enet.c
@@ -457,8 +457,10 @@  static const MemoryRegionOps stellaris_enet_ops = {
     .endianness = DEVICE_NATIVE_ENDIAN,
 };
 
-static void stellaris_enet_reset(stellaris_enet_state *s)
+static void stellaris_enet_reset(DeviceState *dev)
 {
+    stellaris_enet_state *s =  STELLARIS_ENET(dev);
+
     s->mdv = 0x80;
     s->rctl = SE_RCTL_BADCRC;
     s->im = SE_INT_PHY | SE_INT_MD | SE_INT_RXER | SE_INT_FOV | SE_INT_TXEMP
@@ -487,8 +489,6 @@  static void stellaris_enet_realize(DeviceState *dev, Error **errp)
     s->nic = qemu_new_nic(&net_stellaris_enet_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);
-
-    stellaris_enet_reset(s);
 }
 
 static Property stellaris_enet_properties[] = {
@@ -501,6 +501,7 @@  static void stellaris_enet_class_init(ObjectClass *klass, void *data)
     DeviceClass *dc = DEVICE_CLASS(klass);
 
     dc->realize = stellaris_enet_realize;
+    dc->reset = stellaris_enet_reset;
     dc->props = stellaris_enet_properties;
     dc->vmsd = &vmstate_stellaris_enet;
 }