From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Cc: aliguori@us.ibm.com, afaerber@suse.de
Subject: [Qemu-devel] [PATCH 09/25] qdev: move bus properties to a separate global
Date: Tue, 3 Apr 2012 13:15:37 +0200 [thread overview]
Message-ID: <1333451753-3550-10-git-send-email-pbonzini@redhat.com> (raw)
In-Reply-To: <1333451753-3550-1-git-send-email-pbonzini@redhat.com>
Simple code movement in order to simplify future refactoring.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
hw/i2c.c | 10 ++++++----
hw/ide/qdev.c | 10 ++++++----
hw/intel-hda.c | 10 ++++++----
hw/pci.c | 22 ++++++++++++----------
hw/scsi-bus.c | 14 ++++++++------
hw/spapr_vio.c | 10 ++++++----
hw/usb/bus.c | 11 +++++++----
hw/usb/dev-smartcard-reader.c | 10 ++++++----
hw/virtio-serial-bus.c | 12 +++++++-----
9 files changed, 64 insertions(+), 45 deletions(-)
diff --git a/hw/i2c.c b/hw/i2c.c
index 23dfccb..cb10b1d 100644
--- a/hw/i2c.c
+++ b/hw/i2c.c
@@ -17,13 +17,15 @@ struct i2c_bus
uint8_t saved_address;
};
+static Property i2c_props[] = {
+ DEFINE_PROP_UINT8("address", struct I2CSlave, address, 0),
+ DEFINE_PROP_END_OF_LIST(),
+};
+
static struct BusInfo i2c_bus_info = {
.name = "I2C",
.size = sizeof(i2c_bus),
- .props = (Property[]) {
- DEFINE_PROP_UINT8("address", struct I2CSlave, address, 0),
- DEFINE_PROP_END_OF_LIST(),
- }
+ .props = i2c_props,
};
static void i2c_bus_pre_save(void *opaque)
diff --git a/hw/ide/qdev.c b/hw/ide/qdev.c
index f6a4896..4d372f8 100644
--- a/hw/ide/qdev.c
+++ b/hw/ide/qdev.c
@@ -27,14 +27,16 @@
static char *idebus_get_fw_dev_path(DeviceState *dev);
+static Property ide_props[] = {
+ DEFINE_PROP_UINT32("unit", IDEDevice, unit, -1),
+ DEFINE_PROP_END_OF_LIST(),
+};
+
static struct BusInfo ide_bus_info = {
.name = "IDE",
.size = sizeof(IDEBus),
.get_fw_dev_path = idebus_get_fw_dev_path,
- .props = (Property[]) {
- DEFINE_PROP_UINT32("unit", IDEDevice, unit, -1),
- DEFINE_PROP_END_OF_LIST(),
- },
+ .props = ide_props,
};
void ide_bus_new(IDEBus *idebus, DeviceState *dev, int bus_id)
diff --git a/hw/intel-hda.c b/hw/intel-hda.c
index bb11af2..0994f6b 100644
--- a/hw/intel-hda.c
+++ b/hw/intel-hda.c
@@ -29,13 +29,15 @@
/* --------------------------------------------------------------------- */
/* hda bus */
+static Property hda_props[] = {
+ DEFINE_PROP_UINT32("cad", HDACodecDevice, cad, -1),
+ DEFINE_PROP_END_OF_LIST()
+};
+
static struct BusInfo hda_codec_bus_info = {
.name = "HDA",
.size = sizeof(HDACodecBus),
- .props = (Property[]) {
- DEFINE_PROP_UINT32("cad", HDACodecDevice, cad, -1),
- DEFINE_PROP_END_OF_LIST()
- }
+ .props = hda_props,
};
void hda_codec_bus_init(DeviceState *dev, HDACodecBus *bus,
diff --git a/hw/pci.c b/hw/pci.c
index ed8ec99..fff4c4a 100644
--- a/hw/pci.c
+++ b/hw/pci.c
@@ -44,6 +44,17 @@ static char *pcibus_get_dev_path(DeviceState *dev);
static char *pcibus_get_fw_dev_path(DeviceState *dev);
static int pcibus_reset(BusState *qbus);
+static Property pci_props[] = {
+ DEFINE_PROP_PCI_DEVFN("addr", PCIDevice, devfn, -1),
+ DEFINE_PROP_STRING("romfile", PCIDevice, romfile),
+ DEFINE_PROP_UINT32("rombar", PCIDevice, rom_bar, 1),
+ DEFINE_PROP_BIT("multifunction", PCIDevice, cap_present,
+ QEMU_PCI_CAP_MULTIFUNCTION_BITNR, false),
+ DEFINE_PROP_BIT("command_serr_enable", PCIDevice, cap_present,
+ QEMU_PCI_CAP_SERR_BITNR, true),
+ DEFINE_PROP_END_OF_LIST()
+};
+
struct BusInfo pci_bus_info = {
.name = "PCI",
.size = sizeof(PCIBus),
@@ -51,16 +62,7 @@ struct BusInfo pci_bus_info = {
.get_dev_path = pcibus_get_dev_path,
.get_fw_dev_path = pcibus_get_fw_dev_path,
.reset = pcibus_reset,
- .props = (Property[]) {
- DEFINE_PROP_PCI_DEVFN("addr", PCIDevice, devfn, -1),
- DEFINE_PROP_STRING("romfile", PCIDevice, romfile),
- DEFINE_PROP_UINT32("rombar", PCIDevice, rom_bar, 1),
- DEFINE_PROP_BIT("multifunction", PCIDevice, cap_present,
- QEMU_PCI_CAP_MULTIFUNCTION_BITNR, false),
- DEFINE_PROP_BIT("command_serr_enable", PCIDevice, cap_present,
- QEMU_PCI_CAP_SERR_BITNR, true),
- DEFINE_PROP_END_OF_LIST()
- }
+ .props = pci_props,
};
static void pci_update_mappings(PCIDevice *d);
diff --git a/hw/scsi-bus.c b/hw/scsi-bus.c
index 8e76c5d..0352c59 100644
--- a/hw/scsi-bus.c
+++ b/hw/scsi-bus.c
@@ -12,17 +12,19 @@ static char *scsibus_get_fw_dev_path(DeviceState *dev);
static int scsi_req_parse(SCSICommand *cmd, SCSIDevice *dev, uint8_t *buf);
static void scsi_req_dequeue(SCSIRequest *req);
+static Property scsi_props[] = {
+ DEFINE_PROP_UINT32("channel", SCSIDevice, channel, 0),
+ DEFINE_PROP_UINT32("scsi-id", SCSIDevice, id, -1),
+ DEFINE_PROP_UINT32("lun", SCSIDevice, lun, -1),
+ DEFINE_PROP_END_OF_LIST(),
+};
+
static struct BusInfo scsi_bus_info = {
.name = "SCSI",
.size = sizeof(SCSIBus),
.get_dev_path = scsibus_get_dev_path,
.get_fw_dev_path = scsibus_get_fw_dev_path,
- .props = (Property[]) {
- DEFINE_PROP_UINT32("channel", SCSIDevice, channel, 0),
- DEFINE_PROP_UINT32("scsi-id", SCSIDevice, id, -1),
- DEFINE_PROP_UINT32("lun", SCSIDevice, lun, -1),
- DEFINE_PROP_END_OF_LIST(),
- },
+ .props = scsi_props,
};
static int next_scsi_bus;
diff --git a/hw/spapr_vio.c b/hw/spapr_vio.c
index dbf5a90..941a013 100644
--- a/hw/spapr_vio.c
+++ b/hw/spapr_vio.c
@@ -49,13 +49,15 @@
do { } while (0)
#endif
+static Property spapr_vio_props[] = {
+ DEFINE_PROP_UINT32("irq", VIOsPAPRDevice, vio_irq_num, 0), \
+ DEFINE_PROP_END_OF_LIST(),
+};
+
static struct BusInfo spapr_vio_bus_info = {
.name = "spapr-vio",
.size = sizeof(VIOsPAPRBus),
- .props = (Property[]) {
- DEFINE_PROP_UINT32("irq", VIOsPAPRDevice, vio_irq_num, 0), \
- DEFINE_PROP_END_OF_LIST(),
- },
+ .props = spapr_vio_props,
};
VIOsPAPRDevice *spapr_vio_find_by_reg(VIOsPAPRBus *bus, uint32_t reg)
diff --git a/hw/usb/bus.c b/hw/usb/bus.c
index d3f8358..0271bc0 100644
--- a/hw/usb/bus.c
+++ b/hw/usb/bus.c
@@ -11,17 +11,20 @@ static char *usb_get_dev_path(DeviceState *dev);
static char *usb_get_fw_dev_path(DeviceState *qdev);
static int usb_qdev_exit(DeviceState *qdev);
+static Property usb_props[] = {
+ DEFINE_PROP_STRING("port", USBDevice, port_path),
+ DEFINE_PROP_END_OF_LIST()
+};
+
static struct BusInfo usb_bus_info = {
.name = "USB",
.size = sizeof(USBBus),
.print_dev = usb_bus_dev_print,
.get_dev_path = usb_get_dev_path,
.get_fw_dev_path = usb_get_fw_dev_path,
- .props = (Property[]) {
- DEFINE_PROP_STRING("port", USBDevice, port_path),
- DEFINE_PROP_END_OF_LIST()
- },
+ .props = usb_props,
};
+
static int next_usb_bus = 0;
static QTAILQ_HEAD(, USBBus) busses = QTAILQ_HEAD_INITIALIZER(busses);
diff --git a/hw/usb/dev-smartcard-reader.c b/hw/usb/dev-smartcard-reader.c
index 8e66675..4a9cc16 100644
--- a/hw/usb/dev-smartcard-reader.c
+++ b/hw/usb/dev-smartcard-reader.c
@@ -1055,13 +1055,15 @@ static Answer *ccid_peek_next_answer(USBCCIDState *s)
: &s->pending_answers[s->pending_answers_start % PENDING_ANSWERS_NUM];
}
+static Property ccid_props[] = {
+ DEFINE_PROP_UINT32("slot", struct CCIDCardState, slot, 0),
+ DEFINE_PROP_END_OF_LIST(),
+};
+
static struct BusInfo ccid_bus_info = {
.name = "ccid-bus",
.size = sizeof(CCIDBus),
- .props = (Property[]) {
- DEFINE_PROP_UINT32("slot", struct CCIDCardState, slot, 0),
- DEFINE_PROP_END_OF_LIST(),
- }
+ .props = ccid_props,
};
void ccid_card_send_apdu_to_guest(CCIDCardState *card,
diff --git a/hw/virtio-serial-bus.c b/hw/virtio-serial-bus.c
index e22940e..703c08d 100644
--- a/hw/virtio-serial-bus.c
+++ b/hw/virtio-serial-bus.c
@@ -677,15 +677,17 @@ static int virtio_serial_load(QEMUFile *f, void *opaque, int version_id)
static void virtser_bus_dev_print(Monitor *mon, DeviceState *qdev, int indent);
+static Property virtser_props[] = {
+ DEFINE_PROP_UINT32("nr", VirtIOSerialPort, id, VIRTIO_CONSOLE_BAD_ID),
+ DEFINE_PROP_STRING("name", VirtIOSerialPort, name),
+ DEFINE_PROP_END_OF_LIST()
+};
+
static struct BusInfo virtser_bus_info = {
.name = "virtio-serial-bus",
.size = sizeof(VirtIOSerialBus),
.print_dev = virtser_bus_dev_print,
- .props = (Property[]) {
- DEFINE_PROP_UINT32("nr", VirtIOSerialPort, id, VIRTIO_CONSOLE_BAD_ID),
- DEFINE_PROP_STRING("name", VirtIOSerialPort, name),
- DEFINE_PROP_END_OF_LIST()
- }
+ .props = virtser_props,
};
static void virtser_bus_dev_print(Monitor *mon, DeviceState *qdev, int indent)
--
1.7.9.3
next prev parent reply other threads:[~2012-04-03 11:16 UTC|newest]
Thread overview: 57+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-04-03 11:15 [Qemu-devel] [PATCH 00/25] qdev properties final installment: push, push! Paolo Bonzini
2012-04-03 11:15 ` [Qemu-devel] [PATCH 01/25] qom: add object_class_get_parent Paolo Bonzini
2012-04-03 20:50 ` Anthony Liguori
2012-04-03 11:15 ` [Qemu-devel] [PATCH 02/25] qom: add object_child_foreach Paolo Bonzini
2012-04-03 20:51 ` Anthony Liguori
2012-04-03 11:15 ` [Qemu-devel] [PATCH 03/25] qom: add class_base_init Paolo Bonzini
2012-04-03 20:51 ` Anthony Liguori
2012-04-03 11:15 ` [Qemu-devel] [PATCH 04/25] qom: make Object a type Paolo Bonzini
2012-04-03 12:30 ` Andreas Färber
2012-04-03 13:06 ` Paolo Bonzini
2012-04-03 20:52 ` Anthony Liguori
2012-04-03 11:15 ` [Qemu-devel] [PATCH 05/25] qom: push type up to Object Paolo Bonzini
2012-04-03 12:33 ` Andreas Färber
2012-04-03 20:55 ` Anthony Liguori
2012-04-03 11:15 ` [Qemu-devel] [PATCH 06/25] qdev: fix -device foo,? Paolo Bonzini
2012-04-03 20:59 ` Anthony Liguori
2012-04-03 11:15 ` [Qemu-devel] [PATCH 07/25] qdev: use object_property_print in info qtree Paolo Bonzini
2012-04-03 12:28 ` Jan Kiszka
2012-04-03 13:05 ` Paolo Bonzini
2012-05-11 14:10 ` Andreas Färber
2012-05-16 7:40 ` Paolo Bonzini
2012-05-16 7:43 ` Paolo Bonzini
2012-04-03 21:06 ` Anthony Liguori
2012-05-10 20:58 ` Jan Kiszka
2012-05-11 11:28 ` Paolo Bonzini
2012-05-11 11:38 ` Andreas Färber
2012-04-03 11:15 ` [Qemu-devel] [PATCH 08/25] qdev: remove qdev_prop_set_defaults Paolo Bonzini
2012-04-03 21:09 ` Anthony Liguori
2012-04-03 21:43 ` Paolo Bonzini
2012-04-03 11:15 ` Paolo Bonzini [this message]
2012-04-03 11:15 ` [Qemu-devel] [PATCH 10/25] qdev: do not propagate properties to subclasses Paolo Bonzini
2012-04-03 11:15 ` [Qemu-devel] [PATCH 11/25] qdev: pick global properties from superclasses Paolo Bonzini
2012-04-03 11:15 ` [Qemu-devel] [PATCH 12/25] qdev: factor setting of global properties Paolo Bonzini
2012-04-03 11:15 ` [Qemu-devel] [PATCH 13/25] qdev: replace bus properties with superclass properties Paolo Bonzini
2012-04-03 11:15 ` [Qemu-devel] [PATCH 14/25] qapi: add Visitor interfaces for uint*_t and int*_t Paolo Bonzini
2012-04-03 11:15 ` [Qemu-devel] [PATCH 15/25] qdev: use int32_t container for devfn property Paolo Bonzini
2012-04-03 11:15 ` [Qemu-devel] [PATCH 16/25] qdev: switch property accessors to fixed-width visitor interfaces Paolo Bonzini
2012-04-03 11:15 ` [Qemu-devel] [PATCH 17/25] qdev: remove PropertyInfo range checking Paolo Bonzini
2012-04-03 11:15 ` [Qemu-devel] [PATCH 18/25] qdev: remove qdev_prop_exists Paolo Bonzini
2012-04-03 11:15 ` [Qemu-devel] [PATCH 19/25] qom: push state up to Object Paolo Bonzini
2012-04-03 11:15 ` [Qemu-devel] [PATCH 20/25] qdev: generalize properties to Objects Paolo Bonzini
2012-04-03 11:15 ` [Qemu-devel] [PATCH 21/25] qdev: move bulk of qdev-properties.c to qom/object.c Paolo Bonzini
2012-04-03 11:15 ` [Qemu-devel] [PATCH 22/25] qom: push static properties to Object Paolo Bonzini
2012-04-03 11:15 ` [Qemu-devel] [PATCH 23/25] qom: add realized property Paolo Bonzini
2012-04-03 12:11 ` Andreas Färber
2012-04-03 13:03 ` Paolo Bonzini
2012-04-05 12:04 ` Andreas Färber
2012-04-05 12:36 ` Paolo Bonzini
2012-04-05 13:31 ` Andreas Färber
2012-04-05 14:16 ` Paolo Bonzini
2012-04-05 15:13 ` Anthony Liguori
2012-05-09 20:01 ` Igor Mammedov
2012-05-10 7:05 ` Paolo Bonzini
2012-05-10 10:01 ` Andreas Färber
2012-05-10 12:19 ` Anthony Liguori
2012-04-03 11:15 ` [Qemu-devel] [PATCH 24/25] qdev: implement qdev_init on top of realize Paolo Bonzini
2012-04-03 11:15 ` [Qemu-devel] [PATCH 25/25] qdev: split part of device_finalize to device_unrealize Paolo Bonzini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1333451753-3550-10-git-send-email-pbonzini@redhat.com \
--to=pbonzini@redhat.com \
--cc=afaerber@suse.de \
--cc=aliguori@us.ibm.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).