qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Andreas Färber" <afaerber@suse.de>
To: qemu-devel@nongnu.org
Cc: "Peter Crosthwaite" <peter.crosthwaite@petalogix.com>,
	"Andreas Färber" <afaerber@suse.de>,
	anthony@codemonkey.ws, "Michael S. Tsirkin" <mst@redhat.com>
Subject: [Qemu-devel] [PATCH v2 12/12] qdev: Drop FROM_QBUS() macro
Date: Fri,  7 Jun 2013 14:58:20 +0200	[thread overview]
Message-ID: <1370609900-21998-13-git-send-email-afaerber@suse.de> (raw)
In-Reply-To: <1370609900-21998-1-git-send-email-afaerber@suse.de>

Use QOM cast macros I2C_BUS(), SSI_BUS(), PCI_BUS() instead.

Signed-off-by: Andreas Färber <afaerber@suse.de>
---
 hw/i2c/core.c          | 4 ++--
 hw/pci/pci.c           | 2 +-
 hw/ssi/ssi.c           | 2 +-
 include/hw/qdev-core.h | 2 --
 4 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/hw/i2c/core.c b/hw/i2c/core.c
index 0c4fc1d..22ef3b9 100644
--- a/hw/i2c/core.c
+++ b/hw/i2c/core.c
@@ -66,7 +66,7 @@ i2c_bus *i2c_init_bus(DeviceState *parent, const char *name)
 {
     i2c_bus *bus;
 
-    bus = FROM_QBUS(i2c_bus, qbus_create(TYPE_I2C_BUS, parent, name));
+    bus = I2C_BUS(qbus_create(TYPE_I2C_BUS, parent, name));
     vmstate_register(NULL, -1, &vmstate_i2c_bus, bus);
     return bus;
 }
@@ -183,7 +183,7 @@ static int i2c_slave_post_load(void *opaque, int version_id)
 {
     I2CSlave *dev = opaque;
     i2c_bus *bus;
-    bus = FROM_QBUS(i2c_bus, qdev_get_parent_bus(&dev->qdev));
+    bus = I2C_BUS(qdev_get_parent_bus(DEVICE(dev)));
     if (bus->saved_address == dev->address) {
         bus->current_dev = dev;
     }
diff --git a/hw/pci/pci.c b/hw/pci/pci.c
index bb3879b..a3eb19e 100644
--- a/hw/pci/pci.c
+++ b/hw/pci/pci.c
@@ -1700,7 +1700,7 @@ static int pci_qdev_init(DeviceState *qdev)
         pci_dev->cap_present |= QEMU_PCI_CAP_EXPRESS;
     }
 
-    bus = FROM_QBUS(PCIBus, qdev_get_parent_bus(qdev));
+    bus = PCI_BUS(qdev_get_parent_bus(qdev));
     pci_dev = do_pci_register_device(pci_dev, bus,
                                      object_get_typename(OBJECT(qdev)),
                                      pci_dev->devfn);
diff --git a/hw/ssi/ssi.c b/hw/ssi/ssi.c
index 1264d9d..2c25260 100644
--- a/hw/ssi/ssi.c
+++ b/hw/ssi/ssi.c
@@ -103,7 +103,7 @@ SSIBus *ssi_create_bus(DeviceState *parent, const char *name)
 {
     BusState *bus;
     bus = qbus_create(TYPE_SSI_BUS, parent, name);
-    return FROM_QBUS(SSIBus, bus);
+    return SSI_BUS(bus);
 }
 
 uint32_t ssi_transfer(SSIBus *bus, uint32_t val)
diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h
index cf83d54..7fbffcb 100644
--- a/include/hw/qdev-core.h
+++ b/include/hw/qdev-core.h
@@ -261,8 +261,6 @@ void qbus_reset_all_fn(void *opaque);
 
 void qbus_free(BusState *bus);
 
-#define FROM_QBUS(type, dev) DO_UPCAST(type, qbus, dev)
-
 /* This should go away once we get rid of the NULL bus hack */
 BusState *sysbus_get_default(void);
 
-- 
1.8.1.4

  parent reply	other threads:[~2013-06-07 12:58 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-07 12:58 [Qemu-devel] [PATCH v2 00/12] QOM realize for ISA, part 2 Andreas Färber
2013-06-07 12:58 ` [Qemu-devel] [PATCH v2 01/12] gus: QOM'ify some more Andreas Färber
2013-06-07 12:58 ` [Qemu-devel] [PATCH v2 02/12] cs4231a: " Andreas Färber
2013-06-07 12:58 ` [Qemu-devel] [PATCH v2 03/12] isa: Use realizefn for ISADevice Andreas Färber
2013-06-07 12:58 ` [Qemu-devel] [PATCH v2 04/12] i8254: QOM'ify some more Andreas Färber
2013-06-07 12:58 ` [Qemu-devel] [PATCH v2 05/12] kvm/i8254: " Andreas Färber
2013-06-10  1:37   ` li guang
2013-06-10  1:40     ` Andreas Färber
2013-06-10  1:43       ` li guang
2013-06-07 12:58 ` [Qemu-devel] [PATCH v2 06/12] i8254: Convert PITCommonState to QOM realizefn Andreas Färber
2013-06-07 12:58 ` [Qemu-devel] [PATCH v2 07/12] i8259: QOM'ify some more Andreas Färber
2013-06-07 12:58 ` [Qemu-devel] [PATCH v2 08/12] kvm/i8259: " Andreas Färber
2013-06-07 12:58 ` [Qemu-devel] [PATCH v2 09/12] i8259: Convert PICCommonState to use QOM realizefn Andreas Färber
2013-06-07 12:58 ` [Qemu-devel] [PATCH v2 10/12] isa: QOM'ify ISABus Andreas Färber
2013-06-07 12:58 ` [Qemu-devel] [PATCH v2 11/12] isa: QOM'ify ISADevice Andreas Färber
2013-06-07 12:58 ` Andreas Färber [this message]
2013-06-07 13:08 ` [Qemu-devel] [PATCH v2 00/12] QOM realize for ISA, part 2 Andreas Färber
2013-06-15 17:55 ` Blue Swirl

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=1370609900-21998-13-git-send-email-afaerber@suse.de \
    --to=afaerber@suse.de \
    --cc=anthony@codemonkey.ws \
    --cc=mst@redhat.com \
    --cc=peter.crosthwaite@petalogix.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).