From patchwork Mon Jun 24 06:52:00 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Crosthwaite X-Patchwork-Id: 253660 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 8A82E2C0504 for ; Mon, 24 Jun 2013 16:58:31 +1000 (EST) Received: from localhost ([::1]:34472 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ur0jM-0005Ss-Sk for incoming@patchwork.ozlabs.org; Mon, 24 Jun 2013 02:58:28 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45236) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ur0iz-0005Pd-Qi for qemu-devel@nongnu.org; Mon, 24 Jun 2013 02:58:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ur0iy-0004Vy-Ue for qemu-devel@nongnu.org; Mon, 24 Jun 2013 02:58:05 -0400 Received: from mail-pa0-x231.google.com ([2607:f8b0:400e:c03::231]:62663) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ur0iy-0004Vs-NV for qemu-devel@nongnu.org; Mon, 24 Jun 2013 02:58:04 -0400 Received: by mail-pa0-f49.google.com with SMTP id ld11so10489720pab.22 for ; Sun, 23 Jun 2013 23:58:03 -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=PF6Cydp1bNOhF9fn7Zy8YiffEdmnSbtlEKgKo3uceFA=; b=fV+nUmvJWq5TBsNt8urWkPOv0JUGV2DEeSuRptblRIkLvG3Uy1kMW5w79W0104ZOS7 EWoYyGvdVJ3IYa1Napwm/4zVXVYiwwKjvvXqxbvuKn1B8fHV1jB6/eBI9wALosiWK36+ +H1BzQUaqV7pPGqV1P3fTQsPeljScLy9VA5cu/fdCE3XFk3+eXsBgDs08uLh0+IxfUtn lor1L0DM+xLGQILCH8bSKX0dU11jDJfNtayHQSUvQuZT/kQ6rK5igHi5UuAwISxQeJYv MfrdYKkZG9uj81QwYH2gcjVZrWo8pGDBSytZmyrUevnHTpg/EbgRmWu33ZXIf6fQl/F4 CO7w== X-Received: by 10.68.189.199 with SMTP id gk7mr11669404pbc.208.1372057083864; Sun, 23 Jun 2013 23:58:03 -0700 (PDT) Received: from localhost ([203.126.243.116]) by mx.google.com with ESMTPSA id pm7sm16744553pbb.31.2013.06.23.23.57.58 for (version=TLSv1.1 cipher=RC4-SHA bits=128/128); Sun, 23 Jun 2013 23:58:02 -0700 (PDT) From: peter.crosthwaite@xilinx.com To: qemu-devel@nongnu.org Date: Mon, 24 Jun 2013 16:52:00 +1000 Message-Id: <9c7472accbd24d1720a257a63109897a96dfed55.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: ALoCoQmHHpIs6Bu2xR6hP8WxIKbgOrtt6AB9vAjMVaQ9infELEVLPa3AR88cFyo8VKLpL9D0cza+ X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:400e:c03::231 Cc: pbonzini@redhat.com, afaerber@suse.de, mst@redhat.com Subject: [Qemu-devel] [PATCH v2 03/30] net/pcnet-pci: QOM Upcast 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/net/pcnet-pci.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/hw/net/pcnet-pci.c b/hw/net/pcnet-pci.c index 9df2b87..b1afbf4 100644 --- a/hw/net/pcnet-pci.c +++ b/hw/net/pcnet-pci.c @@ -43,6 +43,10 @@ //#define PCNET_DEBUG_TMD //#define PCNET_DEBUG_MATCH +#define TYPE_PCI_PC_NET "pcnet" + +#define PCI_PC_NET(obj) \ + OBJECT_CHECK(PCIPCNetState, (obj), TYPE_PCI_PC_NET) typedef struct { PCIDevice pci_dev; @@ -273,7 +277,7 @@ static void pci_pcnet_cleanup(NetClientState *nc) static void pci_pcnet_uninit(PCIDevice *dev) { - PCIPCNetState *d = DO_UPCAST(PCIPCNetState, pci_dev, dev); + PCIPCNetState *d = PCI_PC_NET(dev); memory_region_destroy(&d->state.mmio); memory_region_destroy(&d->io_bar); @@ -293,7 +297,7 @@ static NetClientInfo net_pci_pcnet_info = { static int pci_pcnet_init(PCIDevice *pci_dev) { - PCIPCNetState *d = DO_UPCAST(PCIPCNetState, pci_dev, pci_dev); + PCIPCNetState *d = PCI_PC_NET(pci_dev); PCNetState *s = &d->state; uint8_t *pci_conf; @@ -329,12 +333,12 @@ static int pci_pcnet_init(PCIDevice *pci_dev) s->phys_mem_write = pci_physical_memory_write; s->dma_opaque = pci_dev; - return pcnet_common_init(&pci_dev->qdev, s, &net_pci_pcnet_info); + return pcnet_common_init(DEVICE(pci_dev), s, &net_pci_pcnet_info); } static void pci_reset(DeviceState *dev) { - PCIPCNetState *d = DO_UPCAST(PCIPCNetState, pci_dev.qdev, dev); + PCIPCNetState *d = PCI_PC_NET(dev); pcnet_h_reset(&d->state); } @@ -362,7 +366,7 @@ static void pcnet_class_init(ObjectClass *klass, void *data) } static const TypeInfo pcnet_info = { - .name = "pcnet", + .name = TYPE_PCI_PC_NET, .parent = TYPE_PCI_DEVICE, .instance_size = sizeof(PCIPCNetState), .class_init = pcnet_class_init,