From patchwork Mon Jul 29 19:19:26 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Andreas_F=C3=A4rber?= X-Patchwork-Id: 263130 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 D28D42C00CD for ; Tue, 30 Jul 2013 09:12:25 +1000 (EST) Received: from localhost ([::1]:45101 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V3tiP-0008DL-R9 for incoming@patchwork.ozlabs.org; Mon, 29 Jul 2013 16:06:45 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57036) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V3t1S-0004m9-Rr for qemu-devel@nongnu.org; Mon, 29 Jul 2013 15:22:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V3t1H-0002j3-7y for qemu-devel@nongnu.org; Mon, 29 Jul 2013 15:22:22 -0400 Received: from cantor2.suse.de ([195.135.220.15]:53461 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V3t1G-0002ij-UC for qemu-devel@nongnu.org; Mon, 29 Jul 2013 15:22:11 -0400 Received: from relay1.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 77CD6A52BF; Mon, 29 Jul 2013 21:22:10 +0200 (CEST) From: =?UTF-8?q?Andreas=20F=C3=A4rber?= To: qemu-devel@nongnu.org Date: Mon, 29 Jul 2013 21:19:26 +0200 Message-Id: <1375125630-24869-110-git-send-email-afaerber@suse.de> X-Mailer: git-send-email 1.8.1.4 In-Reply-To: <1375125630-24869-1-git-send-email-afaerber@suse.de> References: <1375125630-24869-1-git-send-email-afaerber@suse.de> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x X-Received-From: 195.135.220.15 Cc: Maksim Kozlov , Igor Mitsyanko , =?UTF-8?q?Andreas=20F=C3=A4rber?= , Evgeny Voevodin , Dmitry Solodkiy Subject: [Qemu-devel] [PULL 109/173] exynos4210_pmu: QOM cast cleanup 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 Signed-off-by: Andreas Färber --- hw/misc/exynos4210_pmu.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/hw/misc/exynos4210_pmu.c b/hw/misc/exynos4210_pmu.c index 28395ba..cbf0795 100644 --- a/hw/misc/exynos4210_pmu.c +++ b/hw/misc/exynos4210_pmu.c @@ -386,8 +386,13 @@ static const Exynos4210PmuReg exynos4210_pmu_regs[] = { #define PMU_NUM_OF_REGISTERS \ (sizeof(exynos4210_pmu_regs) / sizeof(Exynos4210PmuReg)) +#define TYPE_EXYNOS4210_PMU "exynos4210.pmu" +#define EXYNOS4210_PMU(obj) \ + OBJECT_CHECK(Exynos4210PmuState, (obj), TYPE_EXYNOS4210_PMU) + typedef struct Exynos4210PmuState { - SysBusDevice busdev; + SysBusDevice parent_obj; + MemoryRegion iomem; uint32_t reg[PMU_NUM_OF_REGISTERS]; } Exynos4210PmuState; @@ -443,8 +448,7 @@ static const MemoryRegionOps exynos4210_pmu_ops = { static void exynos4210_pmu_reset(DeviceState *dev) { - Exynos4210PmuState *s = - container_of(dev, Exynos4210PmuState, busdev.qdev); + Exynos4210PmuState *s = EXYNOS4210_PMU(dev); unsigned i; /* Set default values for registers */ @@ -455,7 +459,7 @@ static void exynos4210_pmu_reset(DeviceState *dev) static int exynos4210_pmu_init(SysBusDevice *dev) { - Exynos4210PmuState *s = FROM_SYSBUS(Exynos4210PmuState, dev); + Exynos4210PmuState *s = EXYNOS4210_PMU(dev); /* memory mapping */ memory_region_init_io(&s->iomem, OBJECT(dev), &exynos4210_pmu_ops, s, @@ -485,7 +489,7 @@ static void exynos4210_pmu_class_init(ObjectClass *klass, void *data) } static const TypeInfo exynos4210_pmu_info = { - .name = "exynos4210.pmu", + .name = TYPE_EXYNOS4210_PMU, .parent = TYPE_SYS_BUS_DEVICE, .instance_size = sizeof(Exynos4210PmuState), .class_init = exynos4210_pmu_class_init,