mirror of
https://github.com/xemu-project/xemu.git
synced 2024-11-23 19:49:43 +00:00
serial: realize the serial device
Instead of calling serial_realize_core(), use the QDev realize callback. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
This commit is contained in:
parent
96651db423
commit
c9808d6028
@ -74,7 +74,7 @@ static void serial_isa_realizefn(DeviceState *dev, Error **errp)
|
||||
index++;
|
||||
|
||||
isa_init_irq(isadev, &s->irq, isa->isairq);
|
||||
serial_realize_core(s, errp);
|
||||
object_property_set_bool(OBJECT(s), true, "realized", errp);
|
||||
qdev_set_legacy_instance_id(dev, isa->iobase, 3);
|
||||
|
||||
memory_region_init_io(&s->io, OBJECT(isa), &serial_io_ops, s, "serial", 8);
|
||||
|
@ -106,7 +106,7 @@ static void multi_serial_pci_realize(PCIDevice *dev, Error **errp)
|
||||
|
||||
for (i = 0; i < nports; i++) {
|
||||
s = pci->state + i;
|
||||
serial_realize_core(s, &err);
|
||||
object_property_set_bool(OBJECT(s), true, "realized", &err);
|
||||
if (err != NULL) {
|
||||
error_propagate(errp, err);
|
||||
multi_serial_pci_exit(dev);
|
||||
|
@ -49,7 +49,7 @@ static void serial_pci_realize(PCIDevice *dev, Error **errp)
|
||||
SerialState *s = &pci->state;
|
||||
Error *err = NULL;
|
||||
|
||||
serial_realize_core(s, &err);
|
||||
object_property_set_bool(OBJECT(s), true, "realized", &err);
|
||||
if (err != NULL) {
|
||||
error_propagate(errp, err);
|
||||
return;
|
||||
|
@ -934,8 +934,10 @@ static int serial_be_change(void *opaque)
|
||||
return 0;
|
||||
}
|
||||
|
||||
void serial_realize_core(SerialState *s, Error **errp)
|
||||
static void serial_realize(DeviceState *dev, Error **errp)
|
||||
{
|
||||
SerialState *s = SERIAL(dev);
|
||||
|
||||
s->modem_status_poll = timer_new_ns(QEMU_CLOCK_VIRTUAL, (QEMUTimerCB *) serial_update_msl, s);
|
||||
|
||||
s->fifo_timeout_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, (QEMUTimerCB *) fifo_timeout_int, s);
|
||||
@ -990,7 +992,6 @@ SerialState *serial_init(int base, qemu_irq irq, int baudbase,
|
||||
s->irq = irq;
|
||||
qdev_prop_set_uint32(dev, "baudbase", baudbase);
|
||||
qdev_prop_set_chr(dev, "chardev", chr);
|
||||
serial_realize_core(s, &error_fatal);
|
||||
qdev_set_legacy_instance_id(dev, base, 2);
|
||||
qdev_init_nofail(dev);
|
||||
|
||||
@ -1012,6 +1013,7 @@ static void serial_class_init(ObjectClass *klass, void* data)
|
||||
|
||||
/* internal device for serialio/serialmm, not user-creatable */
|
||||
dc->user_creatable = false;
|
||||
dc->realize = serial_realize;
|
||||
dc->vmsd = &vmstate_serial;
|
||||
dc->props = serial_properties;
|
||||
}
|
||||
@ -1075,8 +1077,6 @@ SerialState *serial_mm_init(MemoryRegion *address_space,
|
||||
s->irq = irq;
|
||||
qdev_prop_set_uint32(dev, "baudbase", baudbase);
|
||||
qdev_prop_set_chr(dev, "chardev", chr);
|
||||
|
||||
serial_realize_core(s, &error_fatal);
|
||||
qdev_set_legacy_instance_id(dev, base, 2);
|
||||
qdev_init_nofail(dev);
|
||||
|
||||
|
@ -83,7 +83,6 @@ typedef struct SerialState {
|
||||
extern const VMStateDescription vmstate_serial;
|
||||
extern const MemoryRegionOps serial_io_ops;
|
||||
|
||||
void serial_realize_core(SerialState *s, Error **errp);
|
||||
void serial_exit_core(SerialState *s);
|
||||
void serial_set_frequency(SerialState *s, uint32_t frequency);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user