All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Andreas Färber" <afaerber@suse.de>
To: peter.crosthwaite@xilinx.com
Cc: pbonzini@redhat.com,
	Stefano Stabellini <stefano.stabellini@eu.citrix.com>,
	qemu-devel@nongnu.org, mst@redhat.com
Subject: Re: [Qemu-devel] [PATCH v2 14/30] xen/xen_platform: QOM casting sweep
Date: Sun, 30 Jun 2013 11:32:15 +0200	[thread overview]
Message-ID: <51CFFB1F.9030000@suse.de> (raw)
In-Reply-To: <9d1116516fd0d5c38ff376df4b8437e197eb8295.1372055322.git.peter.crosthwaite@xilinx.com>

Am 24.06.2013 09:00, schrieb peter.crosthwaite@xilinx.com:
> From: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
> 
> Define and use standard QOM cast macro. Remove usages of DO_UPCAST
> and direct -> style upcasting.
> 
> Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
> ---
> 
>  hw/xen/xen_platform.c | 28 ++++++++++++++++------------
>  1 file changed, 16 insertions(+), 12 deletions(-)
> 
> diff --git a/hw/xen/xen_platform.c b/hw/xen/xen_platform.c
> index b6c6793..f119c44 100644
> --- a/hw/xen/xen_platform.c
> +++ b/hw/xen/xen_platform.c
> @@ -62,6 +62,10 @@ typedef struct PCIXenPlatformState {
>      int log_buffer_off;
>  } PCIXenPlatformState;
>  
> +#define TYPE_XEN_PLATFORM "xen-platform"
> +#define XEN_PLATFORM(obj) \
> +    OBJECT_CHECK(PCIXenPlatformState, (obj), TYPE_XEN_PLATFORM)
> +
>  #define XEN_PLATFORM_IOPORT 0x10
>  
>  /* Send bytes to syslog */
> @@ -88,7 +92,7 @@ static void unplug_nic(PCIBus *b, PCIDevice *d, void *o)
>      if (pci_get_word(d->config + PCI_CLASS_DEVICE) ==
>              PCI_CLASS_NETWORK_ETHERNET
>              && strcmp(d->name, "xen-pci-passthrough") != 0) {
> -        qdev_free(&d->qdev);
> +        qdev_free(DEVICE(d));
>      }
>  }
>  
> @@ -103,7 +107,7 @@ static void unplug_disks(PCIBus *b, PCIDevice *d, void *o)
>      if (pci_get_word(d->config + PCI_CLASS_DEVICE) ==
>              PCI_CLASS_STORAGE_IDE
>              && strcmp(d->name, "xen-pci-passthrough") != 0) {
> -        qdev_unplug(&(d->qdev), NULL);
> +        qdev_unplug(DEVICE(d), NULL);
>      }
>  }
>  
> @@ -114,7 +118,7 @@ static void pci_unplug_disks(PCIBus *bus)
>  
>  static void platform_fixed_ioport_writew(void *opaque, uint32_t addr, uint32_t val)
>  {
> -    PCIXenPlatformState *s = opaque;
> +    PCIXenPlatformState *s = XEN_PLATFORM(opaque);

These are superfluous since PCIXenPlatformState is passed for both
MemoryRegionOps. Dropping these hunks.

Some usages of the parent field are still left behind.

Thanks, applied to qom-next:
https://github.com/afaerber/qemu-cpu/commits/qom-next

Andreas

>  
>      switch (addr) {
>      case 0:
> @@ -164,7 +168,7 @@ static void platform_fixed_ioport_writel(void *opaque, uint32_t addr,
>  
>  static void platform_fixed_ioport_writeb(void *opaque, uint32_t addr, uint32_t val)
>  {
> -    PCIXenPlatformState *s = opaque;
> +    PCIXenPlatformState *s = XEN_PLATFORM(opaque);
>  
>      switch (addr) {
>      case 0: /* Platform flags */ {
> @@ -187,7 +191,7 @@ static void platform_fixed_ioport_writeb(void *opaque, uint32_t addr, uint32_t v
>  
>  static uint32_t platform_fixed_ioport_readw(void *opaque, uint32_t addr)
>  {
> -    PCIXenPlatformState *s = opaque;
> +    PCIXenPlatformState *s = XEN_PLATFORM(opaque);
>  
>      switch (addr) {
>      case 0:
> @@ -206,7 +210,7 @@ static uint32_t platform_fixed_ioport_readw(void *opaque, uint32_t addr)
>  
>  static uint32_t platform_fixed_ioport_readb(void *opaque, uint32_t addr)
>  {
> -    PCIXenPlatformState *s = opaque;
> +    PCIXenPlatformState *s = XEN_PLATFORM(opaque);
>  
>      switch (addr) {
>      case 0:
> @@ -222,7 +226,7 @@ static uint32_t platform_fixed_ioport_readb(void *opaque, uint32_t addr)
>  
>  static void platform_fixed_ioport_reset(void *opaque)
>  {
> -    PCIXenPlatformState *s = opaque;
> +    PCIXenPlatformState *s = XEN_PLATFORM(opaque);
>  
>      platform_fixed_ioport_writeb(s, 0, 0);
>  }
> @@ -292,7 +296,7 @@ static uint64_t xen_platform_ioport_readb(void *opaque, hwaddr addr,
>  static void xen_platform_ioport_writeb(void *opaque, hwaddr addr,
>                                         uint64_t val, unsigned int size)
>  {
> -    PCIXenPlatformState *s = opaque;
> +    PCIXenPlatformState *s = XEN_PLATFORM(opaque);
>  
>      switch (addr) {
>      case 0: /* Platform flags */
> @@ -349,7 +353,7 @@ static void platform_mmio_setup(PCIXenPlatformState *d)
>  
>  static int xen_platform_post_load(void *opaque, int version_id)
>  {
> -    PCIXenPlatformState *s = opaque;
> +    PCIXenPlatformState *s = XEN_PLATFORM(opaque);
>  
>      platform_fixed_ioport_writeb(s, 0, s->flags);
>  
> @@ -371,7 +375,7 @@ static const VMStateDescription vmstate_xen_platform = {
>  
>  static int xen_platform_initfn(PCIDevice *dev)
>  {
> -    PCIXenPlatformState *d = DO_UPCAST(PCIXenPlatformState, pci_dev, dev);
> +    PCIXenPlatformState *d = XEN_PLATFORM(dev);
>      uint8_t *pci_conf;
>  
>      pci_conf = d->pci_dev.config;
> @@ -397,7 +401,7 @@ static int xen_platform_initfn(PCIDevice *dev)
>  
>  static void platform_reset(DeviceState *dev)
>  {
> -    PCIXenPlatformState *s = DO_UPCAST(PCIXenPlatformState, pci_dev.qdev, dev);
> +    PCIXenPlatformState *s = XEN_PLATFORM(dev);
>  
>      platform_fixed_ioport_reset(s);
>  }
> @@ -420,7 +424,7 @@ static void xen_platform_class_init(ObjectClass *klass, void *data)
>  }
>  
>  static const TypeInfo xen_platform_info = {
> -    .name          = "xen-platform",
> +    .name          = TYPE_XEN_PLATFORM,
>      .parent        = TYPE_PCI_DEVICE,
>      .instance_size = sizeof(PCIXenPlatformState),
>      .class_init    = xen_platform_class_init,
> 


-- 
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg

  reply	other threads:[~2013-06-30  9:35 UTC|newest]

Thread overview: 69+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-24  6:49 [Qemu-devel] [PATCH v2 00/30] PCI: Cleanup legacy casts in device land peter.crosthwaite
2013-06-24  6:50 ` [Qemu-devel] [PATCH v2 01/30] net/e1000: QOM Upcast Sweep peter.crosthwaite
2013-06-30 10:59   ` [Qemu-devel] [PATCH qom-next] net/e1000: QOM parent field cleanup Andreas Färber
2013-06-24  6:51 ` [Qemu-devel] [PATCH v2 02/30] net/rtl8139: QOM Upcast Sweep peter.crosthwaite
2013-06-30 11:16   ` [Qemu-devel] [PATCH qom-next] net/rtl8139: QOM parent field cleanup Andreas Färber
2013-06-24  6:52 ` [Qemu-devel] [PATCH v2 03/30] net/pcnet-pci: QOM Upcast Sweep peter.crosthwaite
2013-06-30  7:34   ` Andreas Färber
2013-06-30 11:24     ` Andreas Färber
2013-07-22 17:17     ` Andreas Färber
2013-06-24  6:52 ` [Qemu-devel] [PATCH v2 04/30] usb/hcd-xhci: " peter.crosthwaite
2013-06-30  7:44   ` Andreas Färber
2013-06-30 11:41   ` [Qemu-devel] [PATCH qom-next] usb/hcd-xhci: QOM parent field cleanup Andreas Färber
2013-06-24  6:53 ` [Qemu-devel] [PATCH v2 05/30] scsi/lsi53c895a: QOM Upcast Sweep peter.crosthwaite
2013-06-30  7:51   ` Andreas Färber
2013-06-30 11:54   ` [Qemu-devel] [PATCH qom-next] scsi/lsi53c895a: QOM parent field cleanup Andreas Färber
2013-06-24  6:54 ` [Qemu-devel] [PATCH v2 06/30] scsi/megasas: QOM Upcast Sweep peter.crosthwaite
2013-06-30 12:04   ` [Qemu-devel] [PATCH qom-next] scsi/megasas: QOM parent field cleanup Andreas Färber
2013-06-24  6:55 ` [Qemu-devel] [PATCH v2 07/30] scsi/esp-pci: QOM Upcast Sweep peter.crosthwaite
2013-06-30 12:11   ` [Qemu-devel] [PATCH qom-next] scsi/esp-pci: QOM parent field cleanup Andreas Färber
2013-06-24  6:55 ` [Qemu-devel] [PATCH v2 08/30] ide/ich: QOM Upcast Sweep peter.crosthwaite
2013-06-30  8:21   ` Andreas Färber
2013-06-30 23:36     ` Alexander Graf
2013-07-01 10:03       ` Andreas Färber
2013-07-01 10:10         ` Alexander Graf
2013-06-30 12:20   ` [Qemu-devel] [PATCH qom-next] ide/ich: QOM parent field cleanup Andreas Färber
2013-06-24  6:56 ` [Qemu-devel] [PATCH v2 09/30] ide/piix: QOM casting sweep peter.crosthwaite
2013-06-30  8:25   ` Andreas Färber
2013-07-22 16:20     ` Andreas Färber
2013-07-22 15:58   ` [Qemu-devel] [PATCH qom-next] ide: Introduce abstract QOM type for PCIIDEState Andreas Färber
2013-07-24 23:28     ` Andreas Färber
2013-06-24  6:57 ` [Qemu-devel] [PATCH v2 10/30] acpi/piix4: QOM Upcast Sweep peter.crosthwaite
2013-06-30 12:41   ` [Qemu-devel] [PATCH qom-next] acpi/piix4: QOM parent field cleanup Andreas Färber
2013-06-24  6:58 ` [Qemu-devel] [PATCH v2 11/30] misc/pci-testdev: QOM Upcast Sweep peter.crosthwaite
2013-06-30 12:49   ` Andreas Färber
2013-06-30 12:50   ` [Qemu-devel] [PATCH qom-next] misc/pci-testdev: QOM parent field cleanup Andreas Färber
2013-06-24  6:58 ` [Qemu-devel] [PATCH v2 12/30] virtio/vmware_vga: QOM casting sweep peter.crosthwaite
2013-06-30  8:41   ` Andreas Färber
2013-06-30 13:02   ` [Qemu-devel] [PATCH qom-next] display/vmware_vga: QOM parent field cleanup Andreas Färber
2013-06-24  6:59 ` [Qemu-devel] [PATCH v2 13/30] misc/ivshmem: QOM Upcast Sweep peter.crosthwaite
2013-06-30  9:18   ` Andreas Färber
2013-06-30 13:15     ` Andreas Färber
2013-06-30 13:16   ` [Qemu-devel] [PATCH qom-next] misc/ivshmem: QOM parent field cleanup Andreas Färber
2013-06-24  7:00 ` [Qemu-devel] [PATCH v2 14/30] xen/xen_platform: QOM casting sweep peter.crosthwaite
2013-06-30  9:32   ` Andreas Färber [this message]
2013-06-30 13:23   ` [Qemu-devel] [PATCH qom-next] xen/xen_platform: QOM parent field cleanup Andreas Färber
2013-06-24  7:00 ` [Qemu-devel] [PATCH v2 15/30] isa/*: QOM casting sweep peter.crosthwaite
2013-06-24  7:01 ` [Qemu-devel] [PATCH v2 16/30] pci/*: " peter.crosthwaite
2013-06-30  8:05   ` Andreas Färber
2013-06-24  7:02 ` [Qemu-devel] [PATCH v2 17/30] pci-bridge/pci_bridge_dev: Don't use DO_UPCAST peter.crosthwaite
2013-06-24  7:03 ` [Qemu-devel] [PATCH v2 18/30] pci-bridge/*: substitute ->qdev casts with DEVICE() peter.crosthwaite
2013-06-24  7:03 ` [Qemu-devel] [PATCH v2 19/30] pci/pci_bridge: " peter.crosthwaite
2013-06-24  7:04 ` [Qemu-devel] [PATCH v2 20/30] misc/vfio: " peter.crosthwaite
2013-06-24  7:05 ` [Qemu-devel] [PATCH v2 21/30] net/eepro100: " peter.crosthwaite
2013-06-24  7:06 ` [Qemu-devel] [PATCH v2 22/30] net/ne2000: " peter.crosthwaite
2013-06-24  7:06 ` [Qemu-devel] [PATCH v2 23/30] usb/*: " peter.crosthwaite
2013-06-24  7:07 ` [Qemu-devel] [PATCH v2 24/30] watchdog/wdt_i6300esb: " peter.crosthwaite
2013-06-24  7:08 ` [Qemu-devel] [PATCH v2 25/30] scsi/vmw_pvscsi: " peter.crosthwaite
2013-06-24  7:09 ` [Qemu-devel] [PATCH v2 26/30] i2c/smbus_ich9: " peter.crosthwaite
2013-06-24  7:09 ` [Qemu-devel] [PATCH v2 27/30] ide/cmd646: " peter.crosthwaite
2013-06-24  7:10 ` [Qemu-devel] [PATCH v2 28/30] ide/via: " peter.crosthwaite
2013-06-24  7:11 ` [Qemu-devel] [PATCH v2 29/30] pci-host/*: " peter.crosthwaite
2013-06-24  7:12 ` [Qemu-devel] [PATCH v2 30/30] i386/*: " peter.crosthwaite
2013-06-30 10:44 ` [Qemu-trivial] [Qemu-devel] [PATCH v2 00/30] PCI: Cleanup legacy casts in device land -- ANN: qom-next revived Andreas Färber
2013-06-30 10:44   ` Andreas Färber
2013-06-30 15:09   ` [Qemu-devel] [PATCH v2 00/30] PCI: Cleanup legacy casts in device land Andreas Färber
2013-07-01  4:33   ` [Qemu-trivial] [Qemu-devel] [PATCH v2 00/30] PCI: Cleanup legacy casts in device land -- ANN: qom-next revived Peter Crosthwaite
2013-07-01  4:33     ` Peter Crosthwaite
2013-07-01  4:50   ` [Qemu-trivial] " Peter Crosthwaite
2013-07-01  4:50     ` Peter Crosthwaite

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=51CFFB1F.9030000@suse.de \
    --to=afaerber@suse.de \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.crosthwaite@xilinx.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefano.stabellini@eu.citrix.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.