diff mbox series

[v3,42/46] hw/xtensa/xtfpga: use qemu_create_nic_device()

Message ID 20240108204909.564514-43-dwmw2@infradead.org
State New
Headers show
Series Rework matching of network devices to -nic options | expand

Commit Message

David Woodhouse Jan. 8, 2024, 8:27 p.m. UTC
From: David Woodhouse <dwmw@amazon.co.uk>

Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
---
 hw/xtensa/xtfpga.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

Comments

Thomas Huth Jan. 26, 2024, 4:43 p.m. UTC | #1
On 08/01/2024 21.27, David Woodhouse wrote:
> From: David Woodhouse <dwmw@amazon.co.uk>
> 
> Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
> ---
>   hw/xtensa/xtfpga.c | 13 ++++++-------
>   1 file changed, 6 insertions(+), 7 deletions(-)
> 
> diff --git a/hw/xtensa/xtfpga.c b/hw/xtensa/xtfpga.c
> index fbad1c83a3..f49e6591dc 100644
> --- a/hw/xtensa/xtfpga.c
> +++ b/hw/xtensa/xtfpga.c
> @@ -141,14 +141,16 @@ static void xtfpga_net_init(MemoryRegion *address_space,
>           hwaddr base,
>           hwaddr descriptors,
>           hwaddr buffers,
> -        qemu_irq irq, NICInfo *nd)
> +        qemu_irq irq)
>   {
>       DeviceState *dev;
>       SysBusDevice *s;
>       MemoryRegion *ram;
>   
> -    dev = qdev_new("open_eth");
> -    qdev_set_nic_properties(dev, nd);
> +    dev = qemu_create_nic_device("open_eth", true, NULL);
> +    if (!dev) {
> +        return;
> +    }
>   
>       s = SYS_BUS_DEVICE(dev);
>       sysbus_realize_and_unref(s, &error_fatal);
> @@ -301,10 +303,7 @@ static void xtfpga_init(const XtfpgaBoardDesc *board, MachineState *machine)
>           memory_region_add_subregion(system_memory, board->io[1], io);
>       }
>       xtfpga_fpga_init(system_io, 0x0d020000, freq);
> -    if (nd_table[0].used) {
> -        xtfpga_net_init(system_io, 0x0d030000, 0x0d030400, 0x0d800000,
> -                        extints[1], nd_table);
> -    }
> +    xtfpga_net_init(system_io, 0x0d030000, 0x0d030400, 0x0d800000, extints[1]);
>   
>       serial_mm_init(system_io, 0x0d050020, 2, extints[0],
>                      115200, serial_hd(0), DEVICE_NATIVE_ENDIAN);

Reviewed-by: Thomas Huth <thuth@redhat.com>
diff mbox series

Patch

diff --git a/hw/xtensa/xtfpga.c b/hw/xtensa/xtfpga.c
index fbad1c83a3..f49e6591dc 100644
--- a/hw/xtensa/xtfpga.c
+++ b/hw/xtensa/xtfpga.c
@@ -141,14 +141,16 @@  static void xtfpga_net_init(MemoryRegion *address_space,
         hwaddr base,
         hwaddr descriptors,
         hwaddr buffers,
-        qemu_irq irq, NICInfo *nd)
+        qemu_irq irq)
 {
     DeviceState *dev;
     SysBusDevice *s;
     MemoryRegion *ram;
 
-    dev = qdev_new("open_eth");
-    qdev_set_nic_properties(dev, nd);
+    dev = qemu_create_nic_device("open_eth", true, NULL);
+    if (!dev) {
+        return;
+    }
 
     s = SYS_BUS_DEVICE(dev);
     sysbus_realize_and_unref(s, &error_fatal);
@@ -301,10 +303,7 @@  static void xtfpga_init(const XtfpgaBoardDesc *board, MachineState *machine)
         memory_region_add_subregion(system_memory, board->io[1], io);
     }
     xtfpga_fpga_init(system_io, 0x0d020000, freq);
-    if (nd_table[0].used) {
-        xtfpga_net_init(system_io, 0x0d030000, 0x0d030400, 0x0d800000,
-                        extints[1], nd_table);
-    }
+    xtfpga_net_init(system_io, 0x0d030000, 0x0d030400, 0x0d800000, extints[1]);
 
     serial_mm_init(system_io, 0x0d050020, 2, extints[0],
                    115200, serial_hd(0), DEVICE_NATIVE_ENDIAN);