[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v3 21/25] hw/char: Let devices own the MemoryRegion they create
From: |
Philippe Mathieu-Daudé |
Subject: |
[PATCH v3 21/25] hw/char: Let devices own the MemoryRegion they create |
Date: |
Mon, 16 Mar 2020 19:50:02 +0100 |
Avoid orphan memory regions being added in the /unattached QOM
container.
This commit was produced with the Coccinelle script
scripts/coccinelle/memory-region-housekeeping.cocci.
Signed-off-by: Philippe Mathieu-Daudé <address@hidden>
---
hw/char/serial.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/hw/char/serial.c b/hw/char/serial.c
index 9298881af9..2ab8b69e03 100644
--- a/hw/char/serial.c
+++ b/hw/char/serial.c
@@ -997,7 +997,7 @@ static void serial_io_realize(DeviceState *dev, Error
**errp)
return;
}
- memory_region_init_io(&s->io, NULL, &serial_io_ops, s, "serial", 8);
+ memory_region_init_io(&s->io, OBJECT(dev), &serial_io_ops, s, "serial", 8);
sysbus_init_mmio(SYS_BUS_DEVICE(sio), &s->io);
sysbus_init_irq(SYS_BUS_DEVICE(sio), &s->irq);
}
@@ -1106,8 +1106,9 @@ static void serial_mm_realize(DeviceState *dev, Error
**errp)
return;
}
- memory_region_init_io(&s->io, NULL, &serial_mm_ops[smm->endianness], smm,
- "serial", 8 << smm->regshift);
+ memory_region_init_io(&s->io, OBJECT(dev),
+ &serial_mm_ops[smm->endianness], smm, "serial",
+ 8 << smm->regshift);
sysbus_init_mmio(SYS_BUS_DEVICE(smm), &s->io);
sysbus_init_irq(SYS_BUS_DEVICE(smm), &smm->serial.irq);
}
--
2.21.1
- [PATCH v3 12/25] hw/sh4: Use memory_region_init_rom() with read-only regions, (continued)
- [PATCH v3 12/25] hw/sh4: Use memory_region_init_rom() with read-only regions, Philippe Mathieu-Daudé, 2020/03/16
- [PATCH v3 13/25] hw/sparc: Use memory_region_init_rom() with read-only regions, Philippe Mathieu-Daudé, 2020/03/16
- [PATCH v3 14/25] scripts/cocci: Patch to detect potential use of memory_region_init_rom, Philippe Mathieu-Daudé, 2020/03/16
- [PATCH v3 15/25] scripts/cocci: Patch to remove unnecessary memory_region_set_readonly(), Philippe Mathieu-Daudé, 2020/03/16
- [PATCH v3 16/25] scripts/cocci: Patch to let devices own their MemoryRegions, Philippe Mathieu-Daudé, 2020/03/16
- [PATCH v3 17/25] hw/core: Let devices own the MemoryRegion they create, Philippe Mathieu-Daudé, 2020/03/16
- [PATCH v3 18/25] hw/display: Let devices own the MemoryRegion they create, Philippe Mathieu-Daudé, 2020/03/16
- [PATCH v3 19/25] hw/dma: Let devices own the MemoryRegion they create, Philippe Mathieu-Daudé, 2020/03/16
- [PATCH v3 20/25] hw/riscv: Let devices own the MemoryRegion they create, Philippe Mathieu-Daudé, 2020/03/16
- [PATCH v3 21/25] hw/char: Let devices own the MemoryRegion they create,
Philippe Mathieu-Daudé <=
- [PATCH v3 22/25] hw/arm/stm32: Use memory_region_init_rom() with read-only regions, Philippe Mathieu-Daudé, 2020/03/16
- [PATCH v3 24/25] hw/arm: Remove unnecessary memory_region_set_readonly() on ROM alias, Philippe Mathieu-Daudé, 2020/03/16
- [PATCH v3 23/25] hw/ppc/ppc405: Use memory_region_init_rom() with read-only regions, Philippe Mathieu-Daudé, 2020/03/16
- [PATCH v3 25/25] hw/arm: Let devices own the MemoryRegion they create, Philippe Mathieu-Daudé, 2020/03/16
- [PATCH v3 06/25] hw/display: Use memory_region_init_rom() with read-only regions, Philippe Mathieu-Daudé, 2020/03/16
- Re: [PATCH v3 00/25] hw: Sanitize various MemoryRegion calls, Aleksandar Markovic, 2020/03/16