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:
Anthony Liguori 2011-12-22 15:29:25 -06:00
parent ee46d8a503
commit 0beb494207
10 changed files with 18 additions and 17 deletions

View File

@ -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); memory_region_init_io(&s->mmio, &ser_ops, s, "etraxfs-serial", R_MAX * 4);
sysbus_init_mmio(dev, &s->mmio); sysbus_init_mmio(dev, &s->mmio);
s->chr = qdev_init_chardev(&dev->qdev); s->chr = qemu_char_get_next_serial();
if (s->chr) if (s->chr)
qemu_chr_add_handlers(s->chr, qemu_chr_add_handlers(s->chr,
serial_can_receive, serial_receive, serial_can_receive, serial_receive,

View File

@ -114,7 +114,7 @@ static int lm32_juart_init(SysBusDevice *dev)
{ {
LM32JuartState *s = FROM_SYSBUS(typeof(*s), 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) { if (s->chr) {
qemu_chr_add_handlers(s->chr, juart_can_rx, juart_rx, juart_event, s); qemu_chr_add_handlers(s->chr, juart_can_rx, juart_rx, juart_event, s);
} }

View File

@ -252,7 +252,7 @@ static int lm32_uart_init(SysBusDevice *dev)
memory_region_init_io(&s->iomem, &uart_ops, s, "uart", R_MAX * 4); memory_region_init_io(&s->iomem, &uart_ops, s, "uart", R_MAX * 4);
sysbus_init_mmio(dev, &s->iomem); sysbus_init_mmio(dev, &s->iomem);
s->chr = qdev_init_chardev(&dev->qdev); s->chr = qemu_char_get_next_serial();
if (s->chr) { if (s->chr) {
qemu_chr_add_handlers(s->chr, uart_can_rx, uart_rx, uart_event, s); qemu_chr_add_handlers(s->chr, uart_can_rx, uart_rx, uart_event, s);
} }

View File

@ -199,7 +199,7 @@ static int milkymist_uart_init(SysBusDevice *dev)
"milkymist-uart", R_MAX * 4); "milkymist-uart", R_MAX * 4);
sysbus_init_mmio(dev, &s->regs_region); sysbus_init_mmio(dev, &s->regs_region);
s->chr = qdev_init_chardev(&dev->qdev); s->chr = qemu_char_get_next_serial();
if (s->chr) { if (s->chr) {
qemu_chr_add_handlers(s->chr, uart_can_rx, uart_rx, uart_event, s); qemu_chr_add_handlers(s->chr, uart_can_rx, uart_rx, uart_event, s);
} }

View File

@ -264,7 +264,7 @@ static int pl011_init(SysBusDevice *dev, const unsigned char *id)
sysbus_init_mmio(dev, &s->iomem); sysbus_init_mmio(dev, &s->iomem);
sysbus_init_irq(dev, &s->irq); sysbus_init_irq(dev, &s->irq);
s->id = id; s->id = id;
s->chr = qdev_init_chardev(&dev->qdev); s->chr = qemu_char_get_next_serial();
s->read_trigger = 1; s->read_trigger = 1;
s->ifl = 0x12; s->ifl = 0x12;

View File

@ -336,15 +336,6 @@ bool qdev_machine_modified(void)
return qdev_hot_added || qdev_hot_removed; 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) BusState *qdev_get_parent_bus(DeviceState *dev)
{ {
return dev->parent_bus; return dev->parent_bus;

View File

@ -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_in(DeviceState *dev, qemu_irq_handler handler, int n);
void qdev_init_gpio_out(DeviceState *dev, qemu_irq *pins, 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); BusState *qdev_get_parent_bus(DeviceState *dev);
/*** BUS API. ***/ /*** BUS API. ***/

View File

@ -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); memory_region_init_io(&s->mmio, &uart_ops, s, "xilinx-uartlite", R_MAX * 4);
sysbus_init_mmio(dev, &s->mmio); sysbus_init_mmio(dev, &s->mmio);
s->chr = qdev_init_chardev(&dev->qdev); s->chr = qemu_char_get_next_serial();
if (s->chr) if (s->chr)
qemu_chr_add_handlers(s->chr, uart_can_rx, uart_rx, uart_event, s); qemu_chr_add_handlers(s->chr, uart_can_rx, uart_rx, uart_event, s);
return 0; return 0;

View File

@ -2903,3 +2903,13 @@ CharDriverState *qemu_chr_find(const char *name)
} }
return NULL; 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++];
}

View File

@ -248,4 +248,6 @@ void qemu_chr_close_mem(CharDriverState *chr);
QString *qemu_chr_mem_to_qs(CharDriverState *chr); QString *qemu_chr_mem_to_qs(CharDriverState *chr);
size_t qemu_chr_mem_osize(const CharDriverState *chr); size_t qemu_chr_mem_osize(const CharDriverState *chr);
CharDriverState *qemu_char_get_next_serial(void);
#endif #endif