From nobody Thu Nov 6 10:16:12 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1540820397227599.8916930363235; Mon, 29 Oct 2018 06:39:57 -0700 (PDT) Received: from localhost ([::1]:45640 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gH7ls-0004I7-3q for importer@patchew.org; Mon, 29 Oct 2018 09:39:56 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60421) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gH7jw-0001Ou-Vy for qemu-devel@nongnu.org; Mon, 29 Oct 2018 09:37:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gH7jv-0004gs-BE for qemu-devel@nongnu.org; Mon, 29 Oct 2018 09:37:56 -0400 Received: from mx1.redhat.com ([209.132.183.28]:55404) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gH7jk-0004Vd-1Y; Mon, 29 Oct 2018 09:37:44 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 59ED6AD899; Mon, 29 Oct 2018 13:37:34 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-116-158.ams2.redhat.com [10.36.116.158]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6FB4C608FA; Mon, 29 Oct 2018 13:37:23 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id A4007B3E01; Mon, 29 Oct 2018 14:37:22 +0100 (CET) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Mon, 29 Oct 2018 14:37:19 +0100 Message-Id: <20181029133722.12415-2-kraxel@redhat.com> In-Reply-To: <20181029133722.12415-1-kraxel@redhat.com> References: <20181029133722.12415-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Mon, 29 Oct 2018 13:37:34 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 1/4] hw: AC97: make it more QOMconventional X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , qemu-arm@nongnu.org, Jan Kiszka , Gerd Hoffmann , Li Qiang Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Li Qiang Signed-off-by: Li Qiang Reviewed-by: Philippe Mathieu-Daud=C3=A9 Message-id: 20181013060809.52496-1-liq3ea@163.com Signed-off-by: Gerd Hoffmann --- hw/audio/ac97.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/hw/audio/ac97.c b/hw/audio/ac97.c index 337402e9c6..d799533aa9 100644 --- a/hw/audio/ac97.c +++ b/hw/audio/ac97.c @@ -123,6 +123,10 @@ enum { =20 #define MUTE_SHIFT 15 =20 +#define TYPE_AC97 "AC97" +#define AC97(obj) \ + OBJECT_CHECK(AC97LinkState, (obj), TYPE_AC97) + #define REC_MASK 7 enum { REC_MIC =3D 0, @@ -1340,7 +1344,7 @@ static void ac97_on_reset (DeviceState *dev) =20 static void ac97_realize(PCIDevice *dev, Error **errp) { - AC97LinkState *s =3D DO_UPCAST (AC97LinkState, dev, dev); + AC97LinkState *s =3D AC97(dev); uint8_t *c =3D s->dev.config; =20 /* TODO: no need to override */ @@ -1389,7 +1393,7 @@ static void ac97_realize(PCIDevice *dev, Error **errp) =20 static void ac97_exit(PCIDevice *dev) { - AC97LinkState *s =3D DO_UPCAST(AC97LinkState, dev, dev); + AC97LinkState *s =3D AC97(dev); =20 AUD_close_in(&s->card, s->voice_pi); AUD_close_out(&s->card, s->voice_po); @@ -1399,7 +1403,7 @@ static void ac97_exit(PCIDevice *dev) =20 static int ac97_init (PCIBus *bus) { - pci_create_simple (bus, -1, "AC97"); + pci_create_simple(bus, -1, TYPE_AC97); return 0; } =20 @@ -1427,7 +1431,7 @@ static void ac97_class_init (ObjectClass *klass, void= *data) } =20 static const TypeInfo ac97_info =3D { - .name =3D "AC97", + .name =3D TYPE_AC97, .parent =3D TYPE_PCI_DEVICE, .instance_size =3D sizeof (AC97LinkState), .class_init =3D ac97_class_init, --=20 2.9.3