[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH qom-next for-1.6 06/14] imx_serial: QOM'ify
From: |
Andreas Färber |
Subject: |
[Qemu-devel] [PATCH qom-next for-1.6 06/14] imx_serial: QOM'ify |
Date: |
Wed, 24 Jul 2013 23:42:11 +0200 |
Signed-off-by: Andreas Färber <address@hidden>
---
hw/char/imx_serial.c | 16 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)
diff --git a/hw/char/imx_serial.c b/hw/char/imx_serial.c
index 69b9ed2..d5d21c9 100644
--- a/hw/char/imx_serial.c
+++ b/hw/char/imx_serial.c
@@ -43,8 +43,12 @@ do { printf("imx_serial: " fmt , ##args); } while (0)
# define IPRINTF(fmt, args...) do {} while (0)
#endif
-typedef struct {
- SysBusDevice busdev;
+#define TYPE_IMX_SERIAL "imx-serial"
+#define IMX_SERIAL(obj) OBJECT_CHECK(IMXSerialState, (obj), TYPE_IMX_SERIAL)
+
+typedef struct IMXSerialState {
+ SysBusDevice parent_obj;
+
MemoryRegion iomem;
int32_t readbuff;
@@ -169,7 +173,7 @@ static void imx_serial_reset(IMXSerialState *s)
static void imx_serial_reset_at_boot(DeviceState *dev)
{
- IMXSerialState *s = container_of(dev, IMXSerialState, busdev.qdev);
+ IMXSerialState *s = IMX_SERIAL(dev);
imx_serial_reset(s);
@@ -383,7 +387,7 @@ static const struct MemoryRegionOps imx_serial_ops = {
static int imx_serial_init(SysBusDevice *dev)
{
- IMXSerialState *s = FROM_SYSBUS(IMXSerialState, dev);
+ IMXSerialState *s = IMX_SERIAL(dev);
memory_region_init_io(&s->iomem, OBJECT(s), &imx_serial_ops, s,
@@ -410,7 +414,7 @@ void imx_serial_create(int uart, const hwaddr addr,
qemu_irq irq)
const char chr_name[] = "serial";
char label[ARRAY_SIZE(chr_name) + 1];
- dev = qdev_create(NULL, "imx-serial");
+ dev = qdev_create(NULL, TYPE_IMX_SERIAL);
if (uart >= MAX_SERIAL_PORTS) {
hw_error("Cannot assign uart %d: QEMU supports only %d ports\n",
@@ -454,7 +458,7 @@ static void imx_serial_class_init(ObjectClass *klass, void
*data)
}
static const TypeInfo imx_serial_info = {
- .name = "imx-serial",
+ .name = TYPE_IMX_SERIAL,
.parent = TYPE_SYS_BUS_DEVICE,
.instance_size = sizeof(IMXSerialState),
.class_init = imx_serial_class_init,
--
1.8.1.4
- [Qemu-devel] [PATCH qom-next for-1.6 00/14] char: QOM cast cleanups, Andreas Färber, 2013/07/24
- [Qemu-devel] [PATCH qom-next for-1.6 02/14] escc: QOM'ify, Andreas Färber, 2013/07/24
- [Qemu-devel] [PATCH qom-next for-1.6 01/14] cadence_uart: QOM'ify, Andreas Färber, 2013/07/24
- [Qemu-devel] [PATCH qom-next for-1.6 03/14] etraxfs_ser: QOM'ify, Andreas Färber, 2013/07/24
- [Qemu-devel] [PATCH qom-next for-1.6 05/14] grlib_apbuart: QOM'ify, Andreas Färber, 2013/07/24
- [Qemu-devel] [PATCH qom-next for-1.6 06/14] imx_serial: QOM'ify,
Andreas Färber <=
- [Qemu-devel] [PATCH qom-next for-1.6 04/14] exynos4210_uart: QOM'ify, Andreas Färber, 2013/07/24
- [Qemu-devel] [PATCH qom-next for-1.6 07/14] lm32_juart: Relocate and tidy header, Andreas Färber, 2013/07/24
- [Qemu-devel] [PATCH qom-next for-1.6 09/14] lm32_uart: QOM'ify, Andreas Färber, 2013/07/24
- [Qemu-devel] [PATCH qom-next for-1.6 08/14] lm32_juart: QOM'ify, Andreas Färber, 2013/07/24
- [Qemu-devel] [PATCH qom-next for-1.6 10/14] milkymist-uart: QOM'ify, Andreas Färber, 2013/07/24
- [Qemu-devel] [PATCH qom-next for-1.6 12/14] pl011: QOM'ify pl011 and pl011_luminary, Andreas Färber, 2013/07/24
- [Qemu-devel] [PATCH qom-next for-1.6 11/14] pl011: Rename pl011_state, Andreas Färber, 2013/07/24
- [Qemu-devel] [PATCH qom-next for-1.6 14/14] xilinx_uartlite: QOM'ify, Andreas Färber, 2013/07/24
- [Qemu-devel] [PATCH qom-next for-1.6 13/14] xilinx_uartlite: Rename xlx_uartlite to XilinxUARTLite, Andreas Färber, 2013/07/24