From patchwork Mon Nov 26 00:12:39 2012 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: 201591 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 0069A2C008A for ; Mon, 26 Nov 2012 11:15:41 +1100 (EST) Received: from localhost ([::1]:44617 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TcmMM-0001xG-R0 for incoming@patchwork.ozlabs.org; Sun, 25 Nov 2012 19:15:38 -0500 Received: from eggs.gnu.org ([208.118.235.92]:33606) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TcmKY-0007Sv-Cm for qemu-devel@nongnu.org; Sun, 25 Nov 2012 19:13:49 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TcmKT-0000JV-Ux for qemu-devel@nongnu.org; Sun, 25 Nov 2012 19:13:46 -0500 Received: from cantor2.suse.de ([195.135.220.15]:46238 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TcmKT-0000IO-Op for qemu-devel@nongnu.org; Sun, 25 Nov 2012 19:13:41 -0500 Received: from relay1.suse.de (unknown [195.135.220.254]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx2.suse.de (Postfix) with ESMTP id BCB79A3A4A; Mon, 26 Nov 2012 01:13:23 +0100 (CET) From: =?UTF-8?q?Andreas=20F=C3=A4rber?= To: qemu-devel@nongnu.org Date: Mon, 26 Nov 2012 01:12:39 +0100 Message-Id: <1353888766-6951-28-git-send-email-afaerber@suse.de> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1353888766-6951-1-git-send-email-afaerber@suse.de> References: <1353888766-6951-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: =?UTF-8?q?Andreas=20F=C3=A4rber?= , anthony@codemonkey.ws Subject: [Qemu-devel] [RFC 27/34] wdt_ib700: QOM'ify 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 Introduce type constant and cast macro to obsolete DO_UPCAST(). Prepares for ISA realizefn. Signed-off-by: Andreas Färber --- hw/wdt_ib700.c | 14 +++++++++----- 1 Datei geändert, 9 Zeilen hinzugefügt(+), 5 Zeilen entfernt(-) diff --git a/hw/wdt_ib700.c b/hw/wdt_ib700.c index 7f6c21d..1365898 100644 --- a/hw/wdt_ib700.c +++ b/hw/wdt_ib700.c @@ -35,8 +35,12 @@ #define ib700_debug(fs,...) #endif +#define TYPE_IB700 "ib700" +#define IB700(obj) OBJECT_CHECK(IB700State, (obj), TYPE_IB700) + typedef struct IB700state { - ISADevice dev; + ISADevice parent_obj; + QEMUTimer *timer; } IB700State; @@ -95,7 +99,7 @@ static const VMStateDescription vmstate_ib700 = { static int wdt_ib700_init(ISADevice *dev) { - IB700State *s = DO_UPCAST(IB700State, dev, dev); + IB700State *s = IB700(dev); ib700_debug("watchdog init\n"); @@ -108,7 +112,7 @@ static int wdt_ib700_init(ISADevice *dev) static void wdt_ib700_reset(DeviceState *dev) { - IB700State *s = DO_UPCAST(IB700State, dev.qdev, dev); + IB700State *s = IB700(dev); ib700_debug("watchdog reset\n"); @@ -129,8 +133,8 @@ static void wdt_ib700_class_init(ObjectClass *klass, void *data) dc->vmsd = &vmstate_ib700; } -static TypeInfo wdt_ib700_info = { - .name = "ib700", +static const TypeInfo wdt_ib700_info = { + .name = TYPE_IB700, .parent = TYPE_ISA_DEVICE, .instance_size = sizeof(IB700State), .class_init = wdt_ib700_class_init,