Revision a43f9c90 hw/virtio-serial-bus.c

b/hw/virtio-serial-bus.c
658 658

  
659 659
static void virtser_bus_dev_print(Monitor *mon, DeviceState *qdev, int indent)
660 660
{
661
    VirtIOSerialDevice *dev = DO_UPCAST(VirtIOSerialDevice, qdev, qdev);
662
    VirtIOSerialPort *port = DO_UPCAST(VirtIOSerialPort, dev, &dev->qdev);
661
    VirtIOSerialPort *port = DO_UPCAST(VirtIOSerialPort, dev, qdev);
663 662

  
664 663
    monitor_printf(mon, "%*s dev-prop-int: id: %u\n",
665 664
                   indent, "", port->id);
......
721 720

  
722 721
static int virtser_port_qdev_init(DeviceState *qdev, DeviceInfo *base)
723 722
{
724
    VirtIOSerialDevice *dev = DO_UPCAST(VirtIOSerialDevice, qdev, qdev);
723
    VirtIOSerialPort *port = DO_UPCAST(VirtIOSerialPort, dev, qdev);
725 724
    VirtIOSerialPortInfo *info = DO_UPCAST(VirtIOSerialPortInfo, qdev, base);
726
    VirtIOSerialPort *port = DO_UPCAST(VirtIOSerialPort, dev, &dev->qdev);
727 725
    VirtIOSerialBus *bus = DO_UPCAST(VirtIOSerialBus, qbus, qdev->parent_bus);
728 726
    int ret;
729 727
    bool plugging_port0;
......
761 759
        return -1;
762 760
    }
763 761

  
764
    dev->info = info;
765
    ret = info->init(dev);
762
    port->info = info;
763
    ret = info->init(port);
766 764
    if (ret) {
767 765
        return ret;
768 766
    }
......
791 789

  
792 790
static int virtser_port_qdev_exit(DeviceState *qdev)
793 791
{
794
    VirtIOSerialDevice *dev = DO_UPCAST(VirtIOSerialDevice, qdev, qdev);
795
    VirtIOSerialPort *port = DO_UPCAST(VirtIOSerialPort, dev, &dev->qdev);
792
    VirtIOSerialPort *port = DO_UPCAST(VirtIOSerialPort, dev, qdev);
796 793
    VirtIOSerial *vser = port->vser;
797 794

  
798 795
    remove_port(port->vser, port->id);
......
800 797
    QTAILQ_REMOVE(&vser->ports, port, next);
801 798

  
802 799
    if (port->info->exit)
803
        port->info->exit(dev);
800
        port->info->exit(port);
804 801

  
805 802
    return 0;
806 803
}

Also available in: Unified diff