All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
To: armbru@redhat.com, david@gibson.dropbear.id.au,
	atar4qemu@gmail.com, qemu-devel@nongnu.org, qemu-ppc@nongnu.org
Subject: [PATCH 1/6] sparc32-dma: use object_initialize_child() for espdma and ledma child objects
Date: Sun, 20 Sep 2020 09:20:13 +0100	[thread overview]
Message-ID: <20200920082018.16135-2-mark.cave-ayland@ilande.co.uk> (raw)
In-Reply-To: <20200920082018.16135-1-mark.cave-ayland@ilande.co.uk>

Store the child objects directly within the sparc32-dma object rather than using
link properties.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
---
 hw/dma/sparc32_dma.c           | 15 +++++++++------
 include/hw/sparc/sparc32_dma.h |  4 ++--
 2 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/hw/dma/sparc32_dma.c b/hw/dma/sparc32_dma.c
index d20a5bc065..b25a212f7a 100644
--- a/hw/dma/sparc32_dma.c
+++ b/hw/dma/sparc32_dma.c
@@ -379,10 +379,9 @@ static void sparc32_dma_realize(DeviceState *dev, Error **errp)
         return;
     }
 
-    espdma = qdev_new(TYPE_SPARC32_ESPDMA_DEVICE);
+    espdma = DEVICE(&s->espdma);
     object_property_set_link(OBJECT(espdma), "iommu", iommu, &error_abort);
-    object_property_add_child(OBJECT(s), "espdma", OBJECT(espdma));
-    sysbus_realize_and_unref(SYS_BUS_DEVICE(espdma), &error_fatal);
+    sysbus_realize(SYS_BUS_DEVICE(espdma), &error_fatal);
 
     esp = DEVICE(object_resolve_path_component(OBJECT(espdma), "esp"));
     sbd = SYS_BUS_DEVICE(esp);
@@ -394,10 +393,9 @@ static void sparc32_dma_realize(DeviceState *dev, Error **errp)
     memory_region_add_subregion(&s->dmamem, 0x0,
                                 sysbus_mmio_get_region(sbd, 0));
 
-    ledma = qdev_new(TYPE_SPARC32_LEDMA_DEVICE);
+    ledma = DEVICE(&s->ledma);
     object_property_set_link(OBJECT(ledma), "iommu", iommu, &error_abort);
-    object_property_add_child(OBJECT(s), "ledma", OBJECT(ledma));
-    sysbus_realize_and_unref(SYS_BUS_DEVICE(ledma), &error_fatal);
+    sysbus_realize(SYS_BUS_DEVICE(ledma), &error_fatal);
 
     lance = DEVICE(object_resolve_path_component(OBJECT(ledma), "lance"));
     sbd = SYS_BUS_DEVICE(lance);
@@ -421,6 +419,11 @@ static void sparc32_dma_init(Object *obj)
 
     memory_region_init(&s->dmamem, OBJECT(s), "dma", DMA_SIZE + DMA_ETH_SIZE);
     sysbus_init_mmio(sbd, &s->dmamem);
+
+    object_initialize_child(obj, "espdma", &s->espdma,
+                            TYPE_SPARC32_ESPDMA_DEVICE);
+    object_initialize_child(obj, "ledma", &s->ledma,
+                            TYPE_SPARC32_LEDMA_DEVICE);
 }
 
 static void sparc32_dma_class_init(ObjectClass *klass, void *data)
diff --git a/include/hw/sparc/sparc32_dma.h b/include/hw/sparc/sparc32_dma.h
index a402665a9c..a7b1dd8418 100644
--- a/include/hw/sparc/sparc32_dma.h
+++ b/include/hw/sparc/sparc32_dma.h
@@ -56,8 +56,8 @@ struct SPARC32DMAState {
 
     MemoryRegion dmamem;
     MemoryRegion ledma_alias;
-    ESPDMADeviceState *espdma;
-    LEDMADeviceState *ledma;
+    ESPDMADeviceState espdma;
+    LEDMADeviceState ledma;
 };
 
 /* sparc32_dma.c */
-- 
2.20.1



  reply	other threads:[~2020-09-20  8:22 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-20  8:20 [PATCH 0/6] QOM minor fixes Mark Cave-Ayland
2020-09-20  8:20 ` Mark Cave-Ayland [this message]
2020-09-20 10:49   ` [PATCH 1/6] sparc32-dma: use object_initialize_child() for espdma and ledma child objects Philippe Mathieu-Daudé
2020-09-20  8:20 ` [PATCH 2/6] sparc32-ledma: use object_initialize_child() for lance child object Mark Cave-Ayland
2020-09-20 10:49   ` Philippe Mathieu-Daudé
2020-09-20  8:20 ` [PATCH 3/6] sparc32-espdma: use object_initialize_child() for esp " Mark Cave-Ayland
2020-09-20 10:49   ` Philippe Mathieu-Daudé
2020-09-20  8:20 ` [PATCH 4/6] sparc32-ledma: don't reference nd_table directly within the device Mark Cave-Ayland
2020-09-21  9:25   ` Markus Armbruster
2020-09-21 17:03     ` Mark Cave-Ayland
2020-09-21 17:14       ` Mark Cave-Ayland
2020-09-26 10:23         ` Mark Cave-Ayland
2020-09-21  9:57   ` Philippe Mathieu-Daudé
2020-09-21 17:08     ` Mark Cave-Ayland
2020-09-21 17:58       ` Philippe Mathieu-Daudé
2020-09-26 10:29         ` Mark Cave-Ayland
2020-09-20  8:20 ` [PATCH 5/6] macio: don't reference serial_hd() " Mark Cave-Ayland
2020-09-20 10:52   ` BALATON Zoltan via
2020-09-20 17:59     ` Mark Cave-Ayland
2020-09-20  8:20 ` [PATCH 6/6] sabre: don't call sysbus_mmio_map() in sabre_realize() Mark Cave-Ayland
2020-09-20 10:48   ` Philippe Mathieu-Daudé

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200920082018.16135-2-mark.cave-ayland@ilande.co.uk \
    --to=mark.cave-ayland@ilande.co.uk \
    --cc=armbru@redhat.com \
    --cc=atar4qemu@gmail.com \
    --cc=david@gibson.dropbear.id.au \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.