From patchwork Mon Jun 24 06:58:45 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Crosthwaite X-Patchwork-Id: 253670 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 AFE112C0508 for ; Mon, 24 Jun 2013 17:05:20 +1000 (EST) Received: from localhost ([::1]:47530 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ur0py-0005i8-HS for incoming@patchwork.ozlabs.org; Mon, 24 Jun 2013 03:05:18 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47026) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ur0pW-0005bG-7O for qemu-devel@nongnu.org; Mon, 24 Jun 2013 03:04:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ur0pV-0006qR-0T for qemu-devel@nongnu.org; Mon, 24 Jun 2013 03:04:50 -0400 Received: from mail-pa0-x235.google.com ([2607:f8b0:400e:c03::235]:50620) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ur0pU-0006qN-QH for qemu-devel@nongnu.org; Mon, 24 Jun 2013 03:04:48 -0400 Received: by mail-pa0-f53.google.com with SMTP id tj12so10521409pac.26 for ; Mon, 24 Jun 2013 00:04:48 -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=tsBY6xkE4rKlvttA7e4k5bwZXL5T4HZhM6PfSKUOgq0=; b=KqjnGOyXzF4D4OuftQR1R4XGnzLr8xLDA4le7NnXdq483kO2HDzM5mK0lPPHth4vLo Y54e6hxGjH5ffWPioS2KV+phBz1caeciD3orgsREgRl7Y7fZW5UnqJmTtiMQq5htYLGu KJFfIqDIHbkpA9DKDaKh+zf7knJLNaRe2uwbIhNfy2n7pLkjqbupVXZdkXuzZH7sXa0L fceeMMRirqSW+9RkPYXR3sKx0ouaCCzWiD1CYrijOugI0/aRm6wR1WtKCq0/lRjYoXfS rzepTggZlfuhbhILXy8RZJRPSneKPdy2NX5gwvvT/smp7G7lXO3UMIHRIQ1YilIQLoCO yeww== X-Received: by 10.66.0.233 with SMTP id 9mr26846731pah.33.1372057487990; Mon, 24 Jun 2013 00:04:47 -0700 (PDT) Received: from localhost ([203.126.243.116]) by mx.google.com with ESMTPSA id v20sm18475738paj.4.2013.06.24.00.04.42 for (version=TLSv1.1 cipher=RC4-SHA bits=128/128); Mon, 24 Jun 2013 00:04:47 -0700 (PDT) From: peter.crosthwaite@xilinx.com To: qemu-devel@nongnu.org Date: Mon, 24 Jun 2013 16:58:45 +1000 Message-Id: <566136fd00e29c95756d80eec288e3265b0da486.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: ALoCoQnVHW/OgS8UcACN1zvPG9Wohjtom2kzutylEUXdMSeWj9mpZNFw6qjg1auu9q36USaJj7hB X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:400e:c03::235 Cc: pbonzini@redhat.com, afaerber@suse.de, mst@redhat.com Subject: [Qemu-devel] [PATCH v2 12/30] virtio/vmware_vga: 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 casting. Signed-off-by: Peter Crosthwaite --- hw/display/vmware_vga.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/hw/display/vmware_vga.c b/hw/display/vmware_vga.c index fd3569d..0e2aa3f 100644 --- a/hw/display/vmware_vga.c +++ b/hw/display/vmware_vga.c @@ -81,6 +81,11 @@ struct vmsvga_state_s { int redraw_fifo_first, redraw_fifo_last; }; +#define TYPE_VM_SVGA "vmware-svga" + +#define VM_SVGA(obj) \ + OBJECT_CHECK(struct pci_vmsvga_state_s, (obj), TYPE_VM_SVGA) + struct pci_vmsvga_state_s { PCIDevice card; struct vmsvga_state_s chip; @@ -1092,8 +1097,7 @@ static void vmsvga_update_display(void *opaque) static void vmsvga_reset(DeviceState *dev) { - struct pci_vmsvga_state_s *pci = - DO_UPCAST(struct pci_vmsvga_state_s, card.qdev, dev); + struct pci_vmsvga_state_s *pci = VM_SVGA(dev); struct vmsvga_state_s *s = &pci->chip; s->index = 0; @@ -1246,8 +1250,7 @@ static const MemoryRegionOps vmsvga_io_ops = { static int pci_vmsvga_initfn(PCIDevice *dev) { - struct pci_vmsvga_state_s *s = - DO_UPCAST(struct pci_vmsvga_state_s, card, dev); + struct pci_vmsvga_state_s *s = VM_SVGA(dev); s->card.config[PCI_CACHE_LINE_SIZE] = 0x08; /* Cache line size */ s->card.config[PCI_LATENCY_TIMER] = 0x40; /* Latency timer */ @@ -1299,7 +1302,7 @@ static void vmsvga_class_init(ObjectClass *klass, void *data) } static const TypeInfo vmsvga_info = { - .name = "vmware-svga", + .name = TYPE_VM_SVGA, .parent = TYPE_PCI_DEVICE, .instance_size = sizeof(struct pci_vmsvga_state_s), .class_init = vmsvga_class_init,