From patchwork Mon Jan 30 21:08:47 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Anthony Liguori X-Patchwork-Id: 138655 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id BC3C4B6F9B for ; Tue, 31 Jan 2012 08:57:32 +1100 (EST) Received: from localhost ([::1]:60276 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RrzE8-0003FY-8U for incoming@patchwork.ozlabs.org; Mon, 30 Jan 2012 16:57:28 -0500 Received: from eggs.gnu.org ([140.186.70.92]:41679) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RryTb-0001yI-Kx for qemu-devel@nongnu.org; Mon, 30 Jan 2012 16:09:27 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RryTX-00052m-8W for qemu-devel@nongnu.org; Mon, 30 Jan 2012 16:09:23 -0500 Received: from cpe-70-123-132-139.austin.res.rr.com ([70.123.132.139]:34300 helo=localhost6.localdomain6) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RryTW-00052a-Mj for qemu-devel@nongnu.org; Mon, 30 Jan 2012 16:09:19 -0500 Received: from localhost6.localdomain6 (localhost.localdomain [127.0.0.1]) by localhost6.localdomain6 (8.14.4/8.14.4/Debian-2ubuntu1) with ESMTP id q0UL9DNq006017; Mon, 30 Jan 2012 15:09:14 -0600 Received: (from anthony@localhost) by localhost6.localdomain6 (8.14.4/8.14.4/Submit) id q0UL9DWC006015; Mon, 30 Jan 2012 15:09:13 -0600 From: Anthony Liguori To: qemu-devel@nongnu.org Date: Mon, 30 Jan 2012 15:08:47 -0600 Message-Id: <1327957741-5842-9-git-send-email-aliguori@us.ibm.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1327957741-5842-1-git-send-email-aliguori@us.ibm.com> References: <1327957741-5842-1-git-send-email-aliguori@us.ibm.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 70.123.132.139 Cc: Paolo Bonzini , Andreas Faerber , Anthony Liguori , Peter Maydell Subject: [Qemu-devel] [PATCH 09/23] qdev: kill of DeviceInfo X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org It is no longer used in the tree since everything is done natively through QEMU Object Model. Signed-off-by: Anthony Liguori Reviewed-by: Andreas Färber --- hw/i2c.c | 2 +- hw/ide/qdev.c | 2 +- hw/intel-hda.c | 2 +- hw/isa-bus.c | 2 +- hw/pci.c | 2 +- hw/qdev.c | 70 +----------------------------------------------- hw/qdev.h | 33 +---------------------- hw/s390-virtio-bus.c | 2 +- hw/scsi-bus.c | 2 +- hw/spapr_vio.c | 2 +- hw/ssi.c | 2 +- hw/sysbus.c | 2 +- hw/usb-bus.c | 2 +- hw/usb-ccid.c | 2 +- hw/virtio-serial-bus.c | 2 +- 15 files changed, 15 insertions(+), 114 deletions(-) diff --git a/hw/i2c.c b/hw/i2c.c index e21a666..8ae4aaa 100644 --- a/hw/i2c.c +++ b/hw/i2c.c @@ -196,7 +196,7 @@ const VMStateDescription vmstate_i2c_slave = { } }; -static int i2c_slave_qdev_init(DeviceState *dev, DeviceInfo *base) +static int i2c_slave_qdev_init(DeviceState *dev) { I2CSlave *s = I2C_SLAVE_FROM_QDEV(dev); I2CSlaveClass *sc = I2C_SLAVE_GET_CLASS(s); diff --git a/hw/ide/qdev.c b/hw/ide/qdev.c index 1335615..1640616 100644 --- a/hw/ide/qdev.c +++ b/hw/ide/qdev.c @@ -53,7 +53,7 @@ static char *idebus_get_fw_dev_path(DeviceState *dev) return strdup(path); } -static int ide_qdev_init(DeviceState *qdev, DeviceInfo *base) +static int ide_qdev_init(DeviceState *qdev) { IDEDevice *dev = IDE_DEVICE(qdev); IDEDeviceClass *dc = IDE_DEVICE_GET_CLASS(dev); diff --git a/hw/intel-hda.c b/hw/intel-hda.c index 9e4a31f..83c42d5 100644 --- a/hw/intel-hda.c +++ b/hw/intel-hda.c @@ -47,7 +47,7 @@ void hda_codec_bus_init(DeviceState *dev, HDACodecBus *bus, bus->xfer = xfer; } -static int hda_codec_dev_init(DeviceState *qdev, DeviceInfo *base) +static int hda_codec_dev_init(DeviceState *qdev) { HDACodecBus *bus = DO_UPCAST(HDACodecBus, qbus, qdev->parent_bus); HDACodecDevice *dev = DO_UPCAST(HDACodecDevice, qdev, qdev); diff --git a/hw/isa-bus.c b/hw/isa-bus.c index a22c5c6..d03f828 100644 --- a/hw/isa-bus.c +++ b/hw/isa-bus.c @@ -110,7 +110,7 @@ void isa_register_portio_list(ISADevice *dev, uint16_t start, portio_list_add(piolist, isabus->address_space_io, start); } -static int isa_qdev_init(DeviceState *qdev, DeviceInfo *base) +static int isa_qdev_init(DeviceState *qdev) { ISADevice *dev = ISA_DEVICE(qdev); ISADeviceClass *klass = ISA_DEVICE_GET_CLASS(dev); diff --git a/hw/pci.c b/hw/pci.c index 8fd450c..1df05ae 100644 --- a/hw/pci.c +++ b/hw/pci.c @@ -1453,7 +1453,7 @@ PCIDevice *pci_find_device(PCIBus *bus, int bus_num, uint8_t devfn) return bus->devices[devfn]; } -static int pci_qdev_init(DeviceState *qdev, DeviceInfo *base) +static int pci_qdev_init(DeviceState *qdev) { PCIDevice *pci_dev = (PCIDevice *)qdev; PCIDeviceClass *pc = PCI_DEVICE_GET_CLASS(pci_dev); diff --git a/hw/qdev.c b/hw/qdev.c index ea917ad..84fb112 100644 --- a/hw/qdev.c +++ b/hw/qdev.c @@ -43,49 +43,6 @@ static BusState *qbus_find_recursive(BusState *bus, const char *name, static BusState *qbus_find(const char *path); /* Register a new device type. */ -static void qdev_subclass_init(ObjectClass *klass, void *data) -{ - DeviceClass *dc = DEVICE_CLASS(klass); - DeviceInfo *info = data; - - if (info->fw_name) { - dc->fw_name = info->fw_name; - } - if (info->alias) { - dc->alias = info->alias; - } - if (info->desc) { - dc->desc = info->desc; - } - if (info->props) { - dc->props = info->props; - } - if (info->no_user) { - dc->no_user = info->no_user; - } - if (info->reset) { - dc->reset = info->reset; - } - if (info->vmsd) { - dc->vmsd = info->vmsd; - } - if (info->init) { - dc->init = info->init; - } - if (info->unplug) { - dc->unplug = info->unplug; - } - if (info->exit) { - dc->exit = info->exit; - } - if (info->bus_info) { - dc->bus_info = info->bus_info; - } - if (info->class_init) { - info->class_init(klass, data); - } -} - const VMStateDescription *qdev_get_vmsd(DeviceState *dev) { DeviceClass *dc = DEVICE_GET_CLASS(dev); @@ -117,30 +74,6 @@ const char *qdev_fw_name(DeviceState *dev) return object_get_typename(OBJECT(dev)); } -static void qdev_do_register_subclass(DeviceInfo *info, const char *parent, - const char *name) -{ - TypeInfo type_info = {}; - - assert(info->size >= sizeof(DeviceState)); - - type_info.name = name; - type_info.parent = parent; - type_info.instance_size = info->size; - type_info.class_init = qdev_subclass_init; - type_info.class_data = info; - - type_register_static(&type_info); -} - -void qdev_register_subclass(DeviceInfo *info, const char *parent) -{ - qdev_do_register_subclass(info, parent, info->name); - if (info->alias) { - qdev_do_register_subclass(info, parent, info->alias); - } -} - bool qdev_exists(const char *name) { return !!object_class_by_name(name); @@ -406,8 +339,7 @@ int qdev_init(DeviceState *dev) assert(dev->state == DEV_STATE_CREATED); - /* FIXME hopefully this doesn't break anything */ - rc = dc->init(dev, NULL); + rc = dc->init(dev); if (rc < 0) { qdev_free(dev); return rc; diff --git a/hw/qdev.h b/hw/qdev.h index 54626ac..29f6daa 100644 --- a/hw/qdev.h +++ b/hw/qdev.h @@ -14,8 +14,6 @@ typedef struct PropertyInfo PropertyInfo; typedef struct CompatProperty CompatProperty; -typedef struct DeviceInfo DeviceInfo; - typedef struct BusState BusState; typedef struct BusInfo BusInfo; @@ -72,7 +70,7 @@ typedef struct DeviceProperty #define DEVICE_CLASS(klass) OBJECT_CLASS_CHECK(DeviceClass, (klass), TYPE_DEVICE) #define DEVICE_GET_CLASS(obj) OBJECT_GET_CLASS(DeviceClass, (obj), TYPE_DEVICE) -typedef int (*qdev_initfn)(DeviceState *dev, DeviceInfo *info); +typedef int (*qdev_initfn)(DeviceState *dev); typedef int (*qdev_event)(DeviceState *dev); typedef void (*qdev_resetfn)(DeviceState *dev); @@ -232,35 +230,6 @@ BusState *qdev_get_child_bus(DeviceState *dev, const char *name); /*** Device API. ***/ -struct DeviceInfo { - const char *name; - const char *fw_name; - const char *alias; - const char *desc; - size_t size; - Property *props; - int no_user; - - /* callbacks */ - qdev_resetfn reset; - - /* device state */ - const VMStateDescription *vmsd; - - /** - * See #TypeInfo::class_init() - */ - void (*class_init)(ObjectClass *klass, void *data); - - /* Private to qdev / bus. */ - qdev_initfn init; - qdev_event unplug; - qdev_event exit; - BusInfo *bus_info; -}; - -void qdev_register_subclass(DeviceInfo *info, const char *parent); - /* Register device properties. */ /* GPIO inputs also double as IRQ sinks. */ void qdev_init_gpio_in(DeviceState *dev, qemu_irq_handler handler, int n); diff --git a/hw/s390-virtio-bus.c b/hw/s390-virtio-bus.c index a0c610a..4e1e888 100644 --- a/hw/s390-virtio-bus.c +++ b/hw/s390-virtio-bus.c @@ -410,7 +410,7 @@ static TypeInfo s390_virtio_serial = { .class_init = s390_virtio_serial_class_init, }; -static int s390_virtio_busdev_init(DeviceState *dev, DeviceInfo *info) +static int s390_virtio_busdev_init(DeviceState *dev) { VirtIOS390Device *_dev = (VirtIOS390Device *)dev; VirtIOS390DeviceClass *_info = VIRTIO_S390_DEVICE_GET_CLASS(dev); diff --git a/hw/scsi-bus.c b/hw/scsi-bus.c index b75044f..0ee50a8 100644 --- a/hw/scsi-bus.c +++ b/hw/scsi-bus.c @@ -115,7 +115,7 @@ static void scsi_dma_restart_cb(void *opaque, int running, RunState state) } } -static int scsi_qdev_init(DeviceState *qdev, DeviceInfo *base) +static int scsi_qdev_init(DeviceState *qdev) { SCSIDevice *dev = SCSI_DEVICE(qdev); SCSIBus *bus = DO_UPCAST(SCSIBus, qbus, dev->qdev.parent_bus); diff --git a/hw/spapr_vio.c b/hw/spapr_vio.c index d39a47b..64f0009 100644 --- a/hw/spapr_vio.c +++ b/hw/spapr_vio.c @@ -649,7 +649,7 @@ static int spapr_vio_check_reg(VIOsPAPRDevice *sdev) return 0; } -static int spapr_vio_busdev_init(DeviceState *qdev, DeviceInfo *qinfo) +static int spapr_vio_busdev_init(DeviceState *qdev) { VIOsPAPRDevice *dev = (VIOsPAPRDevice *)qdev; VIOsPAPRDeviceClass *pc = VIO_SPAPR_DEVICE_GET_CLASS(dev); diff --git a/hw/ssi.c b/hw/ssi.c index 4282b8b..ead446c 100644 --- a/hw/ssi.c +++ b/hw/ssi.c @@ -21,7 +21,7 @@ static struct BusInfo ssi_bus_info = { .size = sizeof(SSIBus), }; -static int ssi_slave_init(DeviceState *dev, DeviceInfo *base_info) +static int ssi_slave_init(DeviceState *dev) { SSISlave *s = SSI_SLAVE(dev); SSISlaveClass *ssc = SSI_SLAVE_GET_CLASS(s); diff --git a/hw/sysbus.c b/hw/sysbus.c index 4870dbf..282060a 100644 --- a/hw/sysbus.c +++ b/hw/sysbus.c @@ -105,7 +105,7 @@ void sysbus_init_ioports(SysBusDevice *dev, pio_addr_t ioport, pio_addr_t size) } } -static int sysbus_device_init(DeviceState *dev, DeviceInfo *base) +static int sysbus_device_init(DeviceState *dev) { SysBusDevice *sd = SYS_BUS_DEVICE(dev); SysBusDeviceClass *sbc = SYS_BUS_DEVICE_GET_CLASS(sd); diff --git a/hw/usb-bus.c b/hw/usb-bus.c index d07f844..b753834 100644 --- a/hw/usb-bus.c +++ b/hw/usb-bus.c @@ -156,7 +156,7 @@ void usb_device_set_interface(USBDevice *dev, int interface, } } -static int usb_qdev_init(DeviceState *qdev, DeviceInfo *base) +static int usb_qdev_init(DeviceState *qdev) { USBDevice *dev = USB_DEVICE(qdev); int rc; diff --git a/hw/usb-ccid.c b/hw/usb-ccid.c index 844f873..881da30 100644 --- a/hw/usb-ccid.c +++ b/hw/usb-ccid.c @@ -1161,7 +1161,7 @@ static int ccid_card_exit(DeviceState *qdev) return ret; } -static int ccid_card_init(DeviceState *qdev, DeviceInfo *base) +static int ccid_card_init(DeviceState *qdev) { CCIDCardState *card = CCID_CARD(qdev); USBCCIDState *s = diff --git a/hw/virtio-serial-bus.c b/hw/virtio-serial-bus.c index 50a6d7f..6117629 100644 --- a/hw/virtio-serial-bus.c +++ b/hw/virtio-serial-bus.c @@ -748,7 +748,7 @@ static void remove_port(VirtIOSerial *vser, uint32_t port_id) send_control_event(port, VIRTIO_CONSOLE_PORT_REMOVE, 1); } -static int virtser_port_qdev_init(DeviceState *qdev, DeviceInfo *base) +static int virtser_port_qdev_init(DeviceState *qdev) { VirtIOSerialPort *port = DO_UPCAST(VirtIOSerialPort, dev, qdev); VirtIOSerialPortClass *vsc = VIRTIO_SERIAL_PORT_GET_CLASS(port);