From patchwork Wed Oct 14 23:40:00 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Juan Quintela X-Patchwork-Id: 36035 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 3D55DB7B7A for ; Thu, 15 Oct 2009 10:48:47 +1100 (EST) Received: from localhost ([127.0.0.1]:35127 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MyDaF-0001Kt-RO for incoming@patchwork.ozlabs.org; Wed, 14 Oct 2009 19:48:43 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MyDST-0004qg-Cd for qemu-devel@nongnu.org; Wed, 14 Oct 2009 19:40:41 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MyDSO-0004jO-Me for qemu-devel@nongnu.org; Wed, 14 Oct 2009 19:40:40 -0400 Received: from [199.232.76.173] (port=41476 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MyDSO-0004j9-Fd for qemu-devel@nongnu.org; Wed, 14 Oct 2009 19:40:36 -0400 Received: from mx1.redhat.com ([209.132.183.28]:53420) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MyDSN-0003VZ-T6 for qemu-devel@nongnu.org; Wed, 14 Oct 2009 19:40:36 -0400 Received: from int-mx03.intmail.prod.int.phx2.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id n9ENeZW1000947 for ; Wed, 14 Oct 2009 19:40:35 -0400 Received: from localhost.localdomain (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx03.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id n9ENeR9l015721; Wed, 14 Oct 2009 19:40:33 -0400 From: Juan Quintela To: qemu-devel@nongnu.org Date: Thu, 15 Oct 2009 01:40:00 +0200 Message-Id: <48afcc98e45b481201e8d23b04234f3b3241c7d1.1255563370.git.quintela@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.67 on 10.5.11.16 X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. Cc: rjones@redhat.com Subject: [Qemu-devel] [PATCH 4/6] ib700: Introduce IB700State X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Signed-off-by: Juan Quintela --- hw/wdt_ib700.c | 16 +++++++++++----- 1 files changed, 11 insertions(+), 5 deletions(-) diff --git a/hw/wdt_ib700.c b/hw/wdt_ib700.c index 0ee3a5c..e598df5 100644 --- a/hw/wdt_ib700.c +++ b/hw/wdt_ib700.c @@ -35,6 +35,10 @@ #define ib700_debug(fs,...) #endif +typedef struct IB700state { + ISADevice dev; +} IB700State; + /* This is the timer. We use a global here because the watchdog * code ensures there is only one watchdog (it is located at a fixed, * unchangable IO port, so there could only ever be one anyway). @@ -90,10 +94,12 @@ static int ib700_load(QEMUFile *f, void *vp, int version) static int wdt_ib700_init(ISADevice *dev) { - timer = qemu_new_timer(vm_clock, ib700_timer_expired, NULL); - register_savevm("ib700_wdt", -1, 0, ib700_save, ib700_load, NULL); - register_ioport_write(0x441, 2, 1, ib700_write_disable_reg, NULL); - register_ioport_write(0x443, 2, 1, ib700_write_enable_reg, NULL); + IB700State *s = DO_UPCAST(IB700State, dev, dev); + + timer = qemu_new_timer(vm_clock, ib700_timer_expired, s); + register_savevm("ib700_wdt", -1, 0, ib700_save, ib700_load, s); + register_ioport_write(0x441, 2, 1, ib700_write_disable_reg, s); + register_ioport_write(0x443, 2, 1, ib700_write_enable_reg, s); return 0; } @@ -105,7 +111,7 @@ static WatchdogTimerModel model = { static ISADeviceInfo wdt_ib700_info = { .qdev.name = "ib700", - .qdev.size = sizeof(ISADevice), + .qdev.size = sizeof(IB700State), .init = wdt_ib700_init, };