From patchwork Mon Nov 26 00:12:34 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: 201607 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 F0CE42C007C for ; Mon, 26 Nov 2012 12:31:49 +1100 (EST) Received: from localhost ([::1]:43956 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TcmLn-0001WU-Dp for incoming@patchwork.ozlabs.org; Sun, 25 Nov 2012 19:15:03 -0500 Received: from eggs.gnu.org ([208.118.235.92]:33601) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TcmKY-0007SF-75 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-0000In-KE for qemu-devel@nongnu.org; Sun, 25 Nov 2012 19:13:46 -0500 Received: from cantor2.suse.de ([195.135.220.15]:46233 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TcmKT-0000H7-9g for qemu-devel@nongnu.org; Sun, 25 Nov 2012 19:13:41 -0500 Received: from relay2.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 5834DA39D0; Mon, 26 Nov 2012 01:13:19 +0100 (CET) From: =?UTF-8?q?Andreas=20F=C3=A4rber?= To: qemu-devel@nongnu.org Date: Mon, 26 Nov 2012 01:12:34 +0100 Message-Id: <1353888766-6951-23-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 22/34] serial: QOM'ify ISA serial 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/serial-isa.c | 13 ++++++++----- hw/serial.h | 1 + 2 Dateien geändert, 9 Zeilen hinzugefügt(+), 5 Zeilen entfernt(-) diff --git a/hw/serial-isa.c b/hw/serial-isa.c index 96c78f7..904cc41 100644 --- a/hw/serial-isa.c +++ b/hw/serial-isa.c @@ -26,8 +26,11 @@ #include "serial.h" #include "isa.h" +#define ISA_SERIAL(obj) OBJECT_CHECK(ISASerialState, (obj), TYPE_ISA_SERIAL) + typedef struct ISASerialState { - ISADevice dev; + ISADevice parent_obj; + uint32_t index; uint32_t iobase; uint32_t isairq; @@ -44,7 +47,7 @@ static const int isa_serial_irq[MAX_SERIAL_PORTS] = { static int serial_isa_initfn(ISADevice *dev) { static int index; - ISASerialState *isa = DO_UPCAST(ISASerialState, dev, dev); + ISASerialState *isa = ISA_SERIAL(dev); SerialState *s = &isa->state; if (isa->index == -1) { @@ -99,8 +102,8 @@ static void serial_isa_class_initfn(ObjectClass *klass, void *data) dc->props = serial_isa_properties; } -static TypeInfo serial_isa_info = { - .name = "isa-serial", +static const TypeInfo serial_isa_info = { + .name = TYPE_ISA_SERIAL, .parent = TYPE_ISA_DEVICE, .instance_size = sizeof(ISASerialState), .class_init = serial_isa_class_initfn, @@ -117,7 +120,7 @@ bool serial_isa_init(ISABus *bus, int index, CharDriverState *chr) { ISADevice *dev; - dev = isa_try_create(bus, "isa-serial"); + dev = isa_try_create(bus, TYPE_ISA_SERIAL); if (!dev) { return false; } diff --git a/hw/serial.h b/hw/serial.h index ed1a5cd..bb06366 100644 --- a/hw/serial.h +++ b/hw/serial.h @@ -96,4 +96,5 @@ SerialState *serial_mm_init(MemoryRegion *address_space, CharDriverState *chr, enum device_endian end); /* serial-isa.c */ +#define TYPE_ISA_SERIAL "isa-serial" bool serial_isa_init(ISABus *bus, int index, CharDriverState *chr);