From patchwork Wed Jul 24 07:48:15 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: 261344 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 2A9512C00A3 for ; Wed, 24 Jul 2013 18:29:29 +1000 (EST) Received: from localhost ([::1]:35442 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V1txq-0008Sq-0K for incoming@patchwork.ozlabs.org; Wed, 24 Jul 2013 03:58:26 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33034) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V1toZ-0002Cv-Bm for qemu-devel@nongnu.org; Wed, 24 Jul 2013 03:49:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V1toR-0005gR-96 for qemu-devel@nongnu.org; Wed, 24 Jul 2013 03:48:51 -0400 Received: from cantor2.suse.de ([195.135.220.15]:44036 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V1toQ-0005gG-Sd for qemu-devel@nongnu.org; Wed, 24 Jul 2013 03:48:43 -0400 Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 54CF9A51FF; Wed, 24 Jul 2013 09:48:42 +0200 (CEST) From: =?UTF-8?q?Andreas=20F=C3=A4rber?= To: qemu-devel@nongnu.org Date: Wed, 24 Jul 2013 09:48:15 +0200 Message-Id: <1374652104-26756-21-git-send-email-afaerber@suse.de> X-Mailer: git-send-email 1.8.1.4 In-Reply-To: <1374652104-26756-1-git-send-email-afaerber@suse.de> References: <1374652104-26756-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: Peter Maydell , =?UTF-8?q?Andreas=20F=C3=A4rber?= , Paul Brook Subject: [Qemu-devel] [PATCH qom-next for-1.6 20/29] stellaris: QOM'ify gptm_state 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/arm/stellaris.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/hw/arm/stellaris.c b/hw/arm/stellaris.c index a2b6b17..1c69bcf 100644 --- a/hw/arm/stellaris.c +++ b/hw/arm/stellaris.c @@ -43,8 +43,13 @@ typedef const struct { /* General purpose timer module. */ +#define TYPE_STELLARIS_GPTM "stellaris-gptm" +#define STELLARIS_GPTM(obj) \ + OBJECT_CHECK(gptm_state, (obj), TYPE_STELLARIS_GPTM) + typedef struct gptm_state { - SysBusDevice busdev; + SysBusDevice parent_obj; + MemoryRegion iomem; uint32_t config; uint32_t mode[2]; @@ -302,7 +307,7 @@ static const VMStateDescription vmstate_stellaris_gptm = { static int stellaris_gptm_init(SysBusDevice *dev) { - gptm_state *s = FROM_SYSBUS(gptm_state, dev); + gptm_state *s = STELLARIS_GPTM(dev); sysbus_init_irq(dev, &s->irq); qdev_init_gpio_out(&dev->qdev, &s->trigger, 1); @@ -1215,7 +1220,7 @@ static void stellaris_init(const char *kernel_filename, const char *cpu_model, } for (i = 0; i < 4; i++) { if (board->dc2 & (0x10000 << i)) { - dev = sysbus_create_simple("stellaris-gptm", + dev = sysbus_create_simple(TYPE_STELLARIS_GPTM, 0x40030000 + i * 0x1000, pic[timer_irq[i]]); /* TODO: This is incorrect, but we get away with it because @@ -1371,7 +1376,7 @@ static void stellaris_gptm_class_init(ObjectClass *klass, void *data) } static const TypeInfo stellaris_gptm_info = { - .name = "stellaris-gptm", + .name = TYPE_STELLARIS_GPTM, .parent = TYPE_SYS_BUS_DEVICE, .instance_size = sizeof(gptm_state), .class_init = stellaris_gptm_class_init,