Make AddressSpaces QOM objects to ensure that they are destroyed when
their owners are finalized and also to get a unique path for debugging
output.

The name arguments were used to distinguish AddresSpaces in debugging
output, but they will represent property names after QOM-ification and
debugging output will show QOM paths. So change them to make them more
concise and also avoid conflicts with other properties.

Signed-off-by: Akihiko Odaki <od...@rsg.ci.i.u-tokyo.ac.jp>
---
 hw/sd/allwinner-sdhost.c | 2 +-
 hw/sd/sdhci.c            | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/hw/sd/allwinner-sdhost.c b/hw/sd/allwinner-sdhost.c
index 158d434e7fde..c001dfd60203 100644
--- a/hw/sd/allwinner-sdhost.c
+++ b/hw/sd/allwinner-sdhost.c
@@ -832,7 +832,7 @@ static void allwinner_sdhost_realize(DeviceState *dev, 
Error **errp)
         return;
     }
 
-    address_space_init(&s->dma_as, NULL, s->dma_mr, "sdhost-dma");
+    address_space_init(&s->dma_as, OBJECT(s), s->dma_mr, "as");
 }
 
 static void allwinner_sdhost_reset(DeviceState *dev)
diff --git a/hw/sd/sdhci.c b/hw/sd/sdhci.c
index c6a203744463..1a6b6e1198f2 100644
--- a/hw/sd/sdhci.c
+++ b/hw/sd/sdhci.c
@@ -1594,7 +1594,7 @@ static void sdhci_sysbus_realize(DeviceState *dev, Error 
**errp)
 
     if (s->dma_mr) {
         s->dma_as = &s->sysbus_dma_as;
-        address_space_init(s->dma_as, NULL, s->dma_mr, "sdhci-dma");
+        address_space_init(s->dma_as, OBJECT(s), s->dma_mr, "as");
     } else {
         /* use system_memory() if property "dma" not set */
         s->dma_as = &address_space_memory;
@@ -1612,7 +1612,7 @@ static void sdhci_sysbus_unrealize(DeviceState *dev)
     sdhci_common_unrealize(s);
 
      if (s->dma_mr) {
-        address_space_destroy(s->dma_as);
+        object_unparent(OBJECT(s->dma_as));
     }
 }
 

-- 
2.51.0


Reply via email to