From patchwork Mon Jun 24 07:00:14 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Crosthwaite X-Patchwork-Id: 253672 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id B87AE2C0507 for ; Mon, 24 Jun 2013 17:06:52 +1000 (EST) Received: from localhost ([::1]:50593 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ur0rS-0008ET-PU for incoming@patchwork.ozlabs.org; Mon, 24 Jun 2013 03:06:50 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47167) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ur0qy-00089O-16 for qemu-devel@nongnu.org; Mon, 24 Jun 2013 03:06:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ur0qw-0007Fu-MZ for qemu-devel@nongnu.org; Mon, 24 Jun 2013 03:06:19 -0400 Received: from mail-pb0-x22e.google.com ([2607:f8b0:400e:c01::22e]:55592) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ur0qw-0007Fj-Cg for qemu-devel@nongnu.org; Mon, 24 Jun 2013 03:06:18 -0400 Received: by mail-pb0-f46.google.com with SMTP id rq2so10532522pbb.33 for ; Mon, 24 Jun 2013 00:06:17 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references:x-gm-message-state; bh=LWYb2pFnFEzQGfrP55uo51j937XYXBiDHSwD6F4h/GQ=; b=hSoTMVP38VLHLbO+zbRk8nHeunNIQUDuHdROAJ8wyjzFJhyCvNsmL4z+XiwcPeYJXf YDqQeC9MGphhNhC1jdel6g1Pe3Kf1wMaDSobNx3xawpxlXKCx96vi+0Ql6VJPN3FOmRb S/K1E771W/w9D1jrSQ0hF/wg/KqqEzkjLWxj2lTSKc3vrW6Ph4ZSH3RYkLno83xGGO9+ /JfxXtinb4spxEi93s6gd5xwJKWFytDjJ83pVJv5N6GnSZxTsoDNGSSCFCtGZnZlC37q XzTItVQQaQMDOdTxYQzx1L+8D3EfTzT4wmcNsEBGELxiZnSkO9QK+LNzftSaLvCOOt1R X42g== X-Received: by 10.68.250.5 with SMTP id yy5mr22217283pbc.93.1372057577548; Mon, 24 Jun 2013 00:06:17 -0700 (PDT) Received: from localhost ([203.126.243.116]) by mx.google.com with ESMTPSA id tt7sm16772435pbc.34.2013.06.24.00.06.11 for (version=TLSv1.1 cipher=RC4-SHA bits=128/128); Mon, 24 Jun 2013 00:06:16 -0700 (PDT) From: peter.crosthwaite@xilinx.com To: qemu-devel@nongnu.org Date: Mon, 24 Jun 2013 17:00:14 +1000 Message-Id: <9d1116516fd0d5c38ff376df4b8437e197eb8295.1372055322.git.peter.crosthwaite@xilinx.com> X-Mailer: git-send-email 1.8.3.rc1.44.gb387c77.dirty In-Reply-To: References: X-Gm-Message-State: ALoCoQm4YLf7LENR9uh4U5fEwwXOK7TRDuTf3XOP454W9XFxPl3A1MvozE/dMmaErwA0zVCMUgVw X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:400e:c01::22e Cc: pbonzini@redhat.com, afaerber@suse.de, mst@redhat.com Subject: [Qemu-devel] [PATCH v2 14/30] xen/xen_platform: QOM casting sweep 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 From: Peter Crosthwaite Define and use standard QOM cast macro. Remove usages of DO_UPCAST and direct -> style upcasting. Signed-off-by: Peter Crosthwaite --- 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); 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,