On (Tue) Oct 20 2009 [10:51:30], Gerd Hoffmann wrote: >> @@ -107,3 +107,41 @@ static void virtcon_register(void) >> virtio_serial_port_qdev_register(&virtcon_info); >> } >> device_init(virtcon_register) > >> +static VirtIOSerialPortInfo virtserial_port_info = { >> + .qdev.name = "virtserialport", >> + .qdev.size = sizeof(VirtConsole), >> + .init = virtserial_port_initfn, >> + .have_data = flush_buf, >> + .qdev.props = (Property[]) { >> + DEFINE_PROP_CHR("chardev", VirtConsole, chr), >> + DEFINE_PROP_STRING("name", VirtIOSerialPort, name), > > likewise: DEFINE_PROP_STRING("name", VirtConsole, port.name),
The 'name' field is common to all ports, so it makes sense to put it in the VirtIOSerialPort struct. (Internal users can pre-define it to their liking, eg, org.qemu.vnc) >> +static void virtserial_port_register(void) >> +{ >> + virtio_serial_port_qdev_register(&virtserial_port_info); >> +} >> +device_init(virtserial_port_register) > > You can simply stick two register calls into the existing init function ... The console init function has extra init'ing to do, like disable buffer caching, set is_console to true, etc., so there are two init fns. Amit