diff mbox series

[v2,2/9] hw/sd/pxa2xx: Do not open-code sysbus_create_simple()

Message ID 20231019130925.18744-3-philmd@linaro.org
State Superseded
Headers show
Series hw/arm/pxa2xx: SysBus/QDev fixes | expand

Commit Message

Philippe Mathieu-Daudé Oct. 19, 2023, 1:09 p.m. UTC
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 hw/sd/pxa2xx_mmci.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

Comments

Thomas Huth Oct. 19, 2023, 4:04 p.m. UTC | #1
On 19/10/2023 15.09, Philippe Mathieu-Daudé wrote:
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
>   hw/sd/pxa2xx_mmci.c | 7 +------
>   1 file changed, 1 insertion(+), 6 deletions(-)
> 
> diff --git a/hw/sd/pxa2xx_mmci.c b/hw/sd/pxa2xx_mmci.c
> index 9f7a880bac..4749e935d8 100644
> --- a/hw/sd/pxa2xx_mmci.c
> +++ b/hw/sd/pxa2xx_mmci.c
> @@ -479,13 +479,8 @@ PXA2xxMMCIState *pxa2xx_mmci_init(MemoryRegion *sysmem,
>                   qemu_irq irq, qemu_irq rx_dma, qemu_irq tx_dma)
>   {
>       DeviceState *dev;
> -    SysBusDevice *sbd;
>   
> -    dev = qdev_new(TYPE_PXA2XX_MMCI);
> -    sbd = SYS_BUS_DEVICE(dev);
> -    sysbus_realize_and_unref(sbd, &error_fatal);
> -    sysbus_mmio_map(sbd, 0, base);
> -    sysbus_connect_irq(sbd, 0, irq);
> +    dev = sysbus_create_simple(TYPE_PXA2XX_MMCI, base, irq);
>       qdev_connect_gpio_out_named(dev, "rx-dma", 0, rx_dma);
>       qdev_connect_gpio_out_named(dev, "tx-dma", 0, tx_dma);

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

Patch

diff --git a/hw/sd/pxa2xx_mmci.c b/hw/sd/pxa2xx_mmci.c
index 9f7a880bac..4749e935d8 100644
--- a/hw/sd/pxa2xx_mmci.c
+++ b/hw/sd/pxa2xx_mmci.c
@@ -479,13 +479,8 @@  PXA2xxMMCIState *pxa2xx_mmci_init(MemoryRegion *sysmem,
                 qemu_irq irq, qemu_irq rx_dma, qemu_irq tx_dma)
 {
     DeviceState *dev;
-    SysBusDevice *sbd;
 
-    dev = qdev_new(TYPE_PXA2XX_MMCI);
-    sbd = SYS_BUS_DEVICE(dev);
-    sysbus_realize_and_unref(sbd, &error_fatal);
-    sysbus_mmio_map(sbd, 0, base);
-    sysbus_connect_irq(sbd, 0, irq);
+    dev = sysbus_create_simple(TYPE_PXA2XX_MMCI, base, irq);
     qdev_connect_gpio_out_named(dev, "rx-dma", 0, rx_dma);
     qdev_connect_gpio_out_named(dev, "tx-dma", 0, tx_dma);