From nobody Mon Feb 9 18:44:28 2026 Delivered-To: importer@patchew.org Received-SPF: temperror (zoho.com: Error in retrieving data from DNS) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=temperror (zoho.com: Error in retrieving data from DNS) 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 [209.51.188.17]) by mx.zohomail.com with SMTPS id 1554188655056595.2466047823486; Tue, 2 Apr 2019 00:04:15 -0700 (PDT) Received: from localhost ([127.0.0.1]:39848 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hBDSt-000254-RS for importer@patchew.org; Tue, 02 Apr 2019 03:04:11 -0400 Received: from eggs.gnu.org ([209.51.188.92]:51264) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hBDQs-0000vx-4n for qemu-devel@nongnu.org; Tue, 02 Apr 2019 03:02:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hBDQq-0005j5-Nt for qemu-devel@nongnu.org; Tue, 02 Apr 2019 03:02:06 -0400 Received: from mx1.redhat.com ([209.132.183.28]:46652) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hBDC0-0005Qf-L9 for qemu-devel@nongnu.org; Tue, 02 Apr 2019 02:46:44 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2BD7F308A968 for ; Tue, 2 Apr 2019 06:46:43 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-116-22.ams2.redhat.com [10.36.116.22]) by smtp.corp.redhat.com (Postfix) with ESMTP id D270162478; Tue, 2 Apr 2019 06:46:40 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id E4E04A1E2; Tue, 2 Apr 2019 08:46:39 +0200 (CEST) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Tue, 2 Apr 2019 08:46:35 +0200 Message-Id: <20190402064639.27108-2-kraxel@redhat.com> In-Reply-To: <20190402064639.27108-1-kraxel@redhat.com> References: <20190402064639.27108-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.41]); Tue, 02 Apr 2019 06:46:43 +0000 (UTC) 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/5] Revert "audio: fix pc speaker init" 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: Gerd Hoffmann Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" This reverts commit bd56d378842c238c8901536c06c20a4a51ee9761. Turned out it isn't that simple as the device needs the pit object link. So "-device isa-pcspk" isn't going wo work anyway. We are in freeze, so just reverting the thing is the best way to handle this for now, trying to come up with something better can be done in the 4.1 devel cycle. Also add a comment noting the object link. Reported-by: Dr. David Alan Gilbert Signed-off-by: Gerd Hoffmann Message-id: 20190328071121.21147-1-kraxel@redhat.com --- hw/audio/pcspk.c | 36 +++++++++++++++++++++--------------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/hw/audio/pcspk.c b/hw/audio/pcspk.c index fdbb4b6e9923..9c7fd74aeba7 100644 --- a/hw/audio/pcspk.c +++ b/hw/audio/pcspk.c @@ -57,6 +57,7 @@ typedef struct { } PCSpkState; =20 static const char *s_spk =3D "pcspk"; +static PCSpkState *pcspk_state; =20 static inline void generate_samples(PCSpkState *s) { @@ -110,6 +111,22 @@ static void pcspk_callback(void *opaque, int free) } } =20 +static int pcspk_audio_init(ISABus *bus) +{ + PCSpkState *s =3D pcspk_state; + struct audsettings as =3D {PCSPK_SAMPLE_RATE, 1, AUDIO_FORMAT_U8, 0}; + + AUD_register_card(s_spk, &s->card); + + s->voice =3D AUD_open_out(&s->card, s->voice, s_spk, s, pcspk_callback= , &as); + if (!s->voice) { + AUD_log(s_spk, "Could not open voice\n"); + return -1; + } + + return 0; +} + static uint64_t pcspk_io_read(void *opaque, hwaddr addr, unsigned size) { @@ -162,20 +179,12 @@ static void pcspk_initfn(Object *obj) =20 static void pcspk_realizefn(DeviceState *dev, Error **errp) { - struct audsettings as =3D {PCSPK_SAMPLE_RATE, 1, AUDIO_FORMAT_U8, 0}; ISADevice *isadev =3D ISA_DEVICE(dev); PCSpkState *s =3D PC_SPEAKER(dev); =20 isa_register_ioport(isadev, &s->ioport, s->iobase); =20 - AUD_register_card(s_spk, &s->card); - - s->voice =3D AUD_open_out(&s->card, s->voice, s_spk, s, pcspk_callback= , &as); - if (!s->voice) { - error_setg(errp, "Initializing audio voice failed"); - AUD_remove_card(&s->card); - return; - } + pcspk_state =3D s; } =20 static bool migrate_needed(void *opaque) @@ -212,6 +221,9 @@ static void pcspk_class_initfn(ObjectClass *klass, void= *data) set_bit(DEVICE_CATEGORY_SOUND, dc->categories); dc->vmsd =3D &vmstate_spk; dc->props =3D pcspk_properties; + /* Reason: realize sets global pcspk_state */ + /* Reason: pit object link */ + dc->user_creatable =3D false; } =20 static const TypeInfo pcspk_info =3D { @@ -222,12 +234,6 @@ static const TypeInfo pcspk_info =3D { .class_init =3D pcspk_class_initfn, }; =20 -static int pcspk_audio_init(ISABus *bus) -{ - isa_create_simple(bus, TYPE_PC_SPEAKER); - return 0; -} - static void pcspk_register(void) { type_register_static(&pcspk_info); --=20 2.18.1