Received: from eggs.gnu.org ([208.118.235.92]:33578) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TcmKX-0007QH-JV 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-0000Ie-Jk for qemu-devel@nongnu.org; Sun, 25 Nov 2012 19:13:45 -0500 Received: from cantor2.suse.de ([195.135.220.15]:46234 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TcmKT-0000HD-C6 for qemu-devel@nongnu.org; Sun, 25 Nov 2012 19:13:41 -0500 From: =?UTF-8?q?Andreas=20F=C3=A4rber?= Date: Mon, 26 Nov 2012 01:12:35 +0100 Message-Id: <1353888766-6951-24-git-send-email-afaerber@suse.de> 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 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [RFC 23/34] sga: QOM'ify List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Andreas=20F=C3=A4rber?= , anthony@codemonkey.ws Introduce type constant and cast macro. Prepares for ISA realizefn. Signed-off-by: Andreas F=C3=A4rber --- hw/sga.c | 12 ++++++++---- 1 Datei ge=C3=A4ndert, 8 Zeilen hinzugef=C3=BCgt(+), 4 Zeilen entfernt(-= ) diff --git a/hw/sga.c b/hw/sga.c index a666349..d828f45 100644 --- a/hw/sga.c +++ b/hw/sga.c @@ -31,8 +31,11 @@ =20 #define SGABIOS_FILENAME "sgabios.bin" =20 -typedef struct ISAGAState { - ISADevice dev; +#define TYPE_SGA "sga" +#define SGA(obj) OBJECT_CHECK(ISASGAState, (obj), TYPE_SGA) + +typedef struct ISASGAState { + ISADevice parent_obj; } ISASGAState; =20 static int sga_initfn(ISADevice *dev) @@ -40,6 +43,7 @@ static int sga_initfn(ISADevice *dev) rom_add_vga(SGABIOS_FILENAME); return 0; } + static void sga_class_initfn(ObjectClass *klass, void *data) { DeviceClass *dc =3D DEVICE_CLASS(klass); @@ -48,8 +52,8 @@ static void sga_class_initfn(ObjectClass *klass, void *= data) dc->desc =3D "Serial Graphics Adapter"; } =20 -static TypeInfo sga_info =3D { - .name =3D "sga", +static const TypeInfo sga_info =3D { + .name =3D TYPE_SGA, .parent =3D TYPE_ISA_DEVICE, .instance_size =3D sizeof(ISASGAState), .class_init =3D sga_class_initfn, --=20 1.7.10.4