aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--hw/etraxfs_ser.c2
-rw-r--r--hw/lm32_juart.c2
-rw-r--r--hw/lm32_uart.c2
-rw-r--r--hw/milkymist-uart.c2
-rw-r--r--hw/pl011.c2
-rw-r--r--hw/qdev.c9
-rw-r--r--hw/qdev.h2
-rw-r--r--hw/xilinx_uartlite.c2
-rw-r--r--qemu-char.c10
-rw-r--r--qemu-char.h2
10 files changed, 18 insertions, 17 deletions
diff --git a/hw/etraxfs_ser.c b/hw/etraxfs_ser.c
index b8acd4370b..567cb8cc2d 100644
--- a/hw/etraxfs_ser.c
+++ b/hw/etraxfs_ser.c
@@ -216,7 +216,7 @@ static int etraxfs_ser_init(SysBusDevice *dev)
memory_region_init_io(&s->mmio, &ser_ops, s, "etraxfs-serial", R_MAX * 4);
sysbus_init_mmio(dev, &s->mmio);
- s->chr = qdev_init_chardev(&dev->qdev);
+ s->chr = qemu_char_get_next_serial();
if (s->chr)
qemu_chr_add_handlers(s->chr,
serial_can_receive, serial_receive,
diff --git a/hw/lm32_juart.c b/hw/lm32_juart.c
index 023c644fef..38dd28230d 100644
--- a/hw/lm32_juart.c
+++ b/hw/lm32_juart.c
@@ -114,7 +114,7 @@ static int lm32_juart_init(SysBusDevice *dev)
{
LM32JuartState *s = FROM_SYSBUS(typeof(*s), dev);
- s->chr = qdev_init_chardev(&dev->qdev);
+ s->chr = qemu_char_get_next_serial();
if (s->chr) {
qemu_chr_add_handlers(s->chr, juart_can_rx, juart_rx, juart_event, s);
}
diff --git a/hw/lm32_uart.c b/hw/lm32_uart.c
index fc70490e32..630ccb7131 100644
--- a/hw/lm32_uart.c
+++ b/hw/lm32_uart.c
@@ -252,7 +252,7 @@ static int lm32_uart_init(SysBusDevice *dev)
memory_region_init_io(&s->iomem, &uart_ops, s, "uart", R_MAX * 4);
sysbus_init_mmio(dev, &s->iomem);
- s->chr = qdev_init_chardev(&dev->qdev);
+ s->chr = qemu_char_get_next_serial();
if (s->chr) {
qemu_chr_add_handlers(s->chr, uart_can_rx, uart_rx, uart_event, s);
}
diff --git a/hw/milkymist-uart.c b/hw/milkymist-uart.c
index 2999b79633..f9a229cf68 100644
--- a/hw/milkymist-uart.c
+++ b/hw/milkymist-uart.c
@@ -199,7 +199,7 @@ static int milkymist_uart_init(SysBusDevice *dev)
"milkymist-uart", R_MAX * 4);
sysbus_init_mmio(dev, &s->regs_region);
- s->chr = qdev_init_chardev(&dev->qdev);
+ s->chr = qemu_char_get_next_serial();
if (s->chr) {
qemu_chr_add_handlers(s->chr, uart_can_rx, uart_rx, uart_event, s);
}
diff --git a/hw/pl011.c b/hw/pl011.c
index 8db2248563..752cbf9725 100644
--- a/hw/pl011.c
+++ b/hw/pl011.c
@@ -264,7 +264,7 @@ static int pl011_init(SysBusDevice *dev, const unsigned char *id)
sysbus_init_mmio(dev, &s->iomem);
sysbus_init_irq(dev, &s->irq);
s->id = id;
- s->chr = qdev_init_chardev(&dev->qdev);
+ s->chr = qemu_char_get_next_serial();
s->read_trigger = 1;
s->ifl = 0x12;
diff --git a/hw/qdev.c b/hw/qdev.c
index e82165d738..0692a21fbd 100644
--- a/hw/qdev.c
+++ b/hw/qdev.c
@@ -336,15 +336,6 @@ bool qdev_machine_modified(void)
return qdev_hot_added || qdev_hot_removed;
}
-/* Get a character (serial) device interface. */
-CharDriverState *qdev_init_chardev(DeviceState *dev)
-{
- static int next_serial;
-
- /* FIXME: This function needs to go away: use chardev properties! */
- return serial_hds[next_serial++];
-}
-
BusState *qdev_get_parent_bus(DeviceState *dev)
{
return dev->parent_bus;
diff --git a/hw/qdev.h b/hw/qdev.h
index b33a27cecd..8f525eca85 100644
--- a/hw/qdev.h
+++ b/hw/qdev.h
@@ -235,8 +235,6 @@ BusState *qdev_get_child_bus(DeviceState *dev, const char *name);
void qdev_init_gpio_in(DeviceState *dev, qemu_irq_handler handler, int n);
void qdev_init_gpio_out(DeviceState *dev, qemu_irq *pins, int n);
-CharDriverState *qdev_init_chardev(DeviceState *dev);
-
BusState *qdev_get_parent_bus(DeviceState *dev);
/*** BUS API. ***/
diff --git a/hw/xilinx_uartlite.c b/hw/xilinx_uartlite.c
index 1491bbaeaa..1c2b9087b4 100644
--- a/hw/xilinx_uartlite.c
+++ b/hw/xilinx_uartlite.c
@@ -205,7 +205,7 @@ static int xilinx_uartlite_init(SysBusDevice *dev)
memory_region_init_io(&s->mmio, &uart_ops, s, "xilinx-uartlite", R_MAX * 4);
sysbus_init_mmio(dev, &s->mmio);
- s->chr = qdev_init_chardev(&dev->qdev);
+ s->chr = qemu_char_get_next_serial();
if (s->chr)
qemu_chr_add_handlers(s->chr, uart_can_rx, uart_rx, uart_event, s);
return 0;
diff --git a/qemu-char.c b/qemu-char.c
index 27abcb9186..b1d80dd24e 100644
--- a/qemu-char.c
+++ b/qemu-char.c
@@ -2903,3 +2903,13 @@ CharDriverState *qemu_chr_find(const char *name)
}
return NULL;
}
+
+/* Get a character (serial) device interface. */
+CharDriverState *qemu_char_get_next_serial(void)
+{
+ static int next_serial;
+
+ /* FIXME: This function needs to go away: use chardev properties! */
+ return serial_hds[next_serial++];
+}
+
diff --git a/qemu-char.h b/qemu-char.h
index 8ca1e2d54e..486644b3bd 100644
--- a/qemu-char.h
+++ b/qemu-char.h
@@ -248,4 +248,6 @@ void qemu_chr_close_mem(CharDriverState *chr);
QString *qemu_chr_mem_to_qs(CharDriverState *chr);
size_t qemu_chr_mem_osize(const CharDriverState *chr);
+CharDriverState *qemu_char_get_next_serial(void);
+
#endif