mirror of
https://github.com/qemu/qemu.git
synced 2024-11-23 19:03:38 +08:00
qdev: nuke qdev_init_chardev()
I'm sure the intentions were good here, but there's no reason this should be in qdev. Move it to qemu-char where it belongs. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
This commit is contained in:
parent
ee46d8a503
commit
0beb494207
@ -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,
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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. ***/
|
||||
|
@ -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;
|
||||
|
10
qemu-char.c
10
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++];
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user