From patchwork Mon Jun 24 06:54:15 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Crosthwaite X-Patchwork-Id: 253663 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 26D042C0507 for ; Mon, 24 Jun 2013 17:01:06 +1000 (EST) Received: from localhost ([::1]:39200 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ur0ls-0008PM-3w for incoming@patchwork.ozlabs.org; Mon, 24 Jun 2013 03:01:04 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45662) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ur0lE-0008AI-Jq for qemu-devel@nongnu.org; Mon, 24 Jun 2013 03:00:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ur0lD-0005PW-Dh for qemu-devel@nongnu.org; Mon, 24 Jun 2013 03:00:24 -0400 Received: from mail-pd0-x230.google.com ([2607:f8b0:400e:c02::230]:39510) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ur0lD-0005PI-7t for qemu-devel@nongnu.org; Mon, 24 Jun 2013 03:00:23 -0400 Received: by mail-pd0-f176.google.com with SMTP id t12so391150pdi.7 for ; Mon, 24 Jun 2013 00:00:19 -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=NgI69Ba67+vDavmkx7/fNGRgrzKFY87z1SzwyeBNMgw=; b=lzY2Y+jndbyrqxkxTmsWQg8f3NngcddSWB3GrmtKFeQxrfxT1EPbucLTcOonkeh0T4 jphvfHOV8BBdMPIysH4UL4cRtoDbkG+xy6vhNPiq5S8/v3LETUBJLx22Yd41cinii2tT Q/vtRAWF2JMo5jDIDumS+Z+HKpb5t6p/6kA6BtGlBt64RTy0soYDVWPrgMynvCQ5/UgE GKV6L9NIh1enJ3uvJHq1mJGzkP03ziduuZoestnpRVaFYbyIDHDLF0482JICJpNmAgka jcN/2oes1aP3moLx9uDgqqCeR3gawWlipkvzrHRATqPJujlf6Zh2dVX2jWqav1Dxp1Hn k1rg== X-Received: by 10.68.78.37 with SMTP id y5mr22251453pbw.28.1372057218997; Mon, 24 Jun 2013 00:00:18 -0700 (PDT) Received: from localhost ([203.126.243.116]) by mx.google.com with ESMTPSA id ue9sm8484158pab.7.2013.06.24.00.00.13 for (version=TLSv1.1 cipher=RC4-SHA bits=128/128); Mon, 24 Jun 2013 00:00:18 -0700 (PDT) From: peter.crosthwaite@xilinx.com To: qemu-devel@nongnu.org Date: Mon, 24 Jun 2013 16:54:15 +1000 Message-Id: X-Mailer: git-send-email 1.8.3.rc1.44.gb387c77.dirty In-Reply-To: References: X-Gm-Message-State: ALoCoQl0QadLqAqS/MuXso6QPPsIUrIABl2/CTQiqnZ16HkpxEvM3x/kPSmGKlnrN6CHWD0Kb8xH X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:400e:c02::230 Cc: pbonzini@redhat.com, afaerber@suse.de, mst@redhat.com Subject: [Qemu-devel] [PATCH v2 06/30] scsi/megasas: 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/scsi/megasas.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/hw/scsi/megasas.c b/hw/scsi/megasas.c index 65ccb09..49fcae4 100644 --- a/hw/scsi/megasas.c +++ b/hw/scsi/megasas.c @@ -108,6 +108,11 @@ typedef struct MegasasState { SCSIBus bus; } MegasasState; +#define TYPE_MEGASAS "megasas" + +#define MEGASAS(obj) \ + OBJECT_CHECK(MegasasState, (obj), TYPE_MEGASAS) + #define MEGASAS_INTR_DISABLED_MASK 0xFFFFFFFF static bool megasas_intr_enabled(MegasasState *s) @@ -2039,7 +2044,7 @@ static void megasas_soft_reset(MegasasState *s) static void megasas_scsi_reset(DeviceState *dev) { - MegasasState *s = DO_UPCAST(MegasasState, dev.qdev, dev); + MegasasState *s = MEGASAS(dev); megasas_soft_reset(s); } @@ -2064,7 +2069,7 @@ static const VMStateDescription vmstate_megasas = { static void megasas_scsi_uninit(PCIDevice *d) { - MegasasState *s = DO_UPCAST(MegasasState, dev, d); + MegasasState *s = MEGASAS(d); #ifdef USE_MSIX msix_uninit(&s->dev, &s->mmio_io); @@ -2087,7 +2092,7 @@ static const struct SCSIBusInfo megasas_scsi_info = { static int megasas_scsi_init(PCIDevice *dev) { - MegasasState *s = DO_UPCAST(MegasasState, dev, dev); + MegasasState *s = MEGASAS(dev); uint8_t *pci_conf; int i, bar_type; @@ -2158,7 +2163,7 @@ static int megasas_scsi_init(PCIDevice *dev) s->frames[i].state = s; } - scsi_bus_new(&s->bus, &dev->qdev, &megasas_scsi_info, NULL); + scsi_bus_new(&s->bus, DEVICE(dev), &megasas_scsi_info, NULL); scsi_bus_legacy_handle_cmdline(&s->bus); return 0; } @@ -2198,7 +2203,7 @@ static void megasas_class_init(ObjectClass *oc, void *data) } static const TypeInfo megasas_info = { - .name = "megasas", + .name = TYPE_MEGASAS, .parent = TYPE_PCI_DEVICE, .instance_size = sizeof(MegasasState), .class_init = megasas_class_init,