From nobody Fri Nov 14 18:21:22 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1761116238; cv=none; d=zohomail.com; s=zohoarc; b=cC1Lx58oOyt1JueIIxTewUdwiRCWXqq1eFQoZTH9m0R8nVPJPfn0tBlxJz8aR/BH0MD93N3bPxeC9FJTzQ+6e2s5sw7djT18zaqrj/pXVD86UNTJG9sEzgaSV450csaSpn4Hu3M95dZ69j2ih9auLFMcHP5rNI64OyCLsMuWwV8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761116238; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=Sn6D8TaKLKB7thke8D1SYCsRnUDMQrsF66p9VZMru88=; b=QtOEtD2orq1o2CVI1j+iSczNo+8Uia0gPny5YnTRdLdk+KDZ3rnCQjbrHkMGRHasxLBxddJZNaFjfjNIaLryz3kKAVhdES+sg/N4Z00FNxUJAfxRAfAhbJJucNsHCk1jfxOUIjYO6dRi2elrea7ru7+Bw/3lBqYE6uKj+cc5uUk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1761116238590438.29049748606883; Tue, 21 Oct 2025 23:57:18 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vBSmK-00085V-Uk; Wed, 22 Oct 2025 02:57:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vBSmI-00085M-8i for qemu-devel@nongnu.org; Wed, 22 Oct 2025 02:56:58 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vBSmG-00080V-LR for qemu-devel@nongnu.org; Wed, 22 Oct 2025 02:56:58 -0400 Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-111-AJYHHLv0Nne9VY9fouGbgg-1; Wed, 22 Oct 2025 02:56:52 -0400 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 1EA75180035A; Wed, 22 Oct 2025 06:56:51 +0000 (UTC) Received: from localhost (unknown [10.44.22.9]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id A28A819560B0; Wed, 22 Oct 2025 06:56:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761116215; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Sn6D8TaKLKB7thke8D1SYCsRnUDMQrsF66p9VZMru88=; b=UZhAYlBFESdGBv9EM3DXdazq5JvG1DYTgq77tvOf/ExnZCzSK2Ua80V4y1kd+52IR/OfAl gE/MlOG5I6d/FGz8ULeuTyFUjqgfSRR582qezH5tA/MIThzckfJ2Zw0/v5PZg3uJ16LdBw O7BOx0NyNM+RqpOnNzVwR3BNZXQvTbw= X-MC-Unique: AJYHHLv0Nne9VY9fouGbgg-1 X-Mimecast-MFC-AGG-ID: AJYHHLv0Nne9VY9fouGbgg_1761116211 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Volker=20R=C3=BCmelin?= , Paolo Bonzini , BALATON Zoltan , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Gerd Hoffmann Subject: [PATCH v2 01/42] hw/audio: improve error reports Date: Wed, 22 Oct 2025 10:55:56 +0400 Message-ID: <20251022065640.1172785-2-marcandre.lureau@redhat.com> In-Reply-To: <20251022065640.1172785-1-marcandre.lureau@redhat.com> References: <20251022065640.1172785-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1761116241651154100 From: Marc-Andr=C3=A9 Lureau The -audiodev argument is 'model=3D..', use same terminology. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- hw/audio/soundhw.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/hw/audio/soundhw.c b/hw/audio/soundhw.c index d18fd9fa05..b06552e7a8 100644 --- a/hw/audio/soundhw.c +++ b/hw/audio/soundhw.c @@ -70,7 +70,7 @@ void show_valid_soundhw(void) struct soundhw *c; =20 if (soundhw_count) { - printf("Valid sound card names (comma separated):\n"); + printf("Valid audio device model names:\n"); for (c =3D soundhw; c->name; ++c) { printf ("%-11s %s\n", c->name, c->descr); } @@ -88,7 +88,7 @@ void select_soundhw(const char *name, const char *audiode= v) struct soundhw *c; =20 if (selected) { - error_report("only one -soundhw option is allowed"); + error_report("only one -audio option is allowed"); exit(1); } =20 @@ -101,7 +101,7 @@ void select_soundhw(const char *name, const char *audio= dev) } =20 if (!c->name) { - error_report("Unknown sound card name `%s'", name); + error_report("Unknown audio device model `%s'", name); show_valid_soundhw(); exit(1); } @@ -140,4 +140,3 @@ void soundhw_init(void) c->init_pci(pci_bus, audiodev_id); } } - --=20 2.51.0 From nobody Fri Nov 14 18:21:22 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1761116336; cv=none; d=zohomail.com; s=zohoarc; b=A/6cMGUJpIkJF6wtEVdjOCEQATg+Y5gDvNRmN8D9AdrImWJCiv8hySKeyiYlN9o5XvnkvVsc2nHok+2R5XPHUu1UNhMS2lGGAhgF8v7y/HbDd3iaXOyngFi/K5kCSixreLez74rRY+itPuSU6g1rLFhVtmNlcRCkH1z2j2f/gSw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761116336; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=EiPRTNZ9EVvre6ogNCtE3OgvgK62QDuQH9vHZpna9SA=; b=jrrVQwro3E3tRDGrvP/x/Pk0eZ9LCDik/7zOMVi6JHhxDpTZzusKtHfsrezYK5V5+svI4b0zienjW2MXpKm0nvYFcwX/5mq8BrOvcE/xvjh/PrnOZnl5mkta2F7pKJsXEMdcgtFpUUzQ4kvM9ZXOQzdaBplngFbDUm132fznhos= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1761116336876478.623356683506; Tue, 21 Oct 2025 23:58:56 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vBSmR-000868-IT; Wed, 22 Oct 2025 02:57:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vBSmP-00085v-5q for qemu-devel@nongnu.org; Wed, 22 Oct 2025 02:57:05 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vBSmM-00081N-Ne for qemu-devel@nongnu.org; Wed, 22 Oct 2025 02:57:04 -0400 Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-353-jhoU2xzlPNGlOYfJJ7Qy8Q-1; Wed, 22 Oct 2025 02:56:57 -0400 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id AB3631956088; Wed, 22 Oct 2025 06:56:56 +0000 (UTC) Received: from localhost (unknown [10.44.22.9]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 5DC031956056; Wed, 22 Oct 2025 06:56:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761116221; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=EiPRTNZ9EVvre6ogNCtE3OgvgK62QDuQH9vHZpna9SA=; b=CS7p1VNTyRDYK6zRd1siOQBSWas/mLSuvjTqlGceS6zh699ok/ZEipJ3NrUa/pNM8FjuFN N6a2e8qbn/V3WLhIqMKV4AQAcnXzsd908nSVEmGx7NlzpuVjHBSuuwZhrGXXcwf2/szt59 I4cRcBppJs8iuG0/Cz1ZJMmypO4DYVY= X-MC-Unique: jhoU2xzlPNGlOYfJJ7Qy8Q-1 X-Mimecast-MFC-AGG-ID: jhoU2xzlPNGlOYfJJ7Qy8Q_1761116216 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Volker=20R=C3=BCmelin?= , Paolo Bonzini , BALATON Zoltan , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Gerd Hoffmann Subject: [PATCH v2 02/42] hw/audio: rename model list function Date: Wed, 22 Oct 2025 10:55:57 +0400 Message-ID: <20251022065640.1172785-3-marcandre.lureau@redhat.com> In-Reply-To: <20251022065640.1172785-1-marcandre.lureau@redhat.com> References: <20251022065640.1172785-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1761116338536154100 From: Marc-Andr=C3=A9 Lureau Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- include/hw/audio/soundhw.h | 2 +- hw/audio/soundhw.c | 4 ++-- system/vl.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/hw/audio/soundhw.h b/include/hw/audio/soundhw.h index 474c5ff94e..83b3011083 100644 --- a/include/hw/audio/soundhw.h +++ b/include/hw/audio/soundhw.h @@ -7,7 +7,7 @@ void deprecated_register_soundhw(const char *name, const ch= ar *descr, int isa, const char *typename); =20 void soundhw_init(void); -void show_valid_soundhw(void); +void audio_print_available_models(void); void select_soundhw(const char *name, const char *audiodev); =20 #endif diff --git a/hw/audio/soundhw.c b/hw/audio/soundhw.c index b06552e7a8..aca077f5ae 100644 --- a/hw/audio/soundhw.c +++ b/hw/audio/soundhw.c @@ -65,7 +65,7 @@ void deprecated_register_soundhw(const char *name, const = char *descr, soundhw_count++; } =20 -void show_valid_soundhw(void) +void audio_print_available_models(void) { struct soundhw *c; =20 @@ -102,7 +102,7 @@ void select_soundhw(const char *name, const char *audio= dev) =20 if (!c->name) { error_report("Unknown audio device model `%s'", name); - show_valid_soundhw(); + audio_print_available_models(); exit(1); } } diff --git a/system/vl.c b/system/vl.c index 646239e4a6..d20a9cbe08 100644 --- a/system/vl.c +++ b/system/vl.c @@ -3077,7 +3077,7 @@ void qemu_init(int argc, char **argv) model =3D g_strdup(qdict_get_str(dict, "model")); qdict_del(dict, "model"); if (is_help_option(model)) { - show_valid_soundhw(); + audio_print_available_models(); exit(0); } } --=20 2.51.0 From nobody Fri Nov 14 18:21:22 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1761116345; cv=none; d=zohomail.com; s=zohoarc; b=e8k3ztZE7bEq1B3TocztFKF8xs7alrA9dxujNTlpzZ+nqBdSmsj/pt5PxlwHZYMxq7EeP7GlSFKcdyYvMqoKtNPT7z7tNxuo2qH+z/GuSwAc0re689xp9tvLHuiRQ8yIEyMH+M5za9yZt92FyGjuUhmZ7kXEsMR9FdRzUbQyZWM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761116345; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=vG50Cp8jXs+Vv6N4renrVb1ftJ7mwjUTNPnbXKcw4pg=; b=GZXTNanfrdGtK3JYeuI/ANZgag8muLS3+KcPsjnNp73nXn9WUpiQcEDYX1dlI1nxuDqMQbBWjgTTmKmkon83JyvjPtxOZpBXvj3/CEkYVg1vSqdTzolv5aK2e3CQlsImK24mckiQ/nTlo0FOzcXnwoPIhna6J6u3/QuRw//AaZY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1761116345101629.3586525386766; Tue, 21 Oct 2025 23:59:05 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vBSmW-00086i-30; Wed, 22 Oct 2025 02:57:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vBSmT-00086S-Vp for qemu-devel@nongnu.org; Wed, 22 Oct 2025 02:57:09 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vBSmS-00081n-Cx for qemu-devel@nongnu.org; Wed, 22 Oct 2025 02:57:09 -0400 Received: from mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-685-kc6obWqjOoOAQGmuKWAwuA-1; Wed, 22 Oct 2025 02:57:03 -0400 Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 83EB819560AD; Wed, 22 Oct 2025 06:57:02 +0000 (UTC) Received: from localhost (unknown [10.44.22.9]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 14C68180035A; Wed, 22 Oct 2025 06:57:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761116227; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=vG50Cp8jXs+Vv6N4renrVb1ftJ7mwjUTNPnbXKcw4pg=; b=C3Mln2BN4PNh03Enj2FNkKAmtoNtcZLG3gCAsy1Yto/sfFaltfy+QvOTmn0DjnpIazzvuk PeLNoHdH5Q+TW6AOn5i184T1Qd581e+eEn/NmOa63RJygHPFN+mQ9Y+Rfdh5GESAUH3MxD xzKSLbnsjKAlpzm7WIUpUrNIg2HUQz8= X-MC-Unique: kc6obWqjOoOAQGmuKWAwuA-1 X-Mimecast-MFC-AGG-ID: kc6obWqjOoOAQGmuKWAwuA_1761116222 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Volker=20R=C3=BCmelin?= , Paolo Bonzini , BALATON Zoltan , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Gerd Hoffmann Subject: [PATCH v2 03/42] hw/audio: remove global pcspk Date: Wed, 22 Oct 2025 10:55:58 +0400 Message-ID: <20251022065640.1172785-4-marcandre.lureau@redhat.com> In-Reply-To: <20251022065640.1172785-1-marcandre.lureau@redhat.com> References: <20251022065640.1172785-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1761116356448158500 From: Marc-Andr=C3=A9 Lureau It is no longer used since commit 6033b9ecd4 ("pc: remove -soundhw pcspk") Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- hw/audio/pcspk.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/hw/audio/pcspk.c b/hw/audio/pcspk.c index a419161b5b..1b0cc08119 100644 --- a/hw/audio/pcspk.c +++ b/hw/audio/pcspk.c @@ -60,7 +60,6 @@ struct PCSpkState { }; =20 static const char *s_spk =3D "pcspk"; -static PCSpkState *pcspk_state; =20 static inline void generate_samples(PCSpkState *s) { @@ -192,8 +191,6 @@ static void pcspk_realizefn(DeviceState *dev, Error **e= rrp) if (s->card.state && AUD_register_card(s_spk, &s->card, errp)) { pcspk_audio_init(s); } - - pcspk_state =3D s; } =20 static bool migrate_needed(void *opaque) @@ -229,7 +226,6 @@ static void pcspk_class_initfn(ObjectClass *klass, cons= t void *data) set_bit(DEVICE_CATEGORY_SOUND, dc->categories); dc->vmsd =3D &vmstate_spk; device_class_set_props(dc, pcspk_properties); - /* Reason: realize sets global pcspk_state */ /* Reason: pit object link */ dc->user_creatable =3D false; } --=20 2.51.0 From nobody Fri Nov 14 18:21:22 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1761116266; cv=none; d=zohomail.com; s=zohoarc; b=HwjIBsb8x2MOHZArHWOysapUhUKrJ4VS4IM08SgVzAjNovRPzVecMcNug5HJTcYwBAFwR3FFvdYa+rjHg1VE4wWCuc/XjO/9O4HfGF+30xESSMRcqkBdHdt5Fa19u/nI0GFTeAyV07NdzhT+71+RcicK8zRtY5WatOZL2pwSGq0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761116266; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=l8qpVhvjDcxiMsJKwJtb1U9iBXYjSTlqxniLyPurnXs=; b=bpRgsWIu1B/iN3Fg4tjGFIQnjd5+/7zpnn8fsFSCjOfJRfzGtBJHWWQ+MTP7rFqA5CG4argBwr7Bp4dZTQSVZ0AdHXMheeGXi/lscYXwt5Hq6UUL7H0LWFXZC6003ela9m0cXeMnPfL4VlZyysi35oYFK46Eva1RfcTqp2Jwx2g= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1761116266307962.1093991632299; Tue, 21 Oct 2025 23:57:46 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vBSmg-0008CZ-Go; Wed, 22 Oct 2025 02:57:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vBSmZ-00088u-Cv for qemu-devel@nongnu.org; Wed, 22 Oct 2025 02:57:16 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vBSmX-00082Y-RO for qemu-devel@nongnu.org; Wed, 22 Oct 2025 02:57:15 -0400 Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-38-KUool44WPwG1UfpRghdDLA-1; Wed, 22 Oct 2025 02:57:09 -0400 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id A3AF41956089; Wed, 22 Oct 2025 06:57:08 +0000 (UTC) Received: from localhost (unknown [10.44.22.9]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id D3291180045B; Wed, 22 Oct 2025 06:57:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761116233; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=l8qpVhvjDcxiMsJKwJtb1U9iBXYjSTlqxniLyPurnXs=; b=HuYWKAzkXR6qI1+M0XLjz8RmNY8ucPxVgjfF5FTqds/vRLL5+xCND6889lBoTlIZRHTSQ6 8KC2uqWQvJiPBdETqRP3aeegC/KgJJiIbQiM06Xvattpi/V6mE60zBv2MVb/hLxPbXdyZ3 Pne82BpUXWZf5iqPr96vgaL4q3EqSxo= X-MC-Unique: KUool44WPwG1UfpRghdDLA-1 X-Mimecast-MFC-AGG-ID: KUool44WPwG1UfpRghdDLA_1761116228 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Volker=20R=C3=BCmelin?= , Paolo Bonzini , BALATON Zoltan , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Gerd Hoffmann , "Michael S. Tsirkin" Subject: [PATCH v2 04/42] hw/pcspk: use explicitly the required PIT types Date: Wed, 22 Oct 2025 10:55:59 +0400 Message-ID: <20251022065640.1172785-5-marcandre.lureau@redhat.com> In-Reply-To: <20251022065640.1172785-1-marcandre.lureau@redhat.com> References: <20251022065640.1172785-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1761116275563158500 From: Marc-Andr=C3=A9 Lureau Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- include/hw/timer/i8254.h | 4 ++-- hw/audio/pcspk.c | 2 +- hw/timer/i8254_common.c | 6 ++---- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/include/hw/timer/i8254.h b/include/hw/timer/i8254.h index 8402caad30..f7148d9286 100644 --- a/include/hw/timer/i8254.h +++ b/include/hw/timer/i8254.h @@ -75,7 +75,7 @@ static inline ISADevice *kvm_pit_init(ISABus *bus, int ba= se) return d; } =20 -void pit_set_gate(ISADevice *dev, int channel, int val); -void pit_get_channel_info(ISADevice *dev, int channel, PITChannelInfo *inf= o); +void pit_set_gate(PITCommonState *pit, int channel, int val); +void pit_get_channel_info(PITCommonState *pit, int channel, PITChannelInfo= *info); =20 #endif /* HW_I8254_H */ diff --git a/hw/audio/pcspk.c b/hw/audio/pcspk.c index 1b0cc08119..60cedcb375 100644 --- a/hw/audio/pcspk.c +++ b/hw/audio/pcspk.c @@ -50,7 +50,7 @@ struct PCSpkState { uint8_t sample_buf[PCSPK_BUF_LEN]; QEMUSoundCard card; SWVoiceOut *voice; - void *pit; + PITCommonState *pit; unsigned int pit_count; unsigned int samples; unsigned int play_pos; diff --git a/hw/timer/i8254_common.c b/hw/timer/i8254_common.c index ad091594cd..419d4cd6e5 100644 --- a/hw/timer/i8254_common.c +++ b/hw/timer/i8254_common.c @@ -32,9 +32,8 @@ #include "migration/vmstate.h" =20 /* val must be 0 or 1 */ -void pit_set_gate(ISADevice *dev, int channel, int val) +void pit_set_gate(PITCommonState *pit, int channel, int val) { - PITCommonState *pit =3D PIT_COMMON(dev); PITChannelState *s =3D &pit->channels[channel]; PITCommonClass *c =3D PIT_COMMON_GET_CLASS(pit); =20 @@ -139,9 +138,8 @@ void pit_get_channel_info_common(PITCommonState *s, PIT= ChannelState *sc, info->out =3D pit_get_out(sc, qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL)); } =20 -void pit_get_channel_info(ISADevice *dev, int channel, PITChannelInfo *inf= o) +void pit_get_channel_info(PITCommonState *pit, int channel, PITChannelInfo= *info) { - PITCommonState *pit =3D PIT_COMMON(dev); PITChannelState *s =3D &pit->channels[channel]; PITCommonClass *c =3D PIT_COMMON_GET_CLASS(pit); =20 --=20 2.51.0 From nobody Fri Nov 14 18:21:22 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1761116259; cv=none; d=zohomail.com; s=zohoarc; b=YBwGTWbNJGT5zE8/gUDG/EV0IHute/jjDnQ8+/xsfb7jJsEYJvdVZzxTmc0nD3iVOBXjifXUnfVafE75S0g9h9Dmhe8kVeWMehkd448YPPSXzjQtCWdQ7YW2XOZtr2NJEf9BVTGyHYXS10PcfUQceOV4vzYgbgr1CRB0RECkhIA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761116259; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=6SRS7DAeAlr5aYQ5bL+Wyav63P5997mziAXcrSWjivE=; b=GlPDuaGa1lR2Gy6FSgALItBBc3g//w89kuAmOqJg/afeYd44D7qDDP4oH/fjyTS/4cIP/gg9+V/HM2VsrimY2Ss2ZkAx1x30JHg6IAqoOxRqJRRtDdS0Bu0L/9VwgNpJcdV9HH2DfssF3FlCJmdD/K0FgUuKz+TOd+qKX/cbqlI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1761116259226171.70123951839173; Tue, 21 Oct 2025 23:57:39 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vBSmk-0008Hx-Ru; Wed, 22 Oct 2025 02:57:26 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vBSme-0008Ce-Sv for qemu-devel@nongnu.org; Wed, 22 Oct 2025 02:57:22 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vBSmd-00082x-5n for qemu-devel@nongnu.org; Wed, 22 Oct 2025 02:57:20 -0400 Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-479-4C-LMPkVOpyU-K3Yk02iCw-1; Wed, 22 Oct 2025 02:57:14 -0400 Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id D46CA180057A; Wed, 22 Oct 2025 06:57:13 +0000 (UTC) Received: from localhost (unknown [10.44.22.9]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id D34B5180035A; Wed, 22 Oct 2025 06:57:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761116238; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=6SRS7DAeAlr5aYQ5bL+Wyav63P5997mziAXcrSWjivE=; b=LOskWEemLJTa38kZ+vwOTEQP5yHEcIASWydjkxvcZyacZWdwD1K2n4OyOAuvbP3b86yspI I3k+QTXdVMNhFQb05L63kiRYJL84qJIkqx2egoPjPUHwlDh1bBKb3lqFHq7gpRMkdgqV59 dnYCR+VDiDsI2aiFR2qjjGVcq3sLFow= X-MC-Unique: 4C-LMPkVOpyU-K3Yk02iCw-1 X-Mimecast-MFC-AGG-ID: 4C-LMPkVOpyU-K3Yk02iCw_1761116234 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Volker=20R=C3=BCmelin?= , Paolo Bonzini , BALATON Zoltan , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Gerd Hoffmann Subject: [PATCH v2 05/42] hw/pcspk: make 'pit' a class property Date: Wed, 22 Oct 2025 10:56:00 +0400 Message-ID: <20251022065640.1172785-6-marcandre.lureau@redhat.com> In-Reply-To: <20251022065640.1172785-1-marcandre.lureau@redhat.com> References: <20251022065640.1172785-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1761116281747158500 From: Marc-Andr=C3=A9 Lureau Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- hw/audio/pcspk.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/hw/audio/pcspk.c b/hw/audio/pcspk.c index 60cedcb375..40572241cb 100644 --- a/hw/audio/pcspk.c +++ b/hw/audio/pcspk.c @@ -174,11 +174,6 @@ static void pcspk_initfn(Object *obj) PCSpkState *s =3D PC_SPEAKER(obj); =20 memory_region_init_io(&s->ioport, OBJECT(s), &pcspk_io_ops, s, "pcspk"= , 1); - - object_property_add_link(obj, "pit", TYPE_PIT_COMMON, - (Object **)&s->pit, - qdev_prop_allow_set_link_before_realize, - 0); } =20 static void pcspk_realizefn(DeviceState *dev, Error **errp) @@ -216,6 +211,7 @@ static const Property pcspk_properties[] =3D { DEFINE_AUDIO_PROPERTIES(PCSpkState, card), DEFINE_PROP_UINT32("iobase", PCSpkState, iobase, 0x61), DEFINE_PROP_BOOL("migrate", PCSpkState, migrate, true), + DEFINE_PROP_LINK("pit", PCSpkState, pit, TYPE_PIT_COMMON, PITCommonSta= te *), }; =20 static void pcspk_class_initfn(ObjectClass *klass, const void *data) --=20 2.51.0 From nobody Fri Nov 14 18:21:22 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1761116333; cv=none; d=zohomail.com; s=zohoarc; b=hoWVxY8/VDqG1a9AYSjL2nHsJVdTpUSocUTwQduO4j6kDLnpbVMY7DAI/9K6mBKWFW10mfZs8qqtqdeRbsFIoQ/N3K9XGKAwRdj+3Du9y5CyUzNpcSHLKdVmCTv9VTY86TSPCcxlZtueZQQHZCdKdHe1h8rezWEzesoGkRWkKbY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761116333; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=OrjtDXtBAQBNieIaUjAWciIjKkR5YYxe6JyMLio1rDU=; b=bZHV6p0+cy0xoHOffQzVX49ZmDj5DEDWrsskagj2FPNIGpWM1hIFOSm0jJ5Ioc62Bbyd93ObxwAzor3mpcYwWA2E5H/0eg/KZ79GBbDpftYVDkN8Q/71eSTMchmd3tIfc/hsqJ+gu3FxsJHHYEVEL1yrBcYPQu/Uz3rQTvpe4ww= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1761116333953965.2517218656786; Tue, 21 Oct 2025 23:58:53 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vBSmm-0008Ke-A1; Wed, 22 Oct 2025 02:57:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vBSmi-0008E1-6m for qemu-devel@nongnu.org; Wed, 22 Oct 2025 02:57:24 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vBSmg-00083V-Pq for qemu-devel@nongnu.org; Wed, 22 Oct 2025 02:57:23 -0400 Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-436-1HGVVF0rMNubpez4pnw55A-1; Wed, 22 Oct 2025 02:57:20 -0400 Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 637AE18009C2; Wed, 22 Oct 2025 06:57:19 +0000 (UTC) Received: from localhost (unknown [10.44.22.9]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id E8199180057D; Wed, 22 Oct 2025 06:57:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761116242; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=OrjtDXtBAQBNieIaUjAWciIjKkR5YYxe6JyMLio1rDU=; b=TBfcLIvjlE6Q4nMHXxACFy2sOXWbzZARPxR44hUkdVG8LBm1KdDurwTWZ0JD5AZxF63B7F 4AJuSFVo2QFyrde/2m0XgOUlMY5tQi+mcWsT2YIZ5P9ObTSHVlwXJO4vHsHg8Is3MNodYw TkK2U+zKeT50w+EEDmSsIVFFgk1kCGU= X-MC-Unique: 1HGVVF0rMNubpez4pnw55A-1 X-Mimecast-MFC-AGG-ID: 1HGVVF0rMNubpez4pnw55A_1761116239 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Volker=20R=C3=BCmelin?= , Paolo Bonzini , BALATON Zoltan , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Gerd Hoffmann Subject: [PATCH v2 06/42] hw/pcspk: check the "pit" is set Date: Wed, 22 Oct 2025 10:56:01 +0400 Message-ID: <20251022065640.1172785-7-marcandre.lureau@redhat.com> In-Reply-To: <20251022065640.1172785-1-marcandre.lureau@redhat.com> References: <20251022065640.1172785-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1761116338276158500 From: Marc-Andr=C3=A9 Lureau We don't let the user create a "isa-pcspk" via -device yet (in theory, we could, and fallback on a lookup PIT), but we can add some safety checks that the property was correctly set nonetheless. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- hw/audio/pcspk.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/hw/audio/pcspk.c b/hw/audio/pcspk.c index 40572241cb..8ea3a161a4 100644 --- a/hw/audio/pcspk.c +++ b/hw/audio/pcspk.c @@ -181,6 +181,11 @@ static void pcspk_realizefn(DeviceState *dev, Error **= errp) ISADevice *isadev =3D ISA_DEVICE(dev); PCSpkState *s =3D PC_SPEAKER(dev); =20 + if (!s->pit) { + error_setg(errp, "pcspk: No \"pit\" set or available"); + return; + } + isa_register_ioport(isadev, &s->ioport, s->iobase); =20 if (s->card.state && AUD_register_card(s_spk, &s->card, errp)) { --=20 2.51.0 From nobody Fri Nov 14 18:21:22 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1761116276; cv=none; d=zohomail.com; s=zohoarc; b=Git2HuC7bNbng3pq4NkhRFczsdgldm8zLgHztO3kzIsxDHbsWJSQD6ZPayv5+xCOqu7fKHtkjNXFqo20xSTFQ6HU6W5QlbJoSnhZyezU3pzkMS5U/CY5pEpNCnuWMAXdIGXTCTYuFyanRjQCSOHMhFfwgyNs9x6f27F4es8AFM4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761116276; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=cMUwGFNb07Qm+jO9Ii1yrIe9dztkSD6REgFslsXC07o=; b=fP4Ozc2Epkt4f5bqQ+HllQnd48+7ylu6iG5Ey+K42/9iipCmj/806K8Gmlx+dZeYrMR0A2G++SQvg2BUtKdzRKzLXj2litzbFp73fATZowKsoDP652Ilw57Zl7J5NVLxf497Dn3rlP5Dyt9PQJSfs3ngLMwozZvzzqZQ9zdpGNk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1761116276743830.0544240755414; Tue, 21 Oct 2025 23:57:56 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vBSmp-0008W8-MO; Wed, 22 Oct 2025 02:57:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vBSmn-0008QE-SA for qemu-devel@nongnu.org; Wed, 22 Oct 2025 02:57:29 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vBSmm-000846-2v for qemu-devel@nongnu.org; Wed, 22 Oct 2025 02:57:29 -0400 Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-393-lAPOzBU_Ol6zI1TXc98Wkg-1; Wed, 22 Oct 2025 02:57:25 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id BD2D6195608D; Wed, 22 Oct 2025 06:57:24 +0000 (UTC) Received: from localhost (unknown [10.44.22.9]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 74DF430001BF; Wed, 22 Oct 2025 06:57:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761116247; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=cMUwGFNb07Qm+jO9Ii1yrIe9dztkSD6REgFslsXC07o=; b=KmCRjYOlUY6TlpCMDZTp1mjvbk4Khxj3TN6A5tYPkkWHspqR6/O0G+HraCueA+CBy0ozd2 Wq2A+R6vO9gFTB4lbDdozXLamXpNnBsHLE1W6KWnOTvd/bUtM07XQlzpOkQILUpiwL+zmi LEvWa4cfhkRY8Y4RyWGCp9JyUhTRHRQ= X-MC-Unique: lAPOzBU_Ol6zI1TXc98Wkg-1 X-Mimecast-MFC-AGG-ID: lAPOzBU_Ol6zI1TXc98Wkg_1761116244 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Volker=20R=C3=BCmelin?= , Paolo Bonzini , BALATON Zoltan , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Eduardo Habkost Subject: [PATCH v2 07/42] docs: update -soundhw -> -device list Date: Wed, 22 Oct 2025 10:56:02 +0400 Message-ID: <20251022065640.1172785-8-marcandre.lureau@redhat.com> In-Reply-To: <20251022065640.1172785-1-marcandre.lureau@redhat.com> References: <20251022065640.1172785-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1761116287641158500 From: Marc-Andr=C3=A9 Lureau (note: it's unclear whether -soundhw pcspk was working as expected, since it was not user-creatable) Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Thomas Huth --- docs/qdev-device-use.txt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/docs/qdev-device-use.txt b/docs/qdev-device-use.txt index c98c86d828..043ae46114 100644 --- a/docs/qdev-device-use.txt +++ b/docs/qdev-device-use.txt @@ -324,8 +324,10 @@ Map from -soundhw sound card name to -device: gus -device gus,iobase=3DIOADDR,irq=3DIRQ,dma=3DDMA,freq=3DF hda -device intel-hda,msi=3DMSI -device hda-duplex sb16 -device sb16,iobase=3DIOADDR,irq=3DIRQ,dma=3DDMA,dma16=3DD= MA16,version=3DV - adlib not yet available with -device - pcspk not yet available with -device + adlib -device adlib,iobase=3DIOADDR,freq=3DF + + pcspk Not available with -device, + but audiodev can be set with -machine pcspk-audiodev=3D =20 For PCI devices, you can add bus=3DPCI-BUS,addr=3DDEVFN to control the PCI device address, as usual. --=20 2.51.0 From nobody Fri Nov 14 18:21:22 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1761116743; cv=none; d=zohomail.com; s=zohoarc; b=SfOLDwjXtB1M2aJfKjPxEPpOT9IDOTaHwxQNU6uf4Ojqx0tJoLDldERiH1KTeTNcSEmnTcjKZymXvTMYm1yQ8VCd05lzzNOEElRcNySPsMWo1l2UJNC8czKK+dyiwmVSG0tGHPbBW/07S46iWGXiKzAis/ggY8QAsqUqPngz9pg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761116743; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=/YtqoBXbf8UYt1atKTj+EnrpjrPSzf1Rhm6i4GfcY1w=; b=AdnMXMgljLVwlJCxJKYHW8kh/fCR3Txn+hXJyAJxG4UVUVxQ6xPmqz5wVWJp7jVkdqtLMS1c1ciPZ+IMY8bYq9UmiffRq0fFL/0oIDQ2vPlmKkgKVtJulT2WbUTOv51CdyrAlsPEI6KaE0pVPR8bcOryJTOwyCvcwruFlljbbYY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1761116743654327.55849297602197; Wed, 22 Oct 2025 00:05:43 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vBSn4-00017N-RG; Wed, 22 Oct 2025 02:57:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vBSn3-00013g-0V for qemu-devel@nongnu.org; Wed, 22 Oct 2025 02:57:45 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vBSmu-00085c-5t for qemu-devel@nongnu.org; Wed, 22 Oct 2025 02:57:44 -0400 Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-208-OECkF02PORmbSrdppKby6g-1; Wed, 22 Oct 2025 02:57:31 -0400 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id ED38318001C6; Wed, 22 Oct 2025 06:57:29 +0000 (UTC) Received: from localhost (unknown [10.44.22.9]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id EF8C419560B0; Wed, 22 Oct 2025 06:57:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761116254; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=/YtqoBXbf8UYt1atKTj+EnrpjrPSzf1Rhm6i4GfcY1w=; b=V5KSHuNWUqb4UbnLHluroY9epZth4oRaJNqPUzE9cUx74zdVW1yT/GMd6Q6OyaHaapXMy5 qq8zItaZfkKmIjeHThFcv5+9agAxonTCuKU+oSBQYf4ALYEdF6PGbgHzB5Vv3NEC2HSta6 G2J2J8t7ojt6YN39R3hfLccAXS3Mr3M= X-MC-Unique: OECkF02PORmbSrdppKby6g-1 X-Mimecast-MFC-AGG-ID: OECkF02PORmbSrdppKby6g_1761116250 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Volker=20R=C3=BCmelin?= , Paolo Bonzini , BALATON Zoltan , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Eduardo Habkost Subject: [PATCH v2 08/42] qdev: add qdev_find_default_bus() Date: Wed, 22 Oct 2025 10:56:03 +0400 Message-ID: <20251022065640.1172785-9-marcandre.lureau@redhat.com> In-Reply-To: <20251022065640.1172785-1-marcandre.lureau@redhat.com> References: <20251022065640.1172785-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1761116749315158500 From: Marc-Andr=C3=A9 Lureau This helper is used next by -audio code. Signed-off-by: Marc-Andr=C3=A9 Lureau --- include/monitor/qdev.h | 3 +++ system/qdev-monitor.c | 25 +++++++++++++++++++++---- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/include/monitor/qdev.h b/include/monitor/qdev.h index 1d57bf6577..de33637869 100644 --- a/include/monitor/qdev.h +++ b/include/monitor/qdev.h @@ -1,6 +1,8 @@ #ifndef MONITOR_QDEV_H #define MONITOR_QDEV_H =20 +#include "hw/qdev-core.h" + /*** monitor commands ***/ =20 void hmp_info_qtree(Monitor *mon, const QDict *qdict); @@ -11,6 +13,7 @@ int qdev_device_help(QemuOpts *opts); DeviceState *qdev_device_add(QemuOpts *opts, Error **errp); DeviceState *qdev_device_add_from_qdict(const QDict *opts, bool from_json, Error **errp); +BusState *qdev_find_default_bus(DeviceClass *dc, Error **errp); =20 /** * qdev_set_id: parent the device and set its id if provided. diff --git a/system/qdev-monitor.c b/system/qdev-monitor.c index 2ac92d0a07..9ed05d5d5a 100644 --- a/system/qdev-monitor.c +++ b/system/qdev-monitor.c @@ -621,6 +621,25 @@ const char *qdev_set_id(DeviceState *dev, char *id, Er= ror **errp) return prop->name; } =20 +BusState *qdev_find_default_bus(DeviceClass *dc, Error **errp) +{ + BusState *bus =3D NULL; + + assert(dc->bus_type !=3D NULL); + bus =3D qbus_find_recursive(sysbus_get_default(), NULL, dc->bus_type); + if (!bus) { + error_setg(errp, "No '%s' bus found for device '%s'", + dc->bus_type, object_class_get_name(OBJECT_CLASS(dc))); + return NULL; + } + if (qbus_is_full(bus)) { + error_setg(errp, "A '%s' bus was found but is full", dc->bus_type); + return NULL; + } + + return bus; +} + DeviceState *qdev_device_add_from_qdict(const QDict *opts, bool from_json, Error **errp) { @@ -657,10 +676,8 @@ DeviceState *qdev_device_add_from_qdict(const QDict *o= pts, return NULL; } } else if (dc->bus_type !=3D NULL) { - bus =3D qbus_find_recursive(sysbus_get_default(), NULL, dc->bus_ty= pe); - if (!bus || qbus_is_full(bus)) { - error_setg(errp, "No '%s' bus found for device '%s'", - dc->bus_type, driver); + bus =3D qdev_find_default_bus(dc, errp); + if (!bus) { return NULL; } } --=20 2.51.0 From nobody Fri Nov 14 18:21:22 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1761116320; cv=none; d=zohomail.com; s=zohoarc; b=DRPfVXrdarm5rK1wusS+jdQElsXecrJZWfQrRDqUxySd3AXdOiYsFnVT1sKy99xYI+KgOPQ/eXgasVwv8xfyRibFyU1Rx7XeJd1VHgMBUDn0u8E1XJzzm0qm5P24Z0hyqL8Ig/oWEvOEY2zjZsO/meDRopFZELsKs1H/Xbf4rZo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761116320; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=XM5XiiB9fJ9Ksj/BZ6DFiO9dUHFsPS364V1lxa/i93E=; b=C5HUZD/1gneYCDfbeXODjxwewbm5YKW0h1IgbsdQISZw0wakpwiO4vjbnWHLAdU6M0kAEzSO674iHnx9+rxrdt/8AEzdbq/rypZAdptA+fAdpa8rAXVo+NsGA85mdz8t704DnRCYW/AZQd9p7tqbWDSn6+ys9LPwrr5YpblR/8o= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1761116320571353.7941304491426; Tue, 21 Oct 2025 23:58:40 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vBSn3-00013x-3q; Wed, 22 Oct 2025 02:57:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vBSn1-0000u3-6Z for qemu-devel@nongnu.org; Wed, 22 Oct 2025 02:57:43 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vBSmz-000864-IX for qemu-devel@nongnu.org; Wed, 22 Oct 2025 02:57:42 -0400 Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-25-HXt6Y5GuMISN47db_w3AWw-1; Wed, 22 Oct 2025 02:57:36 -0400 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 9DD8D18002F7; Wed, 22 Oct 2025 06:57:35 +0000 (UTC) Received: from localhost (unknown [10.44.22.9]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 320201956056; Wed, 22 Oct 2025 06:57:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761116260; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=XM5XiiB9fJ9Ksj/BZ6DFiO9dUHFsPS364V1lxa/i93E=; b=NBNbqibRn+cDhKLGYk8lBILL6YCNVFhoErcZup9fYMwoQorpgaulRtlEmCl7Ys3XvC6dYX llbKSKxEBt+naIV/WSR6HqWteAYtqfMN73YahZyMya4ADSwf+JlCMmMdMA00TevlVelre/ KYKQo4w1m6MEyTyOpDe9Ikn9BERaEs4= X-MC-Unique: HXt6Y5GuMISN47db_w3AWw-1 X-Mimecast-MFC-AGG-ID: HXt6Y5GuMISN47db_w3AWw_1761116255 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Volker=20R=C3=BCmelin?= , Paolo Bonzini , BALATON Zoltan , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Gerd Hoffmann Subject: [PATCH v2 09/42] hw/audio: look up the default bus from the device class Date: Wed, 22 Oct 2025 10:56:04 +0400 Message-ID: <20251022065640.1172785-10-marcandre.lureau@redhat.com> In-Reply-To: <20251022065640.1172785-1-marcandre.lureau@redhat.com> References: <20251022065640.1172785-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1761116322515154100 From: Marc-Andr=C3=A9 Lureau Generalize and simplify the device model creation. Signed-off-by: Marc-Andr=C3=A9 Lureau --- hw/audio/soundhw.c | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/hw/audio/soundhw.c b/hw/audio/soundhw.c index aca077f5ae..b4a87ff709 100644 --- a/hw/audio/soundhw.c +++ b/hw/audio/soundhw.c @@ -22,6 +22,8 @@ * THE SOFTWARE. */ #include "qemu/osdep.h" +#include "hw/qdev-core.h" +#include "monitor/qdev.h" #include "qemu/option.h" #include "qemu/help_option.h" #include "qemu/error-report.h" @@ -110,33 +112,19 @@ void select_soundhw(const char *name, const char *aud= iodev) void soundhw_init(void) { struct soundhw *c =3D selected; - ISABus *isa_bus =3D (ISABus *) object_resolve_path_type("", TYPE_ISA_B= US, NULL); - PCIBus *pci_bus =3D (PCIBus *) object_resolve_path_type("", TYPE_PCI_B= US, NULL); - BusState *bus; =20 if (!c) { return; } - if (c->isa) { - if (!isa_bus) { - error_report("ISA bus not available for %s", c->name); - exit(1); - } - bus =3D BUS(isa_bus); - } else { - if (!pci_bus) { - error_report("PCI bus not available for %s", c->name); - exit(1); - } - bus =3D BUS(pci_bus); - } =20 if (c->typename) { DeviceState *dev =3D qdev_new(c->typename); + BusState *bus =3D qdev_find_default_bus(DEVICE_GET_CLASS(dev), &er= ror_fatal); qdev_prop_set_string(dev, "audiodev", audiodev_id); qdev_realize_and_unref(dev, bus, &error_fatal); } else { assert(!c->isa); + PCIBus *pci_bus =3D (PCIBus *) object_resolve_path_type("", TYPE_P= CI_BUS, NULL); c->init_pci(pci_bus, audiodev_id); } } --=20 2.51.0 From nobody Fri Nov 14 18:21:22 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1761116301; cv=none; d=zohomail.com; s=zohoarc; b=bGg0PKDPkopV7bf3B4LiD3PBlRIkx/kPXUBmtbRgVqwrYGD+BgU7/38i41w21a0c+g3p1/42ZOPzSelw6mdNpuFgcE/K1ivRjheTSU/CQ70bXtt7rS/KwGas1ss/qYenYhuHRvlDIqu9ljFPadtTSxN1uBapp2y/YXdLb1+dX/E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761116301; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=nGMm2WNlAwuqkjgPVmmBw8DnVNZofzxhoHILFvByxx8=; b=J+t9p6iE2gYd0WVf/VmUryiwhfBTUjT0KtkWX6gq7SHL+t7C4wwL6hJXIR1IA9RDgnFvyM5mnlQycs9m7xOzBDYZSXuZKH/30Qk3UjBG2Y9iJYr4i5D5Wm+f5LZ5AFvcVKJHRrgVBsDO4P9ooFxUqEQ8ocQosIgDKQNCTNVdbeY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 176111630169250.53489889676621; Tue, 21 Oct 2025 23:58:21 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vBSn6-0001Cu-K4; Wed, 22 Oct 2025 02:57:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vBSn4-00017a-Rk for qemu-devel@nongnu.org; Wed, 22 Oct 2025 02:57:46 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vBSn3-00086N-37 for qemu-devel@nongnu.org; Wed, 22 Oct 2025 02:57:46 -0400 Received: from mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-668-Iv6VYl_cMiGuafVjEsYzzA-1; Wed, 22 Oct 2025 02:57:41 -0400 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id B2547195422D; Wed, 22 Oct 2025 06:57:40 +0000 (UTC) Received: from localhost (unknown [10.44.22.9]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id B3AA21956056; Wed, 22 Oct 2025 06:57:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761116264; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=nGMm2WNlAwuqkjgPVmmBw8DnVNZofzxhoHILFvByxx8=; b=VvK5o/wf/VXEwymg0m/NutcrR4V30ahPKjVQacrqGL6RJ8onmks8PgbX1g1Nb0QWROM+C2 fhfrr05yHkEt7JA+hB+wWQ12r4evC2mDA8DMZ9Nacxf657NsTPmR3XAJxr3ypxBmFjzfdM wetVbZDfgUrkgY2XnHmoUqA5v+hbbFo= X-MC-Unique: Iv6VYl_cMiGuafVjEsYzzA-1 X-Mimecast-MFC-AGG-ID: Iv6VYl_cMiGuafVjEsYzzA_1761116260 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Volker=20R=C3=BCmelin?= , Paolo Bonzini , BALATON Zoltan , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Gerd Hoffmann Subject: [PATCH v2 10/42] audio: rename audio_define->audio_add_audiodev() Date: Wed, 22 Oct 2025 10:56:05 +0400 Message-ID: <20251022065640.1172785-11-marcandre.lureau@redhat.com> In-Reply-To: <20251022065640.1172785-1-marcandre.lureau@redhat.com> References: <20251022065640.1172785-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1761116304322154100 From: Marc-Andr=C3=A9 Lureau For readability. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- audio/audio.h | 4 ++-- audio/audio.c | 8 ++++---- system/vl.c | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/audio/audio.h b/audio/audio.h index fcc22307be..eb5b5d662d 100644 --- a/audio/audio.h +++ b/audio/audio.h @@ -168,8 +168,8 @@ void audio_sample_to_uint64(const void *samples, int po= s, void audio_sample_from_uint64(void *samples, int pos, uint64_t left, uint64_t right); =20 -void audio_define(Audiodev *audio); -void audio_define_default(Audiodev *dev, Error **errp); +void audio_add_audiodev(Audiodev *audio); +void audio_add_default_audiodev(Audiodev *dev, Error **errp); void audio_parse_option(const char *opt); void audio_create_default_audiodevs(void); void audio_init_audiodevs(void); diff --git a/audio/audio.c b/audio/audio.c index 89f091bc88..6197fa1788 100644 --- a/audio/audio.c +++ b/audio/audio.c @@ -1712,7 +1712,7 @@ void audio_create_default_audiodevs(void) visit_type_Audiodev(v, NULL, &dev, &error_fatal); visit_free(v); =20 - audio_define_default(dev, &error_abort); + audio_add_default_audiodev(dev, &error_abort); } } } @@ -2142,10 +2142,10 @@ void audio_parse_option(const char *opt) visit_type_Audiodev(v, NULL, &dev, &error_fatal); visit_free(v); =20 - audio_define(dev); + audio_add_audiodev(dev); } =20 -void audio_define(Audiodev *dev) +void audio_add_audiodev(Audiodev *dev) { AudiodevListEntry *e; =20 @@ -2156,7 +2156,7 @@ void audio_define(Audiodev *dev) QSIMPLEQ_INSERT_TAIL(&audiodevs, e, next); } =20 -void audio_define_default(Audiodev *dev, Error **errp) +void audio_add_default_audiodev(Audiodev *dev, Error **errp) { AudiodevListEntry *e; =20 diff --git a/system/vl.c b/system/vl.c index d20a9cbe08..7187b24449 100644 --- a/system/vl.c +++ b/system/vl.c @@ -2264,7 +2264,7 @@ static void qemu_record_config_group(const char *grou= p, QDict *dict, Audiodev *dev =3D NULL; Visitor *v =3D qobject_input_visitor_new_keyval(QOBJECT(dict)); if (visit_type_Audiodev(v, NULL, &dev, errp)) { - audio_define(dev); + audio_add_audiodev(dev); } visit_free(v); =20 @@ -3086,11 +3086,11 @@ void qemu_init(int argc, char **argv) visit_type_Audiodev(v, NULL, &dev, &error_fatal); visit_free(v); if (model) { - audio_define(dev); + audio_add_audiodev(dev); select_soundhw(model, dev->id); g_free(model); } else { - audio_define_default(dev, &error_fatal); + audio_add_default_audiodev(dev, &error_fatal); } break; } --=20 2.51.0 From nobody Fri Nov 14 18:21:22 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1761116284; cv=none; d=zohomail.com; s=zohoarc; b=cuUHRa33UJJPPl/la8nlHB9pGhs7YjXBA1cjEbg5Ah3F7QHgfcJmMzTg7b5CdYNfHNCeIPBqnkRwKk/TjsaY/1cznPxubJjhMpbbQas8NAB34AYoz0e1CSaTO0upaNU4Txu3zgOl1GK6/MnzkdA/Cohdt/S4qsb1LAcJwCOd4nI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761116284; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=+wt6sb6ECxEGXtba1iyiyGz0oYg1VaDSGGlLXDLDBkw=; b=dnDbswq1VLAT8pi+7ZCz2mvR7Fs2hHl1mOmN3iJj/8ABSzNcQ11nRs2miUBo13H1jqgNZwVIHOSTbDoURLnsI3P/SgoLH6rZQg6Ix3srNLqwi2oGMxJ2l4DF93Baz8olA/xQAO6P0eqRU9K2yy+uyWnV/1wYPQ3rpqZ10MgFtvo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1761116284383199.0405244264707; Tue, 21 Oct 2025 23:58:04 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vBSnE-0001YM-96; Wed, 22 Oct 2025 02:57:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vBSnC-0001PL-IU for qemu-devel@nongnu.org; Wed, 22 Oct 2025 02:57:54 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vBSn9-000879-Gm for qemu-devel@nongnu.org; Wed, 22 Oct 2025 02:57:54 -0400 Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-475-673vDpjiPr2FDeOQwmdf4A-1; Wed, 22 Oct 2025 02:57:48 -0400 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id BA1281800C36; Wed, 22 Oct 2025 06:57:46 +0000 (UTC) Received: from localhost (unknown [10.44.22.9]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 244C91954102; Wed, 22 Oct 2025 06:57:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761116269; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=+wt6sb6ECxEGXtba1iyiyGz0oYg1VaDSGGlLXDLDBkw=; b=ehjRmXNIVQX1Iv9ejOspcXfo8CD6MpQse9dpyJecty9glUCP96Ovs4X/y2nM5lXazKgy8q AaO55dm9zdSWqc2Uw91nZQV5wP3mpCeQ8a6YEFU7u1I1V5prHgYtzgtGwjr96qNCdDxXJy pnV78pnwxGEEX39vrRN2CzSV7qznHRA= X-MC-Unique: 673vDpjiPr2FDeOQwmdf4A-1 X-Mimecast-MFC-AGG-ID: 673vDpjiPr2FDeOQwmdf4A_1761116266 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Volker=20R=C3=BCmelin?= , Paolo Bonzini , BALATON Zoltan , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Gerd Hoffmann , Manos Pitsidianakis , "Michael S. Tsirkin" , Eduardo Habkost Subject: [PATCH v2 11/42] hw/audio: use better naming for -audio model handling code Date: Wed, 22 Oct 2025 10:56:06 +0400 Message-ID: <20251022065640.1172785-12-marcandre.lureau@redhat.com> In-Reply-To: <20251022065640.1172785-1-marcandre.lureau@redhat.com> References: <20251022065640.1172785-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1761116286262154100 From: Marc-Andr=C3=A9 Lureau All the functions are about "-audio model=3D" handling, a simpler way to setup audio. Rename functions/variables to reflect this better. audio_register_model_with_cb() dropped "pci" from the name, since it will be generalized next. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- include/hw/audio/model.h | 13 +++++ include/hw/audio/soundhw.h | 13 ----- hw/audio/ac97.c | 5 +- hw/audio/adlib.c | 4 +- hw/audio/cs4231a.c | 4 +- hw/audio/es1370.c | 5 +- hw/audio/gus.c | 4 +- hw/audio/intel-hda.c | 4 +- hw/audio/{soundhw.c =3D> model.c} | 58 +++++++++---------- hw/audio/pcspk.c | 2 +- hw/audio/sb16.c | 5 +- hw/audio/virtio-snd-pci.c | 4 +- system/vl.c | 6 +- hw/audio/meson.build | 2 +- .../codeconverter/test_regexps.py | 2 +- 15 files changed, 64 insertions(+), 67 deletions(-) create mode 100644 include/hw/audio/model.h delete mode 100644 include/hw/audio/soundhw.h rename hw/audio/{soundhw.c =3D> model.c} (68%) diff --git a/include/hw/audio/model.h b/include/hw/audio/model.h new file mode 100644 index 0000000000..27ae7dcc31 --- /dev/null +++ b/include/hw/audio/model.h @@ -0,0 +1,13 @@ +#ifndef HW_AUDIO_MODEL_H +#define HW_AUDIO_MODEL_H + +void audio_register_model_with_cb(const char *name, const char *descr, + int (*init_pci)(PCIBus *bus, const char = *audiodev)); +void audio_register_model(const char *name, const char *descr, + int isa, const char *typename); + +void audio_model_init(void); +void audio_print_available_models(void); +void audio_set_model(const char *name, const char *audiodev); + +#endif diff --git a/include/hw/audio/soundhw.h b/include/hw/audio/soundhw.h deleted file mode 100644 index 83b3011083..0000000000 --- a/include/hw/audio/soundhw.h +++ /dev/null @@ -1,13 +0,0 @@ -#ifndef HW_SOUNDHW_H -#define HW_SOUNDHW_H - -void pci_register_soundhw(const char *name, const char *descr, - int (*init_pci)(PCIBus *bus, const char *audiode= v)); -void deprecated_register_soundhw(const char *name, const char *descr, - int isa, const char *typename); - -void soundhw_init(void); -void audio_print_available_models(void); -void select_soundhw(const char *name, const char *audiodev); - -#endif diff --git a/hw/audio/ac97.c b/hw/audio/ac97.c index eb7a847080..2e1be5089e 100644 --- a/hw/audio/ac97.c +++ b/hw/audio/ac97.c @@ -18,7 +18,7 @@ */ =20 #include "qemu/osdep.h" -#include "hw/audio/soundhw.h" +#include "hw/audio/model.h" #include "audio/audio.h" #include "hw/pci/pci_device.h" #include "hw/qdev-properties.h" @@ -1360,8 +1360,7 @@ static const TypeInfo ac97_info =3D { static void ac97_register_types(void) { type_register_static(&ac97_info); - deprecated_register_soundhw("ac97", "Intel 82801AA AC97 Audio", - 0, TYPE_AC97); + audio_register_model("ac97", "Intel 82801AA AC97 Audio", 0, TYPE_AC97); } =20 type_init(ac97_register_types) diff --git a/hw/audio/adlib.c b/hw/audio/adlib.c index 1f29a7e319..a7c2efd87c 100644 --- a/hw/audio/adlib.c +++ b/hw/audio/adlib.c @@ -25,7 +25,7 @@ #include "qemu/osdep.h" #include "qapi/error.h" #include "qemu/module.h" -#include "hw/audio/soundhw.h" +#include "hw/audio/model.h" #include "audio/audio.h" #include "hw/isa/isa.h" #include "hw/qdev-properties.h" @@ -323,7 +323,7 @@ static const TypeInfo adlib_info =3D { static void adlib_register_types (void) { type_register_static (&adlib_info); - deprecated_register_soundhw("adlib", ADLIB_DESC, 1, TYPE_ADLIB); + audio_register_model("adlib", ADLIB_DESC, 1, TYPE_ADLIB); } =20 type_init (adlib_register_types) diff --git a/hw/audio/cs4231a.c b/hw/audio/cs4231a.c index 6dfff202ff..1f7e0a33c0 100644 --- a/hw/audio/cs4231a.c +++ b/hw/audio/cs4231a.c @@ -23,7 +23,7 @@ */ =20 #include "qemu/osdep.h" -#include "hw/audio/soundhw.h" +#include "hw/audio/model.h" #include "audio/audio.h" #include "hw/irq.h" #include "hw/isa/isa.h" @@ -723,7 +723,7 @@ static const TypeInfo cs4231a_info =3D { static void cs4231a_register_types (void) { type_register_static (&cs4231a_info); - deprecated_register_soundhw("cs4231a", "CS4231A", 1, TYPE_CS4231A); + audio_register_model("cs4231a", "CS4231A", 1, TYPE_CS4231A); } =20 type_init (cs4231a_register_types) diff --git a/hw/audio/es1370.c b/hw/audio/es1370.c index a6a32a6348..913c9022f6 100644 --- a/hw/audio/es1370.c +++ b/hw/audio/es1370.c @@ -26,7 +26,7 @@ #define VERBOSE_ES1370 0 =20 #include "qemu/osdep.h" -#include "hw/audio/soundhw.h" +#include "hw/audio/model.h" #include "audio/audio.h" #include "hw/pci/pci_device.h" #include "migration/vmstate.h" @@ -905,8 +905,7 @@ static const TypeInfo es1370_info =3D { static void es1370_register_types (void) { type_register_static (&es1370_info); - deprecated_register_soundhw("es1370", "ENSONIQ AudioPCI ES1370", - 0, TYPE_ES1370); + audio_register_model("es1370", "ENSONIQ AudioPCI ES1370", 0, TYPE_ES13= 70); } =20 type_init (es1370_register_types) diff --git a/hw/audio/gus.c b/hw/audio/gus.c index c36df0240f..ac9332ea3d 100644 --- a/hw/audio/gus.c +++ b/hw/audio/gus.c @@ -25,7 +25,7 @@ #include "qemu/osdep.h" #include "qapi/error.h" #include "qemu/module.h" -#include "hw/audio/soundhw.h" +#include "hw/audio/model.h" #include "audio/audio.h" #include "hw/irq.h" #include "hw/isa/isa.h" @@ -319,7 +319,7 @@ static const TypeInfo gus_info =3D { static void gus_register_types (void) { type_register_static (&gus_info); - deprecated_register_soundhw("gus", "Gravis Ultrasound GF1", 1, TYPE_GU= S); + audio_register_model("gus", "Gravis Ultrasound GF1", 1, TYPE_GUS); } =20 type_init (gus_register_types) diff --git a/hw/audio/intel-hda.c b/hw/audio/intel-hda.c index b256c8ccea..6a0db0dd9e 100644 --- a/hw/audio/intel-hda.c +++ b/hw/audio/intel-hda.c @@ -26,7 +26,7 @@ #include "qemu/log.h" #include "qemu/module.h" #include "qemu/error-report.h" -#include "hw/audio/soundhw.h" +#include "hw/audio/model.h" #include "intel-hda.h" #include "migration/vmstate.h" #include "intel-hda-defs.h" @@ -1324,7 +1324,7 @@ static void intel_hda_register_types(void) type_register_static(&intel_hda_info_ich6); type_register_static(&intel_hda_info_ich9); type_register_static(&hda_codec_device_type_info); - pci_register_soundhw("hda", "Intel HD Audio", intel_hda_and_codec_init= ); + audio_register_model_with_cb("hda", "Intel HD Audio", intel_hda_and_co= dec_init); } =20 type_init(intel_hda_register_types) diff --git a/hw/audio/soundhw.c b/hw/audio/model.c similarity index 68% rename from hw/audio/soundhw.c rename to hw/audio/model.c index b4a87ff709..668349c69d 100644 --- a/hw/audio/soundhw.c +++ b/hw/audio/model.c @@ -32,9 +32,9 @@ #include "hw/qdev-properties.h" #include "hw/isa/isa.h" #include "hw/pci/pci.h" -#include "hw/audio/soundhw.h" +#include "hw/audio/model.h" =20 -struct soundhw { +struct audio_model { const char *name; const char *descr; const char *typename; @@ -42,38 +42,38 @@ struct soundhw { int (*init_pci) (PCIBus *bus, const char *audiodev); }; =20 -static struct soundhw soundhw[9]; -static int soundhw_count; +static struct audio_model audio_models[9]; +static int audio_models_count; =20 -void pci_register_soundhw(const char *name, const char *descr, - int (*init_pci)(PCIBus *bus, const char *audiode= v)) +void audio_register_model_with_cb(const char *name, const char *descr, + int (*init_pci)(PCIBus *bus, const char = *audiodev)) { - assert(soundhw_count < ARRAY_SIZE(soundhw) - 1); - soundhw[soundhw_count].name =3D name; - soundhw[soundhw_count].descr =3D descr; - soundhw[soundhw_count].isa =3D 0; - soundhw[soundhw_count].init_pci =3D init_pci; - soundhw_count++; + assert(audio_models_count < ARRAY_SIZE(audio_models) - 1); + audio_models[audio_models_count].name =3D name; + audio_models[audio_models_count].descr =3D descr; + audio_models[audio_models_count].isa =3D 0; + audio_models[audio_models_count].init_pci =3D init_pci; + audio_models_count++; } =20 -void deprecated_register_soundhw(const char *name, const char *descr, - int isa, const char *typename) +void audio_register_model(const char *name, const char *descr, + int isa, const char *typename) { - assert(soundhw_count < ARRAY_SIZE(soundhw) - 1); - soundhw[soundhw_count].name =3D name; - soundhw[soundhw_count].descr =3D descr; - soundhw[soundhw_count].isa =3D isa; - soundhw[soundhw_count].typename =3D typename; - soundhw_count++; + assert(audio_models_count < ARRAY_SIZE(audio_models) - 1); + audio_models[audio_models_count].name =3D name; + audio_models[audio_models_count].descr =3D descr; + audio_models[audio_models_count].isa =3D isa; + audio_models[audio_models_count].typename =3D typename; + audio_models_count++; } =20 void audio_print_available_models(void) { - struct soundhw *c; + struct audio_model *c; =20 - if (soundhw_count) { + if (audio_models_count) { printf("Valid audio device model names:\n"); - for (c =3D soundhw; c->name; ++c) { + for (c =3D audio_models; c->name; ++c) { printf ("%-11s %s\n", c->name, c->descr); } } else { @@ -82,19 +82,19 @@ void audio_print_available_models(void) } } =20 -static struct soundhw *selected =3D NULL; +static struct audio_model *selected =3D NULL; static const char *audiodev_id; =20 -void select_soundhw(const char *name, const char *audiodev) +void audio_set_model(const char *name, const char *audiodev) { - struct soundhw *c; + struct audio_model *c; =20 if (selected) { error_report("only one -audio option is allowed"); exit(1); } =20 - for (c =3D soundhw; c->name; ++c) { + for (c =3D audio_models; c->name; ++c) { if (g_str_equal(c->name, name)) { selected =3D c; audiodev_id =3D audiodev; @@ -109,9 +109,9 @@ void select_soundhw(const char *name, const char *audio= dev) } } =20 -void soundhw_init(void) +void audio_model_init(void) { - struct soundhw *c =3D selected; + struct audio_model *c =3D selected; =20 if (!c) { return; diff --git a/hw/audio/pcspk.c b/hw/audio/pcspk.c index 8ea3a161a4..12a214c566 100644 --- a/hw/audio/pcspk.c +++ b/hw/audio/pcspk.c @@ -24,7 +24,7 @@ =20 #include "qemu/osdep.h" #include "hw/isa/isa.h" -#include "hw/audio/soundhw.h" +#include "hw/audio/model.h" #include "audio/audio.h" #include "qemu/module.h" #include "qemu/timer.h" diff --git a/hw/audio/sb16.c b/hw/audio/sb16.c index bac64118fe..0d9fa74108 100644 --- a/hw/audio/sb16.c +++ b/hw/audio/sb16.c @@ -23,7 +23,7 @@ */ =20 #include "qemu/osdep.h" -#include "hw/audio/soundhw.h" +#include "hw/audio/model.h" #include "audio/audio.h" #include "hw/irq.h" #include "hw/isa/isa.h" @@ -1471,8 +1471,7 @@ static const TypeInfo sb16_info =3D { static void sb16_register_types (void) { type_register_static (&sb16_info); - deprecated_register_soundhw("sb16", "Creative Sound Blaster 16", - 1, TYPE_SB16); + audio_register_model("sb16", "Creative Sound Blaster 16", 1, TYPE_SB16= ); } =20 type_init (sb16_register_types) diff --git a/hw/audio/virtio-snd-pci.c b/hw/audio/virtio-snd-pci.c index 9eb0007392..613538e46f 100644 --- a/hw/audio/virtio-snd-pci.c +++ b/hw/audio/virtio-snd-pci.c @@ -11,7 +11,7 @@ #include "qemu/osdep.h" #include "qom/object.h" #include "qapi/error.h" -#include "hw/audio/soundhw.h" +#include "hw/audio/model.h" #include "hw/virtio/virtio-pci.h" #include "hw/audio/virtio-snd.h" =20 @@ -88,7 +88,7 @@ static int virtio_snd_pci_init(PCIBus *bus, const char *a= udiodev) static void virtio_snd_pci_register(void) { virtio_pci_types_register(&virtio_snd_pci_info); - pci_register_soundhw("virtio", "Virtio Sound", virtio_snd_pci_init); + audio_register_model_with_cb("virtio", "Virtio Sound", virtio_snd_pci_= init); } =20 type_init(virtio_snd_pci_register); diff --git a/system/vl.c b/system/vl.c index 7187b24449..9245ec986c 100644 --- a/system/vl.c +++ b/system/vl.c @@ -86,7 +86,7 @@ #include "migration/snapshot.h" #include "system/tpm.h" #include "system/dma.h" -#include "hw/audio/soundhw.h" +#include "hw/audio/model.h" #include "audio/audio.h" #include "system/cpus.h" #include "system/cpu-timers.h" @@ -2731,7 +2731,7 @@ static void qemu_create_cli_devices(void) { DeviceOption *opt; =20 - soundhw_init(); + audio_model_init(); =20 qemu_opts_foreach(qemu_find_opts("fw_cfg"), parse_fw_cfg, fw_cfg_find(), &error_fatal); @@ -3087,7 +3087,7 @@ void qemu_init(int argc, char **argv) visit_free(v); if (model) { audio_add_audiodev(dev); - select_soundhw(model, dev->id); + audio_set_model(model, dev->id); g_free(model); } else { audio_add_default_audiodev(dev, &error_fatal); diff --git a/hw/audio/meson.build b/hw/audio/meson.build index 2990974449..2154cbdb57 100644 --- a/hw/audio/meson.build +++ b/hw/audio/meson.build @@ -1,4 +1,4 @@ -system_ss.add(files('soundhw.c')) +system_ss.add(files('model.c')) system_ss.add(when: 'CONFIG_AC97', if_true: files('ac97.c')) system_ss.add(when: 'CONFIG_ADLIB', if_true: files('fmopl.c', 'adlib.c')) system_ss.add(when: 'CONFIG_ASC', if_true: files('asc.c')) diff --git a/scripts/codeconverter/codeconverter/test_regexps.py b/scripts/= codeconverter/codeconverter/test_regexps.py index 4526268ae8..fe7354b473 100644 --- a/scripts/codeconverter/codeconverter/test_regexps.py +++ b/scripts/codeconverter/codeconverter/test_regexps.py @@ -264,7 +264,7 @@ def test_initial_includes(): #define SILENT_ES1370 =20 #include "qemu/osdep.h" -#include "hw/audio/soundhw.h" +#include "hw/audio/model.h" #include "audio/audio.h" #include "hw/pci/pci.h" #include "migration/vmstate.h" --=20 2.51.0 From nobody Fri Nov 14 18:21:22 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1761116318; cv=none; d=zohomail.com; s=zohoarc; b=FQWqcZU/e3cWHW0NxDLivPApp+fDw/jCUBD8yZns6BNbV16kW6+F1I7SmatBWBJDxz8AgEkcobgzuZ8q/j2N279/mHl/JTfaYjvK5OdzzAlGyAuRKgePm4LKm1gf0igMi/bfsUeCeXljpKjtXnK3w+g/RTDz1B+2TSgLO74R6Zw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761116318; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=GJHhV44xA2yV6Pwkj+xG4UfO7EkjL4EsvWC4IiZRDKY=; b=PSTbQZE/JzPphzwAbxSDhSBLagO/L/+wwSbfHTmvZ2MH1sBJRQMhhrQi4CjKoc39uWjphXWpUdfOMc+X9mvYn60giD//rssARg0wqYg399tQn4G4m0komD4LOU4yb3P9sRzq+y2IMNpCnKhzWwW9yv01HRDZxiwKtncko3GSPnI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1761116318394736.9667567750068; Tue, 21 Oct 2025 23:58:38 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vBSnK-0001ip-5H; Wed, 22 Oct 2025 02:58:02 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vBSnI-0001hE-1k for qemu-devel@nongnu.org; Wed, 22 Oct 2025 02:58:00 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vBSnG-00087o-AJ for qemu-devel@nongnu.org; Wed, 22 Oct 2025 02:57:59 -0400 Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-301-3Q8tBEQ8PyCb41a6kFDucw-1; Wed, 22 Oct 2025 02:57:53 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 6B6E71956096; Wed, 22 Oct 2025 06:57:52 +0000 (UTC) Received: from localhost (unknown [10.44.22.9]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 2278B3000218; Wed, 22 Oct 2025 06:57:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761116277; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=GJHhV44xA2yV6Pwkj+xG4UfO7EkjL4EsvWC4IiZRDKY=; b=Pk3hUPYKArydlrHW8uOyASENP0BSUGSAqX1Krpm74dhWVSqIqhONEYuunmrpsTLsRhW75b 2b3OYaR75lsqL1Je2uf4CrRGhw13/bgyNbj1ghk/Km7GhmT1aJTWOB2BB5SXhO9HMHq49Y pYPXxL/ouT9mXnORcHhststg4WAcT0g= X-MC-Unique: 3Q8tBEQ8PyCb41a6kFDucw-1 X-Mimecast-MFC-AGG-ID: 3Q8tBEQ8PyCb41a6kFDucw_1761116272 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Volker=20R=C3=BCmelin?= , Paolo Bonzini , BALATON Zoltan , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Gerd Hoffmann , Manos Pitsidianakis , "Michael S. Tsirkin" Subject: [PATCH v2 12/42] hw/audio/virtio-snd-pci: remove custom model callback Date: Wed, 22 Oct 2025 10:56:07 +0400 Message-ID: <20251022065640.1172785-13-marcandre.lureau@redhat.com> In-Reply-To: <20251022065640.1172785-1-marcandre.lureau@redhat.com> References: <20251022065640.1172785-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1761116320323154100 From: Marc-Andr=C3=A9 Lureau virtio-snd can rely on the default code to instantiate the device and set the audiodev. Signed-off-by: Marc-Andr=C3=A9 Lureau --- hw/audio/virtio-snd-pci.c | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/hw/audio/virtio-snd-pci.c b/hw/audio/virtio-snd-pci.c index 613538e46f..b78eaff851 100644 --- a/hw/audio/virtio-snd-pci.c +++ b/hw/audio/virtio-snd-pci.c @@ -71,24 +71,10 @@ static const VirtioPCIDeviceTypeInfo virtio_snd_pci_inf= o =3D { .class_init =3D virtio_snd_pci_class_init, }; =20 -/* Create a Virtio Sound PCI device, so '-audio driver,model=3Dvirtio' wor= ks. */ -static int virtio_snd_pci_init(PCIBus *bus, const char *audiodev) -{ - DeviceState *vdev =3D NULL; - VirtIOSoundPCI *dev =3D NULL; - - vdev =3D qdev_new(TYPE_VIRTIO_SND_PCI); - assert(vdev); - dev =3D VIRTIO_SND_PCI(vdev); - qdev_prop_set_string(DEVICE(&dev->vdev), "audiodev", audiodev); - qdev_realize_and_unref(vdev, BUS(bus), &error_fatal); - return 0; -} - static void virtio_snd_pci_register(void) { virtio_pci_types_register(&virtio_snd_pci_info); - audio_register_model_with_cb("virtio", "Virtio Sound", virtio_snd_pci_= init); + audio_register_model("virtio", "Virtio Sound", 0, TYPE_VIRTIO_SND_PCI); } =20 type_init(virtio_snd_pci_register); --=20 2.51.0 From nobody Fri Nov 14 18:21:22 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1761116319; cv=none; d=zohomail.com; s=zohoarc; b=kmnqY52UVzCluXjfC747bd/N2NadpYGn15zjoKCuxMp4EvFjlbl+Q1aVg8BOnnJYbVaIsoxm2HDYEKBH14WllsmvW9Qo2yJCQ7smaxwYZy2G0KSUN3vdjbBGui6cELSQaptJNTU7GpCtYehRFhnSMt98S4QITNGFAZTlXrxdOoQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761116319; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=rwpnWD9iw8bqt6SJCbIjLvqQbhMiOwHt9uoQCFJISgc=; b=ReHmG4mpupp+HK2GCmK3qWNuX+qz5Mtb7i6TGYssowIrEibYPavxElfBxH9abI3uu8Q0D4cqCDEGihplaccngRJVFOMmrIuwnDGr4vjYEm4CrzQHjB8EoExZQft626gKYD4TRkOHdbggoLfJIACA1deP27bv5eIo3hmppc0x1Is= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1761116319579519.3161853691374; Tue, 21 Oct 2025 23:58:39 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vBSnN-0001mc-T5; Wed, 22 Oct 2025 02:58:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vBSnM-0001lN-FM for qemu-devel@nongnu.org; Wed, 22 Oct 2025 02:58:04 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vBSnK-00088p-SZ for qemu-devel@nongnu.org; Wed, 22 Oct 2025 02:58:04 -0400 Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-49-1onX_duNMEizwbd9ks6J4w-1; Wed, 22 Oct 2025 02:57:58 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 7DB3018001C6; Wed, 22 Oct 2025 06:57:57 +0000 (UTC) Received: from localhost (unknown [10.44.22.9]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 7EED03000218; Wed, 22 Oct 2025 06:57:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761116282; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=rwpnWD9iw8bqt6SJCbIjLvqQbhMiOwHt9uoQCFJISgc=; b=A3YfpA6a5x3DzSd0Yl4BuXtY1+j/ziDM3at2kvpd1cUUSky5NsfZcrscKOzN5ytuaajEsd EB3LoQEQxtnpxA1gnWGhODPcc5jJEovXSlWZoC6ZJLnsmNXw4/ycj7qfaA41tm0ux4Lbci 6UXw/JmuyLlE2joLnubBxy8s1tyuiZU= X-MC-Unique: 1onX_duNMEizwbd9ks6J4w-1 X-Mimecast-MFC-AGG-ID: 1onX_duNMEizwbd9ks6J4w_1761116277 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Volker=20R=C3=BCmelin?= , Paolo Bonzini , BALATON Zoltan , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Gerd Hoffmann Subject: [PATCH v2 13/42] hw/audio: simplify 'hda' audio init code Date: Wed, 22 Oct 2025 10:56:08 +0400 Message-ID: <20251022065640.1172785-14-marcandre.lureau@redhat.com> In-Reply-To: <20251022065640.1172785-1-marcandre.lureau@redhat.com> References: <20251022065640.1172785-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1761116320028158500 From: Marc-Andr=C3=A9 Lureau For consistency, use only qdev_device_add() to instantiate the devices. We can't rely on automatic bus lookup for the "hda-duplex" device though as it may end up on a different "intel-hda" bus... Signed-off-by: Marc-Andr=C3=A9 Lureau --- hw/audio/intel-hda.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/hw/audio/intel-hda.c b/hw/audio/intel-hda.c index 6a0db0dd9e..14bcf1257d 100644 --- a/hw/audio/intel-hda.c +++ b/hw/audio/intel-hda.c @@ -21,6 +21,7 @@ #include "hw/pci/pci.h" #include "hw/qdev-properties.h" #include "hw/pci/msi.h" +#include "monitor/qdev.h" #include "qemu/timer.h" #include "qemu/bitops.h" #include "qemu/log.h" @@ -30,6 +31,7 @@ #include "intel-hda.h" #include "migration/vmstate.h" #include "intel-hda-defs.h" +#include "qobject/qdict.h" #include "system/dma.h" #include "qapi/error.h" #include "qom/object.h" @@ -1305,15 +1307,19 @@ static const TypeInfo hda_codec_device_type_info = =3D { */ static int intel_hda_and_codec_init(PCIBus *bus, const char *audiodev) { - DeviceState *controller; + g_autoptr(QDict) props =3D qdict_new(); + DeviceState *intel_hda, *codec; BusState *hdabus; - DeviceState *codec; =20 - controller =3D DEVICE(pci_create_simple(bus, -1, "intel-hda")); - hdabus =3D QLIST_FIRST(&controller->child_bus); + qdict_put_str(props, "driver", "intel-hda"); + intel_hda =3D qdev_device_add_from_qdict(props, false, &error_fatal); + hdabus =3D QLIST_FIRST(&intel_hda->child_bus); + codec =3D qdev_new("hda-duplex"); qdev_prop_set_string(codec, "audiodev", audiodev); qdev_realize_and_unref(codec, hdabus, &error_fatal); + object_unref(intel_hda); + return 0; } =20 --=20 2.51.0 From nobody Fri Nov 14 18:21:22 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1761116364; cv=none; d=zohomail.com; s=zohoarc; b=cyQpLRAC5/dq0zXjl8MjM01gIRoJMjfnDMXs1hqv0hXgq8a7jdGF4ndfxolOa/7O23iBZITw0VyooAm5emrxYaLbAVXzgBoreWfKlcHlkuHTbj/Yyfjvbm49lfFY1Ph9dTsGSxCvsW6ifio7vm3EzN3iTJ7dSRf/HNlxyqgeuA4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761116364; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=qO3UCF88r7wg/RiyvGpw9tTC25/Vsr3Q7lftN3svXyI=; b=ValpSaBvO3c+5MZvqoaAwmItmK2O2YmD6J2+aDxIOE/Cqnoo8C/m1Y0AcbILWJ1V4JIqP5Grdldxzt22LIKUZlebE+c4NEiu0DvkaNHpQppdpH2nrGaoHNImBKdL/x6n/qjROwtKVYU6vXMyHTdLIYP5zkrr5W5TZ9qFz72aINI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1761116364153418.2607991794556; Tue, 21 Oct 2025 23:59:24 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vBSnb-0002ab-03; Wed, 22 Oct 2025 02:58:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vBSnX-0002Q2-DN for qemu-devel@nongnu.org; Wed, 22 Oct 2025 02:58:15 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vBSnR-0008DF-5V for qemu-devel@nongnu.org; Wed, 22 Oct 2025 02:58:15 -0400 Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-596-XEmfMvgYOMuwo66G1UAD7w-1; Wed, 22 Oct 2025 02:58:04 -0400 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 679B11800D87; Wed, 22 Oct 2025 06:58:03 +0000 (UTC) Received: from localhost (unknown [10.44.22.9]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id B79F3180044F; Wed, 22 Oct 2025 06:58:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761116288; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=qO3UCF88r7wg/RiyvGpw9tTC25/Vsr3Q7lftN3svXyI=; b=C41vr/KUtcpuB39WZvH5NmQLnrC5WWtz5Lz5rclFwVFvBEJmQrv6cz44s4dZaodNLzvUVl TGkvIYATGvzYbzSNaDcnt17s1LnOIibryu/30nn9C0faxQlyQHuUC/RmVHL9jOLH9n3Zqu u74IrrjDnUUdD28DbkhfkcEaM55H8bg= X-MC-Unique: XEmfMvgYOMuwo66G1UAD7w-1 X-Mimecast-MFC-AGG-ID: XEmfMvgYOMuwo66G1UAD7w_1761116283 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Volker=20R=C3=BCmelin?= , Paolo Bonzini , BALATON Zoltan , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Gerd Hoffmann Subject: [PATCH v2 14/42] hw/audio: generalize audio_model.init() Date: Wed, 22 Oct 2025 10:56:09 +0400 Message-ID: <20251022065640.1172785-15-marcandre.lureau@redhat.com> In-Reply-To: <20251022065640.1172785-1-marcandre.lureau@redhat.com> References: <20251022065640.1172785-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1761116364527158501 From: Marc-Andr=C3=A9 Lureau It is no longer PCI bus only. Signed-off-by: Marc-Andr=C3=A9 Lureau --- include/hw/audio/model.h | 2 +- hw/audio/intel-hda.c | 2 +- hw/audio/model.c | 12 ++++-------- 3 files changed, 6 insertions(+), 10 deletions(-) diff --git a/include/hw/audio/model.h b/include/hw/audio/model.h index 27ae7dcc31..55d6ac7f6e 100644 --- a/include/hw/audio/model.h +++ b/include/hw/audio/model.h @@ -2,7 +2,7 @@ #define HW_AUDIO_MODEL_H =20 void audio_register_model_with_cb(const char *name, const char *descr, - int (*init_pci)(PCIBus *bus, const char = *audiodev)); + int (*init_audio_model)(const char *audi= odev)); void audio_register_model(const char *name, const char *descr, int isa, const char *typename); =20 diff --git a/hw/audio/intel-hda.c b/hw/audio/intel-hda.c index 14bcf1257d..0d35afa4ab 100644 --- a/hw/audio/intel-hda.c +++ b/hw/audio/intel-hda.c @@ -1305,7 +1305,7 @@ static const TypeInfo hda_codec_device_type_info =3D { * create intel hda controller with codec attached to it, * so '-soundhw hda' works. */ -static int intel_hda_and_codec_init(PCIBus *bus, const char *audiodev) +static int intel_hda_and_codec_init(const char *audiodev) { g_autoptr(QDict) props =3D qdict_new(); DeviceState *intel_hda, *codec; diff --git a/hw/audio/model.c b/hw/audio/model.c index 668349c69d..4f6a234159 100644 --- a/hw/audio/model.c +++ b/hw/audio/model.c @@ -24,14 +24,11 @@ #include "qemu/osdep.h" #include "hw/qdev-core.h" #include "monitor/qdev.h" -#include "qemu/option.h" -#include "qemu/help_option.h" #include "qemu/error-report.h" #include "qapi/error.h" #include "qom/object.h" #include "hw/qdev-properties.h" #include "hw/isa/isa.h" -#include "hw/pci/pci.h" #include "hw/audio/model.h" =20 struct audio_model { @@ -39,20 +36,20 @@ struct audio_model { const char *descr; const char *typename; int isa; - int (*init_pci) (PCIBus *bus, const char *audiodev); + int (*init)(const char *audiodev); }; =20 static struct audio_model audio_models[9]; static int audio_models_count; =20 void audio_register_model_with_cb(const char *name, const char *descr, - int (*init_pci)(PCIBus *bus, const char = *audiodev)) + int (*init_audio_model)(const char *audi= odev)) { assert(audio_models_count < ARRAY_SIZE(audio_models) - 1); audio_models[audio_models_count].name =3D name; audio_models[audio_models_count].descr =3D descr; audio_models[audio_models_count].isa =3D 0; - audio_models[audio_models_count].init_pci =3D init_pci; + audio_models[audio_models_count].init =3D init_audio_model; audio_models_count++; } =20 @@ -124,7 +121,6 @@ void audio_model_init(void) qdev_realize_and_unref(dev, bus, &error_fatal); } else { assert(!c->isa); - PCIBus *pci_bus =3D (PCIBus *) object_resolve_path_type("", TYPE_P= CI_BUS, NULL); - c->init_pci(pci_bus, audiodev_id); + c->init(audiodev_id); } } --=20 2.51.0 From nobody Fri Nov 14 18:21:22 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1761116329; cv=none; d=zohomail.com; s=zohoarc; b=FsmTmHuAy2+jGlpBih5hHxPNIRllsuiwWKd0b6aFqDthia3BE4Vy6Wg526lgGZuDXZteXiMlRjaRGGLIkm8+pcmnkmS+Lp4U+bNkgBnoNk/e3cxpbRh4QIfyr8kJJvIYiNbw2+/b6mAqizHOIE7UjpVxB09b5IcLP3S0kXCL+5U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761116329; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=Yg4NLhxMkcVDvibW3oLI5+ujcThDlytrlMAaLa+r/XQ=; b=nRcZdqB3U9DK9M3R74W+B55AXJlymBHNvFjHaTfvKcpHJVpNNa87FCwXcSizHWtCsnkw6bG/FpA04eiOWkk2gdt4+Z+GJiJxqIUFtR8TKlh5sTHkeNm1hLNXscThalyEUkkVpBt70qLIA49whTJd9bqdnKlUYVyT7/OkjMiQNQs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1761116329972310.3620901553803; Tue, 21 Oct 2025 23:58:49 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vBSnZ-0002ZC-Sv; Wed, 22 Oct 2025 02:58:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vBSnW-0002NO-Qo for qemu-devel@nongnu.org; Wed, 22 Oct 2025 02:58:15 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vBSnU-0008Dw-KY for qemu-devel@nongnu.org; Wed, 22 Oct 2025 02:58:14 -0400 Received: from mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-652-ZWnonhvPOxm_xkL5EcMdBQ-1; Wed, 22 Oct 2025 02:58:10 -0400 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id DB760195420F; Wed, 22 Oct 2025 06:58:08 +0000 (UTC) Received: from localhost (unknown [10.44.22.9]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 845D6180045B; Wed, 22 Oct 2025 06:58:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761116291; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Yg4NLhxMkcVDvibW3oLI5+ujcThDlytrlMAaLa+r/XQ=; b=gezLAT+ztKxAOGqGilo9FqV3PhkEEauRo7PyAufZJ72vvFa2TiTpID4DnpKMHN8EsG+pne hYhwijS4Z4QT2H4al+Oxd4xsGdgZA1L0HyI0KPvsc7ihKa/R0WJG1zuzHrvjwlMW6T22Hm sD3KRoKG93kfbwug6XSMtc01FNdLOxw= X-MC-Unique: ZWnonhvPOxm_xkL5EcMdBQ-1 X-Mimecast-MFC-AGG-ID: ZWnonhvPOxm_xkL5EcMdBQ_1761116289 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Volker=20R=C3=BCmelin?= , Paolo Bonzini , BALATON Zoltan , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Gerd Hoffmann , "Michael S. Tsirkin" , Manos Pitsidianakis Subject: [PATCH v2 15/42] hw/audio: drop audio_model.isa Date: Wed, 22 Oct 2025 10:56:10 +0400 Message-ID: <20251022065640.1172785-16-marcandre.lureau@redhat.com> In-Reply-To: <20251022065640.1172785-1-marcandre.lureau@redhat.com> References: <20251022065640.1172785-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1761116342350158500 From: Marc-Andr=C3=A9 Lureau That's no longer necessary, the code is bus-agnostic. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- include/hw/audio/model.h | 2 +- hw/audio/ac97.c | 2 +- hw/audio/adlib.c | 2 +- hw/audio/cs4231a.c | 2 +- hw/audio/es1370.c | 2 +- hw/audio/gus.c | 2 +- hw/audio/model.c | 7 +------ hw/audio/sb16.c | 2 +- hw/audio/virtio-snd-pci.c | 2 +- 9 files changed, 9 insertions(+), 14 deletions(-) diff --git a/include/hw/audio/model.h b/include/hw/audio/model.h index 55d6ac7f6e..ebe456c22f 100644 --- a/include/hw/audio/model.h +++ b/include/hw/audio/model.h @@ -4,7 +4,7 @@ void audio_register_model_with_cb(const char *name, const char *descr, int (*init_audio_model)(const char *audi= odev)); void audio_register_model(const char *name, const char *descr, - int isa, const char *typename); + const char *typename); =20 void audio_model_init(void); void audio_print_available_models(void); diff --git a/hw/audio/ac97.c b/hw/audio/ac97.c index 2e1be5089e..3d3c667e86 100644 --- a/hw/audio/ac97.c +++ b/hw/audio/ac97.c @@ -1360,7 +1360,7 @@ static const TypeInfo ac97_info =3D { static void ac97_register_types(void) { type_register_static(&ac97_info); - audio_register_model("ac97", "Intel 82801AA AC97 Audio", 0, TYPE_AC97); + audio_register_model("ac97", "Intel 82801AA AC97 Audio", TYPE_AC97); } =20 type_init(ac97_register_types) diff --git a/hw/audio/adlib.c b/hw/audio/adlib.c index a7c2efd87c..0bc0359ae6 100644 --- a/hw/audio/adlib.c +++ b/hw/audio/adlib.c @@ -323,7 +323,7 @@ static const TypeInfo adlib_info =3D { static void adlib_register_types (void) { type_register_static (&adlib_info); - audio_register_model("adlib", ADLIB_DESC, 1, TYPE_ADLIB); + audio_register_model("adlib", ADLIB_DESC, TYPE_ADLIB); } =20 type_init (adlib_register_types) diff --git a/hw/audio/cs4231a.c b/hw/audio/cs4231a.c index 1f7e0a33c0..18db8da324 100644 --- a/hw/audio/cs4231a.c +++ b/hw/audio/cs4231a.c @@ -723,7 +723,7 @@ static const TypeInfo cs4231a_info =3D { static void cs4231a_register_types (void) { type_register_static (&cs4231a_info); - audio_register_model("cs4231a", "CS4231A", 1, TYPE_CS4231A); + audio_register_model("cs4231a", "CS4231A", TYPE_CS4231A); } =20 type_init (cs4231a_register_types) diff --git a/hw/audio/es1370.c b/hw/audio/es1370.c index 913c9022f6..8cb47589c3 100644 --- a/hw/audio/es1370.c +++ b/hw/audio/es1370.c @@ -905,7 +905,7 @@ static const TypeInfo es1370_info =3D { static void es1370_register_types (void) { type_register_static (&es1370_info); - audio_register_model("es1370", "ENSONIQ AudioPCI ES1370", 0, TYPE_ES13= 70); + audio_register_model("es1370", "ENSONIQ AudioPCI ES1370", TYPE_ES1370); } =20 type_init (es1370_register_types) diff --git a/hw/audio/gus.c b/hw/audio/gus.c index ac9332ea3d..16785ce226 100644 --- a/hw/audio/gus.c +++ b/hw/audio/gus.c @@ -319,7 +319,7 @@ static const TypeInfo gus_info =3D { static void gus_register_types (void) { type_register_static (&gus_info); - audio_register_model("gus", "Gravis Ultrasound GF1", 1, TYPE_GUS); + audio_register_model("gus", "Gravis Ultrasound GF1", TYPE_GUS); } =20 type_init (gus_register_types) diff --git a/hw/audio/model.c b/hw/audio/model.c index 4f6a234159..924a41e0ac 100644 --- a/hw/audio/model.c +++ b/hw/audio/model.c @@ -28,14 +28,12 @@ #include "qapi/error.h" #include "qom/object.h" #include "hw/qdev-properties.h" -#include "hw/isa/isa.h" #include "hw/audio/model.h" =20 struct audio_model { const char *name; const char *descr; const char *typename; - int isa; int (*init)(const char *audiodev); }; =20 @@ -48,18 +46,16 @@ void audio_register_model_with_cb(const char *name, con= st char *descr, assert(audio_models_count < ARRAY_SIZE(audio_models) - 1); audio_models[audio_models_count].name =3D name; audio_models[audio_models_count].descr =3D descr; - audio_models[audio_models_count].isa =3D 0; audio_models[audio_models_count].init =3D init_audio_model; audio_models_count++; } =20 void audio_register_model(const char *name, const char *descr, - int isa, const char *typename) + const char *typename) { assert(audio_models_count < ARRAY_SIZE(audio_models) - 1); audio_models[audio_models_count].name =3D name; audio_models[audio_models_count].descr =3D descr; - audio_models[audio_models_count].isa =3D isa; audio_models[audio_models_count].typename =3D typename; audio_models_count++; } @@ -120,7 +116,6 @@ void audio_model_init(void) qdev_prop_set_string(dev, "audiodev", audiodev_id); qdev_realize_and_unref(dev, bus, &error_fatal); } else { - assert(!c->isa); c->init(audiodev_id); } } diff --git a/hw/audio/sb16.c b/hw/audio/sb16.c index 0d9fa74108..cd7e813d05 100644 --- a/hw/audio/sb16.c +++ b/hw/audio/sb16.c @@ -1471,7 +1471,7 @@ static const TypeInfo sb16_info =3D { static void sb16_register_types (void) { type_register_static (&sb16_info); - audio_register_model("sb16", "Creative Sound Blaster 16", 1, TYPE_SB16= ); + audio_register_model("sb16", "Creative Sound Blaster 16", TYPE_SB16); } =20 type_init (sb16_register_types) diff --git a/hw/audio/virtio-snd-pci.c b/hw/audio/virtio-snd-pci.c index b78eaff851..230581ed63 100644 --- a/hw/audio/virtio-snd-pci.c +++ b/hw/audio/virtio-snd-pci.c @@ -74,7 +74,7 @@ static const VirtioPCIDeviceTypeInfo virtio_snd_pci_info = =3D { static void virtio_snd_pci_register(void) { virtio_pci_types_register(&virtio_snd_pci_info); - audio_register_model("virtio", "Virtio Sound", 0, TYPE_VIRTIO_SND_PCI); + audio_register_model("virtio", "Virtio Sound", TYPE_VIRTIO_SND_PCI); } =20 type_init(virtio_snd_pci_register); --=20 2.51.0 From nobody Fri Nov 14 18:21:22 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1761116331; cv=none; d=zohomail.com; s=zohoarc; b=cvSq2wZ+TI35oTT7eSisFcyWevfUW6N/Nq6ZGFNfeYiiSbUliIvBk4EH4upllCrMBgynQnxLVo6nk0Y7lm/o32zdy0O9z7bnLzapdTObA5VOX2c8sLvgOwRUnddwVxHLE+6SGRSQ5sNQG4M3yFSHGNZjm60qlH86lR31EiyzAPc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761116331; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=7AhsANNLrtfRCdhH/sgNTMRB0jOkot8Dm/EOkC2K6qo=; b=UfUbA6RoqvxYfI86DJSYdt8vc4Rof6kUCggCgAvDT0Og7mjxE5kq7wc54k2DEOXA6uwlP36kO3l6tcAZfXusqMmY0IfCYdD+lPqd+bfsw3pglee3/rSbsOpMImqXcBM2CUgUyE2ko7D9jRkvTjp2CeZYoGGQhE9BqAoeDFM/+xE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1761116331081706.1876208553556; Tue, 21 Oct 2025 23:58:51 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vBSng-0002lH-2A; Wed, 22 Oct 2025 02:58:24 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vBSnc-0002cR-Kf for qemu-devel@nongnu.org; Wed, 22 Oct 2025 02:58:20 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vBSna-0008El-Pq for qemu-devel@nongnu.org; Wed, 22 Oct 2025 02:58:20 -0400 Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-676-cibZdwH1MC2pPHTRU3oRGw-1; Wed, 22 Oct 2025 02:58:15 -0400 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 43D651800C36; Wed, 22 Oct 2025 06:58:14 +0000 (UTC) Received: from localhost (unknown [10.44.22.9]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id F021119541B2; Wed, 22 Oct 2025 06:58:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761116297; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=7AhsANNLrtfRCdhH/sgNTMRB0jOkot8Dm/EOkC2K6qo=; b=hsyekAKbcyPE/nIKbdlQFNuri5Or/afL6p7lY61vbjKTsfPeC2dBvTSnIsYvhGPkuJAsKI eILRRkNu/fxKJRfPytnys/pNREDuOGms6xQ6qPHQ9uZLjb8GvdDWXioXLBgJ6SyKtG85rD OxFl9HlQj3Tkn+JQ9bJmnxQqBcAGG8A= X-MC-Unique: cibZdwH1MC2pPHTRU3oRGw-1 X-Mimecast-MFC-AGG-ID: cibZdwH1MC2pPHTRU3oRGw_1761116294 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Volker=20R=C3=BCmelin?= , Paolo Bonzini , BALATON Zoltan , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Gerd Hoffmann Subject: [PATCH v2 16/42] audio: start making AudioState a QOM Object Date: Wed, 22 Oct 2025 10:56:11 +0400 Message-ID: <20251022065640.1172785-17-marcandre.lureau@redhat.com> In-Reply-To: <20251022065640.1172785-1-marcandre.lureau@redhat.com> References: <20251022065640.1172785-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1761116332480154100 From: Marc-Andr=C3=A9 Lureau QOM brings some conveniences for introspection, type checking, reference counting, interfaces etc. This is only the first step to introduce QOM in audio/ (I have more in the pipeline) Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- audio/audio.h | 7 +++++++ audio/audio_int.h | 2 ++ audio/audio.c | 43 ++++++++++++++++++++++++++++++++----------- 3 files changed, 41 insertions(+), 11 deletions(-) diff --git a/audio/audio.h b/audio/audio.h index eb5b5d662d..e41c5bc55a 100644 --- a/audio/audio.h +++ b/audio/audio.h @@ -80,6 +80,10 @@ typedef struct SWVoiceOut SWVoiceOut; typedef struct CaptureVoiceOut CaptureVoiceOut; typedef struct SWVoiceIn SWVoiceIn; =20 +struct AudioStateClass { + ObjectClass parent_class; +}; + typedef struct AudioState AudioState; typedef struct QEMUSoundCard { char *name; @@ -182,4 +186,7 @@ const char *audio_get_id(QEMUSoundCard *card); #define DEFINE_AUDIO_PROPERTIES(_s, _f) \ DEFINE_PROP_AUDIODEV("audiodev", _s, _f) =20 +#define TYPE_AUDIO_STATE "audio-state" +OBJECT_DECLARE_TYPE(AudioState, AudioStateClass, AUDIO_STATE) + #endif /* QEMU_AUDIO_H */ diff --git a/audio/audio_int.h b/audio/audio_int.h index f78ca05f92..b2b4d2d10e 100644 --- a/audio/audio_int.h +++ b/audio/audio_int.h @@ -217,6 +217,8 @@ struct SWVoiceCap { }; =20 typedef struct AudioState { + Object parent; + struct audio_driver *drv; Audiodev *dev; void *drv_opaque; diff --git a/audio/audio.c b/audio/audio.c index 6197fa1788..754952ce58 100644 --- a/audio/audio.c +++ b/audio/audio.c @@ -1617,8 +1617,19 @@ static void audio_vm_change_state_handler (void *opa= que, bool running, audio_reset_timer (s); } =20 -static void free_audio_state(AudioState *s) +static void audio_state_init(Object *obj) { + AudioState *s =3D AUDIO_STATE(obj); + + QLIST_INIT (&s->hw_head_out); + QLIST_INIT (&s->hw_head_in); + QLIST_INIT (&s->cap_head); + s->ts =3D timer_new_ns(QEMU_CLOCK_VIRTUAL, audio_timer, s); +} + +static void audio_state_finalize(Object *obj) +{ + AudioState *s =3D AUDIO_STATE(obj); HWVoiceOut *hwo, *hwon; HWVoiceIn *hwi, *hwin; =20 @@ -1663,8 +1674,6 @@ static void free_audio_state(AudioState *s) timer_free(s->ts); s->ts =3D NULL; } - - g_free(s); } =20 void audio_cleanup(void) @@ -1673,7 +1682,7 @@ void audio_cleanup(void) while (!QTAILQ_EMPTY(&audio_states)) { AudioState *s =3D QTAILQ_FIRST(&audio_states); QTAILQ_REMOVE(&audio_states, s, list); - free_audio_state(s); + object_unref(s); } } =20 @@ -1732,18 +1741,13 @@ static AudioState *audio_init(Audiodev *dev, Error = **errp) AudioState *s; struct audio_driver *driver; =20 - s =3D g_new0(AudioState, 1); + s =3D AUDIO_STATE(object_new(TYPE_AUDIO_STATE)); =20 - QLIST_INIT (&s->hw_head_out); - QLIST_INIT (&s->hw_head_in); - QLIST_INIT (&s->cap_head); if (!atexit_registered) { atexit(audio_cleanup); atexit_registered =3D true; } =20 - s->ts =3D timer_new_ns(QEMU_CLOCK_VIRTUAL, audio_timer, s); - if (dev) { /* -audiodev option */ s->dev =3D dev; @@ -1796,7 +1800,7 @@ static AudioState *audio_init(Audiodev *dev, Error **= errp) return s; =20 out: - free_audio_state(s); + object_unref(s); return NULL; } =20 @@ -2320,3 +2324,20 @@ AudiodevList *qmp_query_audiodevs(Error **errp) } return ret; } + +static const TypeInfo audio_state_info =3D { + .name =3D TYPE_AUDIO_STATE, + .parent =3D TYPE_OBJECT, + .instance_size =3D sizeof(AudioState), + .instance_init =3D audio_state_init, + .instance_finalize =3D audio_state_finalize, + .abstract =3D false, // todo, subclass and make it abstract + .class_size =3D sizeof(AudioStateClass), +}; + +static void register_types(void) +{ + type_register_static(&audio_state_info); +} + +type_init(register_types); --=20 2.51.0 From nobody Fri Nov 14 18:21:22 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1761116940; cv=none; d=zohomail.com; s=zohoarc; b=TxcXpn+16V2nqT5kv5XPsxaa03vYHhl7RYdMq9QvCGzt+e4WU0o8DXfLp/fB+9pGvEdYvvOJXGf8+2hp3wSp092+83nYh+qz6nei7VfZOqoffLabXT/CYoMocvtwl14WWwQnQ9Ban6PxxQUGmBoebY+fyEaHu3DnyeUWrXmxmBA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761116940; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=8guV0BGBLNjls1Um0FXs6xeolRiKerR67aVgQk1lHIU=; b=GxJvIpk2opeUtwLmTUia+YqrYQUi1HDUYtSKqKMbFBD5MLfRckgYDx8zHXO3kr5gTWDGt/+8cinXs718TTz22jMBa2gLMJy7DPP3faAk42gVfRlhdw3jPz1g0ysO+dhIyJXJV6+aZf08uOIaQuwScNUeljpDFeuZ3T5YTJehhnM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1761116940826883.526305260983; Wed, 22 Oct 2025 00:09:00 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vBSnr-0003Dt-D7; Wed, 22 Oct 2025 02:58:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vBSnj-00030P-Rs for qemu-devel@nongnu.org; Wed, 22 Oct 2025 02:58:28 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vBSnh-0008Fp-Tw for qemu-devel@nongnu.org; Wed, 22 Oct 2025 02:58:27 -0400 Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-517-qqck0Hd7PkWKuzHcaLGw3A-1; Wed, 22 Oct 2025 02:58:20 -0400 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 6C1DF19560A3; Wed, 22 Oct 2025 06:58:19 +0000 (UTC) Received: from localhost (unknown [10.44.22.9]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 5ACD41956056; Wed, 22 Oct 2025 06:58:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761116305; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=8guV0BGBLNjls1Um0FXs6xeolRiKerR67aVgQk1lHIU=; b=BeQL2ZLQisRNzfK2imcf4uP/A+9Be5gckIcydXypIF673NToxCBnJT5++09cwJMZlfhqzB Pt5CF63Gb6LS0LtmuAJweLt4niy0iC/T0ybrkFYs7KrBp/za/0BTUJKMrs4a+bTsVTCoCC 7bpqQf81TxKX6y/pEqOIz9zIvSoboyY= X-MC-Unique: qqck0Hd7PkWKuzHcaLGw3A-1 X-Mimecast-MFC-AGG-ID: qqck0Hd7PkWKuzHcaLGw3A_1761116299 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Volker=20R=C3=BCmelin?= , Paolo Bonzini , BALATON Zoltan , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Gerd Hoffmann , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Eduardo Habkost Subject: [PATCH v2 17/42] audio: register backends in /audiodevs container Date: Wed, 22 Oct 2025 10:56:12 +0400 Message-ID: <20251022065640.1172785-18-marcandre.lureau@redhat.com> In-Reply-To: <20251022065640.1172785-1-marcandre.lureau@redhat.com> References: <20251022065640.1172785-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1761116943462154100 From: Marc-Andr=C3=A9 Lureau QOM tree now has /audiodevs objects. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- audio/audio.c | 8 ++++++++ qom/object.c | 1 + 2 files changed, 9 insertions(+) diff --git a/audio/audio.c b/audio/audio.c index 754952ce58..3f40120db0 100644 --- a/audio/audio.c +++ b/audio/audio.c @@ -1676,6 +1676,11 @@ static void audio_state_finalize(Object *obj) } } =20 +static Object *get_audiodevs_root(void) +{ + return object_get_container("audiodevs"); +} + void audio_cleanup(void) { default_audio_state =3D NULL; @@ -1742,6 +1747,9 @@ static AudioState *audio_init(Audiodev *dev, Error **= errp) struct audio_driver *driver; =20 s =3D AUDIO_STATE(object_new(TYPE_AUDIO_STATE)); + if (!object_property_try_add_child(get_audiodevs_root(), dev->id, OBJE= CT(s), errp)) { + goto out; + } =20 if (!atexit_registered) { atexit(audio_cleanup); diff --git a/qom/object.c b/qom/object.c index 1856bb36c7..4f32c1aba7 100644 --- a/qom/object.c +++ b/qom/object.c @@ -1730,6 +1730,7 @@ const char *object_property_get_type(Object *obj, con= st char *name, Error **errp } =20 static const char *const root_containers[] =3D { + "audiodevs", "chardevs", "objects", "backend" --=20 2.51.0 From nobody Fri Nov 14 18:21:22 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1761116627; cv=none; d=zohomail.com; s=zohoarc; b=UhK/YjntHKpsfWqJbPI2Dqp+GYP4GFgRqNhYHp3F1TGwNnCFSAD3sj9TLVtbWV1ERlp/4dHmro11D8xHS3ELp06xs3FlNOJh2ouUgQ3nI7m0QJsTp0btM1gTD08iiBCr5DImg/kXaz9luUO/yWZL1zATFDyWVy7iaXLiuV1y21E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761116627; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=qIFdZgokrQG6SDUXZnDfV6boQDfSuqnA3SV34oss4tw=; b=b5gVr8hGnvxx8ocpNi31ZqT6BECoYRJmI0KbRjQOSZv03vDpCGuucU33HKwu7qKegPOpGkAAJsvfe5iwX2tOu1ED0LTsbj8e2CNbQUaEJJoLANj55qIuW5pF0bflCbGvXEt6GmFsMIR2SvXGRHWEq3/XNFEsOV1C3Tp7ev4voEo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 176111662714763.71226413450324; Wed, 22 Oct 2025 00:03:47 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vBSnt-0003Qv-IB; Wed, 22 Oct 2025 02:58:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vBSno-000395-2s for qemu-devel@nongnu.org; Wed, 22 Oct 2025 02:58:32 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vBSnm-0008G9-Ev for qemu-devel@nongnu.org; Wed, 22 Oct 2025 02:58:31 -0400 Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-392-7AGwQe6vOcGHdJ4Etdm64A-1; Wed, 22 Oct 2025 02:58:26 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 23EDA180035D; Wed, 22 Oct 2025 06:58:25 +0000 (UTC) Received: from localhost (unknown [10.44.22.9]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id CF313300022A; Wed, 22 Oct 2025 06:58:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761116309; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=qIFdZgokrQG6SDUXZnDfV6boQDfSuqnA3SV34oss4tw=; b=UESGbHQWbRYlYD+35cFc+QonAwOh1IRQMQeY93n0EZGMTZ9rM2NJw+ceuk4NEbCGWMphvd N5bXOR6VNhE0ahIdfdmNkZA1FGA4hoxlIwYQu0HEVluQYNq6Ym52sONgFCED7rKxh2LUDv NtZs2SPsmJ/i6yD6fPbcLyE9qm/dZKE= X-MC-Unique: 7AGwQe6vOcGHdJ4Etdm64A-1 X-Mimecast-MFC-AGG-ID: 7AGwQe6vOcGHdJ4Etdm64A_1761116305 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Volker=20R=C3=BCmelin?= , Paolo Bonzini , BALATON Zoltan , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Gerd Hoffmann Subject: [PATCH v2 18/42] audio: use /audiodevs QOM container Date: Wed, 22 Oct 2025 10:56:13 +0400 Message-ID: <20251022065640.1172785-19-marcandre.lureau@redhat.com> In-Reply-To: <20251022065640.1172785-1-marcandre.lureau@redhat.com> References: <20251022065640.1172785-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1761116629880154100 From: Marc-Andr=C3=A9 Lureau audio_cleanup() is already called at exit (similar to chardev) Signed-off-by: Marc-Andr=C3=A9 Lureau --- audio/audio_int.h | 2 -- audio/audio.c | 38 +++++++++++++------------------------- 2 files changed, 13 insertions(+), 27 deletions(-) diff --git a/audio/audio_int.h b/audio/audio_int.h index b2b4d2d10e..4187a2dbfc 100644 --- a/audio/audio_int.h +++ b/audio/audio_int.h @@ -235,8 +235,6 @@ typedef struct AudioState { =20 bool timer_running; uint64_t timer_last; - - QTAILQ_ENTRY(AudioState) list; } AudioState; =20 extern const struct mixeng_volume nominal_volume; diff --git a/audio/audio.c b/audio/audio.c index 3f40120db0..3af5f2670b 100644 --- a/audio/audio.c +++ b/audio/audio.c @@ -102,8 +102,6 @@ static audio_driver *audio_driver_lookup(const char *na= me) return NULL; } =20 -static QTAILQ_HEAD(AudioStateHead, AudioState) audio_states =3D - QTAILQ_HEAD_INITIALIZER(audio_states); static AudioState *default_audio_state; =20 const struct mixeng_volume nominal_volume =3D { @@ -1684,11 +1682,8 @@ static Object *get_audiodevs_root(void) void audio_cleanup(void) { default_audio_state =3D NULL; - while (!QTAILQ_EMPTY(&audio_states)) { - AudioState *s =3D QTAILQ_FIRST(&audio_states); - QTAILQ_REMOVE(&audio_states, s, list); - object_unref(s); - } + + object_unparent(get_audiodevs_root()); } =20 static bool vmstate_audio_needed(void *opaque) @@ -1739,7 +1734,6 @@ void audio_create_default_audiodevs(void) */ static AudioState *audio_init(Audiodev *dev, Error **errp) { - static bool atexit_registered; int done =3D 0; const char *drvname; VMChangeStateEntry *vmse; @@ -1747,14 +1741,6 @@ static AudioState *audio_init(Audiodev *dev, Error *= *errp) struct audio_driver *driver; =20 s =3D AUDIO_STATE(object_new(TYPE_AUDIO_STATE)); - if (!object_property_try_add_child(get_audiodevs_root(), dev->id, OBJE= CT(s), errp)) { - goto out; - } - - if (!atexit_registered) { - atexit(audio_cleanup); - atexit_registered =3D true; - } =20 if (dev) { /* -audiodev option */ @@ -1802,7 +1788,10 @@ static AudioState *audio_init(Audiodev *dev, Error *= *errp) "(Audio can continue looping even after stopping the VM)\n"= ); } =20 - QTAILQ_INSERT_TAIL(&audio_states, s, list); + if (!object_property_try_add_child(get_audiodevs_root(), dev->id, OBJE= CT(s), errp)) { + goto out; + } + object_unref(s); QLIST_INIT (&s->card_head); vmstate_register_any(NULL, &vmstate_audio, s); return s; @@ -2249,15 +2238,14 @@ int audio_buffer_bytes(AudiodevPerDirectionOptions = *pdo, =20 AudioState *audio_state_by_name(const char *name, Error **errp) { - AudioState *s; - QTAILQ_FOREACH(s, &audio_states, list) { - assert(s->dev); - if (strcmp(name, s->dev->id) =3D=3D 0) { - return s; - } + Object *obj =3D object_resolve_path_component(get_audiodevs_root(), na= me); + + if (!obj) { + error_setg(errp, "audiodev '%s' not found", name); + return NULL; + } else { + return AUDIO_STATE(obj); } - error_setg(errp, "audiodev '%s' not found", name); - return NULL; } =20 const char *audio_get_id(QEMUSoundCard *card) --=20 2.51.0 From nobody Fri Nov 14 18:21:22 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1761116349; cv=none; d=zohomail.com; s=zohoarc; b=lAAFL/PIP7m8fYGCyfee7xuCTdWjznRDpp0gV3cJK1uNGyTniwK0++toCloBuEW1QN60qRFLvwA2luNP6V4b9tin2dtw8+P3oxDowyZSOL96a6WJ0vkThNyXedZUOm5wqtgVjRO46VWyZSbb5BhNTkrUxtyV7pDsiIFfxqemvlY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761116349; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=DXHP6OdQkB89vcCyTKcDf3Nxv8JeBOGNotvi4AlxWwE=; b=jmKq/PYZxP9zjmUB7azJrEJC05QLeXhPFwa0M9XpRyHyXCKlVJgnukzl+AYSK6FZfvL5gxl9wbfaK/pmi2d9aXI+IPtTHOHju/yvTbflw+2zmoDbgvcr2mflI/gtkmBY6N8m1DKVubHYc/2OG1Iut6aSMB+Vz6/JIIzYPS7FMRI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 17611163494751019.4975865647955; Tue, 21 Oct 2025 23:59:09 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vBSo0-0003mm-Mb; Wed, 22 Oct 2025 02:58:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vBSnt-0003Rl-J1 for qemu-devel@nongnu.org; Wed, 22 Oct 2025 02:58:37 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vBSnr-0008Gl-Dx for qemu-devel@nongnu.org; Wed, 22 Oct 2025 02:58:37 -0400 Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-374-EBOVEEruMG-RPoiLb1P8jQ-1; Wed, 22 Oct 2025 02:58:31 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 3FD18195608F; Wed, 22 Oct 2025 06:58:30 +0000 (UTC) Received: from localhost (unknown [10.44.22.9]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 38059300022B; Wed, 22 Oct 2025 06:58:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761116314; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=DXHP6OdQkB89vcCyTKcDf3Nxv8JeBOGNotvi4AlxWwE=; b=CbFcEH9ZHfG8n7/9ltMR35PIfJKtoA8JXBlGyE4QrGjRkRkKtwCwwoJGhBQh4BOQQ1G+L7 RhZTQEycxJ8CTDRP8VCbCBPI0BYSKi3J6ALjFa3usFxyv27WJ5Z0RnTvjYqr2FkhmB+cPE ZF7DOIHtF2MMOqAKFqcNanTFS38uOc8= X-MC-Unique: EBOVEEruMG-RPoiLb1P8jQ-1 X-Mimecast-MFC-AGG-ID: EBOVEEruMG-RPoiLb1P8jQ_1761116310 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Volker=20R=C3=BCmelin?= , Paolo Bonzini , BALATON Zoltan , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Gerd Hoffmann Subject: [PATCH v2 19/42] audio/paaudio: remove needless return value Date: Wed, 22 Oct 2025 10:56:14 +0400 Message-ID: <20251022065640.1172785-20-marcandre.lureau@redhat.com> In-Reply-To: <20251022065640.1172785-1-marcandre.lureau@redhat.com> References: <20251022065640.1172785-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1761116354379158500 From: Marc-Andr=C3=A9 Lureau Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- audio/paaudio.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/audio/paaudio.c b/audio/paaudio.c index f3193b08c3..93030f3fc8 100644 --- a/audio/paaudio.c +++ b/audio/paaudio.c @@ -747,14 +747,13 @@ static void qpa_volume_in(HWVoiceIn *hw, Volume *vol) pa_threaded_mainloop_unlock(c->mainloop); } =20 -static int qpa_validate_per_direction_opts(Audiodev *dev, - AudiodevPaPerDirectionOptions *= pdo) +static void qpa_validate_per_direction_opts(Audiodev *dev, + AudiodevPaPerDirectionOptions = *pdo) { if (!pdo->has_latency) { pdo->has_latency =3D true; pdo->latency =3D 46440; } - return 1; } =20 /* common */ @@ -844,12 +843,8 @@ static void *qpa_audio_init(Audiodev *dev, Error **err= p) } } =20 - if (!qpa_validate_per_direction_opts(dev, popts->in)) { - return NULL; - } - if (!qpa_validate_per_direction_opts(dev, popts->out)) { - return NULL; - } + qpa_validate_per_direction_opts(dev, popts->in); + qpa_validate_per_direction_opts(dev, popts->out); =20 g =3D g_new0(paaudio, 1); server =3D popts->server; --=20 2.51.0 From nobody Fri Nov 14 18:21:22 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1761116608; cv=none; d=zohomail.com; s=zohoarc; b=lROzfSORRvqo9nsYqTz3aDFppqiB5EGnud3N5nKNdkVKu5Bbj6WuIC3Bm6mG/Z/Xvkovohzxx/RKUmID2d1B+CDTh+zZmqjtpA290OXVlzI9IhTSEMMpOyjRvU++DRgDeG/+XPTOxpI2Z9k9FsVAEss7dFoQYQSSIF+yTU5hsV4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761116608; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=T5DGuhfLFoc7PT62ZhKWesCEDaDqaTP9IZTqxum1alU=; b=Dwf+hk2yRTdfoKhi36b4El4F5wE8Mi+0sczd9xnN8QyFpyT2+o+Ro768RQ4mEL+oeiOvARl/xHXYxJzZsrMzjwZLjXNsgPsj7LzU+BlL7V0FvacbRcKtIh7PakEKtcmEaCQXO2TgzOYyXEcjN5FTKl2D5Cj3bGjI6koK3m6F7b4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 176111660866882.02831499303193; Wed, 22 Oct 2025 00:03:28 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vBSo2-00047L-LR; Wed, 22 Oct 2025 02:58:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vBSnz-0003lS-JP for qemu-devel@nongnu.org; Wed, 22 Oct 2025 02:58:44 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vBSnx-0008HE-NJ for qemu-devel@nongnu.org; Wed, 22 Oct 2025 02:58:43 -0400 Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-34-kh7-rlA3MDijS6Yu3mVcCg-1; Wed, 22 Oct 2025 02:58:37 -0400 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 9FA8D1808972; Wed, 22 Oct 2025 06:58:35 +0000 (UTC) Received: from localhost (unknown [10.44.22.9]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 5191419560B0; Wed, 22 Oct 2025 06:58:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761116320; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=T5DGuhfLFoc7PT62ZhKWesCEDaDqaTP9IZTqxum1alU=; b=fA/lU5LSa/pdllgsqacbj1rPdj7U9lT2N7zBIBlyTPg4iEArA/XCSMka/ZSKLTyjFmfdte ettmJdhahWb1IyyY3sO80IypBjSe+Gz9hATCOx+TNg20Rkd7Wpn4+eEVWKK0QOQ0SVA7aG e22Cz0c6ca3JPmAedd+eFkjliC1ydpI= X-MC-Unique: kh7-rlA3MDijS6Yu3mVcCg-1 X-Mimecast-MFC-AGG-ID: kh7-rlA3MDijS6Yu3mVcCg_1761116315 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Volker=20R=C3=BCmelin?= , Paolo Bonzini , BALATON Zoltan , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Gerd Hoffmann Subject: [PATCH v2 20/42] audio/dsound: simplify init() Date: Wed, 22 Oct 2025 10:56:15 +0400 Message-ID: <20251022065640.1172785-21-marcandre.lureau@redhat.com> In-Reply-To: <20251022065640.1172785-1-marcandre.lureau@redhat.com> References: <20251022065640.1172785-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1761116609711154100 From: Marc-Andr=C3=A9 Lureau Use dsound_audio_fini() on error & fail if the capture failed to initialize too. Signed-off-by: Marc-Andr=C3=A9 Lureau --- audio/dsoundaudio.c | 29 +++++++++++------------------ 1 file changed, 11 insertions(+), 18 deletions(-) diff --git a/audio/dsoundaudio.c b/audio/dsoundaudio.c index f3bb48d007..d54d79d41c 100644 --- a/audio/dsoundaudio.c +++ b/audio/dsoundaudio.c @@ -638,7 +638,7 @@ static void *dsound_audio_init(Audiodev *dev, Error **e= rrp) hr =3D CoInitialize (NULL); if (FAILED (hr)) { dsound_logerr (hr, "Could not initialize COM\n"); - g_free(s); + dsound_audio_fini(s); return NULL; } =20 @@ -651,19 +651,14 @@ static void *dsound_audio_init(Audiodev *dev, Error *= *errp) ); if (FAILED (hr)) { dsound_logerr (hr, "Could not create DirectSound instance\n"); - g_free(s); + dsound_audio_fini(s); return NULL; } =20 hr =3D IDirectSound_Initialize (s->dsound, NULL); if (FAILED (hr)) { dsound_logerr (hr, "Could not initialize DirectSound\n"); - - hr =3D IDirectSound_Release (s->dsound); - if (FAILED (hr)) { - dsound_logerr (hr, "Could not release DirectSound\n"); - } - g_free(s); + dsound_audio_fini(s); return NULL; } =20 @@ -676,17 +671,15 @@ static void *dsound_audio_init(Audiodev *dev, Error *= *errp) ); if (FAILED (hr)) { dsound_logerr (hr, "Could not create DirectSoundCapture instance\n= "); - } else { - hr =3D IDirectSoundCapture_Initialize (s->dsound_capture, NULL); - if (FAILED (hr)) { - dsound_logerr (hr, "Could not initialize DirectSoundCapture\n"= ); + dsound_audio_fini(s); + return NULL; + } =20 - hr =3D IDirectSoundCapture_Release (s->dsound_capture); - if (FAILED (hr)) { - dsound_logerr (hr, "Could not release DirectSoundCapture\n= "); - } - s->dsound_capture =3D NULL; - } + hr =3D IDirectSoundCapture_Initialize (s->dsound_capture, NULL); + if (FAILED (hr)) { + dsound_logerr (hr, "Could not initialize DirectSoundCapture\n"); + dsound_audio_fini(s); + return NULL; } =20 err =3D dsound_set_cooperative_level(s); --=20 2.51.0 From nobody Fri Nov 14 18:21:22 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1761116337; cv=none; d=zohomail.com; s=zohoarc; b=PieawO7fbD5Zc0EVcKH7JaiwhtgywYXK3YFx2H2kFqgXuqhvyBp2IV+OrUjPJ/ivdkNA8dNcHYIHSu7xN58pDrRwRQi2OoeaeSUzgVaMNNk4GdppZHcgXXMGDwT9bM9/TXR6A/RFJBPqRMvl29NPfmwbL1Krj44sCFlI7DoKWeg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761116337; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=qkzbrmyTwzsUPm+IgyKPZIwl+rvV+nRn9814G1hr6PQ=; b=K4+kYJh5k1RhS9Txzo+81gK7qwgSAlqpjF0jmwFsM55lOkC/kB8IN/d6P1E5NTMbeGrNqPdm6wEmnQA+OXmk38SVg6pfT04qsHga3vASbpLR4btBKvdaWn8C08yZhBrByDvFFL3Dcp0pNttbummo+VJu2hb5DgQ3muvk+13IEyw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 176111633732552.437379608858464; Tue, 21 Oct 2025 23:58:57 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vBSo9-0004b6-Nm; Wed, 22 Oct 2025 02:58:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vBSo5-0004QA-36 for qemu-devel@nongnu.org; Wed, 22 Oct 2025 02:58:49 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vBSo1-0008HW-JB for qemu-devel@nongnu.org; Wed, 22 Oct 2025 02:58:48 -0400 Received: from mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-151-_S5DwMZaNBmHv0v0Xm4Eyw-1; Wed, 22 Oct 2025 02:58:42 -0400 Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 52AB519541B7; Wed, 22 Oct 2025 06:58:41 +0000 (UTC) Received: from localhost (unknown [10.44.22.9]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id D288118003FC; Wed, 22 Oct 2025 06:58:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761116324; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=qkzbrmyTwzsUPm+IgyKPZIwl+rvV+nRn9814G1hr6PQ=; b=bF3TSRnr2pUF31+NR//nc1sCIiXShOgtSPOGt39fb/d2yvLK2OLxAyMayVtAV47h/0yNR7 i0I5F/J50dCS/OqJGduoHU9przlP5KO1Q9xM81pMCMaCjq8mj6qdmXg/jJBtoHa8aopy5U sz9Krto+xFXEiUYF8NFfscno7tfFaPc= X-MC-Unique: _S5DwMZaNBmHv0v0Xm4Eyw-1 X-Mimecast-MFC-AGG-ID: _S5DwMZaNBmHv0v0Xm4Eyw_1761116321 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Volker=20R=C3=BCmelin?= , Paolo Bonzini , BALATON Zoltan , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Gerd Hoffmann Subject: [PATCH v2 21/42] audio/dsound: report init error via **errp Date: Wed, 22 Oct 2025 10:56:16 +0400 Message-ID: <20251022065640.1172785-22-marcandre.lureau@redhat.com> In-Reply-To: <20251022065640.1172785-1-marcandre.lureau@redhat.com> References: <20251022065640.1172785-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1761116338611154100 From: Marc-Andr=C3=A9 Lureau Whenever NULL is returned, errp should be set. Inline SetCooperativeLevel call to simplify code. Signed-off-by: Marc-Andr=C3=A9 Lureau --- audio/dsoundaudio.c | 182 +++++++++++++++++++------------------------- 1 file changed, 79 insertions(+), 103 deletions(-) diff --git a/audio/dsoundaudio.c b/audio/dsoundaudio.c index d54d79d41c..6a8b7f1a19 100644 --- a/audio/dsoundaudio.c +++ b/audio/dsoundaudio.c @@ -33,6 +33,7 @@ #include "audio_int.h" #include "qemu/host-utils.h" #include "qemu/module.h" +#include "qapi/error.h" =20 #include #include @@ -64,162 +65,154 @@ typedef struct { dsound *s; } DSoundVoiceIn; =20 -static void dsound_log_hresult (HRESULT hr) +static const char *dserror (HRESULT hr) { - const char *str =3D "BUG"; - switch (hr) { case DS_OK: - str =3D "The method succeeded"; - break; + return "The method succeeded"; #ifdef DS_NO_VIRTUALIZATION case DS_NO_VIRTUALIZATION: - str =3D "The buffer was created, but another 3D algorithm was subs= tituted"; - break; + return "The buffer was created, but another 3D algorithm was subst= ituted"; #endif #ifdef DS_INCOMPLETE case DS_INCOMPLETE: - str =3D "The method succeeded, but not all the optional effects we= re obtained"; - break; + return "The method succeeded, but not all the optional effects wer= e obtained"; #endif #ifdef DSERR_ACCESSDENIED case DSERR_ACCESSDENIED: - str =3D "The request failed because access was denied"; - break; + return "The request failed because access was denied"; #endif #ifdef DSERR_ALLOCATED case DSERR_ALLOCATED: - str =3D "The request failed because resources, " - "such as a priority level, were already in use " - "by another caller"; - break; + return "The request failed because resources, " + "such as a priority level, were already in use " + "by another caller"; #endif #ifdef DSERR_ALREADYINITIALIZED case DSERR_ALREADYINITIALIZED: - str =3D "The object is already initialized"; - break; + return "The object is already initialized"; #endif #ifdef DSERR_BADFORMAT case DSERR_BADFORMAT: - str =3D "The specified wave format is not supported"; - break; + return "The specified wave format is not supported"; #endif #ifdef DSERR_BADSENDBUFFERGUID case DSERR_BADSENDBUFFERGUID: - str =3D "The GUID specified in an audiopath file " - "does not match a valid mix-in buffer"; - break; + return "The GUID specified in an audiopath file " + "does not match a valid mix-in buffer"; #endif #ifdef DSERR_BUFFERLOST case DSERR_BUFFERLOST: - str =3D "The buffer memory has been lost and must be restored"; - break; + return "The buffer memory has been lost and must be restored"; #endif #ifdef DSERR_BUFFERTOOSMALL case DSERR_BUFFERTOOSMALL: - str =3D "The buffer size is not great enough to " - "enable effects processing"; - break; + return "The buffer size is not great enough to " + "enable effects processing"; #endif #ifdef DSERR_CONTROLUNAVAIL case DSERR_CONTROLUNAVAIL: - str =3D "The buffer control (volume, pan, and so on) " - "requested by the caller is not available. " - "Controls must be specified when the buffer is created, " - "using the dwFlags member of DSBUFFERDESC"; - break; + return "The buffer control (volume, pan, and so on) " + "requested by the caller is not available. " + "Controls must be specified when the buffer is created, " + "using the dwFlags member of DSBUFFERDESC"; #endif #ifdef DSERR_DS8_REQUIRED case DSERR_DS8_REQUIRED: - str =3D "A DirectSound object of class CLSID_DirectSound8 or later= " - "is required for the requested functionality. " - "For more information, see IDirectSound8 Interface"; - break; + return "A DirectSound object of class CLSID_DirectSound8 or later " + "is required for the requested functionality. " + "For more information, see IDirectSound8 Interface"; #endif #ifdef DSERR_FXUNAVAILABLE case DSERR_FXUNAVAILABLE: - str =3D "The effects requested could not be found on the system, " - "or they are in the wrong order or in the wrong location; " - "for example, an effect expected in hardware " - "was found in software"; - break; + return "The effects requested could not be found on the system, " + "or they are in the wrong order or in the wrong location; " + "for example, an effect expected in hardware " + "was found in software"; #endif #ifdef DSERR_GENERIC case DSERR_GENERIC: - str =3D "An undetermined error occurred inside the DirectSound sub= system"; - break; + return "An undetermined error occurred inside the DirectSound subs= ystem"; #endif #ifdef DSERR_INVALIDCALL case DSERR_INVALIDCALL: - str =3D "This function is not valid for the current state of this = object"; - break; + return "This function is not valid for the current state of this o= bject"; #endif #ifdef DSERR_INVALIDPARAM case DSERR_INVALIDPARAM: - str =3D "An invalid parameter was passed to the returning function= "; - break; + return "An invalid parameter was passed to the returning function"; #endif #ifdef DSERR_NOAGGREGATION case DSERR_NOAGGREGATION: - str =3D "The object does not support aggregation"; - break; + return "The object does not support aggregation"; #endif #ifdef DSERR_NODRIVER case DSERR_NODRIVER: - str =3D "No sound driver is available for use, " - "or the given GUID is not a valid DirectSound device ID"; - break; + return "No sound driver is available for use, " + "or the given GUID is not a valid DirectSound device ID"; #endif #ifdef DSERR_NOINTERFACE case DSERR_NOINTERFACE: - str =3D "The requested COM interface is not available"; - break; + return "The requested COM interface is not available"; #endif #ifdef DSERR_OBJECTNOTFOUND case DSERR_OBJECTNOTFOUND: - str =3D "The requested object was not found"; - break; + return "The requested object was not found"; #endif #ifdef DSERR_OTHERAPPHASPRIO case DSERR_OTHERAPPHASPRIO: - str =3D "Another application has a higher priority level, " + return "Another application has a higher priority level, " "preventing this call from succeeding"; - break; #endif #ifdef DSERR_OUTOFMEMORY case DSERR_OUTOFMEMORY: - str =3D "The DirectSound subsystem could not allocate " + return "The DirectSound subsystem could not allocate " "sufficient memory to complete the caller's request"; - break; #endif #ifdef DSERR_PRIOLEVELNEEDED case DSERR_PRIOLEVELNEEDED: - str =3D "A cooperative level of DSSCL_PRIORITY or higher is requir= ed"; - break; + return "A cooperative level of DSSCL_PRIORITY or higher is require= d"; #endif #ifdef DSERR_SENDLOOP case DSERR_SENDLOOP: - str =3D "A circular loop of send effects was detected"; - break; + return "A circular loop of send effects was detected"; #endif #ifdef DSERR_UNINITIALIZED case DSERR_UNINITIALIZED: - str =3D "The Initialize method has not been called " - "or has not been called successfully " - "before other methods were called"; - break; + return "The Initialize method has not been called " + "or has not been called successfully " + "before other methods were called"; #endif #ifdef DSERR_UNSUPPORTED case DSERR_UNSUPPORTED: - str =3D "The function called is not supported at this time"; - break; + return "The function called is not supported at this time"; #endif default: - AUD_log (AUDIO_CAP, "Reason: Unknown (HRESULT 0x%lx)\n", hr); - return; + return NULL; + } + +} + +static void dserror_set(Error **errp, HRESULT hr, const char *msg) +{ + const char *str =3D dserror(hr); + + if (str) { + error_setg(errp, "%s: %s", msg, str); + } else { + error_setg(errp, "%s: Unknown (HRESULT: 0x%lx)", msg, hr); } +} + +static void dsound_log_hresult (HRESULT hr) +{ + const char *str =3D dserror(hr); =20 - AUD_log (AUDIO_CAP, "Reason: %s\n", str); + if (str) { + AUD_log (AUDIO_CAP, "Reason: %s\n", str); + } else { + AUD_log (AUDIO_CAP, "Reason: Unknown (HRESULT: 0x%lx)\n", hr); + } } =20 static void G_GNUC_PRINTF (2, 3) dsound_logerr ( @@ -359,27 +352,6 @@ static void dsound_clear_sample (HWVoiceOut *hw, LPDIR= ECTSOUNDBUFFER dsb, dsound_unlock_out (dsb, p1, p2, blen1, blen2); } =20 -static int dsound_set_cooperative_level(dsound *s) -{ - HRESULT hr; - HWND hwnd; - - hwnd =3D GetDesktopWindow(); - hr =3D IDirectSound_SetCooperativeLevel ( - s->dsound, - hwnd, - DSSCL_PRIORITY - ); - - if (FAILED (hr)) { - dsound_logerr (hr, "Could not set cooperative level for window %p\= n", - hwnd); - return -1; - } - - return 0; -} - static void dsound_enable_out(HWVoiceOut *hw, bool enable) { HRESULT hr; @@ -621,7 +593,6 @@ static void dsound_audio_fini (void *opaque) =20 static void *dsound_audio_init(Audiodev *dev, Error **errp) { - int err; HRESULT hr; dsound *s =3D g_new0(dsound, 1); AudiodevDsoundOptions *dso; @@ -637,7 +608,7 @@ static void *dsound_audio_init(Audiodev *dev, Error **e= rrp) =20 hr =3D CoInitialize (NULL); if (FAILED (hr)) { - dsound_logerr (hr, "Could not initialize COM\n"); + dserror_set(errp, hr, "Could not initialize COM"); dsound_audio_fini(s); return NULL; } @@ -650,14 +621,14 @@ static void *dsound_audio_init(Audiodev *dev, Error *= *errp) (void **) &s->dsound ); if (FAILED (hr)) { - dsound_logerr (hr, "Could not create DirectSound instance\n"); + dserror_set(errp, hr, "Could not create DirectSound instance"); dsound_audio_fini(s); return NULL; } =20 hr =3D IDirectSound_Initialize (s->dsound, NULL); if (FAILED (hr)) { - dsound_logerr (hr, "Could not initialize DirectSound\n"); + dserror_set(errp, hr, "Could not initialize DirectSound"); dsound_audio_fini(s); return NULL; } @@ -670,21 +641,26 @@ static void *dsound_audio_init(Audiodev *dev, Error *= *errp) (void **) &s->dsound_capture ); if (FAILED (hr)) { - dsound_logerr (hr, "Could not create DirectSoundCapture instance\n= "); + dserror_set(errp, hr, "Could not create DirectSoundCapture instanc= e"); dsound_audio_fini(s); return NULL; } =20 hr =3D IDirectSoundCapture_Initialize (s->dsound_capture, NULL); if (FAILED (hr)) { - dsound_logerr (hr, "Could not initialize DirectSoundCapture\n"); + dserror_set(errp, hr, "Could not initialize DirectSoundCapture"); dsound_audio_fini(s); return NULL; } =20 - err =3D dsound_set_cooperative_level(s); - if (err) { - dsound_audio_fini (s); + hr =3D IDirectSound_SetCooperativeLevel ( + s->dsound, + GetDesktopWindow(), + DSSCL_PRIORITY + ); + if (FAILED (hr)) { + dserror_set(errp, hr, "Could not set cooperative level"); + dsound_audio_fini(s); return NULL; } =20 --=20 2.51.0 From nobody Fri Nov 14 18:21:22 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1761116363; cv=none; d=zohomail.com; s=zohoarc; b=Dl8ycB/ga2N1nPwrms5HMt5+stJcKqqovsrVy0XLTg51J6FepvJ+cxoXw+AscEaP6pCBrI6RXqcJWPO0Bko+XJTlJL+RA03YGeCs1SrjuasSO9rzmzbSwrzoy5UXoDNiTRviVedfANNYQgQMcZmX3qOQfI/LzCiZKrqxd71v+rw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761116363; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=juic9oRRoPnEyyLc+RZtMFFg/bc4UccwpaWA/hiu/p8=; b=m4I7J//Zo3HrMPZHsiKqq9e7ot5ayJbUMvA2npDvzHVfYoRdBIzGedtdISvLgAW0JURWMTxQ3Kng15meO5x6U6z+FPaq9b6HIV8KZvY+E01FCNL2XiYOn4P8XzoG9EqyBA/elyaeJ5Rr8zaPQ0wrWkL/TDpkCvaGoPZ07JFFAmk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1761116363499411.2846847827318; Tue, 21 Oct 2025 23:59:23 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vBSoH-0005HQ-Ox; Wed, 22 Oct 2025 02:59:02 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vBSoC-0004tu-Hk for qemu-devel@nongnu.org; Wed, 22 Oct 2025 02:58:56 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vBSo8-0008IA-0X for qemu-devel@nongnu.org; Wed, 22 Oct 2025 02:58:56 -0400 Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-494-vZDQTzuBNjmmc1b6PoNpTQ-1; Wed, 22 Oct 2025 02:58:48 -0400 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id DD71E1800D85; Wed, 22 Oct 2025 06:58:46 +0000 (UTC) Received: from localhost (unknown [10.44.22.9]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 978F81956056; Wed, 22 Oct 2025 06:58:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761116331; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=juic9oRRoPnEyyLc+RZtMFFg/bc4UccwpaWA/hiu/p8=; b=W7MFhlB/S77FYEykzMDqznOhhYYbOH3aSdMy2mFUT8NEP2xYMtiC9FQLoe+P+z1z1wfEbc XX8BtFIJrmAidFuZttsqIEoQ2xyKxYyej0208xAokE8mLqD1fJmuLnozOK+DKPRVGDVXym zmoMVAJeHbXp6utaAQwFhn07ZRoJEnc= X-MC-Unique: vZDQTzuBNjmmc1b6PoNpTQ-1 X-Mimecast-MFC-AGG-ID: vZDQTzuBNjmmc1b6PoNpTQ_1761116327 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Volker=20R=C3=BCmelin?= , Paolo Bonzini , BALATON Zoltan , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Gerd Hoffmann Subject: [PATCH v2 22/42] audio: simplify audio_driver_init() Date: Wed, 22 Oct 2025 10:56:17 +0400 Message-ID: <20251022065640.1172785-23-marcandre.lureau@redhat.com> In-Reply-To: <20251022065640.1172785-1-marcandre.lureau@redhat.com> References: <20251022065640.1172785-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1761116364811154100 From: Marc-Andr=C3=A9 Lureau Catch and return from error early to avoid indentations and ease the flow & return a bool for success value. All driver init() calls have been checked to set errp on error. Signed-off-by: Marc-Andr=C3=A9 Lureau --- audio/audio.c | 48 ++++++++++++++++++++---------------------------- 1 file changed, 20 insertions(+), 28 deletions(-) diff --git a/audio/audio.c b/audio/audio.c index 3af5f2670b..bffb8cddb0 100644 --- a/audio/audio.c +++ b/audio/audio.c @@ -1562,35 +1562,27 @@ size_t audio_generic_read(HWVoiceIn *hw, void *buf,= size_t size) return total; } =20 -static int audio_driver_init(AudioState *s, struct audio_driver *drv, - Audiodev *dev, Error **errp) +static bool audio_driver_init(AudioState *s, struct audio_driver *drv, + Audiodev *dev, Error **errp) { - Error *local_err =3D NULL; - - s->drv_opaque =3D drv->init(dev, &local_err); - - if (s->drv_opaque) { - if (!drv->pcm_ops->get_buffer_in) { - drv->pcm_ops->get_buffer_in =3D audio_generic_get_buffer_in; - drv->pcm_ops->put_buffer_in =3D audio_generic_put_buffer_in; - } - if (!drv->pcm_ops->get_buffer_out) { - drv->pcm_ops->get_buffer_out =3D audio_generic_get_buffer_out; - drv->pcm_ops->put_buffer_out =3D audio_generic_put_buffer_out; - } + s->drv_opaque =3D drv->init(dev, errp); + if (!s->drv_opaque) { + return false; + } =20 - audio_init_nb_voices_out(s, drv, 1); - audio_init_nb_voices_in(s, drv, 0); - s->drv =3D drv; - return 0; - } else { - if (local_err) { - error_propagate(errp, local_err); - } else { - error_setg(errp, "Could not init `%s' audio driver", drv->name= ); - } - return -1; + if (!drv->pcm_ops->get_buffer_in) { + drv->pcm_ops->get_buffer_in =3D audio_generic_get_buffer_in; + drv->pcm_ops->put_buffer_in =3D audio_generic_put_buffer_in; } + if (!drv->pcm_ops->get_buffer_out) { + drv->pcm_ops->get_buffer_out =3D audio_generic_get_buffer_out; + drv->pcm_ops->put_buffer_out =3D audio_generic_put_buffer_out; + } + + audio_init_nb_voices_out(s, drv, 1); + audio_init_nb_voices_in(s, drv, 0); + s->drv =3D drv; + return true; } =20 static void audio_vm_change_state_handler (void *opaque, bool running, @@ -1748,7 +1740,7 @@ static AudioState *audio_init(Audiodev *dev, Error **= errp) drvname =3D AudiodevDriver_str(dev->driver); driver =3D audio_driver_lookup(drvname); if (driver) { - done =3D !audio_driver_init(s, driver, dev, errp); + done =3D audio_driver_init(s, driver, dev, errp); } else { error_setg(errp, "Unknown audio driver `%s'", drvname); } @@ -1768,7 +1760,7 @@ static AudioState *audio_init(Audiodev *dev, Error **= errp) g_free(e); drvname =3D AudiodevDriver_str(dev->driver); driver =3D audio_driver_lookup(drvname); - if (!audio_driver_init(s, driver, dev, NULL)) { + if (audio_driver_init(s, driver, dev, NULL)) { break; } qapi_free_Audiodev(dev); --=20 2.51.0 From nobody Fri Nov 14 18:21:22 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1761116373; cv=none; d=zohomail.com; s=zohoarc; b=KMcIj+ivJyVyOAl9xkWTO8MUdMoAOX5qZHiPAGatjzCCV3J7h4RUlMr9gt7XHsFOKBLmAXxfxmwK7aetuzo1CZElGco9H0PYPsCLFEBmBd+l/bLpENHl96W+L6Ce75zqXKAWvt5etL2IfcB/+e1cQqjUcpB4z2gFyYJqLz72iQ8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761116373; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=5VivmlLMnXRxx6PS1LLoJpztwyYc6uGdFp5WcViyarE=; b=aUXsROQUxNswPGAFQAwslGV+YCf22M37wJg6XEDhxfCjkal/tZbVi044f/glYU3SXVe0RRTbmhW0sy/kX3B9+WQScKldUOT0XAPxWDnbCBh0ce0P8xk9osMFXTswMNYNrmQmzfwopkCbdgyItTx89MqdyvE5ZJdfNlGIwmUTDp0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 176111637306747.54998830013221; Tue, 21 Oct 2025 23:59:33 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vBSoK-0005Rp-92; Wed, 22 Oct 2025 02:59:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vBSoE-00050n-3R for qemu-devel@nongnu.org; Wed, 22 Oct 2025 02:59:00 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vBSoC-0008Ii-As for qemu-devel@nongnu.org; Wed, 22 Oct 2025 02:58:57 -0400 Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-562-3WYHrgEkMj6jqnSj8BPJwA-1; Wed, 22 Oct 2025 02:58:53 -0400 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 63FE51956053; Wed, 22 Oct 2025 06:58:52 +0000 (UTC) Received: from localhost (unknown [10.44.22.9]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id F1B0819560B2; Wed, 22 Oct 2025 06:58:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761116335; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=5VivmlLMnXRxx6PS1LLoJpztwyYc6uGdFp5WcViyarE=; b=VJhQ5cILUC0snjbwLQMglFmrkwPRX7l7nocvj/DxkEFxv6/nR65NMszTqdmZRhCBMRslM7 +WIjshs8mF/rrJP6pG4wH2FFoDeFkI791zXvrZdV7SMO2XZFzH4De4VbZptr4UvW/2QEh9 r+QNxbiJ8b1Xjbu7+M4VsPFC29Ix21A= X-MC-Unique: 3WYHrgEkMj6jqnSj8BPJwA-1 X-Mimecast-MFC-AGG-ID: 3WYHrgEkMj6jqnSj8BPJwA_1761116332 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Volker=20R=C3=BCmelin?= , Paolo Bonzini , BALATON Zoltan , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Gerd Hoffmann Subject: [PATCH v2 23/42] audio: move period tick initialization Date: Wed, 22 Oct 2025 10:56:18 +0400 Message-ID: <20251022065640.1172785-24-marcandre.lureau@redhat.com> In-Reply-To: <20251022065640.1172785-1-marcandre.lureau@redhat.com> References: <20251022065640.1172785-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1761116376648158500 From: Marc-Andr=C3=A9 Lureau Part of QOM-ification. Signed-off-by: Marc-Andr=C3=A9 Lureau --- audio/audio.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/audio/audio.c b/audio/audio.c index bffb8cddb0..dcaf86a586 100644 --- a/audio/audio.c +++ b/audio/audio.c @@ -1582,6 +1582,13 @@ static bool audio_driver_init(AudioState *s, struct = audio_driver *drv, audio_init_nb_voices_out(s, drv, 1); audio_init_nb_voices_in(s, drv, 0); s->drv =3D drv; + + if (dev->timer_period <=3D 0) { + s->period_ticks =3D 1; + } else { + s->period_ticks =3D dev->timer_period * (int64_t)SCALE_US; + } + return true; } =20 @@ -1768,12 +1775,6 @@ static AudioState *audio_init(Audiodev *dev, Error *= *errp) } } =20 - if (dev->timer_period <=3D 0) { - s->period_ticks =3D 1; - } else { - s->period_ticks =3D dev->timer_period * (int64_t)SCALE_US; - } - vmse =3D qemu_add_vm_change_state_handler (audio_vm_change_state_handl= er, s); if (!vmse) { dolog ("warning: Could not register change state handler\n" --=20 2.51.0 From nobody Fri Nov 14 18:21:22 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1761116869; cv=none; d=zohomail.com; s=zohoarc; b=ORyeAJhhBHxBB3k2wn7KeISd2xpKl658cOMdnk4mocJ9ufWsd96H17xjtRFLvPZ0rmN+jbScm57MFwZAmt/wCN0hgnLcSz+Tyg7Ihe4o+hoY9jf/2gfzMbwu0LKLOoevwSZ0xJapKVPBuapcNJmiUcvdQbp8B4HuqYb7g+q2oHA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761116869; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=z3iIUtb7cIX94DkQb9F7TLax93AdBG1w2HRzW7aZl8U=; b=W/NJd46J5NSjW6sBUjYW0Kz+5eKDxUhxJA8BWwal+bQvnrhMwYVWFJVXp1DObAZznpHCpcfPbMdTIV1Lf7htjh4mbb2KY+DGgH/xrWikitkAJr658rU/ePbuQcRSPvUFUVWiDBZFbWC2XE7hfqSOuZT5iwvSDZVZL02TkcV0Zic= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1761116869482423.7644092348578; Wed, 22 Oct 2025 00:07:49 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vBSoQ-00069q-Ih; Wed, 22 Oct 2025 02:59:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vBSoL-0005lX-Uo for qemu-devel@nongnu.org; Wed, 22 Oct 2025 02:59:06 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vBSoJ-0008JO-BO for qemu-devel@nongnu.org; Wed, 22 Oct 2025 02:59:04 -0400 Received: from mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-139-l1adBO76OCiF4V8KTSobcw-1; Wed, 22 Oct 2025 02:58:58 -0400 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 98C6819560A0; Wed, 22 Oct 2025 06:58:57 +0000 (UTC) Received: from localhost (unknown [10.44.22.9]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 95DCB1956056; Wed, 22 Oct 2025 06:58:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761116342; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=z3iIUtb7cIX94DkQb9F7TLax93AdBG1w2HRzW7aZl8U=; b=cprf+V5kiRDIlQkP6UUKd5LqnaLOjIQIRyQNvMczKWE/MzC8wtQOUfBFpO0ZBZD5K2TrQl Heck8kNBPVVY0htn6Mmd02VVh8e8jSdGlvbNJVwr2KZ2JzL6pNy7zwH8hRvn5NqqTcqbzP 82PasDuLDPbta7vxnBAklEEig5A1Iw0= X-MC-Unique: l1adBO76OCiF4V8KTSobcw-1 X-Mimecast-MFC-AGG-ID: l1adBO76OCiF4V8KTSobcw_1761116337 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Volker=20R=C3=BCmelin?= , Paolo Bonzini , BALATON Zoltan , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Gerd Hoffmann Subject: [PATCH v2 24/42] audio: drop needless error message Date: Wed, 22 Oct 2025 10:56:19 +0400 Message-ID: <20251022065640.1172785-25-marcandre.lureau@redhat.com> In-Reply-To: <20251022065640.1172785-1-marcandre.lureau@redhat.com> References: <20251022065640.1172785-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1761116880947158500 From: Marc-Andr=C3=A9 Lureau The only reason it would fail to add the handler is if it's calling a stub. But this cannot happen as audio is only supported with system qemu. Signed-off-by: Marc-Andr=C3=A9 Lureau --- audio/audio.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/audio/audio.c b/audio/audio.c index dcaf86a586..4478041e5d 100644 --- a/audio/audio.c +++ b/audio/audio.c @@ -1776,10 +1776,7 @@ static AudioState *audio_init(Audiodev *dev, Error *= *errp) } =20 vmse =3D qemu_add_vm_change_state_handler (audio_vm_change_state_handl= er, s); - if (!vmse) { - dolog ("warning: Could not register change state handler\n" - "(Audio can continue looping even after stopping the VM)\n"= ); - } + assert(vmse !=3D NULL); =20 if (!object_property_try_add_child(get_audiodevs_root(), dev->id, OBJE= CT(s), errp)) { goto out; --=20 2.51.0 From nobody Fri Nov 14 18:21:22 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1761116402; cv=none; d=zohomail.com; s=zohoarc; b=h5gjBeVRewCZHAqHoGRITNPinBc++Hsudq/dqdsAji3FHNYVo4+fgf+tNJzCBUR9kX3BeXJt1M0SVAlKhVGsBUnncSN0EsZxLKvbHZif38R4bCkPd5Cy1mHI3LUjWg/t7sufggqdhmQTNLjuJqaYVGqadgpyICSl55s5XDG2H0k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761116402; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=U3qEMyN2Ig2MXdwLXWBdlvpZ1JIUr5GwgkG+gBGafMQ=; b=QgYmzNMRgMZAKLqpi6TLakFuq3ly9Wk4/6wp+mY1ZTdLiNclioWhM6m/iCGzTVhvHHpkkJFrLx54fwutXLO3I6cb6Y0CEgW5G8p7mImOEprNeT3ZvQoQ7L7I9ZOeWqm4zh3pPOgnMEZZ6efzUhv1V+j8Yzfs+EkBbrCaAU09hCE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1761116402811831.6077387168257; Wed, 22 Oct 2025 00:00:02 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vBSoT-0006b5-Aj; Wed, 22 Oct 2025 02:59:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vBSoR-0006UW-Oz for qemu-devel@nongnu.org; Wed, 22 Oct 2025 02:59:11 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vBSoP-0008Jk-Nk for qemu-devel@nongnu.org; Wed, 22 Oct 2025 02:59:11 -0400 Received: from mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-383-i9DThp5rN2GmqwHJ7cvLBg-1; Wed, 22 Oct 2025 02:59:04 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 1A58019560A2; Wed, 22 Oct 2025 06:59:03 +0000 (UTC) Received: from localhost (unknown [10.44.22.9]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id C53E830001BF; Wed, 22 Oct 2025 06:59:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761116347; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=U3qEMyN2Ig2MXdwLXWBdlvpZ1JIUr5GwgkG+gBGafMQ=; b=YQiMal0w4+lpLQNc9myKNdrw6TwnRC70zW4NAVrPOZ9IPDeKW7E9I/xwQWf8yo69WFtxq4 hPcqGFYP+YyUCvAwkL3lu///FwjBdOuGoYZlkSmxSYwjtVNvv7Ep98OF/LQZofS/P+S0yh BitbcIHxVZe8249uVDi0o/3miEQnk7g= X-MC-Unique: i9DThp5rN2GmqwHJ7cvLBg-1 X-Mimecast-MFC-AGG-ID: i9DThp5rN2GmqwHJ7cvLBg_1761116343 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Volker=20R=C3=BCmelin?= , Paolo Bonzini , BALATON Zoltan , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Gerd Hoffmann Subject: [PATCH v2 25/42] audio: clean-up vmstate change handler on finalize Date: Wed, 22 Oct 2025 10:56:20 +0400 Message-ID: <20251022065640.1172785-26-marcandre.lureau@redhat.com> In-Reply-To: <20251022065640.1172785-1-marcandre.lureau@redhat.com> References: <20251022065640.1172785-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1761116405261154102 From: Marc-Andr=C3=A9 Lureau QOM-ification continues. Signed-off-by: Marc-Andr=C3=A9 Lureau --- audio/audio_int.h | 1 + audio/audio.c | 12 ++++++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/audio/audio_int.h b/audio/audio_int.h index 4187a2dbfc..4a4d69f2bf 100644 --- a/audio/audio_int.h +++ b/audio/audio_int.h @@ -235,6 +235,7 @@ typedef struct AudioState { =20 bool timer_running; uint64_t timer_last; + VMChangeStateEntry *vmse; } AudioState; =20 extern const struct mixeng_volume nominal_volume; diff --git a/audio/audio.c b/audio/audio.c index 4478041e5d..b39b86cc2e 100644 --- a/audio/audio.c +++ b/audio/audio.c @@ -1622,6 +1622,9 @@ static void audio_state_init(Object *obj) QLIST_INIT (&s->hw_head_in); QLIST_INIT (&s->cap_head); s->ts =3D timer_new_ns(QEMU_CLOCK_VIRTUAL, audio_timer, s); + + s->vmse =3D qemu_add_vm_change_state_handler(audio_vm_change_state_han= dler, s); + assert(s->vmse !=3D NULL); } =20 static void audio_state_finalize(Object *obj) @@ -1671,6 +1674,11 @@ static void audio_state_finalize(Object *obj) timer_free(s->ts); s->ts =3D NULL; } + + if (s->vmse) { + qemu_del_vm_change_state_handler(s->vmse); + s->vmse =3D NULL; + } } =20 static Object *get_audiodevs_root(void) @@ -1735,7 +1743,6 @@ static AudioState *audio_init(Audiodev *dev, Error **= errp) { int done =3D 0; const char *drvname; - VMChangeStateEntry *vmse; AudioState *s; struct audio_driver *driver; =20 @@ -1775,9 +1782,6 @@ static AudioState *audio_init(Audiodev *dev, Error **= errp) } } =20 - vmse =3D qemu_add_vm_change_state_handler (audio_vm_change_state_handl= er, s); - assert(vmse !=3D NULL); - if (!object_property_try_add_child(get_audiodevs_root(), dev->id, OBJE= CT(s), errp)) { goto out; } --=20 2.51.0 From nobody Fri Nov 14 18:21:22 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1761116762; cv=none; d=zohomail.com; s=zohoarc; b=On02bPi511vp2NrqOhXM51yWyMWkPCcXNHEAd6WZwF1oeaNwDeP6eX0Yzs8BYC/w9cCqQV+apQXkSdhXj8Ux4KHbmrTpOgbgD6k5XNviBmyirdfwYrAHyFmGZ59EA58wkMoQnVcNcfX0udWJLKisypnqzFssr9T43wGzVdyZxss= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761116762; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=YAafkmBEG44dEvteX7fLDwSFhNPhRmmSpWk7ihmCK6E=; b=PkSuYU/uht0rVXYsYcjAH02nbR7hJ5Y5uCgaLAryGk4P8f7qLkRFoQPmQTgWIcSUq2es1B5SWiwl/zqbG8FIgSN6Qwr0PeHq6ZGL3+16vCrHqF80tBxfPkyHHP620pqkSDWfyQPu6skzWr+ADpNNNtiohLNkpszy2GE7kpzI3jI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1761116762409294.4000416835669; Wed, 22 Oct 2025 00:06:02 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vBSoX-0006ip-Gk; Wed, 22 Oct 2025 02:59:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vBSoW-0006hh-5w for qemu-devel@nongnu.org; Wed, 22 Oct 2025 02:59:16 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vBSoU-0008KK-QO for qemu-devel@nongnu.org; Wed, 22 Oct 2025 02:59:15 -0400 Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-106-F7u92J0vP56eHbkFhx5fsg-1; Wed, 22 Oct 2025 02:59:09 -0400 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 9ED8F19540E7; Wed, 22 Oct 2025 06:59:08 +0000 (UTC) Received: from localhost (unknown [10.44.22.9]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 4C5B1180044F; Wed, 22 Oct 2025 06:59:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761116353; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=YAafkmBEG44dEvteX7fLDwSFhNPhRmmSpWk7ihmCK6E=; b=CKBXfnh9Xqt+kWPl5qxM8KBZf2Z7XHWS7A8o8ha5u2RnShYddiqc9U0yKPVC2HWsA2/aeP gbHGaWG+JMAGRrhNwI3TRCNzbUUBxOai86omAk58lyYArANAhtemM+dsbXYNv+16smuRQi DdSoSIP9ivCrzWjJK53yXFj6ULbQ3kQ= X-MC-Unique: F7u92J0vP56eHbkFhx5fsg-1 X-Mimecast-MFC-AGG-ID: F7u92J0vP56eHbkFhx5fsg_1761116348 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Volker=20R=C3=BCmelin?= , Paolo Bonzini , BALATON Zoltan , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Gerd Hoffmann Subject: [PATCH v2 26/42] audio: unregister vmstate description Date: Wed, 22 Oct 2025 10:56:21 +0400 Message-ID: <20251022065640.1172785-27-marcandre.lureau@redhat.com> In-Reply-To: <20251022065640.1172785-1-marcandre.lureau@redhat.com> References: <20251022065640.1172785-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1761116763429154100 From: Marc-Andr=C3=A9 Lureau Signed-off-by: Marc-Andr=C3=A9 Lureau --- audio/audio.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/audio/audio.c b/audio/audio.c index b39b86cc2e..e610e8453a 100644 --- a/audio/audio.c +++ b/audio/audio.c @@ -1614,6 +1614,8 @@ static void audio_vm_change_state_handler (void *opaq= ue, bool running, audio_reset_timer (s); } =20 +static const VMStateDescription vmstate_audio; + static void audio_state_init(Object *obj) { AudioState *s =3D AUDIO_STATE(obj); @@ -1625,6 +1627,8 @@ static void audio_state_init(Object *obj) =20 s->vmse =3D qemu_add_vm_change_state_handler(audio_vm_change_state_han= dler, s); assert(s->vmse !=3D NULL); + + vmstate_register_any(NULL, &vmstate_audio, s); } =20 static void audio_state_finalize(Object *obj) @@ -1679,6 +1683,8 @@ static void audio_state_finalize(Object *obj) qemu_del_vm_change_state_handler(s->vmse); s->vmse =3D NULL; } + + vmstate_unregister(NULL, &vmstate_audio, s); } =20 static Object *get_audiodevs_root(void) @@ -1787,7 +1793,6 @@ static AudioState *audio_init(Audiodev *dev, Error **= errp) } object_unref(s); QLIST_INIT (&s->card_head); - vmstate_register_any(NULL, &vmstate_audio, s); return s; =20 out: --=20 2.51.0 From nobody Fri Nov 14 18:21:22 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1761116582; cv=none; d=zohomail.com; s=zohoarc; b=VH7d7DxWL1jzUOvmxO53pFa81JyrbKIK5idMU97gscIBL+PFeLdcR1NkxtZxXXlg8a0EnKEE3+sAK53OqbdwcrO+FIVWnc+Pxp0AbRGCqPvl5v/MK8JKucb+M689GMzSnMZZbN9GLJ8bLFZZCXJqa/nOP/ie3gsVqjQh1fdeQyQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761116582; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=P57rDjV56wJcNLKbnw+B9+K7vaTUKBKpvQyIeUi4jI4=; b=m3DpSoZqN7/w0+UKJ+PWskCdoAIBbQhBOdFoaiWO1yKNCIOKu6NIZGeQuuzaV/9zwYlCMXBLjyZQTZBPuTJ3kodhz7lqvGFfx2IT+7/+1NilCbaWFBg3cLxEeUiDqGvaL5smRjGoeuXPeNEF8pao+E8sisno6f1A5T0chqolwnM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1761116582938645.6010910612074; Wed, 22 Oct 2025 00:03:02 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vBSom-0007oM-VL; Wed, 22 Oct 2025 02:59:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vBSol-0007gm-1f for qemu-devel@nongnu.org; Wed, 22 Oct 2025 02:59:31 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vBSog-0008LU-1O for qemu-devel@nongnu.org; Wed, 22 Oct 2025 02:59:30 -0400 Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-8-gpWyr1s4Pl-pguAW2Lk5ew-1; Wed, 22 Oct 2025 02:59:23 -0400 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 1275B1869DAC; Wed, 22 Oct 2025 06:59:15 +0000 (UTC) Received: from localhost (unknown [10.44.22.9]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id EA5BD180058D; Wed, 22 Oct 2025 06:59:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761116365; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=P57rDjV56wJcNLKbnw+B9+K7vaTUKBKpvQyIeUi4jI4=; b=NiJc6n7mqILr6sSnRFnYUv/CutKXoGZrXoMG9b5ns8bK+gVAn2DRTaLFGQux9Uap76JMj2 EpbaVIW5rVu3R1hBvLH3xMtqY/Cf9WdzWI2co25l4NCK37q4/nSDKpF9fD/5wUp/hqekmu h6MyNF9XXFof2V+xrJPkj7W7+IieKlk= X-MC-Unique: gpWyr1s4Pl-pguAW2Lk5ew-1 X-Mimecast-MFC-AGG-ID: gpWyr1s4Pl-pguAW2Lk5ew_1761116361 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Volker=20R=C3=BCmelin?= , Paolo Bonzini , BALATON Zoltan , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Gerd Hoffmann Subject: [PATCH v2 27/42] audio: initialize card_head during object init Date: Wed, 22 Oct 2025 10:56:22 +0400 Message-ID: <20251022065640.1172785-28-marcandre.lureau@redhat.com> In-Reply-To: <20251022065640.1172785-1-marcandre.lureau@redhat.com> References: <20251022065640.1172785-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1761116585440154100 From: Marc-Andr=C3=A9 Lureau Signed-off-by: Marc-Andr=C3=A9 Lureau --- audio/audio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/audio/audio.c b/audio/audio.c index e610e8453a..934a67ad19 100644 --- a/audio/audio.c +++ b/audio/audio.c @@ -1623,6 +1623,7 @@ static void audio_state_init(Object *obj) QLIST_INIT (&s->hw_head_out); QLIST_INIT (&s->hw_head_in); QLIST_INIT (&s->cap_head); + QLIST_INIT (&s->card_head); s->ts =3D timer_new_ns(QEMU_CLOCK_VIRTUAL, audio_timer, s); =20 s->vmse =3D qemu_add_vm_change_state_handler(audio_vm_change_state_han= dler, s); @@ -1792,7 +1793,6 @@ static AudioState *audio_init(Audiodev *dev, Error **= errp) goto out; } object_unref(s); - QLIST_INIT (&s->card_head); return s; =20 out: --=20 2.51.0 From nobody Fri Nov 14 18:21:22 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1761116660; cv=none; d=zohomail.com; s=zohoarc; b=eU9P2Js3FCnYMuhdLI+wOvIyfMDMe3IW8bAXVrEqh3fY3pVPaOShn9Ei1QP35FIlV26U2iRooC491Mzlh18E6CPMDnEH6J5NdFlxC05MyvNCpuoJhqfcp705V9Xtbou3OqU04xghYdgUkahWSJy7SXMACrUVQhnBZ1tvx5KM0dk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761116660; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=TGkgJzyrJPclmcCsN9Df1/UmShCK43qWv4Y75ZfMMVk=; b=DR4cjffLlutomlngkw6Isxepcc4kXZ/CWlJXi0sa+70hxRgqW/biw9Cfj6gHZAKLbp3GagSgSYqvDFIFwU59ueVkDtDujWucXSLVGjI04LeOZkia1biHqbZLkOHsvPlqxNUcGakEua2ekIV9EdLyAMXWUA0qvjH5TKuPP9uV5w0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1761116660130654.192259235959; Wed, 22 Oct 2025 00:04:20 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vBSoi-0007QU-2e; Wed, 22 Oct 2025 02:59:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vBSof-0007GL-TR for qemu-devel@nongnu.org; Wed, 22 Oct 2025 02:59:25 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vBSoe-0008L5-5s for qemu-devel@nongnu.org; Wed, 22 Oct 2025 02:59:25 -0400 Received: from mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-645-sF2TYB63OZOo1aXP-Eo6sw-1; Wed, 22 Oct 2025 02:59:21 -0400 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 991E619560B0; Wed, 22 Oct 2025 06:59:20 +0000 (UTC) Received: from localhost (unknown [10.44.22.9]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 449751955F01; Wed, 22 Oct 2025 06:59:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761116363; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=TGkgJzyrJPclmcCsN9Df1/UmShCK43qWv4Y75ZfMMVk=; b=QFOCtYceowUQEmqsjKRLa58LWs3XRqQ8Yk8SOg8PJJj8cjx6yp6w5FGUHQA/Mf1rgrtagn DnjbrxxC9++H0WF7CBi7asErnUkN5szkS3HL+iuduQOnevL6b4i9mrfh1y1KXqZS0AWDjG 4Nr25nZB1WXn+1sxczSlU7dxus5Et/4= X-MC-Unique: sF2TYB63OZOo1aXP-Eo6sw-1 X-Mimecast-MFC-AGG-ID: sF2TYB63OZOo1aXP-Eo6sw_1761116360 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Volker=20R=C3=BCmelin?= , Paolo Bonzini , BALATON Zoltan , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Gerd Hoffmann Subject: [PATCH v2 28/42] audio: remove some needless headers Date: Wed, 22 Oct 2025 10:56:23 +0400 Message-ID: <20251022065640.1172785-29-marcandre.lureau@redhat.com> In-Reply-To: <20251022065640.1172785-1-marcandre.lureau@redhat.com> References: <20251022065640.1172785-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1761116662261154100 From: Marc-Andr=C3=A9 Lureau Signed-off-by: Marc-Andr=C3=A9 Lureau --- audio/audio.h | 1 - audio/audio.c | 3 --- audio/dbusaudio.c | 2 -- audio/dsoundaudio.c | 1 - audio/mixeng.c | 4 +++- audio/noaudio.c | 2 -- audio/wavaudio.c | 3 --- audio/wavcapture.c | 1 - 8 files changed, 3 insertions(+), 14 deletions(-) diff --git a/audio/audio.h b/audio/audio.h index e41c5bc55a..3be0c4f24f 100644 --- a/audio/audio.h +++ b/audio/audio.h @@ -27,7 +27,6 @@ =20 #include "qemu/queue.h" #include "qapi/qapi-types-audio.h" -#include "hw/qdev-properties.h" #include "hw/qdev-properties-system.h" =20 typedef void (*audio_callback_fn) (void *opaque, int avail); diff --git a/audio/audio.c b/audio/audio.c index 934a67ad19..0f3093ad59 100644 --- a/audio/audio.c +++ b/audio/audio.c @@ -25,7 +25,6 @@ #include "qemu/osdep.h" #include "audio.h" #include "migration/vmstate.h" -#include "monitor/monitor.h" #include "qemu/timer.h" #include "qapi/error.h" #include "qapi/clone-visitor.h" @@ -33,7 +32,6 @@ #include "qapi/qapi-visit-audio.h" #include "qapi/qapi-commands-audio.h" #include "qobject/qdict.h" -#include "qemu/cutils.h" #include "qemu/error-report.h" #include "qemu/log.h" #include "qemu/module.h" @@ -41,7 +39,6 @@ #include "system/system.h" #include "system/replay.h" #include "system/runstate.h" -#include "ui/qemu-spice.h" #include "trace.h" =20 #define AUDIO_CAP "audio" diff --git a/audio/dbusaudio.c b/audio/dbusaudio.c index b44fdd1511..908214a170 100644 --- a/audio/dbusaudio.c +++ b/audio/dbusaudio.c @@ -24,9 +24,7 @@ =20 #include "qemu/osdep.h" #include "qemu/error-report.h" -#include "qemu/host-utils.h" #include "qemu/module.h" -#include "qemu/timer.h" #include "qemu/dbus.h" =20 #ifdef G_OS_UNIX diff --git a/audio/dsoundaudio.c b/audio/dsoundaudio.c index 6a8b7f1a19..003ef27365 100644 --- a/audio/dsoundaudio.c +++ b/audio/dsoundaudio.c @@ -31,7 +31,6 @@ =20 #define AUDIO_CAP "dsound" #include "audio_int.h" -#include "qemu/host-utils.h" #include "qemu/module.h" #include "qapi/error.h" =20 diff --git a/audio/mixeng.c b/audio/mixeng.c index 703ee5448f..be38617e9b 100644 --- a/audio/mixeng.c +++ b/audio/mixeng.c @@ -24,11 +24,13 @@ */ #include "qemu/osdep.h" #include "qemu/bswap.h" -#include "qemu/error-report.h" #include "audio.h" =20 #define AUDIO_CAP "mixeng" #include "audio_int.h" +#ifdef FLOAT_MIXENG +#include "qemu/error-report.h" +#endif =20 /* 8 bit */ #define ENDIAN_CONVERSION natural diff --git a/audio/noaudio.c b/audio/noaudio.c index 1b60d8518a..34ff1d2a27 100644 --- a/audio/noaudio.c +++ b/audio/noaudio.c @@ -23,10 +23,8 @@ */ =20 #include "qemu/osdep.h" -#include "qemu/host-utils.h" #include "qemu/module.h" #include "audio.h" -#include "qemu/timer.h" =20 #define AUDIO_CAP "noaudio" #include "audio_int.h" diff --git a/audio/wavaudio.c b/audio/wavaudio.c index a8798a1c42..a098b20cad 100644 --- a/audio/wavaudio.c +++ b/audio/wavaudio.c @@ -23,10 +23,7 @@ */ =20 #include "qemu/osdep.h" -#include "qemu/host-utils.h" #include "qemu/module.h" -#include "qemu/timer.h" -#include "qapi/opts-visitor.h" #include "audio.h" =20 #define AUDIO_CAP "wav" diff --git a/audio/wavcapture.c b/audio/wavcapture.c index c60286e162..b990844d48 100644 --- a/audio/wavcapture.c +++ b/audio/wavcapture.c @@ -1,6 +1,5 @@ #include "qemu/osdep.h" #include "qemu/qemu-print.h" -#include "qapi/error.h" #include "qemu/error-report.h" #include "audio.h" =20 --=20 2.51.0 From nobody Fri Nov 14 18:21:22 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1761116874; cv=none; d=zohomail.com; s=zohoarc; b=RMmJTpE6spw4Zh6qnMvLC6lUr1lxqGfVq15e+kBizWxzQlEKA1N6vZ12vcLRExfP8h/Uu6k3aVR3H8gn67LqkGgEdoYtp3UMH83Fre+HgEyq2f1yY2LIZUqkDVH8L7LRDmVJpFDbsUaM40H3exEf7Y6R47LCUVF8pSHbnBQMXbU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761116874; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=+zxlLJT+GvECd5XVHlTu8gA6K4cRvwAoKgfk0xuOS/8=; b=lrTHxqTBUEkFZCjknO/wORwshcRBUG17McBIm3paiapJPyLzac/xRkr+igPZ9YoLk/j4JtffV9ZXWgbi9B8UwrAJVeAWtBWDBwMLlAdMfcCYjrLAR2twPkH4QBosqLqoOIWZLPeHOBhqI5C9oMoVDuxfKnnSmqugfgR9Q3D1FoU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 17611168743881007.8708185149904; Wed, 22 Oct 2025 00:07:54 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vBSot-00086D-6N; Wed, 22 Oct 2025 02:59:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vBSor-0007za-AS for qemu-devel@nongnu.org; Wed, 22 Oct 2025 02:59:37 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vBSop-0008M2-83 for qemu-devel@nongnu.org; Wed, 22 Oct 2025 02:59:36 -0400 Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-621-52xyCPDyOxCPaTJ2Eui_QA-1; Wed, 22 Oct 2025 02:59:27 -0400 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 273A81956060; Wed, 22 Oct 2025 06:59:26 +0000 (UTC) Received: from localhost (unknown [10.44.22.9]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id C987C19541B2; Wed, 22 Oct 2025 06:59:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761116374; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=+zxlLJT+GvECd5XVHlTu8gA6K4cRvwAoKgfk0xuOS/8=; b=ZolUnLROrXgd+tKIGBeNfXM2suocOvXQ0IKSXV7fQ51a9UTvi3pO1wTdl4KV1g70bRSDPQ fJ5j0H7mobhWv1RBlQpNRU5iu/VyrI7OMgHZIKKRpBTLdr9djViFV6yUHh7KLuR6HR26sv zGikO8wZEatMXSz0Augkp9qz4g6smjA= X-MC-Unique: 52xyCPDyOxCPaTJ2Eui_QA-1 X-Mimecast-MFC-AGG-ID: 52xyCPDyOxCPaTJ2Eui_QA_1761116366 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Volker=20R=C3=BCmelin?= , Paolo Bonzini , BALATON Zoltan , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Gerd Hoffmann , Laurent Vivier Subject: [PATCH v2 29/42] audio: remove AUDIO_HOST_ENDIANNESS Date: Wed, 22 Oct 2025 10:56:24 +0400 Message-ID: <20251022065640.1172785-30-marcandre.lureau@redhat.com> In-Reply-To: <20251022065640.1172785-1-marcandre.lureau@redhat.com> References: <20251022065640.1172785-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1761116876702154100 From: Marc-Andr=C3=A9 Lureau Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- audio/audio.h | 6 ------ audio/audio.c | 6 +++--- audio/spiceaudio.c | 4 ++-- hw/audio/adlib.c | 2 +- hw/audio/asc.c | 2 +- hw/audio/cs4231a.c | 2 +- hw/audio/gus.c | 2 +- 7 files changed, 9 insertions(+), 15 deletions(-) diff --git a/audio/audio.h b/audio/audio.h index 3be0c4f24f..0af911fd9a 100644 --- a/audio/audio.h +++ b/audio/audio.h @@ -31,12 +31,6 @@ =20 typedef void (*audio_callback_fn) (void *opaque, int avail); =20 -#if HOST_BIG_ENDIAN -#define AUDIO_HOST_ENDIANNESS 1 -#else -#define AUDIO_HOST_ENDIANNESS 0 -#endif - typedef struct audsettings { int freq; int nchannels; diff --git a/audio/audio.c b/audio/audio.c index 0f3093ad59..284ea13289 100644 --- a/audio/audio.c +++ b/audio/audio.c @@ -274,7 +274,7 @@ static int audio_pcm_info_eq (struct audio_pcm_info *in= fo, struct audsettings *a && info->is_signed =3D=3D is_signed && info->is_float =3D=3D is_float && info->bits =3D=3D bits - && info->swap_endianness =3D=3D (as->endianness !=3D AUDIO_HOST_EN= DIANNESS); + && info->swap_endianness =3D=3D (as->endianness !=3D HOST_BIG_ENDI= AN); } =20 void audio_pcm_init_info (struct audio_pcm_info *info, struct audsettings = *as) @@ -320,7 +320,7 @@ void audio_pcm_init_info (struct audio_pcm_info *info, = struct audsettings *as) info->nchannels =3D as->nchannels; info->bytes_per_frame =3D as->nchannels * mul; info->bytes_per_second =3D info->freq * info->bytes_per_frame; - info->swap_endianness =3D (as->endianness !=3D AUDIO_HOST_ENDIANNESS); + info->swap_endianness =3D (as->endianness !=3D HOST_BIG_ENDIAN); } =20 void audio_pcm_info_clear_buf (struct audio_pcm_info *info, void *buf, int= len) @@ -2179,7 +2179,7 @@ audsettings audiodev_to_audsettings(AudiodevPerDirect= ionOptions *pdo) .freq =3D pdo->frequency, .nchannels =3D pdo->channels, .fmt =3D pdo->format, - .endianness =3D AUDIO_HOST_ENDIANNESS, + .endianness =3D HOST_BIG_ENDIAN, }; } =20 diff --git a/audio/spiceaudio.c b/audio/spiceaudio.c index 7f02f7285c..7e737bff9a 100644 --- a/audio/spiceaudio.c +++ b/audio/spiceaudio.c @@ -102,7 +102,7 @@ static int line_out_init(HWVoiceOut *hw, struct audsett= ings *as, #endif settings.nchannels =3D SPICE_INTERFACE_PLAYBACK_CHAN; settings.fmt =3D AUDIO_FORMAT_S16; - settings.endianness =3D AUDIO_HOST_ENDIANNESS; + settings.endianness =3D HOST_BIG_ENDIAN; =20 audio_pcm_init_info (&hw->info, &settings); hw->samples =3D LINE_OUT_SAMPLES; @@ -218,7 +218,7 @@ static int line_in_init(HWVoiceIn *hw, struct audsettin= gs *as, void *drv_opaque) #endif settings.nchannels =3D SPICE_INTERFACE_RECORD_CHAN; settings.fmt =3D AUDIO_FORMAT_S16; - settings.endianness =3D AUDIO_HOST_ENDIANNESS; + settings.endianness =3D HOST_BIG_ENDIAN; =20 audio_pcm_init_info (&hw->info, &settings); hw->samples =3D LINE_IN_SAMPLES; diff --git a/hw/audio/adlib.c b/hw/audio/adlib.c index 0bc0359ae6..50bbb97a56 100644 --- a/hw/audio/adlib.c +++ b/hw/audio/adlib.c @@ -272,7 +272,7 @@ static void adlib_realizefn (DeviceState *dev, Error **= errp) as.freq =3D s->freq; as.nchannels =3D SHIFT; as.fmt =3D AUDIO_FORMAT_S16; - as.endianness =3D AUDIO_HOST_ENDIANNESS; + as.endianness =3D HOST_BIG_ENDIAN; =20 s->voice =3D AUD_open_out ( &s->card, diff --git a/hw/audio/asc.c b/hw/audio/asc.c index edd42d6d91..41472dc2e3 100644 --- a/hw/audio/asc.c +++ b/hw/audio/asc.c @@ -650,7 +650,7 @@ static void asc_realize(DeviceState *dev, Error **errp) as.freq =3D ASC_FREQ; as.nchannels =3D 2; as.fmt =3D AUDIO_FORMAT_U8; - as.endianness =3D AUDIO_HOST_ENDIANNESS; + as.endianness =3D HOST_BIG_ENDIAN; =20 s->voice =3D AUD_open_out(&s->card, s->voice, "asc.out", s, asc_out_cb, &as); diff --git a/hw/audio/cs4231a.c b/hw/audio/cs4231a.c index 18db8da324..c8837fe269 100644 --- a/hw/audio/cs4231a.c +++ b/hw/audio/cs4231a.c @@ -305,7 +305,7 @@ static void cs_reset_voices (CSState *s, uint32_t val) s->tab =3D ALawDecompressTable; x_law: as.fmt =3D AUDIO_FORMAT_S16; - as.endianness =3D AUDIO_HOST_ENDIANNESS; + as.endianness =3D HOST_BIG_ENDIAN; s->shift =3D as.nchannels =3D=3D 2; break; =20 diff --git a/hw/audio/gus.c b/hw/audio/gus.c index 16785ce226..2c84740adf 100644 --- a/hw/audio/gus.c +++ b/hw/audio/gus.c @@ -254,7 +254,7 @@ static void gus_realizefn (DeviceState *dev, Error **er= rp) as.freq =3D s->freq; as.nchannels =3D 2; as.fmt =3D AUDIO_FORMAT_S16; - as.endianness =3D AUDIO_HOST_ENDIANNESS; + as.endianness =3D HOST_BIG_ENDIAN; =20 s->voice =3D AUD_open_out ( &s->card, --=20 2.51.0 From nobody Fri Nov 14 18:21:22 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1761116403; cv=none; d=zohomail.com; s=zohoarc; b=ncTO7ZVYrHZ4HjskA6xH3F749pYfwDT9NOJCF/f9na11XpxjhvdbTff2QZO2lRh51kFDsRFXxmJvPtj4T5VdxYdbf0rCBP8lqjMx3VI4/3zgNRAb++39CTnqrc/UDwQ4ZBreWFTvsOx4eHRrQL5N2fOPGzapSXrovRlIzZcHz/A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761116403; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=diOv9EHv5g2wvAeeVNhVdb4+wKRzzCXow7Ys5XqMn1A=; b=DUMtO2i7ks6VxbOQ0M8271NFbLeiV4vEgDagKOg9hFb0+p/oJeZefMAkG7qAf22UZI1OY1iRlydZrA2+QySMxJop57WoxRZOtfWniO1GAgSxeY355A/oOWKPNCyMj5ydNmjlU3HVg8DsNBM2DC9vbZab5b8RzPkxI7ASLitl3gk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1761116403147797.6780522494261; Wed, 22 Oct 2025 00:00:03 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vBSp7-0000YT-He; Wed, 22 Oct 2025 02:59:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vBSp6-0000UJ-71 for qemu-devel@nongnu.org; Wed, 22 Oct 2025 02:59:52 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vBSoz-0008Mv-9i for qemu-devel@nongnu.org; Wed, 22 Oct 2025 02:59:51 -0400 Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-140-fc_pHtpBO2qGecs2U5-AsQ-1; Wed, 22 Oct 2025 02:59:39 -0400 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 48DD6180A228; Wed, 22 Oct 2025 06:59:32 +0000 (UTC) Received: from localhost (unknown [10.44.22.9]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 3C4F2180057D; Wed, 22 Oct 2025 06:59:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761116382; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=diOv9EHv5g2wvAeeVNhVdb4+wKRzzCXow7Ys5XqMn1A=; b=dg0nzf9amzM4fg2TzN6glmQxRDEH3KKtQrpwGCNvwdv2MtqYje1G3M0+TMAlrSKNLVZBVa PMSOubtrL+/J4QiGhK3bs7UuUZ3gqTpTHtJLftvTEON+54oLSMsarOSBjvTq3CliPiCvjW SuV9j2vXriLEpeZKSPxojjaue2dsBPU= X-MC-Unique: fc_pHtpBO2qGecs2U5-AsQ-1 X-Mimecast-MFC-AGG-ID: fc_pHtpBO2qGecs2U5-AsQ_1761116378 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Volker=20R=C3=BCmelin?= , Paolo Bonzini , BALATON Zoltan , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Gerd Hoffmann , Laurent Vivier , Manos Pitsidianakis , "Michael S. Tsirkin" , Alistair Francis , "Edgar E. Iglesias" , Peter Maydell , qemu-arm@nongnu.org (open list:Xilinx ZynqMP and...) Subject: [PATCH v2 30/42] audio: introduce AUD_set_volume_{in,out}_lr() Date: Wed, 22 Oct 2025 10:56:25 +0400 Message-ID: <20251022065640.1172785-31-marcandre.lureau@redhat.com> In-Reply-To: <20251022065640.1172785-1-marcandre.lureau@redhat.com> References: <20251022065640.1172785-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1761116405270154100 From: Marc-Andr=C3=A9 Lureau Keep the AUD_ prefix for consistency. Introduce a macro to call the more flexible Volume function. Signed-off-by: Marc-Andr=C3=A9 Lureau --- audio/audio.h | 8 ++++---- audio/audio.c | 16 ++-------------- hw/audio/ac97.c | 4 ++-- hw/audio/asc.c | 2 +- hw/audio/hda-codec.c | 4 ++-- hw/audio/lm4549.c | 2 +- hw/audio/via-ac97.c | 2 +- hw/audio/virtio-snd.c | 4 ++-- hw/audio/wm8750.c | 12 ++++++------ hw/display/xlnx_dp.c | 2 +- hw/usb/dev-audio.c | 4 ++-- 11 files changed, 24 insertions(+), 36 deletions(-) diff --git a/audio/audio.h b/audio/audio.h index 0af911fd9a..2175223ef6 100644 --- a/audio/audio.h +++ b/audio/audio.h @@ -119,8 +119,8 @@ int AUD_is_active_out (SWVoiceOut *sw); void AUD_init_time_stamp_out (SWVoiceOut *sw, QEMUAudioTimeStamp *ts); uint64_t AUD_get_elapsed_usec_out (SWVoiceOut *sw, QEMUAudioTimeStamp *ts); =20 -void AUD_set_volume_out (SWVoiceOut *sw, int mute, uint8_t lvol, uint8_t r= vol); -void AUD_set_volume_in (SWVoiceIn *sw, int mute, uint8_t lvol, uint8_t rvo= l); +#define AUD_set_volume_out_lr(sw, mut, lvol, rvol) AUD_set_volume_out(sw, = &(Volume) { .mute =3D mut, .channels =3D 2, .vol =3D { lvol, rvol } }) +#define AUD_set_volume_in_lr(sw, mut, lvol, rvol) AUD_set_volume_in(sw, &(= Volume) { .mute =3D mut, .channels =3D 2, .vol =3D { lvol, rvol } }) =20 #define AUDIO_MAX_CHANNELS 16 typedef struct Volume { @@ -129,8 +129,8 @@ typedef struct Volume { uint8_t vol[AUDIO_MAX_CHANNELS]; } Volume; =20 -void audio_set_volume_out(SWVoiceOut *sw, Volume *vol); -void audio_set_volume_in(SWVoiceIn *sw, Volume *vol); +void AUD_set_volume_out(SWVoiceOut *sw, Volume *vol); +void AUD_set_volume_in(SWVoiceIn *sw, Volume *vol); =20 SWVoiceIn *AUD_open_in ( QEMUSoundCard *card, diff --git a/audio/audio.c b/audio/audio.c index 284ea13289..9e6d79b4e3 100644 --- a/audio/audio.c +++ b/audio/audio.c @@ -1949,13 +1949,7 @@ void AUD_del_capture (CaptureVoiceOut *cap, void *cb= _opaque) } } =20 -void AUD_set_volume_out (SWVoiceOut *sw, int mute, uint8_t lvol, uint8_t r= vol) -{ - Volume vol =3D { .mute =3D mute, .channels =3D 2, .vol =3D { lvol, rvo= l } }; - audio_set_volume_out(sw, &vol); -} - -void audio_set_volume_out(SWVoiceOut *sw, Volume *vol) +void AUD_set_volume_out(SWVoiceOut *sw, Volume *vol) { if (sw) { HWVoiceOut *hw =3D sw->hw; @@ -1971,13 +1965,7 @@ void audio_set_volume_out(SWVoiceOut *sw, Volume *vo= l) } } =20 -void AUD_set_volume_in (SWVoiceIn *sw, int mute, uint8_t lvol, uint8_t rvo= l) -{ - Volume vol =3D { .mute =3D mute, .channels =3D 2, .vol =3D { lvol, rvo= l } }; - audio_set_volume_in(sw, &vol); -} - -void audio_set_volume_in(SWVoiceIn *sw, Volume *vol) +void AUD_set_volume_in(SWVoiceIn *sw, Volume *vol) { if (sw) { HWVoiceIn *hw =3D sw->hw; diff --git a/hw/audio/ac97.c b/hw/audio/ac97.c index 3d3c667e86..9157588dbc 100644 --- a/hw/audio/ac97.c +++ b/hw/audio/ac97.c @@ -414,7 +414,7 @@ static void update_combined_volume_out(AC97LinkState *s) lvol =3D (lvol * plvol) / 255; rvol =3D (rvol * prvol) / 255; =20 - AUD_set_volume_out(s->voice_po, mute, lvol, rvol); + AUD_set_volume_out_lr(s->voice_po, mute, lvol, rvol); } =20 static void update_volume_in(AC97LinkState *s) @@ -425,7 +425,7 @@ static void update_volume_in(AC97LinkState *s) get_volume(mixer_load(s, AC97_Record_Gain_Mute), 0x0f, 0, &mute, &lvol, &rvol); =20 - AUD_set_volume_in(s->voice_pi, mute, lvol, rvol); + AUD_set_volume_in_lr(s->voice_pi, mute, lvol, rvol); } =20 static void set_volume(AC97LinkState *s, int index, uint32_t val) diff --git a/hw/audio/asc.c b/hw/audio/asc.c index 41472dc2e3..991316e984 100644 --- a/hw/audio/asc.c +++ b/hw/audio/asc.c @@ -489,7 +489,7 @@ static void asc_write(void *opaque, hwaddr addr, uint64= _t value, { int vol =3D (value & 0xe0); =20 - AUD_set_volume_out(s->voice, 0, vol, vol); + AUD_set_volume_out_lr(s->voice, 0, vol, vol); break; } } diff --git a/hw/audio/hda-codec.c b/hw/audio/hda-codec.c index 66edad280f..cc87557954 100644 --- a/hw/audio/hda-codec.c +++ b/hw/audio/hda-codec.c @@ -466,9 +466,9 @@ static void hda_audio_set_amp(HDAAudioStream *st) return; } if (st->output) { - AUD_set_volume_out(st->voice.out, muted, left, right); + AUD_set_volume_out_lr(st->voice.out, muted, left, right); } else { - AUD_set_volume_in(st->voice.in, muted, left, right); + AUD_set_volume_in_lr(st->voice.in, muted, left, right); } } =20 diff --git a/hw/audio/lm4549.c b/hw/audio/lm4549.c index a4a77c8dc6..dccbf56068 100644 --- a/hw/audio/lm4549.c +++ b/hw/audio/lm4549.c @@ -308,7 +308,7 @@ void lm4549_init(lm4549_state *s, lm4549_callback data_= req_cb, void* opaque, &as ); =20 - AUD_set_volume_out(s->voice, 0, 255, 255); + AUD_set_volume_out_lr(s->voice, 0, 255, 255); =20 s->voice_is_active =3D 0; =20 diff --git a/hw/audio/via-ac97.c b/hw/audio/via-ac97.c index d5231e1cf2..62341e5600 100644 --- a/hw/audio/via-ac97.c +++ b/hw/audio/via-ac97.c @@ -53,7 +53,7 @@ static void codec_volume_set_out(ViaAC97State *s) rvol /=3D 255; mute =3D CODEC_REG(s, AC97_Master_Volume_Mute) >> MUTE_SHIFT; mute |=3D CODEC_REG(s, AC97_PCM_Out_Volume_Mute) >> MUTE_SHIFT; - AUD_set_volume_out(s->vo, mute, lvol, rvol); + AUD_set_volume_out_lr(s->vo, mute, lvol, rvol); } =20 static void codec_reset(ViaAC97State *s) diff --git a/hw/audio/virtio-snd.c b/hw/audio/virtio-snd.c index eca3319e59..88777977a9 100644 --- a/hw/audio/virtio-snd.c +++ b/hw/audio/virtio-snd.c @@ -463,7 +463,7 @@ static uint32_t virtio_snd_pcm_prepare(VirtIOSound *s, = uint32_t stream_id) stream, virtio_snd_pcm_out_cb, &as); - AUD_set_volume_out(stream->voice.out, 0, 255, 255); + AUD_set_volume_out_lr(stream->voice.out, 0, 255, 255); } else { stream->voice.in =3D AUD_open_in(&s->card, stream->voice.in, @@ -471,7 +471,7 @@ static uint32_t virtio_snd_pcm_prepare(VirtIOSound *s, = uint32_t stream_id) stream, virtio_snd_pcm_in_cb, &as); - AUD_set_volume_in(stream->voice.in, 0, 255, 255); + AUD_set_volume_in_lr(stream->voice.in, 0, 255, 255); } =20 return cpu_to_le32(VIRTIO_SND_S_OK); diff --git a/hw/audio/wm8750.c b/hw/audio/wm8750.c index 2846b55fe2..7a36c4bd3f 100644 --- a/hw/audio/wm8750.c +++ b/hw/audio/wm8750.c @@ -145,30 +145,30 @@ static void wm8750_vol_update(WM8750State *s) { /* FIXME: multiply all volumes by s->invol[2], s->invol[3] */ =20 - AUD_set_volume_in(s->adc_voice[0], s->mute, + AUD_set_volume_in_lr(s->adc_voice[0], s->mute, s->inmute[0] ? 0 : WM8750_INVOL_TRANSFORM(s->invol[0]), s->inmute[1] ? 0 : WM8750_INVOL_TRANSFORM(s->invol[1])= ); - AUD_set_volume_in(s->adc_voice[1], s->mute, + AUD_set_volume_in_lr(s->adc_voice[1], s->mute, s->inmute[0] ? 0 : WM8750_INVOL_TRANSFORM(s->invol[0]), s->inmute[1] ? 0 : WM8750_INVOL_TRANSFORM(s->invol[1])= ); - AUD_set_volume_in(s->adc_voice[2], s->mute, + AUD_set_volume_in_lr(s->adc_voice[2], s->mute, s->inmute[0] ? 0 : WM8750_INVOL_TRANSFORM(s->invol[0]), s->inmute[1] ? 0 : WM8750_INVOL_TRANSFORM(s->invol[1])= ); =20 /* FIXME: multiply all volumes by s->outvol[0], s->outvol[1] */ =20 /* Speaker: LOUT2VOL ROUT2VOL */ - AUD_set_volume_out(s->dac_voice[0], s->mute, + AUD_set_volume_out_lr(s->dac_voice[0], s->mute, s->outmute[0] ? 0 : WM8750_OUTVOL_TRANSFORM(s->outvol[= 4]), s->outmute[1] ? 0 : WM8750_OUTVOL_TRANSFORM(s->outvol[= 5])); =20 /* Headphone: LOUT1VOL ROUT1VOL */ - AUD_set_volume_out(s->dac_voice[1], s->mute, + AUD_set_volume_out_lr(s->dac_voice[1], s->mute, s->outmute[0] ? 0 : WM8750_OUTVOL_TRANSFORM(s->outvol[= 2]), s->outmute[1] ? 0 : WM8750_OUTVOL_TRANSFORM(s->outvol[= 3])); =20 /* MONOOUT: MONOVOL MONOVOL */ - AUD_set_volume_out(s->dac_voice[2], s->mute, + AUD_set_volume_out_lr(s->dac_voice[2], s->mute, s->outmute[0] ? 0 : WM8750_OUTVOL_TRANSFORM(s->outvol[= 6]), s->outmute[1] ? 0 : WM8750_OUTVOL_TRANSFORM(s->outvol[= 6])); } diff --git a/hw/display/xlnx_dp.c b/hw/display/xlnx_dp.c index ef73e1815f..882ae3c4b4 100644 --- a/hw/display/xlnx_dp.c +++ b/hw/display/xlnx_dp.c @@ -1334,7 +1334,7 @@ static void xlnx_dp_realize(DeviceState *dev, Error *= *errp) s, xlnx_dp_audio_callback, &as); - AUD_set_volume_out(s->amixer_output_stream, 0, 255, 255); + AUD_set_volume_out_lr(s->amixer_output_stream, 0, 255, 255); xlnx_dp_audio_activate(s); s->vblank =3D ptimer_init(vblank_hit, s, DP_VBLANK_PTIMER_POLICY); ptimer_transaction_begin(s->vblank); diff --git a/hw/usb/dev-audio.c b/hw/usb/dev-audio.c index 26af709f31..f59e5a53f0 100644 --- a/hw/usb/dev-audio.c +++ b/hw/usb/dev-audio.c @@ -805,7 +805,7 @@ static int usb_audio_set_control(USBAudioState *s, uint= 8_t attrib, } fprintf(stderr, "\n"); } - audio_set_volume_out(s->out.voice, &s->out.vol); + AUD_set_volume_out(s->out.voice, &s->out.vol); } =20 return ret; @@ -981,7 +981,7 @@ static void usb_audio_reinit(USBDevice *dev, unsigned c= hannels) =20 s->out.voice =3D AUD_open_out(&s->card, s->out.voice, TYPE_USB_AUDIO, s, output_callback, &s->out.as); - audio_set_volume_out(s->out.voice, &s->out.vol); + AUD_set_volume_out(s->out.voice, &s->out.vol); AUD_set_active_out(s->out.voice, 0); } =20 --=20 2.51.0 From nobody Fri Nov 14 18:21:23 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1761116527; cv=none; d=zohomail.com; s=zohoarc; b=IFrhWfbxtApdLIo/w4+I9bhjuTDM7NHOYV0xyErwLuPpCQVp8nmJ/NSy2D6qS+NsjN1512ssh38Qcs3qFr6yBklHH9KSVfej01LDwrd9ic2cQ4zIKMfOXVMxcmWR0DHJjogxWratsv7p+vhhhoeijaIQATfK0c793zPuHJ5ah7c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761116527; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=DqVV/DhfUVmiAsOuDOS5NZyZJD1edNdISD6WpYTmcrA=; b=Lltu8MSW+UUej+FW3Fbtm+IMv9G8eLul48Wm8tklXskpQdMfqg0cuftTAx8tUHWRdtZ9z20vhwR247UG9LdRhLp5pu8vuji0OEZ5ALKrGgQrrOwXnm0GXDoMzBIZTDD65ZOYc0aYCCamW7X4jxtEeEkmE8jSado9A0KTwJkeWa8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1761116527232536.2533452973694; Wed, 22 Oct 2025 00:02:07 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vBSp8-0000YW-Ic; Wed, 22 Oct 2025 02:59:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vBSp5-0000V7-VR for qemu-devel@nongnu.org; Wed, 22 Oct 2025 02:59:52 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vBSp2-0008NL-2L for qemu-devel@nongnu.org; Wed, 22 Oct 2025 02:59:51 -0400 Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-318-QqFVV9VTPQqqHsJrMUo_fQ-1; Wed, 22 Oct 2025 02:59:42 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 793AC1805C28; Wed, 22 Oct 2025 06:59:38 +0000 (UTC) Received: from localhost (unknown [10.44.22.9]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 60B3D3000225; Wed, 22 Oct 2025 06:59:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761116386; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=DqVV/DhfUVmiAsOuDOS5NZyZJD1edNdISD6WpYTmcrA=; b=UwEUmo95hJotrrkT6ALlm2QZ1TKdRawELoTD+ylueUnuAVjzBK4gr7+8wpDBWlxR/ekvR5 I3JtvKAOvXA/0MmQ/vJmnrD0wMcc6QjFCIKRsRTq5vPdrVuaj6ZnFlofDKmRmJqnT08+Sr XhHq3WnZIdUyMXUxKDZ75Oe2sWw8ZLI= X-MC-Unique: QqFVV9VTPQqqHsJrMUo_fQ-1 X-Mimecast-MFC-AGG-ID: QqFVV9VTPQqqHsJrMUo_fQ_1761116381 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Volker=20R=C3=BCmelin?= , Paolo Bonzini , BALATON Zoltan , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Gerd Hoffmann Subject: [PATCH v2 31/42] hw/audio: replace AUD_log() usage Date: Wed, 22 Oct 2025 10:56:26 +0400 Message-ID: <20251022065640.1172785-32-marcandre.lureau@redhat.com> In-Reply-To: <20251022065640.1172785-1-marcandre.lureau@redhat.com> References: <20251022065640.1172785-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -10 X-Spam_score: -1.1 X-Spam_bar: - X-Spam_report: (-1.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, URI_DOTEDU=1 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1761116530522158500 From: Marc-Andr=C3=A9 Lureau AUD_log() is just printf(stderr, "prefix: "..), we can use error_report() or warn_report() appropriately instead. Ideally it should be converted to traces, but there are many places to convert, this is left for another day. Avoid bit-rot by using conditionals. The patch could be splitted if necessary. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- hw/audio/ac97.c | 120 ++++++++++++++++++++++----------------------- hw/audio/adlib.c | 20 +++----- hw/audio/cs4231a.c | 40 +++++++-------- hw/audio/es1370.c | 24 ++++----- hw/audio/gus.c | 21 ++++---- hw/audio/pcspk.c | 2 +- hw/audio/sb16.c | 93 +++++++++++++++++------------------ 7 files changed, 151 insertions(+), 169 deletions(-) diff --git a/hw/audio/ac97.c b/hw/audio/ac97.c index 9157588dbc..1b2ce601a6 100644 --- a/hw/audio/ac97.c +++ b/hw/audio/ac97.c @@ -26,6 +26,7 @@ #include "qemu/module.h" #include "system/dma.h" #include "qom/object.h" +#include "qemu/error-report.h" #include "ac97.h" =20 #define SOFT_VOLUME @@ -141,11 +142,8 @@ enum { BUP_LAST =3D 2 }; =20 -#ifdef DEBUG_AC97 -#define dolog(...) AUD_log("ac97", __VA_ARGS__) -#else -#define dolog(...) -#endif +#define DEBUG_AC97 0 +#define dolog(fmt, ...) do { if (DEBUG_AC97) error_report("ac97: " fmt, ##= __VA_ARGS__); } while (0) =20 #define MKREGS(prefix, start) \ enum { \ @@ -190,7 +188,7 @@ static void fetch_bd(AC97LinkState *s, AC97BusMasterReg= s *r) r->bd.addr =3D le32_to_cpu(*(uint32_t *) &b[0]) & ~3; r->bd.ctl_len =3D le32_to_cpu(*(uint32_t *) &b[4]); r->picb =3D r->bd.ctl_len & 0xffff; - dolog("bd %2d addr=3D0x%x ctl=3D0x%06x len=3D0x%x(%d bytes)\n", + dolog("bd %2d addr=3D0x%x ctl=3D0x%06x len=3D0x%x(%d bytes)", r->civ, r->bd.addr, r->bd.ctl_len >> 16, r->bd.ctl_len & 0xffff, (r->bd.ctl_len & 0xffff) << 1); } @@ -222,7 +220,7 @@ static void update_sr(AC97LinkState *s, AC97BusMasterRe= gs *r, uint32_t new_sr) =20 r->sr =3D new_sr; =20 - dolog("IOC%d LVB%d sr=3D0x%x event=3D%d level=3D%d\n", + dolog("IOC%d LVB%d sr=3D0x%x event=3D%d level=3D%d", r->sr & SR_BCIS, r->sr & SR_LVBCI, r->sr, event, level); =20 if (!event) { @@ -231,11 +229,11 @@ static void update_sr(AC97LinkState *s, AC97BusMaster= Regs *r, uint32_t new_sr) =20 if (level) { s->glob_sta |=3D masks[r - s->bm_regs]; - dolog("set irq level=3D1\n"); + dolog("set irq level=3D1"); pci_irq_assert(&s->dev); } else { s->glob_sta &=3D ~masks[r - s->bm_regs]; - dolog("set irq level=3D0\n"); + dolog("set irq level=3D0"); pci_irq_deassert(&s->dev); } } @@ -256,14 +254,14 @@ static void voice_set_active(AC97LinkState *s, int bm= _index, int on) break; =20 default: - AUD_log("ac97", "invalid bm_index(%d) in voice_set_active", bm_ind= ex); + error_report("ac97: invalid bm_index(%d) in voice_set_active", bm_= index); break; } } =20 static void reset_bm_regs(AC97LinkState *s, AC97BusMasterRegs *r) { - dolog("reset_bm_regs\n"); + dolog("reset_bm_regs"); r->bdbar =3D 0; r->civ =3D 0; r->lvi =3D 0; @@ -281,7 +279,7 @@ static void reset_bm_regs(AC97LinkState *s, AC97BusMast= erRegs *r) static void mixer_store(AC97LinkState *s, uint32_t i, uint16_t v) { if (i + 2 > sizeof(s->mixer_data)) { - dolog("mixer_store: index %d out of bounds %zd\n", + dolog("mixer_store: index %d out of bounds %zd", i, sizeof(s->mixer_data)); return; } @@ -295,7 +293,7 @@ static uint16_t mixer_load(AC97LinkState *s, uint32_t i) uint16_t val =3D 0xffff; =20 if (i + 2 > sizeof(s->mixer_data)) { - dolog("mixer_load: index %d out of bounds %zd\n", + dolog("mixer_load: index %d out of bounds %zd", i, sizeof(s->mixer_data)); } else { val =3D s->mixer_data[i + 0] | (s->mixer_data[i + 1] << 8); @@ -460,7 +458,7 @@ static void mixer_reset(AC97LinkState *s) { uint8_t active[LAST_INDEX]; =20 - dolog("mixer_reset\n"); + dolog("mixer_reset"); memset(s->mixer_data, 0, sizeof(s->mixer_data)); memset(active, 0, sizeof(active)); mixer_store(s, AC97_Reset, 0x0000); /* 6940 */ @@ -508,7 +506,7 @@ static void mixer_reset(AC97LinkState *s) static uint32_t nam_readb(void *opaque, uint32_t addr) { AC97LinkState *s =3D opaque; - dolog("U nam readb 0x%x\n", addr); + dolog("U nam readb 0x%x", addr); s->cas =3D 0; return ~0U; } @@ -523,7 +521,7 @@ static uint32_t nam_readw(void *opaque, uint32_t addr) static uint32_t nam_readl(void *opaque, uint32_t addr) { AC97LinkState *s =3D opaque; - dolog("U nam readl 0x%x\n", addr); + dolog("U nam readl 0x%x", addr); s->cas =3D 0; return ~0U; } @@ -535,7 +533,7 @@ static uint32_t nam_readl(void *opaque, uint32_t addr) static void nam_writeb(void *opaque, uint32_t addr, uint32_t val) { AC97LinkState *s =3D opaque; - dolog("U nam writeb 0x%x <- 0x%x\n", addr, val); + dolog("U nam writeb 0x%x <- 0x%x", addr, val); s->cas =3D 0; } =20 @@ -563,10 +561,10 @@ static void nam_writew(void *opaque, uint32_t addr, u= int32_t val) break; case AC97_Vendor_ID1: case AC97_Vendor_ID2: - dolog("Attempt to write vendor ID to 0x%x\n", val); + dolog("Attempt to write vendor ID to 0x%x", val); break; case AC97_Extended_Audio_ID: - dolog("Attempt to write extended audio ID to 0x%x\n", val); + dolog("Attempt to write extended audio ID to 0x%x", val); break; case AC97_Extended_Audio_Ctrl_Stat: if (!(val & EACS_VRA)) { @@ -579,36 +577,36 @@ static void nam_writew(void *opaque, uint32_t addr, u= int32_t val) mixer_store(s, AC97_MIC_ADC_Rate, 0xbb80); open_voice(s, MC_INDEX, 48000); } - dolog("Setting extended audio control to 0x%x\n", val); + dolog("Setting extended audio control to 0x%x", val); mixer_store(s, AC97_Extended_Audio_Ctrl_Stat, val); break; case AC97_PCM_Front_DAC_Rate: if (mixer_load(s, AC97_Extended_Audio_Ctrl_Stat) & EACS_VRA) { mixer_store(s, addr, val); - dolog("Set front DAC rate to %d\n", val); + dolog("Set front DAC rate to %d", val); open_voice(s, PO_INDEX, val); } else { - dolog("Attempt to set front DAC rate to %d, but VRA is not set= \n", + dolog("Attempt to set front DAC rate to %d, but VRA is not set= ", val); } break; case AC97_MIC_ADC_Rate: if (mixer_load(s, AC97_Extended_Audio_Ctrl_Stat) & EACS_VRM) { mixer_store(s, addr, val); - dolog("Set MIC ADC rate to %d\n", val); + dolog("Set MIC ADC rate to %d", val); open_voice(s, MC_INDEX, val); } else { - dolog("Attempt to set MIC ADC rate to %d, but VRM is not set\n= ", + dolog("Attempt to set MIC ADC rate to %d, but VRM is not set", val); } break; case AC97_PCM_LR_ADC_Rate: if (mixer_load(s, AC97_Extended_Audio_Ctrl_Stat) & EACS_VRA) { mixer_store(s, addr, val); - dolog("Set front LR ADC rate to %d\n", val); + dolog("Set front LR ADC rate to %d", val); open_voice(s, PI_INDEX, val); } else { - dolog("Attempt to set LR ADC rate to %d, but VRA is not set\n", + dolog("Attempt to set LR ADC rate to %d, but VRA is not set", val); } break; @@ -630,7 +628,7 @@ static void nam_writew(void *opaque, uint32_t addr, uin= t32_t val) /* None of the features in these regs are emulated, so they are RO= */ break; default: - dolog("U nam writew 0x%x <- 0x%x\n", addr, val); + dolog("U nam writew 0x%x <- 0x%x", addr, val); mixer_store(s, addr, val); break; } @@ -639,7 +637,7 @@ static void nam_writew(void *opaque, uint32_t addr, uin= t32_t val) static void nam_writel(void *opaque, uint32_t addr, uint32_t val) { AC97LinkState *s =3D opaque; - dolog("U nam writel 0x%x <- 0x%x\n", addr, val); + dolog("U nam writel 0x%x <- 0x%x", addr, val); s->cas =3D 0; } =20 @@ -655,7 +653,7 @@ static uint32_t nabm_readb(void *opaque, uint32_t addr) =20 switch (addr) { case CAS: - dolog("CAS %d\n", s->cas); + dolog("CAS %d", s->cas); val =3D s->cas; s->cas =3D 1; break; @@ -664,38 +662,38 @@ static uint32_t nabm_readb(void *opaque, uint32_t add= r) case MC_CIV: r =3D &s->bm_regs[GET_BM(addr)]; val =3D r->civ; - dolog("CIV[%d] -> 0x%x\n", GET_BM(addr), val); + dolog("CIV[%d] -> 0x%x", GET_BM(addr), val); break; case PI_LVI: case PO_LVI: case MC_LVI: r =3D &s->bm_regs[GET_BM(addr)]; val =3D r->lvi; - dolog("LVI[%d] -> 0x%x\n", GET_BM(addr), val); + dolog("LVI[%d] -> 0x%x", GET_BM(addr), val); break; case PI_PIV: case PO_PIV: case MC_PIV: r =3D &s->bm_regs[GET_BM(addr)]; val =3D r->piv; - dolog("PIV[%d] -> 0x%x\n", GET_BM(addr), val); + dolog("PIV[%d] -> 0x%x", GET_BM(addr), val); break; case PI_CR: case PO_CR: case MC_CR: r =3D &s->bm_regs[GET_BM(addr)]; val =3D r->cr; - dolog("CR[%d] -> 0x%x\n", GET_BM(addr), val); + dolog("CR[%d] -> 0x%x", GET_BM(addr), val); break; case PI_SR: case PO_SR: case MC_SR: r =3D &s->bm_regs[GET_BM(addr)]; val =3D r->sr & 0xff; - dolog("SRb[%d] -> 0x%x\n", GET_BM(addr), val); + dolog("SRb[%d] -> 0x%x", GET_BM(addr), val); break; default: - dolog("U nabm readb 0x%x -> 0x%x\n", addr, val); + dolog("U nabm readb 0x%x -> 0x%x", addr, val); break; } return val; @@ -713,17 +711,17 @@ static uint32_t nabm_readw(void *opaque, uint32_t add= r) case MC_SR: r =3D &s->bm_regs[GET_BM(addr)]; val =3D r->sr; - dolog("SR[%d] -> 0x%x\n", GET_BM(addr), val); + dolog("SR[%d] -> 0x%x", GET_BM(addr), val); break; case PI_PICB: case PO_PICB: case MC_PICB: r =3D &s->bm_regs[GET_BM(addr)]; val =3D r->picb; - dolog("PICB[%d] -> 0x%x\n", GET_BM(addr), val); + dolog("PICB[%d] -> 0x%x", GET_BM(addr), val); break; default: - dolog("U nabm readw 0x%x -> 0x%x\n", addr, val); + dolog("U nabm readw 0x%x -> 0x%x", addr, val); break; } return val; @@ -741,14 +739,14 @@ static uint32_t nabm_readl(void *opaque, uint32_t add= r) case MC_BDBAR: r =3D &s->bm_regs[GET_BM(addr)]; val =3D r->bdbar; - dolog("BMADDR[%d] -> 0x%x\n", GET_BM(addr), val); + dolog("BMADDR[%d] -> 0x%x", GET_BM(addr), val); break; case PI_CIV: case PO_CIV: case MC_CIV: r =3D &s->bm_regs[GET_BM(addr)]; val =3D r->civ | (r->lvi << 8) | (r->sr << 16); - dolog("CIV LVI SR[%d] -> 0x%x, 0x%x, 0x%x\n", GET_BM(addr), + dolog("CIV LVI SR[%d] -> 0x%x, 0x%x, 0x%x", GET_BM(addr), r->civ, r->lvi, r->sr); break; case PI_PICB: @@ -756,19 +754,19 @@ static uint32_t nabm_readl(void *opaque, uint32_t add= r) case MC_PICB: r =3D &s->bm_regs[GET_BM(addr)]; val =3D r->picb | (r->piv << 16) | (r->cr << 24); - dolog("PICB PIV CR[%d] -> 0x%x 0x%x 0x%x 0x%x\n", GET_BM(addr), + dolog("PICB PIV CR[%d] -> 0x%x 0x%x 0x%x 0x%x", GET_BM(addr), val, r->picb, r->piv, r->cr); break; case GLOB_CNT: val =3D s->glob_cnt; - dolog("glob_cnt -> 0x%x\n", val); + dolog("glob_cnt -> 0x%x", val); break; case GLOB_STA: val =3D s->glob_sta | GS_S0CR; - dolog("glob_sta -> 0x%x\n", val); + dolog("glob_sta -> 0x%x", val); break; default: - dolog("U nabm readl 0x%x -> 0x%x\n", addr, val); + dolog("U nabm readl 0x%x -> 0x%x", addr, val); break; } return val; @@ -795,7 +793,7 @@ static void nabm_writeb(void *opaque, uint32_t addr, ui= nt32_t val) fetch_bd(s, r); } r->lvi =3D val % 32; - dolog("LVI[%d] <- 0x%x\n", GET_BM(addr), val); + dolog("LVI[%d] <- 0x%x", GET_BM(addr), val); break; case PI_CR: case PO_CR: @@ -816,7 +814,7 @@ static void nabm_writeb(void *opaque, uint32_t addr, ui= nt32_t val) voice_set_active(s, r - s->bm_regs, 1); } } - dolog("CR[%d] <- 0x%x (cr 0x%x)\n", GET_BM(addr), val, r->cr); + dolog("CR[%d] <- 0x%x (cr 0x%x)", GET_BM(addr), val, r->cr); break; case PI_SR: case PO_SR: @@ -824,10 +822,10 @@ static void nabm_writeb(void *opaque, uint32_t addr, = uint32_t val) r =3D &s->bm_regs[GET_BM(addr)]; r->sr |=3D val & ~(SR_RO_MASK | SR_WCLEAR_MASK); update_sr(s, r, r->sr & ~(val & SR_WCLEAR_MASK)); - dolog("SR[%d] <- 0x%x (sr 0x%x)\n", GET_BM(addr), val, r->sr); + dolog("SR[%d] <- 0x%x (sr 0x%x)", GET_BM(addr), val, r->sr); break; default: - dolog("U nabm writeb 0x%x <- 0x%x\n", addr, val); + dolog("U nabm writeb 0x%x <- 0x%x", addr, val); break; } } @@ -844,10 +842,10 @@ static void nabm_writew(void *opaque, uint32_t addr, = uint32_t val) r =3D &s->bm_regs[GET_BM(addr)]; r->sr |=3D val & ~(SR_RO_MASK | SR_WCLEAR_MASK); update_sr(s, r, r->sr & ~(val & SR_WCLEAR_MASK)); - dolog("SR[%d] <- 0x%x (sr 0x%x)\n", GET_BM(addr), val, r->sr); + dolog("SR[%d] <- 0x%x (sr 0x%x)", GET_BM(addr), val, r->sr); break; default: - dolog("U nabm writew 0x%x <- 0x%x\n", addr, val); + dolog("U nabm writew 0x%x <- 0x%x", addr, val); break; } } @@ -863,22 +861,22 @@ static void nabm_writel(void *opaque, uint32_t addr, = uint32_t val) case MC_BDBAR: r =3D &s->bm_regs[GET_BM(addr)]; r->bdbar =3D val & ~3; - dolog("BDBAR[%d] <- 0x%x (bdbar 0x%x)\n", GET_BM(addr), val, r->bd= bar); + dolog("BDBAR[%d] <- 0x%x (bdbar 0x%x)", GET_BM(addr), val, r->bdba= r); break; case GLOB_CNT: /* TODO: Handle WR or CR being set (warm/cold reset requests) */ if (!(val & (GC_WR | GC_CR))) { s->glob_cnt =3D val & GC_VALID_MASK; } - dolog("glob_cnt <- 0x%x (glob_cnt 0x%x)\n", val, s->glob_cnt); + dolog("glob_cnt <- 0x%x (glob_cnt 0x%x)", val, s->glob_cnt); break; case GLOB_STA: s->glob_sta &=3D ~(val & GS_WCLEAR_MASK); s->glob_sta |=3D (val & ~(GS_WCLEAR_MASK | GS_RO_MASK)) & GS_VALID= _MASK; - dolog("glob_sta <- 0x%x (glob_sta 0x%x)\n", val, s->glob_sta); + dolog("glob_sta <- 0x%x (glob_sta 0x%x)", val, s->glob_sta); break; default: - dolog("U nabm writel 0x%x <- 0x%x\n", addr, val); + dolog("U nabm writel 0x%x <- 0x%x", addr, val); break; } } @@ -903,7 +901,7 @@ static int write_audio(AC97LinkState *s, AC97BusMasterR= egs *r, to_copy =3D MIN(temp, sizeof(tmpbuf)); pci_dma_read(&s->dev, addr, tmpbuf, to_copy); copied =3D AUD_write(s->voice_po, tmpbuf, to_copy); - dolog("write_audio max=3D%x to_copy=3D%x copied=3D%x\n", + dolog("write_audio max=3D%x to_copy=3D%x copied=3D%x", max, to_copy, copied); if (!copied) { *stop =3D 1; @@ -916,7 +914,7 @@ static int write_audio(AC97LinkState *s, AC97BusMasterR= egs *r, =20 if (!temp) { if (to_copy < 4) { - dolog("whoops\n"); + dolog("whoops"); s->last_samp =3D 0; } else { s->last_samp =3D *(uint32_t *)&tmpbuf[to_copy - 4]; @@ -929,7 +927,7 @@ static int write_audio(AC97LinkState *s, AC97BusMasterR= egs *r, =20 static void write_bup(AC97LinkState *s, int elapsed) { - dolog("write_bup\n"); + dolog("write_bup"); if (!(s->bup_flag & BUP_SET)) { if (s->bup_flag & BUP_LAST) { int i; @@ -997,7 +995,7 @@ static void transfer_audio(AC97LinkState *s, int index,= int elapsed) int stop =3D 0; =20 if (s->invalid_freq[index]) { - AUD_log("ac97", "attempt to use voice %d with invalid frequency %d= \n", + error_report("ac97: attempt to use voice %d with invalid frequency= %d", index, s->invalid_freq[index]); return; } @@ -1017,12 +1015,12 @@ static void transfer_audio(AC97LinkState *s, int in= dex, int elapsed) int temp; =20 if (!r->bd_valid) { - dolog("invalid bd\n"); + dolog("invalid bd"); fetch_bd(s, r); } =20 if (!r->picb) { - dolog("fresh bd %d is empty 0x%x 0x%x\n", + dolog("fresh bd %d is empty 0x%x 0x%x", r->civ, r->bd.addr, r->bd.ctl_len); if (r->civ =3D=3D r->lvi) { r->sr |=3D SR_DCH; /* CELV? */ @@ -1059,7 +1057,7 @@ static void transfer_audio(AC97LinkState *s, int inde= x, int elapsed) } =20 if (r->civ =3D=3D r->lvi) { - dolog("Underrun civ (%d) =3D=3D lvi (%d)\n", r->civ, r->lv= i); + dolog("Underrun civ (%d) =3D=3D lvi (%d)", r->civ, r->lvi); =20 new_sr |=3D SR_LVBCI | SR_DCH | SR_CELV; stop =3D 1; diff --git a/hw/audio/adlib.c b/hw/audio/adlib.c index 50bbb97a56..231055b8b5 100644 --- a/hw/audio/adlib.c +++ b/hw/audio/adlib.c @@ -29,24 +29,20 @@ #include "audio/audio.h" #include "hw/isa/isa.h" #include "hw/qdev-properties.h" +#include "qemu/error-report.h" #include "qom/object.h" =20 -//#define DEBUG +#define DEBUG 0 =20 #define ADLIB_KILL_TIMERS 1 =20 #define ADLIB_DESC "Yamaha YM3812 (OPL2)" =20 -#ifdef DEBUG +#if DEBUG #include "qemu/timer.h" #endif =20 -#define dolog(...) AUD_log ("adlib", __VA_ARGS__) -#ifdef DEBUG -#define ldebug(...) dolog (__VA_ARGS__) -#else -#define ldebug(...) -#endif +#define ldebug(fmt, ...) do { if (DEBUG) error_report("adlib: " fmt, ##__V= A_ARGS__); } while(0) =20 #include "fmopl.h" #define SHIFT 1 @@ -64,7 +60,7 @@ struct AdlibState { int enabled; int active; int bufpos; -#ifdef DEBUG +#if DEBUG int64_t exp[2]; #endif int16_t *mixbuf; @@ -92,7 +88,7 @@ static void adlib_kill_timers (AdlibState *s) =20 delta =3D AUD_get_elapsed_usec_out (s->voice, &s->ats); ldebug ( - "delta =3D %f dexp =3D %f expired =3D> %d\n", + "delta =3D %f dexp =3D %f expired =3D> %d", delta / 1000000.0, s->dexp[i] / 1000000.0, delta >=3D s->dexp[i] @@ -131,7 +127,7 @@ static void timer_handler (void *opaque, int c, double = interval_Sec) { AdlibState *s =3D opaque; unsigned n =3D c & 1; -#ifdef DEBUG +#if DEBUG double interval; int64_t exp; #endif @@ -142,7 +138,7 @@ static void timer_handler (void *opaque, int c, double = interval_Sec) } =20 s->ticking[n] =3D 1; -#ifdef DEBUG +#if DEBUG interval =3D NANOSECONDS_PER_SECOND * interval_Sec; exp =3D qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + interval; s->exp[n] =3D exp; diff --git a/hw/audio/cs4231a.c b/hw/audio/cs4231a.c index c8837fe269..062af7628b 100644 --- a/hw/audio/cs4231a.c +++ b/hw/audio/cs4231a.c @@ -30,7 +30,7 @@ #include "hw/qdev-properties.h" #include "migration/vmstate.h" #include "qemu/module.h" -#include "qemu/timer.h" +#include "qemu/error-report.h" #include "qapi/error.h" #include "qom/object.h" =20 @@ -43,21 +43,17 @@ More... */ =20 -/* #define DEBUG */ +#define DEBUG 0 /* #define DEBUG_XLAW */ =20 static struct { int aci_counter; } conf =3D {1}; =20 -#ifdef DEBUG -#define dolog(...) AUD_log ("cs4231a", __VA_ARGS__) -#else -#define dolog(...) -#endif +#define dolog(fmt, ...) do { if (DEBUG) error_report("cs4231a: " fmt, ##__= VA_ARGS__); } while(0) =20 -#define lwarn(...) AUD_log ("cs4231a", "warning: " __VA_ARGS__) -#define lerr(...) AUD_log ("cs4231a", "error: " __VA_ARGS__) +#define lwarn(fmt, ...) warn_report("cs4231a: " fmt, ##__VA_ARGS__) +#define lerr(fmt, ...) error_report("cs4231a: " fmt, ##__VA_ARGS__) =20 #define CS_REGS 16 #define CS_DREGS 32 @@ -284,7 +280,7 @@ static void cs_reset_voices (CSState *s, uint32_t val) as.freq =3D freqs[xtal][(val >> 1) & 7]; =20 if (as.freq =3D=3D -1) { - lerr ("unsupported frequency (val=3D%#x)\n", val); + lerr ("unsupported frequency (val=3D%#x)", val); goto error; } =20 @@ -319,11 +315,11 @@ static void cs_reset_voices (CSState *s, uint32_t val) =20 case 7: case 4: - lerr ("attempt to use reserved format value (%#x)\n", val); + lerr ("attempt to use reserved format value (%#x)", val); goto error; =20 case 5: - lerr ("ADPCM 4 bit IMA compatible format is not supported\n"); + lerr ("ADPCM 4 bit IMA compatible format is not supported"); goto error; } =20 @@ -393,7 +389,7 @@ static uint64_t cs_read (void *opaque, hwaddr addr, uns= igned size) ret =3D s->regs[saddr]; break; } - dolog ("read %d:%d -> %d\n", saddr, iaddr, ret); + dolog ("read %d:%d -> %d", saddr, iaddr, ret); return ret; } =20 @@ -425,7 +421,7 @@ static void cs_write (void *opaque, hwaddr addr, case RESERVED: case RESERVED_2: case RESERVED_3: - lwarn ("attempt to write %#x to reserved indirect register %d\= n", + lwarn ("attempt to write %#x to reserved indirect register %d", val, iaddr); break; =20 @@ -439,7 +435,7 @@ static void cs_write (void *opaque, hwaddr addr, cs_reset_voices (s, val); } else { - lwarn ("[P]MCE(%#x, %#x) is not set, val=3D%#x\n", + lwarn ("[P]MCE(%#x, %#x) is not set, val=3D%#x", s->regs[Index_Address], s->dregs[Alternate_Feature_Status], val); @@ -453,7 +449,7 @@ static void cs_write (void *opaque, hwaddr addr, val &=3D ~(1 << 5); /* D5 is reserved */ s->dregs[iaddr] =3D val; if (val & PPIO) { - lwarn ("PIO is not supported (%#x)\n", val); + lwarn ("PIO is not supported (%#x)", val); break; } if (val & PEN) { @@ -472,11 +468,11 @@ static void cs_write (void *opaque, hwaddr addr, break; =20 case Error_Status_And_Initialization: - lwarn ("attempt to write to read only register %d\n", iaddr); + lwarn ("attempt to write to read only register %d", iaddr); break; =20 case MODE_And_ID: - dolog ("val=3D%#x\n", val); + dolog ("val=3D%#x", val); if (val & MODE2) s->dregs[iaddr] |=3D MODE2; else @@ -485,7 +481,7 @@ static void cs_write (void *opaque, hwaddr addr, =20 case Alternate_Feature_Enable_I: if (val & TE) - lerr ("timer is not yet supported\n"); + lerr ("timer is not yet supported"); s->dregs[iaddr] =3D val; break; =20 @@ -499,7 +495,7 @@ static void cs_write (void *opaque, hwaddr addr, break; =20 case Version_Chip_ID: - lwarn ("write to Version_Chip_ID register %#x\n", val); + lwarn ("write to Version_Chip_ID register %#x", val); s->dregs[iaddr] =3D val; break; =20 @@ -507,7 +503,7 @@ static void cs_write (void *opaque, hwaddr addr, s->dregs[iaddr] =3D val; break; } - dolog ("written value %#x to indirect register %d\n", val, iaddr); + dolog ("written value %#x to indirect register %d", val, iaddr); break; =20 case Status: @@ -519,7 +515,7 @@ static void cs_write (void *opaque, hwaddr addr, break; =20 case PIO_Data: - lwarn ("attempt to write value %#x to PIO register\n", val); + lwarn ("attempt to write value %#x to PIO register", val); break; } } diff --git a/hw/audio/es1370.c b/hw/audio/es1370.c index 8cb47589c3..ac5a6aba85 100644 --- a/hw/audio/es1370.c +++ b/hw/audio/es1370.c @@ -32,7 +32,7 @@ #include "migration/vmstate.h" #include "qemu/cutils.h" #include "qemu/module.h" -#include "system/dma.h" +#include "qemu/error-report.h" #include "qom/object.h" #include "trace.h" =20 @@ -190,7 +190,7 @@ static void print_ctl(uint32_t val) a(CDC_EN); a(SERR_DIS); #undef a - AUD_log("es1370", "ctl - PCLKDIV %d(DAC2 freq %d), freq %d,%s\n", + error_report("es1370: ctl - PCLKDIV %d(DAC2 freq %d), freq %d,%s\n= ", (val & CTRL_PCLKDIV) >> CTRL_SH_PCLKDIV, DAC2_DIVTOSR((val & CTRL_PCLKDIV) >> CTRL_SH_PCLKDIV), dac1_samplerate[(val & CTRL_WTSRSEL) >> CTRL_SH_WTSRSEL], @@ -226,7 +226,7 @@ static void print_sctl(uint32_t val) } #undef b #undef a - AUD_log("es1370", + error_report("es1370: " "%s p2_end_inc %d, p2_st_inc %d," " r1_fmt %s, p2_fmt %s, p1_fmt %s\n", buf, @@ -238,10 +238,10 @@ static void print_sctl(uint32_t val) } } =20 -#define lwarn(...) \ +#define lwarn(fmt, ...) \ do { \ if (VERBOSE_ES1370) { \ - AUD_log("es1370: warning", __VA_ARGS__); \ + error_report("es1370: " fmt, ##__VA_ARGS__); \ } \ } while (0) =20 @@ -502,10 +502,10 @@ static void es1370_write(void *opaque, hwaddr addr, u= int64_t val, unsigned size) break; =20 case ES1370_REG_PHANTOM_FRAMECNT: - lwarn("writing to phantom frame count 0x%" PRIx64 "\n", val); + lwarn("writing to phantom frame count 0x%" PRIx64, val); break; case ES1370_REG_PHANTOM_FRAMEADR: - lwarn("writing to phantom frame address 0x%" PRIx64 "\n", val); + lwarn("writing to phantom frame address 0x%" PRIx64, val); break; =20 case ES1370_REG_ADC_FRAMECNT: @@ -522,7 +522,7 @@ static void es1370_write(void *opaque, hwaddr addr, uin= t64_t val, unsigned size) break; =20 default: - lwarn("writel 0x%" PRIx64 " <- 0x%" PRIx64 "\n", addr, val); + lwarn("writel 0x%" PRIx64 " <- 0x%" PRIx64, addr, val); break; } } @@ -586,16 +586,16 @@ static uint64_t es1370_read(void *opaque, hwaddr addr= , unsigned size) =20 case ES1370_REG_PHANTOM_FRAMECNT: val =3D ~0U; - lwarn("reading from phantom frame count\n"); + lwarn("reading from phantom frame count"); break; case ES1370_REG_PHANTOM_FRAMEADR: val =3D ~0U; - lwarn("reading from phantom frame address\n"); + lwarn("reading from phantom frame address"); break; =20 default: val =3D ~0U; - lwarn("readl 0x%" PRIx64 " -> 0x%x\n", addr, val); + lwarn("readl 0x%" PRIx64 " -> 0x%x", addr, val); break; } return val; @@ -677,7 +677,7 @@ static void es1370_transfer_audio (ES1370State *s, stru= ct chan *d, int loop_sel, * when the sample count reaches zero) or 1 for stop mode (set * interrupt and stop recording). */ - AUD_log ("es1370: warning", "non looping mode\n"); + warn_report("es1370: non looping mode"); } else { d->frame_cnt =3D size; =20 diff --git a/hw/audio/gus.c b/hw/audio/gus.c index 2c84740adf..40073f2d4f 100644 --- a/hw/audio/gus.c +++ b/hw/audio/gus.c @@ -32,15 +32,12 @@ #include "hw/qdev-properties.h" #include "migration/vmstate.h" #include "gusemu.h" -#include "gustate.h" +#include "qemu/error-report.h" #include "qom/object.h" =20 -#define dolog(...) AUD_log ("audio", __VA_ARGS__) -#ifdef DEBUG -#define ldebug(...) dolog (__VA_ARGS__) -#else -#define ldebug(...) -#endif +#define DEBUG 0 + +#define ldebug(fmt, ...) do { if (DEBUG) error_report("gus: " fmt, ##__VA_= ARGS__); } while (0) =20 #define TYPE_GUS "gus" OBJECT_DECLARE_SIMPLE_TYPE(GUSState, GUS) @@ -154,14 +151,14 @@ int GUS_irqrequest (GUSEmuState *emu, int hwirq, int = n) /* qemu_irq_lower (s->pic); */ qemu_irq_raise (s->pic); s->irqs +=3D n; - ldebug ("irqrequest %d %d %d\n", hwirq, n, s->irqs); + ldebug("irqrequest %d %d %d", hwirq, n, s->irqs); return n; } =20 void GUS_irqclear (GUSEmuState *emu, int hwirq) { GUSState *s =3D emu->opaque; - ldebug ("irqclear %d %d\n", hwirq, s->irqs); + ldebug("irqclear %d %d", hwirq, s->irqs); qemu_irq_lower (s->pic); s->irqs -=3D 1; #ifdef IRQ_STORM @@ -175,7 +172,7 @@ void GUS_dmarequest (GUSEmuState *emu) { GUSState *s =3D emu->opaque; IsaDmaClass *k =3D ISADMA_GET_CLASS(s->isa_dma); - ldebug ("dma request %d\n", der->gusdma); + ldebug("dma request %d", s->emu.gusdma); k->hold_DREQ(s->isa_dma, s->emu.gusdma); } =20 @@ -186,13 +183,13 @@ static int GUS_read_DMA (void *opaque, int nchan, int= dma_pos, int dma_len) QEMU_UNINITIALIZED char tmpbuf[4096]; int pos =3D dma_pos, mode, left =3D dma_len - dma_pos; =20 - ldebug ("read DMA %#x %d\n", dma_pos, dma_len); + ldebug("read DMA %#x %d", dma_pos, dma_len); mode =3D k->has_autoinitialization(s->isa_dma, s->emu.gusdma); while (left) { int to_copy =3D MIN ((size_t) left, sizeof (tmpbuf)); int copied; =20 - ldebug ("left=3D%d to_copy=3D%d pos=3D%d\n", left, to_copy, pos); + ldebug("left=3D%d to_copy=3D%d pos=3D%d", left, to_copy, pos); copied =3D k->read_memory(s->isa_dma, nchan, tmpbuf, pos, to_copy); gus_dma_transferdata (&s->emu, tmpbuf, copied, left =3D=3D copied); left -=3D copied; diff --git a/hw/audio/pcspk.c b/hw/audio/pcspk.c index 12a214c566..c8c63b7915 100644 --- a/hw/audio/pcspk.c +++ b/hw/audio/pcspk.c @@ -124,7 +124,7 @@ static int pcspk_audio_init(PCSpkState *s) =20 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"); + error_report("pcspk: Could not open voice"); return -1; } =20 diff --git a/hw/audio/sb16.c b/hw/audio/sb16.c index cd7e813d05..069cf6e120 100644 --- a/hw/audio/sb16.c +++ b/hw/audio/sb16.c @@ -30,22 +30,17 @@ #include "hw/qdev-properties.h" #include "migration/vmstate.h" #include "qemu/timer.h" +#include "qemu/error-report.h" #include "qemu/host-utils.h" #include "qemu/log.h" #include "qemu/module.h" #include "qapi/error.h" #include "qom/object.h" =20 -#define dolog(...) AUD_log ("sb16", __VA_ARGS__) - -/* #define DEBUG */ +#define DEBUG 0 /* #define DEBUG_SB16_MOST */ =20 -#ifdef DEBUG -#define ldebug(...) dolog (__VA_ARGS__) -#else -#define ldebug(...) -#endif +#define ldebug(fmt, ...) do { if (DEBUG) error_report("sb16: " fmt, ##__VA= _ARGS__); } while (0) =20 static const char e3[] =3D "COPYRIGHT (C) CREATIVE TECHNOLOGY LTD, 1992."; =20 @@ -157,7 +152,7 @@ static int irq_of_magic (int magic) #if 0 static void log_dsp (SB16State *dsp) { - ldebug ("%s:%s:%d:%s:dmasize=3D%d:freq=3D%d:const=3D%d:speaker=3D%d\n", + ldebug ("%s:%s:%d:%s:dmasize=3D%d:freq=3D%d:const=3D%d:speaker=3D%d", dsp->fmt_stereo ? "Stereo" : "Mono", dsp->fmt_signed ? "Signed" : "Unsigned", dsp->fmt_bits, @@ -182,7 +177,7 @@ static void control (SB16State *s, int hold) IsaDmaClass *k =3D ISADMA_GET_CLASS(isa_dma); s->dma_running =3D hold; =20 - ldebug ("hold %d high %d dma %d\n", hold, s->use_hdma, dma); + ldebug ("hold %d high %d dma %d", hold, s->use_hdma, dma); =20 if (hold) { k->hold_DREQ(isa_dma, dma); @@ -290,7 +285,7 @@ static void dma_cmd8 (SB16State *s, int mask, int dma_l= en) } =20 ldebug ("freq %d, stereo %d, sign %d, bits %d, " - "dma %d, auto %d, fifo %d, high %d\n", + "dma %d, auto %d, fifo %d, high %d", s->freq, s->fmt_stereo, s->fmt_signed, s->fmt_bits, s->block_size, s->dma_auto, s->fifo, s->highspeed); =20 @@ -338,7 +333,7 @@ static void dma_cmd (SB16State *s, uint8_t cmd, uint8_t= d0, int dma_len) } =20 ldebug ("freq %d, stereo %d, sign %d, bits %d, " - "dma %d, auto %d, fifo %d, high %d\n", + "dma %d, auto %d, fifo %d, high %d", s->freq, s->fmt_stereo, s->fmt_signed, s->fmt_bits, s->block_size, s->dma_auto, s->fifo, s->highspeed); =20 @@ -395,7 +390,7 @@ static void dma_cmd (SB16State *s, uint8_t cmd, uint8_t= d0, int dma_len) =20 static inline void dsp_out_data (SB16State *s, uint8_t val) { - ldebug ("outdata %#x\n", val); + ldebug ("outdata %#x", val); if ((size_t) s->out_data_len < sizeof (s->out_data)) { s->out_data[s->out_data_len++] =3D val; } @@ -407,14 +402,14 @@ static inline uint8_t dsp_get_data (SB16State *s) return s->in2_data[--s->in_index]; } else { - dolog ("buffer underflow\n"); + warn_report("sb16: buffer underflow"); return 0; } } =20 static void command (SB16State *s, uint8_t cmd) { - ldebug ("command %#x\n", cmd); + ldebug ("command %#x", cmd); =20 if (cmd > 0xaf && cmd < 0xd0) { if (cmd & 8) { @@ -651,7 +646,7 @@ static void command (SB16State *s, uint8_t cmd) } =20 if (!s->needed_bytes) { - ldebug ("\n"); + ldebug ("!needed_bytes"); } =20 exit: @@ -687,7 +682,7 @@ static uint16_t dsp_get_hilo (SB16State *s) static void complete (SB16State *s) { int d0, d1, d2; - ldebug ("complete command %#x, in_index %d, needed_bytes %d\n", + ldebug ("complete command %#x, in_index %d, needed_bytes %d", s->cmd, s->in_index, s->needed_bytes); =20 if (s->cmd > 0xaf && s->cmd < 0xd0) { @@ -696,11 +691,11 @@ static void complete (SB16State *s) d0 =3D dsp_get_data (s); =20 if (s->cmd & 8) { - dolog ("ADC params cmd =3D %#x d0 =3D %d, d1 =3D %d, d2 =3D %d= \n", + warn_report("sb16: ADC params cmd =3D %#x d0 =3D %d, d1 =3D %d= , d2 =3D %d", s->cmd, d0, d1, d2); } else { - ldebug ("cmd =3D %#x d0 =3D %d, d1 =3D %d, d2 =3D %d\n", + ldebug ("cmd =3D %#x d0 =3D %d, d1 =3D %d, d2 =3D %d", s->cmd, d0, d1, d2); dma_cmd (s, s->cmd, d0, d1 + (d2 << 8)); } @@ -711,13 +706,13 @@ static void complete (SB16State *s) s->csp_mode =3D dsp_get_data (s); s->csp_reg83r =3D 0; s->csp_reg83w =3D 0; - ldebug ("CSP command 0x04: mode=3D%#x\n", s->csp_mode); + ldebug ("CSP command 0x04: mode=3D%#x", s->csp_mode); break; =20 case 0x05: s->csp_param =3D dsp_get_data (s); s->csp_value =3D dsp_get_data (s); - ldebug ("CSP command 0x05: param=3D%#x value=3D%#x\n", + ldebug ("CSP command 0x05: param=3D%#x value=3D%#x", s->csp_param, s->csp_value); break; @@ -725,9 +720,9 @@ static void complete (SB16State *s) case 0x0e: d0 =3D dsp_get_data (s); d1 =3D dsp_get_data (s); - ldebug ("write CSP register %d <- %#x\n", d1, d0); + ldebug ("write CSP register %d <- %#x", d1, d0); if (d1 =3D=3D 0x83) { - ldebug ("0x83[%d] <- %#x\n", s->csp_reg83r, d0); + ldebug ("0x83[%d] <- %#x", s->csp_reg83r, d0); s->csp_reg83[s->csp_reg83r % 4] =3D d0; s->csp_reg83r +=3D 1; } @@ -738,10 +733,10 @@ static void complete (SB16State *s) =20 case 0x0f: d0 =3D dsp_get_data (s); - ldebug ("read CSP register %#x -> %#x, mode=3D%#x\n", + ldebug ("read CSP register %#x -> %#x, mode=3D%#x", d0, s->csp_regs[d0], s->csp_mode); if (d0 =3D=3D 0x83) { - ldebug ("0x83[%d] -> %#x\n", + ldebug ("0x83[%d] -> %#x", s->csp_reg83w, s->csp_reg83[s->csp_reg83w % 4]); dsp_out_data (s, s->csp_reg83[s->csp_reg83w % 4]); @@ -754,7 +749,7 @@ static void complete (SB16State *s) =20 case 0x10: d0 =3D dsp_get_data (s); - dolog ("cmd 0x10 d0=3D%#x\n", d0); + warn_report("sb16: cmd 0x10 d0=3D%#x\n", d0); break; =20 case 0x14: @@ -763,7 +758,7 @@ static void complete (SB16State *s) =20 case 0x40: s->time_const =3D dsp_get_data (s); - ldebug ("set time const %d\n", s->time_const); + ldebug ("set time const %d", s->time_const); break; =20 case 0x41: @@ -776,12 +771,12 @@ static void complete (SB16State *s) * http://homepages.cae.wisc.edu/~brodskye/sb16doc/sb16doc.htm= l#SamplingRate */ s->freq =3D restrict_sampling_rate(dsp_get_hilo(s)); - ldebug ("set freq %d\n", s->freq); + ldebug ("set freq %d", s->freq); break; =20 case 0x48: s->block_size =3D dsp_get_lohi (s) + 1; - ldebug ("set dma block len %d\n", s->block_size); + ldebug ("set dma block len %d", s->block_size); break; =20 case 0x74: @@ -811,21 +806,21 @@ static void complete (SB16State *s) ); } } - ldebug ("mix silence %d %d %" PRId64 "\n", samples, bytes,= ticks); + ldebug ("mix silence %d %d %" PRId64, samples, bytes, tick= s); } break; =20 case 0xe0: d0 =3D dsp_get_data (s); s->out_data_len =3D 0; - ldebug ("E0 data =3D %#x\n", d0); + ldebug ("E0 data =3D %#x", d0); dsp_out_data (s, ~d0); break; =20 case 0xe2: -#ifdef DEBUG +#if DEBUG d0 =3D dsp_get_data (s); - dolog ("E2 =3D %#x\n", d0); + warn_report("sb16: E2 =3D %#x", d0); #endif break; =20 @@ -835,7 +830,7 @@ static void complete (SB16State *s) =20 case 0xf9: d0 =3D dsp_get_data (s); - ldebug ("command 0xf9 with %#x\n", d0); + ldebug ("command 0xf9 with %#x", d0); switch (d0) { case 0x0e: dsp_out_data (s, 0xff); @@ -862,7 +857,7 @@ static void complete (SB16State *s) } } =20 - ldebug ("\n"); + ldebug (""); s->cmd =3D -1; } =20 @@ -926,7 +921,7 @@ static void dsp_write(void *opaque, uint32_t nport, uin= t32_t val) =20 iport =3D nport - s->port; =20 - ldebug ("write %#x <- %#x\n", nport, val); + ldebug ("write %#x <- %#x", nport, val); switch (iport) { case 0x06: switch (val) { @@ -976,7 +971,7 @@ static void dsp_write(void *opaque, uint32_t nport, uin= t32_t val) } else { if (s->in_index =3D=3D sizeof (s->in2_data)) { - dolog ("in data overrun\n"); + warn_report("sb16: in data overrun"); } else { s->in2_data[s->in_index++] =3D val; @@ -992,7 +987,7 @@ static void dsp_write(void *opaque, uint32_t nport, uin= t32_t val) break; =20 default: - ldebug ("(nport=3D%#x, val=3D%#x)\n", nport, val); + ldebug ("(nport=3D%#x, val=3D%#x)", nport, val); break; } } @@ -1016,7 +1011,7 @@ static uint32_t dsp_read(void *opaque, uint32_t nport) } else { if (s->cmd !=3D -1) { - dolog ("empty output buffer for command %#x\n", + warn_report("sb16: empty output buffer for command %#x", s->cmd); } retval =3D s->last_read_byte; @@ -1029,7 +1024,7 @@ static uint32_t dsp_read(void *opaque, uint32_t nport) break; =20 case 0x0d: /* timer interrupt clear */ - /* dolog ("timer interrupt clear\n"); */ + /* warn_report("sb16: timer interrupt clear"); */ retval =3D 0; break; =20 @@ -1056,13 +1051,13 @@ static uint32_t dsp_read(void *opaque, uint32_t npo= rt) } =20 if (!ack) { - ldebug ("read %#x -> %#x\n", nport, retval); + ldebug ("read %#x -> %#x", nport, retval); } =20 return retval; =20 error: - dolog ("warning: dsp_read %#x error\n", nport); + warn_report("sb16: dsp_read %#x error", nport); return 0xff; } =20 @@ -1108,7 +1103,7 @@ static void mixer_write_datab(void *opaque, uint32_t = nport, uint32_t val) SB16State *s =3D opaque; =20 (void) nport; - ldebug ("mixer_write [%#x] <- %#x\n", s->mixer_nreg, val); + ldebug ("mixer_write [%#x] <- %#x", s->mixer_nreg, val); =20 switch (s->mixer_nreg) { case 0x00: @@ -1118,7 +1113,7 @@ static void mixer_write_datab(void *opaque, uint32_t = nport, uint32_t val) case 0x80: { int irq =3D irq_of_magic (val); - ldebug ("setting irq to %d (val=3D%#x)\n", irq, val); + ldebug ("setting irq to %d (val=3D%#x)", irq, val); if (irq > 0) { s->irq =3D irq; } @@ -1150,7 +1145,7 @@ static void mixer_write_datab(void *opaque, uint32_t = nport, uint32_t val) =20 default: if (s->mixer_nreg >=3D 0x80) { - ldebug ("attempt to write mixer[%#x] <- %#x\n", s->mixer_nreg,= val); + ldebug ("attempt to write mixer[%#x] <- %#x", s->mixer_nreg, v= al); } break; } @@ -1165,11 +1160,11 @@ static uint32_t mixer_read(void *opaque, uint32_t n= port) (void) nport; #ifndef DEBUG_SB16_MOST if (s->mixer_nreg !=3D 0x82) { - ldebug ("mixer_read[%#x] -> %#x\n", + ldebug ("mixer_read[%#x] -> %#x", s->mixer_nreg, s->mixer_regs[s->mixer_nreg]); } #else - ldebug ("mixer_read[%#x] -> %#x\n", + ldebug ("mixer_read[%#x] -> %#x", s->mixer_nreg, s->mixer_regs[s->mixer_nreg]); #endif return s->mixer_regs[s->mixer_nreg]; @@ -1241,7 +1236,7 @@ static int SB_read_DMA (void *opaque, int nchan, int = dma_pos, int dma_len) till =3D s->left_till_irq; =20 #ifdef DEBUG_SB16_MOST - dolog ("pos:%06d %d till:%d len:%d\n", + warn_report("sb16: pos:%06d %d till:%d len:%d", dma_pos, free, till, dma_len); #endif =20 @@ -1265,7 +1260,7 @@ static int SB_read_DMA (void *opaque, int nchan, int = dma_pos, int dma_len) } =20 #ifdef DEBUG_SB16_MOST - ldebug ("pos %5d free %5d size %5d till % 5d copy %5d written %5d size= %5d\n", + ldebug ("pos %5d free %5d size %5d till % 5d copy %5d written %5d size= %5d", dma_pos, free, dma_len, s->left_till_irq, copy, written, s->block_size); #endif --=20 2.51.0 From nobody Fri Nov 14 18:21:23 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1761116477; cv=none; d=zohomail.com; s=zohoarc; b=n8IYt85XLm2fndzFC857qKoG1/69PTTPWPvp8QpR0/TC8rac+RKl6noI8IgR9w8tTCqgefXPEwDujEanRmQnEJ9InFze5z7ISiHYR/moaoJJ085FvNnk3TeixI6aj3p9MuH+cPFLM7EKr986Ae4X6VbS8lCsehduY+qxY9CmJfI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761116477; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=DKT1nXlJpI9tRXzouXdla7L7sC/MuqhqLow2hMhCfo0=; b=Qns0u9jyQwHEbuNT5Wpgd7HDQN73F/rk8a0NxPqOm/iYP8uH0ZgjYaVQtLaRAYhOWtS9zQUItn6XdvWSTPmviIWBhnjzpmo9pJ+iWbnmiY9mKOjz/Ywg0C+IXk8lWX7PIkchG199k50bzKMhCnQx1vQMGGUYefeGvejuD+5Isvo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1761116477817509.5369091710983; Wed, 22 Oct 2025 00:01:17 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vBSp9-0000Zt-NV; Wed, 22 Oct 2025 02:59:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vBSp6-0000VS-6W for qemu-devel@nongnu.org; Wed, 22 Oct 2025 02:59:52 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vBSp4-0008Ne-CE for qemu-devel@nongnu.org; Wed, 22 Oct 2025 02:59:51 -0400 Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-125-5XfCOtDJNWiZYOu9H9WvIg-1; Wed, 22 Oct 2025 02:59:45 -0400 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 1E5E91800C32; Wed, 22 Oct 2025 06:59:44 +0000 (UTC) Received: from localhost (unknown [10.44.22.9]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id CDB9A1800579; Wed, 22 Oct 2025 06:59:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761116389; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=DKT1nXlJpI9tRXzouXdla7L7sC/MuqhqLow2hMhCfo0=; b=DD2XmVA2KQ8M4/4293Xl30hyThqov6WCkBVMvJ66ffM8+fFglcvGIuxXHF+0p8yqG737IZ 82I8y6RVZ/zWfb9PU9b61hO5LW9s+iO7MdhkSbE5pFB9pRq6TU6l0eYBfH/TgXWiV4FBqv Y11A+njHYfFdrKiVy2hOActh1hJbyFA= X-MC-Unique: 5XfCOtDJNWiZYOu9H9WvIg-1 X-Mimecast-MFC-AGG-ID: 5XfCOtDJNWiZYOu9H9WvIg_1761116384 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Volker=20R=C3=BCmelin?= , Paolo Bonzini , BALATON Zoltan , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Gerd Hoffmann , =?UTF-8?q?Alex=20Benn=C3=A9e?= Subject: [PATCH v2 32/42] audio/replay: fix type punning Date: Wed, 22 Oct 2025 10:56:27 +0400 Message-ID: <20251022065640.1172785-33-marcandre.lureau@redhat.com> In-Reply-To: <20251022065640.1172785-1-marcandre.lureau@redhat.com> References: <20251022065640.1172785-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1761116480286154100 From: Marc-Andr=C3=A9 Lureau Signed-off-by: Marc-Andr=C3=A9 Lureau --- audio/audio.h | 6 ++++-- audio/mixeng.h | 1 - include/system/replay.h | 3 ++- audio/mixeng.c | 6 ++---- replay/replay-audio.c | 2 +- replay/stubs-system.c | 2 +- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/audio/audio.h b/audio/audio.h index 2175223ef6..68509fed58 100644 --- a/audio/audio.h +++ b/audio/audio.h @@ -160,9 +160,11 @@ int wav_start_capture(AudioState *state, CaptureState = *s, const char *path, =20 void audio_cleanup(void); =20 -void audio_sample_to_uint64(const void *samples, int pos, +typedef struct st_sample st_sample; + +void audio_sample_to_uint64(const st_sample *sample, int pos, uint64_t *left, uint64_t *right); -void audio_sample_from_uint64(void *samples, int pos, +void audio_sample_from_uint64(st_sample *sample, int pos, uint64_t left, uint64_t right); =20 void audio_add_audiodev(Audiodev *audio); diff --git a/audio/mixeng.h b/audio/mixeng.h index ead93ac2f7..f63283f408 100644 --- a/audio/mixeng.h +++ b/audio/mixeng.h @@ -33,7 +33,6 @@ struct st_sample { mixeng_real l; mixeng_real r; }; struct mixeng_volume { int mute; int64_t r; int64_t l; }; struct st_sample { int64_t l; int64_t r; }; #endif -typedef struct st_sample st_sample; =20 typedef void (t_sample) (struct st_sample *dst, const void *src, int sampl= es); typedef void (f_sample) (void *dst, const struct st_sample *src, int sampl= es); diff --git a/include/system/replay.h b/include/system/replay.h index 1c87c97fdd..1e63c0784c 100644 --- a/include/system/replay.h +++ b/include/system/replay.h @@ -16,6 +16,7 @@ #include "qapi/qapi-types-run-state.h" #include "qapi/qapi-types-ui.h" #include "block/aio.h" +#include "audio/audio.h" =20 /* replay clock kinds */ enum ReplayClockKind { @@ -165,7 +166,7 @@ void replay_net_packet_event(ReplayNetState *rns, unsig= ned flags, /*! Saves/restores number of played samples of audio out operation. */ void replay_audio_out(size_t *played); /*! Saves/restores recorded samples of audio in operation. */ -void replay_audio_in(size_t *recorded, void *samples, size_t *wpos, size_t= size); +void replay_audio_in(size_t *recorded, st_sample *samples, size_t *wpos, s= ize_t size); =20 /* VM state operations */ =20 diff --git a/audio/mixeng.c b/audio/mixeng.c index be38617e9b..af9ec3d4d2 100644 --- a/audio/mixeng.c +++ b/audio/mixeng.c @@ -404,7 +404,7 @@ f_sample *mixeng_clip_float[2][2] =3D { } }; =20 -void audio_sample_to_uint64(const void *samples, int pos, +void audio_sample_to_uint64(const st_sample *sample, int pos, uint64_t *left, uint64_t *right) { #ifdef FLOAT_MIXENG @@ -412,14 +412,13 @@ void audio_sample_to_uint64(const void *samples, int = pos, "Coreaudio and floating point samples are not supported by replay = yet"); abort(); #else - const struct st_sample *sample =3D samples; sample +=3D pos; *left =3D sample->l; *right =3D sample->r; #endif } =20 -void audio_sample_from_uint64(void *samples, int pos, +void audio_sample_from_uint64(st_sample *sample, int pos, uint64_t left, uint64_t right) { #ifdef FLOAT_MIXENG @@ -427,7 +426,6 @@ void audio_sample_from_uint64(void *samples, int pos, "Coreaudio and floating point samples are not supported by replay = yet"); abort(); #else - struct st_sample *sample =3D samples; sample +=3D pos; sample->l =3D left; sample->r =3D right; diff --git a/replay/replay-audio.c b/replay/replay-audio.c index ed2ba2164b..3413801062 100644 --- a/replay/replay-audio.c +++ b/replay/replay-audio.c @@ -35,7 +35,7 @@ void replay_audio_out(size_t *played) } } =20 -void replay_audio_in(size_t *recorded, void *samples, size_t *wpos, size_t= size) +void replay_audio_in(size_t *recorded, st_sample *samples, size_t *wpos, s= ize_t size) { int pos; uint64_t left, right; diff --git a/replay/stubs-system.c b/replay/stubs-system.c index 8f2b2d326e..7f85764936 100644 --- a/replay/stubs-system.c +++ b/replay/stubs-system.c @@ -15,7 +15,7 @@ void replay_input_sync_event(void) void replay_add_blocker(const char *feature) { } -void replay_audio_in(size_t *recorded, void *samples, size_t *wpos, size_t= size) +void replay_audio_in(size_t *recorded, st_sample *samples, size_t *wpos, s= ize_t size) { } void replay_audio_out(size_t *played) --=20 2.51.0 From nobody Fri Nov 14 18:21:23 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1761116898; cv=none; d=zohomail.com; s=zohoarc; b=i8HOpPgIRSmtJdwZEv80fkXvnTNlSQI090yPkNUZSxfMCFSVXQb4ZNKeizRkPkD0W7li3/wwDlT1tN+11+M4wuE747TQXkQnc4wNvbg7FLfqRKp5PitsUMAB/6556XViC0jlHdUz1XLa6D++OsVAuREuEZ+6JwQ/yryzsZyUNyM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761116898; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=CH7P42O24akCrSS/HXFEvKJEwmzuKXQF/eDHOvR5Gsg=; b=jTf0Bntx9DvOLGS7WKurlvDQeZ1ggUTJnXJFQfv0b4uWhKiEh/ireMx/nJKvR2DzsQeO9i+7L/sjNoUalQTgxSMZqWf/NTqixfp8yQKDB7xA2+Fl3ygwRSCQ5q5rz82AZ5EOpcN5LBoQJo3FJDNGU0wFKjzBBPcuRIzY21u7CeY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1761116898618844.4663290663069; Wed, 22 Oct 2025 00:08:18 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vBSpD-0000am-GK; Wed, 22 Oct 2025 02:59:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vBSpC-0000aK-BP for qemu-devel@nongnu.org; Wed, 22 Oct 2025 02:59:58 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vBSpA-0008OD-37 for qemu-devel@nongnu.org; Wed, 22 Oct 2025 02:59:57 -0400 Received: from mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-614-ru_qw45FOOSUYq9BITfQiA-1; Wed, 22 Oct 2025 02:59:50 -0400 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id C778E195608A; Wed, 22 Oct 2025 06:59:49 +0000 (UTC) Received: from localhost (unknown [10.44.22.9]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 7EC7D1956056; Wed, 22 Oct 2025 06:59:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761116394; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=CH7P42O24akCrSS/HXFEvKJEwmzuKXQF/eDHOvR5Gsg=; b=Iavq6PA/2XcfY5O+8rm93rLwTfnfvXgL0NzK/2QKW5COrO6IfzjVmSRpu/s4QhKCrtF+mn aeW3dxi+VCsVLViRokyavq58kYtHxQ8NXnLzhjtYUw4qRAZB5ZY+/oa6Hp1YNH4d9BorKX EKm0PunQZDb4fNCxwXC2b4WRwuCesiA= X-MC-Unique: ru_qw45FOOSUYq9BITfQiA-1 X-Mimecast-MFC-AGG-ID: ru_qw45FOOSUYq9BITfQiA_1761116389 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Volker=20R=C3=BCmelin?= , Paolo Bonzini , BALATON Zoltan , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Gerd Hoffmann Subject: [PATCH v2 33/42] audio: move internal APIs to audio_int.h Date: Wed, 22 Oct 2025 10:56:28 +0400 Message-ID: <20251022065640.1172785-34-marcandre.lureau@redhat.com> In-Reply-To: <20251022065640.1172785-1-marcandre.lureau@redhat.com> References: <20251022065640.1172785-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1761116900871154100 From: Marc-Andr=C3=A9 Lureau Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- audio/audio.h | 21 --------------------- audio/audio_int.h | 22 ++++++++++++++++++++++ audio/audio-hmp-cmds.c | 2 +- audio/wavcapture.c | 2 +- 4 files changed, 24 insertions(+), 23 deletions(-) diff --git a/audio/audio.h b/audio/audio.h index 68509fed58..b8b9715896 100644 --- a/audio/audio.h +++ b/audio/audio.h @@ -38,15 +38,6 @@ typedef struct audsettings { int endianness; } audsettings; =20 -audsettings audiodev_to_audsettings(AudiodevPerDirectionOptions *pdo); -int audioformat_bytes_per_sample(AudioFormat fmt); -int audio_buffer_frames(AudiodevPerDirectionOptions *pdo, - audsettings *as, int def_usecs); -int audio_buffer_samples(AudiodevPerDirectionOptions *pdo, - audsettings *as, int def_usecs); -int audio_buffer_bytes(AudiodevPerDirectionOptions *pdo, - audsettings *as, int def_usecs); - typedef enum { AUD_CNOTIFY_ENABLE, AUD_CNOTIFY_DISABLE @@ -88,9 +79,6 @@ typedef struct QEMUAudioTimeStamp { uint64_t old_ts; } QEMUAudioTimeStamp; =20 -void AUD_vlog (const char *cap, const char *fmt, va_list ap) G_GNUC_PRINTF= (2, 0); -void AUD_log (const char *cap, const char *fmt, ...) G_GNUC_PRINTF(2, 3); - bool AUD_register_card (const char *name, QEMUSoundCard *card, Error **err= p); void AUD_remove_card (QEMUSoundCard *card); CaptureVoiceOut *AUD_add_capture( @@ -149,15 +137,6 @@ int AUD_is_active_in (SWVoiceIn *sw); void AUD_init_time_stamp_in (SWVoiceIn *sw, QEMUAudioTimeStamp *ts); uint64_t AUD_get_elapsed_usec_in (SWVoiceIn *sw, QEMUAudioTimeStamp *ts); =20 -static inline void *advance (void *p, int incr) -{ - uint8_t *d =3D p; - return (d + incr); -} - -int wav_start_capture(AudioState *state, CaptureState *s, const char *path, - int freq, int bits, int nchannels); - void audio_cleanup(void); =20 typedef struct st_sample st_sample; diff --git a/audio/audio_int.h b/audio/audio_int.h index 4a4d69f2bf..cc7a6fe087 100644 --- a/audio/audio_int.h +++ b/audio/audio_int.h @@ -29,12 +29,16 @@ #define FLOAT_MIXENG /* #define RECIPROCAL */ #endif +#include "audio.h" #include "mixeng.h" =20 #ifdef CONFIG_GIO #include #endif =20 +void AUD_vlog (const char *cap, const char *fmt, va_list ap) G_GNUC_PRINTF= (2, 0); +void AUD_log (const char *cap, const char *fmt, ...) G_GNUC_PRINTF(2, 3); + struct audio_pcm_ops; =20 struct audio_callback { @@ -187,6 +191,24 @@ struct audio_pcm_ops { void (*volume_in)(HWVoiceIn *hw, Volume *vol); }; =20 +audsettings audiodev_to_audsettings(AudiodevPerDirectionOptions *pdo); +int audioformat_bytes_per_sample(AudioFormat fmt); +int audio_buffer_frames(AudiodevPerDirectionOptions *pdo, + audsettings *as, int def_usecs); +int audio_buffer_samples(AudiodevPerDirectionOptions *pdo, + audsettings *as, int def_usecs); +int audio_buffer_bytes(AudiodevPerDirectionOptions *pdo, + audsettings *as, int def_usecs); + +static inline void *advance (void *p, int incr) +{ + uint8_t *d =3D p; + return (d + incr); +} + +int wav_start_capture(AudioState *state, CaptureState *s, const char *path, + int freq, int bits, int nchannels); + void audio_generic_run_buffer_in(HWVoiceIn *hw); void *audio_generic_get_buffer_in(HWVoiceIn *hw, size_t *size); void audio_generic_put_buffer_in(HWVoiceIn *hw, void *buf, size_t size); diff --git a/audio/audio-hmp-cmds.c b/audio/audio-hmp-cmds.c index 8774c09f18..819f8fa9d8 100644 --- a/audio/audio-hmp-cmds.c +++ b/audio/audio-hmp-cmds.c @@ -23,7 +23,7 @@ */ =20 #include "qemu/osdep.h" -#include "audio/audio.h" +#include "audio_int.h" #include "monitor/hmp.h" #include "monitor/monitor.h" #include "qapi/error.h" diff --git a/audio/wavcapture.c b/audio/wavcapture.c index b990844d48..0fbc695d23 100644 --- a/audio/wavcapture.c +++ b/audio/wavcapture.c @@ -1,7 +1,7 @@ #include "qemu/osdep.h" #include "qemu/qemu-print.h" #include "qemu/error-report.h" -#include "audio.h" +#include "audio_int.h" =20 typedef struct { FILE *f; --=20 2.51.0 From nobody Fri Nov 14 18:21:23 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1761116902; cv=none; d=zohomail.com; s=zohoarc; b=KBGPRO9D9hDFLBCCRwEupRHFE6hhizFumWLdD2dEvhrD+53WPnGFPe40Gdrcin7aOad5zyb/2hXE8zEYyt9fBAwRyXFTcPaTcnGy/iPMnseClKI7bLriYS6L6bc2wKicWgDSbDLcb2fi3LXoaDimM6jgtGDHBta9Th11qTW47Io= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761116902; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=rv5zQUtEYKUBvsxUjqDo6xENFAue2SxAH7ckuabDWGM=; b=hqEobnqqhBDW7GXUbG2R+SqQ4+/O8N3l1BaeP4oeeAaS3ZCDZtCw3Yx7l6yp7ESgl8/0ncWLA+u/NDXfijyVE+SHTU7Lggbv4AQIqnGPIw0zwWrhyt83F8tr98bvnP+VzVxLDGjlXYGmotr9YgcRvxPYcrd3/jszNPrldGYpHcg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1761116902591997.8164591371758; Wed, 22 Oct 2025 00:08:22 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vBSq0-0000yJ-DD; Wed, 22 Oct 2025 03:00:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vBSpT-0000rn-2N for qemu-devel@nongnu.org; Wed, 22 Oct 2025 03:00:17 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vBSpK-0008Vl-6M for qemu-devel@nongnu.org; Wed, 22 Oct 2025 03:00:09 -0400 Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-323-m7ry-Ue1Oq2GX1hvsz_3kg-1; Wed, 22 Oct 2025 02:59:57 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 243C81956096; Wed, 22 Oct 2025 06:59:56 +0000 (UTC) Received: from localhost (unknown [10.44.22.9]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id D8E6630001BF; Wed, 22 Oct 2025 06:59:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761116404; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=rv5zQUtEYKUBvsxUjqDo6xENFAue2SxAH7ckuabDWGM=; b=Icy/wqC5XQ/STpiZZJt2Zw1jl/h7wlIN0aEoNAvTPnYfPAuoEsseleG4DXzxPSu779/lj+ u2r89uPQ3VdcMICHpTV7RIglKpYQOYTRYMGXSALyJVjkIrPxpp/ewvOwXL0ekS3v3jgKiP xbd2kYqU4MBn77nFKxf6OHXVvj4X2Lk= X-MC-Unique: m7ry-Ue1Oq2GX1hvsz_3kg-1 X-Mimecast-MFC-AGG-ID: m7ry-Ue1Oq2GX1hvsz_3kg_1761116396 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Volker=20R=C3=BCmelin?= , Paolo Bonzini , BALATON Zoltan , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Gerd Hoffmann , Christian Schoenebeck , Eduardo Habkost , Marcel Apfelbaum , Yanan Wang , Zhao Liu , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Subject: [PATCH v2 34/42] audio: rename AudioState -> AudioBackend Date: Wed, 22 Oct 2025 10:56:29 +0400 Message-ID: <20251022065640.1172785-35-marcandre.lureau@redhat.com> In-Reply-To: <20251022065640.1172785-1-marcandre.lureau@redhat.com> References: <20251022065640.1172785-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1761116907490158500 From: Marc-Andr=C3=A9 Lureau Naming is hard. But in general in QEMU, a host "backend" is the term used to fullfill the request made by the device or frontend. AudioBackend will become an abstract base class in a follow-up series. Currently the frontend is QEMUSoundCard, we are going to drop that next. Note that "audiodev" is the corresponding QAPI type name (or configuration). Signed-off-by: Marc-Andr=C3=A9 Lureau --- audio/audio.h | 16 +++--- audio/audio_int.h | 20 +++---- audio/audio_template.h | 20 +++---- ui/vnc.h | 2 +- audio/alsaaudio.c | 2 +- audio/audio-hmp-cmds.c | 2 +- audio/audio.c | 90 ++++++++++++++++---------------- audio/dbusaudio.c | 8 +-- audio/ossaudio.c | 4 +- audio/wavcapture.c | 2 +- hw/audio/pcspk.c | 2 +- hw/core/machine.c | 2 +- hw/core/qdev-properties-system.c | 6 +-- ui/dbus.c | 8 +-- ui/vnc.c | 10 ++-- 15 files changed, 97 insertions(+), 97 deletions(-) diff --git a/audio/audio.h b/audio/audio.h index b8b9715896..69ba1e8b94 100644 --- a/audio/audio.h +++ b/audio/audio.h @@ -64,14 +64,14 @@ typedef struct SWVoiceOut SWVoiceOut; typedef struct CaptureVoiceOut CaptureVoiceOut; typedef struct SWVoiceIn SWVoiceIn; =20 -struct AudioStateClass { +struct AudioBackendClass { ObjectClass parent_class; }; =20 -typedef struct AudioState AudioState; +typedef struct AudioBackend AudioBackend; typedef struct QEMUSoundCard { char *name; - AudioState *state; + AudioBackend *be; QLIST_ENTRY (QEMUSoundCard) entries; } QEMUSoundCard; =20 @@ -82,7 +82,7 @@ typedef struct QEMUAudioTimeStamp { bool AUD_register_card (const char *name, QEMUSoundCard *card, Error **err= p); void AUD_remove_card (QEMUSoundCard *card); CaptureVoiceOut *AUD_add_capture( - AudioState *s, + AudioBackend *s, struct audsettings *as, struct audio_capture_ops *ops, void *opaque @@ -153,14 +153,14 @@ void audio_create_default_audiodevs(void); void audio_init_audiodevs(void); void audio_help(void); =20 -AudioState *audio_state_by_name(const char *name, Error **errp); -AudioState *audio_get_default_audio_state(Error **errp); +AudioBackend *audio_be_by_name(const char *name, Error **errp); +AudioBackend *audio_get_default_audio_be(Error **errp); const char *audio_get_id(QEMUSoundCard *card); =20 #define DEFINE_AUDIO_PROPERTIES(_s, _f) \ DEFINE_PROP_AUDIODEV("audiodev", _s, _f) =20 -#define TYPE_AUDIO_STATE "audio-state" -OBJECT_DECLARE_TYPE(AudioState, AudioStateClass, AUDIO_STATE) +#define TYPE_AUDIO_BACKEND "audio-backend" +OBJECT_DECLARE_TYPE(AudioBackend, AudioBackendClass, AUDIO_BACKEND) =20 #endif /* QEMU_AUDIO_H */ diff --git a/audio/audio_int.h b/audio/audio_int.h index cc7a6fe087..d3929034b3 100644 --- a/audio/audio_int.h +++ b/audio/audio_int.h @@ -57,7 +57,7 @@ struct audio_pcm_info { int swap_endianness; }; =20 -typedef struct AudioState AudioState; +typedef struct AudioBackend AudioBackend; typedef struct SWVoiceCap SWVoiceCap; =20 typedef struct STSampleBuffer { @@ -66,7 +66,7 @@ typedef struct STSampleBuffer { } STSampleBuffer; =20 typedef struct HWVoiceOut { - AudioState *s; + AudioBackend *s; int enabled; int poll_mode; int pending_disable; @@ -87,7 +87,7 @@ typedef struct HWVoiceOut { } HWVoiceOut; =20 typedef struct HWVoiceIn { - AudioState *s; + AudioBackend *s; int enabled; int poll_mode; struct audio_pcm_info info; @@ -109,7 +109,7 @@ typedef struct HWVoiceIn { =20 struct SWVoiceOut { QEMUSoundCard *card; - AudioState *s; + AudioBackend *s; struct audio_pcm_info info; t_sample *conv; STSampleBuffer resample_buf; @@ -126,7 +126,7 @@ struct SWVoiceOut { =20 struct SWVoiceIn { QEMUSoundCard *card; - AudioState *s; + AudioBackend *s; int active; struct audio_pcm_info info; void *rate; @@ -147,7 +147,7 @@ struct audio_driver { void *(*init) (Audiodev *, Error **); void (*fini) (void *); #ifdef CONFIG_GIO - void (*set_dbus_server) (AudioState *s, GDBusObjectManagerServer *mana= ger, bool p2p); + void (*set_dbus_server) (AudioBackend *s, GDBusObjectManagerServer *ma= nager, bool p2p); #endif struct audio_pcm_ops *pcm_ops; int max_voices_out; @@ -206,7 +206,7 @@ static inline void *advance (void *p, int incr) return (d + incr); } =20 -int wav_start_capture(AudioState *state, CaptureState *s, const char *path, +int wav_start_capture(AudioBackend *state, CaptureState *s, const char *pa= th, int freq, int bits, int nchannels); =20 void audio_generic_run_buffer_in(HWVoiceIn *hw); @@ -238,7 +238,7 @@ struct SWVoiceCap { QLIST_ENTRY (SWVoiceCap) entries; }; =20 -typedef struct AudioState { +typedef struct AudioBackend { Object parent; =20 struct audio_driver *drv; @@ -258,7 +258,7 @@ typedef struct AudioState { bool timer_running; uint64_t timer_last; VMChangeStateEntry *vmse; -} AudioState; +} AudioBackend; =20 extern const struct mixeng_volume nominal_volume; =20 @@ -271,7 +271,7 @@ void audio_pcm_info_clear_buf (struct audio_pcm_info *i= nfo, void *buf, int len); =20 int audio_bug (const char *funcname, int cond); =20 -void audio_run(AudioState *s, const char *msg); +void audio_run(AudioBackend *s, const char *msg); =20 const char *audio_application_name(void); =20 diff --git a/audio/audio_template.h b/audio/audio_template.h index c29d79c443..b3c10a0709 100644 --- a/audio/audio_template.h +++ b/audio/audio_template.h @@ -36,7 +36,7 @@ #define HWBUF hw->conv_buf #endif =20 -static void glue(audio_init_nb_voices_, TYPE)(AudioState *s, +static void glue(audio_init_nb_voices_, TYPE)(AudioBackend *s, struct audio_driver *drv, in= t min_voices) { int max_voices =3D glue (drv->max_voices_, TYPE); @@ -221,7 +221,7 @@ static void glue (audio_pcm_hw_del_sw_, TYPE) (SW *sw) static void glue (audio_pcm_hw_gc_, TYPE) (HW **hwp) { HW *hw =3D *hwp; - AudioState *s =3D hw->s; + AudioBackend *s =3D hw->s; =20 if (!hw->sw_head.lh_first) { #ifdef DAC @@ -236,12 +236,12 @@ static void glue (audio_pcm_hw_gc_, TYPE) (HW **hwp) } } =20 -static HW *glue(audio_pcm_hw_find_any_, TYPE)(AudioState *s, HW *hw) +static HW *glue(audio_pcm_hw_find_any_, TYPE)(AudioBackend *s, HW *hw) { return hw ? hw->entries.le_next : glue (s->hw_head_, TYPE).lh_first; } =20 -static HW *glue(audio_pcm_hw_find_any_enabled_, TYPE)(AudioState *s, HW *h= w) +static HW *glue(audio_pcm_hw_find_any_enabled_, TYPE)(AudioBackend *s, HW = *hw) { while ((hw =3D glue(audio_pcm_hw_find_any_, TYPE)(s, hw))) { if (hw->enabled) { @@ -251,7 +251,7 @@ static HW *glue(audio_pcm_hw_find_any_enabled_, TYPE)(A= udioState *s, HW *hw) return NULL; } =20 -static HW *glue(audio_pcm_hw_find_specific_, TYPE)(AudioState *s, HW *hw, +static HW *glue(audio_pcm_hw_find_specific_, TYPE)(AudioBackend *s, HW *hw, struct audsettings *as) { while ((hw =3D glue(audio_pcm_hw_find_any_, TYPE)(s, hw))) { @@ -262,7 +262,7 @@ static HW *glue(audio_pcm_hw_find_specific_, TYPE)(Audi= oState *s, HW *hw, return NULL; } =20 -static HW *glue(audio_pcm_hw_add_new_, TYPE)(AudioState *s, +static HW *glue(audio_pcm_hw_add_new_, TYPE)(AudioBackend *s, struct audsettings *as) { HW *hw; @@ -398,7 +398,7 @@ AudiodevPerDirectionOptions *glue(audio_get_pdo_, TYPE)= (Audiodev *dev) abort(); } =20 -static HW *glue(audio_pcm_hw_add_, TYPE)(AudioState *s, struct audsettings= *as) +static HW *glue(audio_pcm_hw_add_, TYPE)(AudioBackend *s, struct audsettin= gs *as) { HW *hw; AudiodevPerDirectionOptions *pdo =3D glue(audio_get_pdo_, TYPE)(s->dev= ); @@ -424,7 +424,7 @@ static HW *glue(audio_pcm_hw_add_, TYPE)(AudioState *s,= struct audsettings *as) } =20 static SW *glue(audio_pcm_create_voice_pair_, TYPE)( - AudioState *s, + AudioBackend *s, const char *sw_name, struct audsettings *as ) @@ -494,7 +494,7 @@ SW *glue (AUD_open_, TYPE) ( struct audsettings *as ) { - AudioState *s; + AudioBackend *s; AudiodevPerDirectionOptions *pdo; =20 if (audio_bug(__func__, !card || !name || !callback_fn || !as)) { @@ -503,7 +503,7 @@ SW *glue (AUD_open_, TYPE) ( goto fail; } =20 - s =3D card->state; + s =3D card->be; pdo =3D glue(audio_get_pdo_, TYPE)(s->dev); =20 ldebug ("open %s, freq %d, nchannels %d, fmt %d\n", diff --git a/ui/vnc.h b/ui/vnc.h index f2dab2f4d9..e2137c5ed1 100644 --- a/ui/vnc.h +++ b/ui/vnc.h @@ -184,7 +184,7 @@ struct VncDisplay VncDisplaySASL sasl; #endif =20 - AudioState *audio_state; + AudioBackend *audio_be; =20 VMChangeStateEntry *vmstate_handler_entry; }; diff --git a/audio/alsaaudio.c b/audio/alsaaudio.c index 9b6c01c0ef..797cb478e6 100644 --- a/audio/alsaaudio.c +++ b/audio/alsaaudio.c @@ -41,7 +41,7 @@ struct pollhlp { struct pollfd *pfds; int count; int mask; - AudioState *s; + AudioBackend *s; }; =20 typedef struct ALSAVoiceOut { diff --git a/audio/audio-hmp-cmds.c b/audio/audio-hmp-cmds.c index 819f8fa9d8..1e56af21ab 100644 --- a/audio/audio-hmp-cmds.c +++ b/audio/audio-hmp-cmds.c @@ -67,7 +67,7 @@ void hmp_wavcapture(Monitor *mon, const QDict *qdict) const char *audiodev =3D qdict_get_str(qdict, "audiodev"); CaptureState *s; Error *local_err =3D NULL; - AudioState *as =3D audio_state_by_name(audiodev, &local_err); + AudioBackend *as =3D audio_be_by_name(audiodev, &local_err); =20 if (!as) { error_report_err(local_err); diff --git a/audio/audio.c b/audio/audio.c index 9e6d79b4e3..8a7489ec82 100644 --- a/audio/audio.c +++ b/audio/audio.c @@ -99,7 +99,7 @@ static audio_driver *audio_driver_lookup(const char *name) return NULL; } =20 -static AudioState *default_audio_state; +static AudioBackend *default_audio_be; =20 const struct mixeng_volume nominal_volume =3D { .mute =3D 0, @@ -380,7 +380,7 @@ void audio_pcm_info_clear_buf (struct audio_pcm_info *i= nfo, void *buf, int len) /* * Capture */ -static CaptureVoiceOut *audio_pcm_capture_find_specific(AudioState *s, +static CaptureVoiceOut *audio_pcm_capture_find_specific(AudioBackend *s, struct audsettings= *as) { CaptureVoiceOut *cap; @@ -460,7 +460,7 @@ static void audio_detach_capture (HWVoiceOut *hw) =20 static int audio_attach_capture (HWVoiceOut *hw) { - AudioState *s =3D hw->s; + AudioBackend *s =3D hw->s; CaptureVoiceOut *cap; =20 audio_detach_capture (hw); @@ -798,7 +798,7 @@ static void audio_pcm_print_info (const char *cap, stru= ct audio_pcm_info *info) /* * Timer */ -static int audio_is_timer_needed(AudioState *s) +static int audio_is_timer_needed(AudioBackend *s) { HWVoiceIn *hwi =3D NULL; HWVoiceOut *hwo =3D NULL; @@ -816,7 +816,7 @@ static int audio_is_timer_needed(AudioState *s) return 0; } =20 -static void audio_reset_timer (AudioState *s) +static void audio_reset_timer (AudioBackend *s) { if (audio_is_timer_needed(s)) { timer_mod_anticipate_ns(s->ts, @@ -838,7 +838,7 @@ static void audio_reset_timer (AudioState *s) static void audio_timer (void *opaque) { int64_t now, diff; - AudioState *s =3D opaque; + AudioBackend *s =3D opaque; =20 now =3D qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL); diff =3D now - s->timer_last; @@ -921,7 +921,7 @@ void AUD_set_active_out (SWVoiceOut *sw, int on) =20 hw =3D sw->hw; if (sw->active !=3D on) { - AudioState *s =3D sw->s; + AudioBackend *s =3D sw->s; SWVoiceOut *temp_sw; SWVoiceCap *sc; =20 @@ -969,7 +969,7 @@ void AUD_set_active_in (SWVoiceIn *sw, int on) =20 hw =3D sw->hw; if (sw->active !=3D on) { - AudioState *s =3D sw->s; + AudioBackend *s =3D sw->s; SWVoiceIn *temp_sw; =20 if (on) { @@ -1137,7 +1137,7 @@ static size_t audio_pcm_hw_run_out(HWVoiceOut *hw, si= ze_t live) return clipped; } =20 -static void audio_run_out (AudioState *s) +static void audio_run_out (AudioBackend *s) { HWVoiceOut *hw =3D NULL; SWVoiceOut *sw; @@ -1291,7 +1291,7 @@ static size_t audio_pcm_hw_run_in(HWVoiceIn *hw, size= _t samples) return conv; } =20 -static void audio_run_in (AudioState *s) +static void audio_run_in (AudioBackend *s) { HWVoiceIn *hw =3D NULL; =20 @@ -1339,7 +1339,7 @@ static void audio_run_in (AudioState *s) } } =20 -static void audio_run_capture (AudioState *s) +static void audio_run_capture (AudioBackend *s) { CaptureVoiceOut *cap; =20 @@ -1386,7 +1386,7 @@ static void audio_run_capture (AudioState *s) } } =20 -void audio_run(AudioState *s, const char *msg) +void audio_run(AudioBackend *s, const char *msg) { audio_run_out(s); audio_run_in(s); @@ -1559,7 +1559,7 @@ size_t audio_generic_read(HWVoiceIn *hw, void *buf, s= ize_t size) return total; } =20 -static bool audio_driver_init(AudioState *s, struct audio_driver *drv, +static bool audio_driver_init(AudioBackend *s, struct audio_driver *drv, Audiodev *dev, Error **errp) { s->drv_opaque =3D drv->init(dev, errp); @@ -1592,7 +1592,7 @@ static bool audio_driver_init(AudioState *s, struct a= udio_driver *drv, static void audio_vm_change_state_handler (void *opaque, bool running, RunState state) { - AudioState *s =3D opaque; + AudioBackend *s =3D opaque; HWVoiceOut *hwo =3D NULL; HWVoiceIn *hwi =3D NULL; =20 @@ -1613,9 +1613,9 @@ static void audio_vm_change_state_handler (void *opaq= ue, bool running, =20 static const VMStateDescription vmstate_audio; =20 -static void audio_state_init(Object *obj) +static void audio_be_init(Object *obj) { - AudioState *s =3D AUDIO_STATE(obj); + AudioBackend *s =3D AUDIO_BACKEND(obj); =20 QLIST_INIT (&s->hw_head_out); QLIST_INIT (&s->hw_head_in); @@ -1629,9 +1629,9 @@ static void audio_state_init(Object *obj) vmstate_register_any(NULL, &vmstate_audio, s); } =20 -static void audio_state_finalize(Object *obj) +static void audio_be_finalize(Object *obj) { - AudioState *s =3D AUDIO_STATE(obj); + AudioBackend *s =3D AUDIO_BACKEND(obj); HWVoiceOut *hwo, *hwon; HWVoiceIn *hwi, *hwin; =20 @@ -1692,7 +1692,7 @@ static Object *get_audiodevs_root(void) =20 void audio_cleanup(void) { - default_audio_state =3D NULL; + default_audio_be =3D NULL; =20 object_unparent(get_audiodevs_root()); } @@ -1743,14 +1743,14 @@ void audio_create_default_audiodevs(void) * if dev =3D=3D NULL =3D> legacy implicit initialization, return the alre= ady created * state or create a new one */ -static AudioState *audio_init(Audiodev *dev, Error **errp) +static AudioBackend *audio_init(Audiodev *dev, Error **errp) { int done =3D 0; const char *drvname; - AudioState *s; + AudioBackend *s; struct audio_driver *driver; =20 - s =3D AUDIO_STATE(object_new(TYPE_AUDIO_STATE)); + s =3D AUDIO_BACKEND(object_new(TYPE_AUDIO_BACKEND)); =20 if (dev) { /* -audiodev option */ @@ -1766,7 +1766,7 @@ static AudioState *audio_init(Audiodev *dev, Error **= errp) goto out; } } else { - assert(!default_audio_state); + assert(!default_audio_be); for (;;) { AudiodevListEntry *e =3D QSIMPLEQ_FIRST(&default_audiodevs); if (!e) { @@ -1797,11 +1797,11 @@ out: return NULL; } =20 -AudioState *audio_get_default_audio_state(Error **errp) +AudioBackend *audio_get_default_audio_be(Error **errp) { - if (!default_audio_state) { - default_audio_state =3D audio_init(NULL, errp); - if (!default_audio_state) { + if (!default_audio_be) { + default_audio_be =3D audio_init(NULL, errp); + if (!default_audio_be) { if (!QSIMPLEQ_EMPTY(&audiodevs)) { error_append_hint(errp, "Perhaps you wanted to use -audio = or set audiodev=3D%s?\n", QSIMPLEQ_FIRST(&audiodevs)->dev->id); @@ -1809,21 +1809,21 @@ AudioState *audio_get_default_audio_state(Error **e= rrp) } } =20 - return default_audio_state; + return default_audio_be; } =20 bool AUD_register_card (const char *name, QEMUSoundCard *card, Error **err= p) { - if (!card->state) { - card->state =3D audio_get_default_audio_state(errp); - if (!card->state) { + if (!card->be) { + card->be =3D audio_get_default_audio_be(errp); + if (!card->be) { return false; } } =20 card->name =3D g_strdup (name); memset (&card->entries, 0, sizeof (card->entries)); - QLIST_INSERT_HEAD(&card->state->card_head, card, entries); + QLIST_INSERT_HEAD(&card->be->card_head, card, entries); =20 return true; } @@ -1837,7 +1837,7 @@ void AUD_remove_card (QEMUSoundCard *card) static struct audio_pcm_ops capture_pcm_ops; =20 CaptureVoiceOut *AUD_add_capture( - AudioState *s, + AudioBackend *s, struct audsettings *as, struct audio_capture_ops *ops, void *cb_opaque @@ -2220,7 +2220,7 @@ int audio_buffer_bytes(AudiodevPerDirectionOptions *p= do, audioformat_bytes_per_sample(as->fmt); } =20 -AudioState *audio_state_by_name(const char *name, Error **errp) +AudioBackend *audio_be_by_name(const char *name, Error **errp) { Object *obj =3D object_resolve_path_component(get_audiodevs_root(), na= me); =20 @@ -2228,15 +2228,15 @@ AudioState *audio_state_by_name(const char *name, E= rror **errp) error_setg(errp, "audiodev '%s' not found", name); return NULL; } else { - return AUDIO_STATE(obj); + return AUDIO_BACKEND(obj); } } =20 const char *audio_get_id(QEMUSoundCard *card) { - if (card->state) { - assert(card->state->dev); - return card->state->dev->id; + if (card->be) { + assert(card->be->dev); + return card->be->dev->id; } else { return ""; } @@ -2305,19 +2305,19 @@ AudiodevList *qmp_query_audiodevs(Error **errp) return ret; } =20 -static const TypeInfo audio_state_info =3D { - .name =3D TYPE_AUDIO_STATE, +static const TypeInfo audio_be_info =3D { + .name =3D TYPE_AUDIO_BACKEND, .parent =3D TYPE_OBJECT, - .instance_size =3D sizeof(AudioState), - .instance_init =3D audio_state_init, - .instance_finalize =3D audio_state_finalize, + .instance_size =3D sizeof(AudioBackend), + .instance_init =3D audio_be_init, + .instance_finalize =3D audio_be_finalize, .abstract =3D false, // todo, subclass and make it abstract - .class_size =3D sizeof(AudioStateClass), + .class_size =3D sizeof(AudioBackendClass), }; =20 static void register_types(void) { - type_register_static(&audio_state_info); + type_register_static(&audio_be_info); } =20 type_init(register_types); diff --git a/audio/dbusaudio.c b/audio/dbusaudio.c index 908214a170..49cef38e3e 100644 --- a/audio/dbusaudio.c +++ b/audio/dbusaudio.c @@ -458,7 +458,7 @@ listener_in_vanished_cb(GDBusConnection *connection, } =20 static gboolean -dbus_audio_register_listener(AudioState *s, +dbus_audio_register_listener(AudioBackend *s, GDBusMethodInvocation *invocation, #ifdef G_OS_UNIX GUnixFDList *fd_list, @@ -615,7 +615,7 @@ dbus_audio_register_listener(AudioState *s, } =20 static gboolean -dbus_audio_register_out_listener(AudioState *s, +dbus_audio_register_out_listener(AudioBackend *s, GDBusMethodInvocation *invocation, #ifdef G_OS_UNIX GUnixFDList *fd_list, @@ -631,7 +631,7 @@ dbus_audio_register_out_listener(AudioState *s, } =20 static gboolean -dbus_audio_register_in_listener(AudioState *s, +dbus_audio_register_in_listener(AudioBackend *s, GDBusMethodInvocation *invocation, #ifdef G_OS_UNIX GUnixFDList *fd_list, @@ -646,7 +646,7 @@ dbus_audio_register_in_listener(AudioState *s, } =20 static void -dbus_audio_set_server(AudioState *s, GDBusObjectManagerServer *server, boo= l p2p) +dbus_audio_set_server(AudioBackend *s, GDBusObjectManagerServer *server, b= ool p2p) { DBusAudio *da =3D s->drv_opaque; =20 diff --git a/audio/ossaudio.c b/audio/ossaudio.c index c5858284a1..4a549b26a2 100644 --- a/audio/ossaudio.c +++ b/audio/ossaudio.c @@ -107,13 +107,13 @@ static void oss_anal_close (int *fdp) =20 static void oss_helper_poll_out (void *opaque) { - AudioState *s =3D opaque; + AudioBackend *s =3D opaque; audio_run(s, "oss_poll_out"); } =20 static void oss_helper_poll_in (void *opaque) { - AudioState *s =3D opaque; + AudioBackend *s =3D opaque; audio_run(s, "oss_poll_in"); } =20 diff --git a/audio/wavcapture.c b/audio/wavcapture.c index 0fbc695d23..b33a38ff45 100644 --- a/audio/wavcapture.c +++ b/audio/wavcapture.c @@ -103,7 +103,7 @@ static struct capture_ops wav_capture_ops =3D { .info =3D wav_capture_info }; =20 -int wav_start_capture(AudioState *state, CaptureState *s, const char *path, +int wav_start_capture(AudioBackend *state, CaptureState *s, const char *pa= th, int freq, int bits, int nchannels) { WAVState *wav; diff --git a/hw/audio/pcspk.c b/hw/audio/pcspk.c index c8c63b7915..e9ab5ac41b 100644 --- a/hw/audio/pcspk.c +++ b/hw/audio/pcspk.c @@ -188,7 +188,7 @@ static void pcspk_realizefn(DeviceState *dev, Error **e= rrp) =20 isa_register_ioport(isadev, &s->ioport, s->iobase); =20 - if (s->card.state && AUD_register_card(s_spk, &s->card, errp)) { + if (s->card.be && AUD_register_card(s_spk, &s->card, errp)) { pcspk_audio_init(s); } } diff --git a/hw/core/machine.c b/hw/core/machine.c index 681adbb7ac..2de8b89606 100644 --- a/hw/core/machine.c +++ b/hw/core/machine.c @@ -763,7 +763,7 @@ static void machine_set_audiodev(Object *obj, const cha= r *value, { MachineState *ms =3D MACHINE(obj); =20 - if (!audio_state_by_name(value, errp)) { + if (!audio_be_by_name(value, errp)) { return; } =20 diff --git a/hw/core/qdev-properties-system.c b/hw/core/qdev-properties-sys= tem.c index 1f810b7ddf..c83a52fc62 100644 --- a/hw/core/qdev-properties-system.c +++ b/hw/core/qdev-properties-system.c @@ -499,16 +499,16 @@ static void set_audiodev(Object *obj, Visitor *v, con= st char* name, { const Property *prop =3D opaque; QEMUSoundCard *card =3D object_field_prop_ptr(obj, prop); - AudioState *state; + AudioBackend *state; g_autofree char *str =3D NULL; =20 if (!visit_type_str(v, name, &str, errp)) { return; } =20 - state =3D audio_state_by_name(str, errp); + state =3D audio_be_by_name(str, errp); if (state) { - card->state =3D state; + card->be =3D state; } } =20 diff --git a/ui/dbus.c b/ui/dbus.c index dd0336702d..84cff47ec7 100644 --- a/ui/dbus.c +++ b/ui/dbus.c @@ -220,16 +220,16 @@ dbus_display_complete(UserCreatable *uc, Error **errp) } =20 if (dd->audiodev && *dd->audiodev) { - AudioState *audio_state =3D audio_state_by_name(dd->audiodev, errp= ); - if (!audio_state) { + AudioBackend *audio_be =3D audio_be_by_name(dd->audiodev, errp); + if (!audio_be) { return; } - if (!g_str_equal(audio_state->drv->name, "dbus")) { + if (!g_str_equal(audio_be->drv->name, "dbus")) { error_setg(errp, "Audiodev '%s' is not compatible with DBus", dd->audiodev); return; } - audio_state->drv->set_dbus_server(audio_state, dd->server, dd->p2p= ); + audio_be->drv->set_dbus_server(audio_be, dd->server, dd->p2p); } =20 consoles =3D g_array_new(FALSE, FALSE, sizeof(guint32)); diff --git a/ui/vnc.c b/ui/vnc.c index 77c823bf2e..0094ec680c 100644 --- a/ui/vnc.c +++ b/ui/vnc.c @@ -1276,7 +1276,7 @@ static void audio_add(VncState *vs) ops.destroy =3D audio_capture_destroy; ops.capture =3D audio_capture; =20 - vs->audio_cap =3D AUD_add_capture(vs->vd->audio_state, &vs->as, &ops, = vs); + vs->audio_cap =3D AUD_add_capture(vs->vd->audio_be, &vs->as, &ops, vs); if (!vs->audio_cap) { error_report("Failed to add audio capture"); } @@ -2193,7 +2193,7 @@ static void set_encodings(VncState *vs, int32_t *enco= dings, size_t n_encodings) send_ext_key_event_ack(vs); break; case VNC_ENCODING_AUDIO: - if (vs->vd->audio_state) { + if (vs->vd->audio_be) { vnc_set_feature(vs, VNC_FEATURE_AUDIO); send_ext_audio_ack(vs); } @@ -4236,12 +4236,12 @@ void vnc_display_open(const char *id, Error **errp) =20 audiodev =3D qemu_opt_get(opts, "audiodev"); if (audiodev) { - vd->audio_state =3D audio_state_by_name(audiodev, errp); - if (!vd->audio_state) { + vd->audio_be =3D audio_be_by_name(audiodev, errp); + if (!vd->audio_be) { goto fail; } } else { - vd->audio_state =3D audio_get_default_audio_state(NULL); + vd->audio_be =3D audio_get_default_audio_be(NULL); } =20 device_id =3D qemu_opt_get(opts, "display"); --=20 2.51.0 From nobody Fri Nov 14 18:21:23 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1761116472; cv=none; d=zohomail.com; s=zohoarc; b=lco9Kr7KMIlCpDKVH01EUNeAodrhQcXR5rRoRy4sURmsTn00TkyPAktuV1A+4ClLP96Q1y+nqs/vlAko9GgjPLFKUtQnFXQzM2T/xZ7z7q4yeOxkE1380MJMRrNMEta9OgM7bMzK0FIGR8PZNtaNf4Ora8sUKIEKDRAffCleVPA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761116472; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=QssPPeyaIjfJevdBjzrYuPiKWfc5/sU41ILy4aVHt7c=; b=DFxPv6nhpEO4tbbMXBNWNPAxwjTg/pse4XsHVgaqbG6QqIU/PTYYxDCSU3FyrCQny35+7CyGztzJI8zpNQ4mn21mifFCwbHD/MbhFgmDQpiAwWfhBm/Lhbr9HFH/rlYZYoC4Cx6JfivY3A/wFYal09q1AC+6XApNhkeFO7RyLMA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1761116472893301.49964845834666; Wed, 22 Oct 2025 00:01:12 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vBSqI-00016T-SN; Wed, 22 Oct 2025 03:01:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vBSpT-0000ro-4z for qemu-devel@nongnu.org; Wed, 22 Oct 2025 03:00:17 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vBSpM-0000AP-EW for qemu-devel@nongnu.org; Wed, 22 Oct 2025 03:00:12 -0400 Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-622-ElGh2sksNWqL4rGnDi7lbQ-1; Wed, 22 Oct 2025 03:00:05 -0400 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 4C6A8195608F; Wed, 22 Oct 2025 07:00:03 +0000 (UTC) Received: from localhost (unknown [10.44.22.9]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id D982E19560B0; Wed, 22 Oct 2025 07:00:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761116407; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=QssPPeyaIjfJevdBjzrYuPiKWfc5/sU41ILy4aVHt7c=; b=cfnDFy5gsQgHP90srvmWFt1AlOW8qa5soNmJ6BxnBI6QZ94mwMDU7LXLgCS1gIk1aqXm0e GNYwksamMZEznkx0SRt/RH+RuYqzl9Wc1sKRhduBcpLPu/iKzgmvnau+a7hSqdkMxsyiwE ES+UUy7LhtWB3m5iT5QOFGBuhd3aicE= X-MC-Unique: ElGh2sksNWqL4rGnDi7lbQ-1 X-Mimecast-MFC-AGG-ID: ElGh2sksNWqL4rGnDi7lbQ_1761116403 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Volker=20R=C3=BCmelin?= , Paolo Bonzini , BALATON Zoltan , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Gerd Hoffmann , Laurent Vivier , "Michael S. Tsirkin" , Manos Pitsidianakis , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Eduardo Habkost , Alistair Francis , "Edgar E. Iglesias" , Peter Maydell , Jiaxun Yang , qemu-arm@nongnu.org (open list:Xilinx ZynqMP and...) Subject: [PATCH v2 35/42] audio: remove QEMUSoundCard Date: Wed, 22 Oct 2025 10:56:30 +0400 Message-ID: <20251022065640.1172785-36-marcandre.lureau@redhat.com> In-Reply-To: <20251022065640.1172785-1-marcandre.lureau@redhat.com> References: <20251022065640.1172785-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1761116474389154100 From: Marc-Andr=C3=A9 Lureau There is no clear need for this extra intermediary structure between the audio backend and its user. Signed-off-by: Marc-Andr=C3=A9 Lureau --- audio/audio.h | 18 ++++++------------ audio/audio_int.h | 3 --- audio/audio_template.h | 22 ++++++++++------------ hw/audio/lm4549.h | 2 +- include/hw/audio/asc.h | 2 +- include/hw/audio/virtio-snd.h | 2 +- include/hw/display/xlnx_dp.h | 2 +- include/hw/isa/vt82c686.h | 2 +- include/hw/qdev-properties-system.h | 2 +- audio/audio.c | 29 ++++++++++------------------- hw/audio/ac97.c | 25 ++++++++++++------------- hw/audio/adlib.c | 9 ++++----- hw/audio/asc.c | 9 +++------ hw/audio/cs4231a.c | 8 ++++---- hw/audio/es1370.c | 23 +++++++++++------------ hw/audio/gus.c | 9 ++++----- hw/audio/hda-codec.c | 15 +++++++-------- hw/audio/lm4549.c | 8 ++++---- hw/audio/pcspk.c | 9 +++++---- hw/audio/pl041.c | 2 +- hw/audio/sb16.c | 16 ++++++++-------- hw/audio/via-ac97.c | 9 ++++----- hw/audio/virtio-snd.c | 13 ++++++------- hw/audio/wm8750.c | 23 +++++++++++------------ hw/core/qdev-properties-system.c | 11 +++++------ hw/display/xlnx_dp.c | 6 +++--- hw/usb/dev-audio.c | 11 +++++------ 27 files changed, 129 insertions(+), 161 deletions(-) diff --git a/audio/audio.h b/audio/audio.h index 69ba1e8b94..4c596fcc7f 100644 --- a/audio/audio.h +++ b/audio/audio.h @@ -69,18 +69,12 @@ struct AudioBackendClass { }; =20 typedef struct AudioBackend AudioBackend; -typedef struct QEMUSoundCard { - char *name; - AudioBackend *be; - QLIST_ENTRY (QEMUSoundCard) entries; -} QEMUSoundCard; =20 typedef struct QEMUAudioTimeStamp { uint64_t old_ts; } QEMUAudioTimeStamp; =20 -bool AUD_register_card (const char *name, QEMUSoundCard *card, Error **err= p); -void AUD_remove_card (QEMUSoundCard *card); +bool AUD_backend_check (AudioBackend **be, Error **errp); CaptureVoiceOut *AUD_add_capture( AudioBackend *s, struct audsettings *as, @@ -90,7 +84,7 @@ CaptureVoiceOut *AUD_add_capture( void AUD_del_capture (CaptureVoiceOut *cap, void *cb_opaque); =20 SWVoiceOut *AUD_open_out ( - QEMUSoundCard *card, + AudioBackend *be, SWVoiceOut *sw, const char *name, void *callback_opaque, @@ -98,7 +92,7 @@ SWVoiceOut *AUD_open_out ( struct audsettings *settings ); =20 -void AUD_close_out (QEMUSoundCard *card, SWVoiceOut *sw); +void AUD_close_out (AudioBackend *be, SWVoiceOut *sw); size_t AUD_write (SWVoiceOut *sw, void *pcm_buf, size_t size); int AUD_get_buffer_size_out (SWVoiceOut *sw); void AUD_set_active_out (SWVoiceOut *sw, int on); @@ -121,7 +115,7 @@ void AUD_set_volume_out(SWVoiceOut *sw, Volume *vol); void AUD_set_volume_in(SWVoiceIn *sw, Volume *vol); =20 SWVoiceIn *AUD_open_in ( - QEMUSoundCard *card, + AudioBackend *be, SWVoiceIn *sw, const char *name, void *callback_opaque, @@ -129,7 +123,7 @@ SWVoiceIn *AUD_open_in ( struct audsettings *settings ); =20 -void AUD_close_in (QEMUSoundCard *card, SWVoiceIn *sw); +void AUD_close_in (AudioBackend *be, SWVoiceIn *sw); size_t AUD_read (SWVoiceIn *sw, void *pcm_buf, size_t size); void AUD_set_active_in (SWVoiceIn *sw, int on); int AUD_is_active_in (SWVoiceIn *sw); @@ -155,7 +149,7 @@ void audio_help(void); =20 AudioBackend *audio_be_by_name(const char *name, Error **errp); AudioBackend *audio_get_default_audio_be(Error **errp); -const char *audio_get_id(QEMUSoundCard *card); +const char *audio_be_get_id(AudioBackend *be); =20 #define DEFINE_AUDIO_PROPERTIES(_s, _f) \ DEFINE_PROP_AUDIODEV("audiodev", _s, _f) diff --git a/audio/audio_int.h b/audio/audio_int.h index d3929034b3..210457e0c4 100644 --- a/audio/audio_int.h +++ b/audio/audio_int.h @@ -108,7 +108,6 @@ typedef struct HWVoiceIn { } HWVoiceIn; =20 struct SWVoiceOut { - QEMUSoundCard *card; AudioBackend *s; struct audio_pcm_info info; t_sample *conv; @@ -125,7 +124,6 @@ struct SWVoiceOut { }; =20 struct SWVoiceIn { - QEMUSoundCard *card; AudioBackend *s; int active; struct audio_pcm_info info; @@ -246,7 +244,6 @@ typedef struct AudioBackend { void *drv_opaque; =20 QEMUTimer *ts; - QLIST_HEAD (card_listhead, QEMUSoundCard) card_head; QLIST_HEAD (hw_in_listhead, HWVoiceIn) hw_head_in; QLIST_HEAD (hw_out_listhead, HWVoiceOut) hw_head_out; QLIST_HEAD (cap_listhead, CaptureVoiceOut) cap_head; diff --git a/audio/audio_template.h b/audio/audio_template.h index b3c10a0709..97305445c8 100644 --- a/audio/audio_template.h +++ b/audio/audio_template.h @@ -473,11 +473,11 @@ static void glue (audio_close_, TYPE) (SW *sw) g_free (sw); } =20 -void glue (AUD_close_, TYPE) (QEMUSoundCard *card, SW *sw) +void glue (AUD_close_, TYPE) (AudioBackend *be, SW *sw) { if (sw) { - if (audio_bug(__func__, !card)) { - dolog ("card=3D%p\n", card); + if (audio_bug(__func__, !be)) { + dolog ("backend=3D%p\n", be); return; } =20 @@ -486,7 +486,7 @@ void glue (AUD_close_, TYPE) (QEMUSoundCard *card, SW *= sw) } =20 SW *glue (AUD_open_, TYPE) ( - QEMUSoundCard *card, + AudioBackend *be, SW *sw, const char *name, void *callback_opaque , @@ -494,16 +494,15 @@ SW *glue (AUD_open_, TYPE) ( struct audsettings *as ) { - AudioBackend *s; + AudioBackend *s =3D be; AudiodevPerDirectionOptions *pdo; =20 - if (audio_bug(__func__, !card || !name || !callback_fn || !as)) { - dolog ("card=3D%p name=3D%p callback_fn=3D%p as=3D%p\n", - card, name, callback_fn, as); + if (audio_bug(__func__, !be || !name || !callback_fn || !as)) { + dolog ("backend=3D%p name=3D%p callback_fn=3D%p as=3D%p\n", + be, name, callback_fn, as); goto fail; } =20 - s =3D card->be; pdo =3D glue(audio_get_pdo_, TYPE)(s->dev); =20 ldebug ("open %s, freq %d, nchannels %d, fmt %d\n", @@ -524,7 +523,7 @@ SW *glue (AUD_open_, TYPE) ( } =20 if (!pdo->fixed_settings && sw) { - glue (AUD_close_, TYPE) (card, sw); + glue (AUD_close_, TYPE) (be, sw); sw =3D NULL; } =20 @@ -548,7 +547,6 @@ SW *glue (AUD_open_, TYPE) ( } } =20 - sw->card =3D card; sw->vol =3D nominal_volume; sw->callback.fn =3D callback_fn; sw->callback.opaque =3D callback_opaque; @@ -562,7 +560,7 @@ SW *glue (AUD_open_, TYPE) ( return sw; =20 fail: - glue (AUD_close_, TYPE) (card, sw); + glue (AUD_close_, TYPE) (be, sw); return NULL; } =20 diff --git a/hw/audio/lm4549.h b/hw/audio/lm4549.h index 61c3ab12dd..1d858e2a04 100644 --- a/hw/audio/lm4549.h +++ b/hw/audio/lm4549.h @@ -21,7 +21,7 @@ typedef void (*lm4549_callback)(void *opaque); =20 =20 typedef struct { - QEMUSoundCard card; + AudioBackend *audio_be; SWVoiceOut *voice; uint32_t voice_is_active; =20 diff --git a/include/hw/audio/asc.h b/include/hw/audio/asc.h index 04fac270b6..a60c2f597c 100644 --- a/include/hw/audio/asc.h +++ b/include/hw/audio/asc.h @@ -61,7 +61,7 @@ struct ASCState { MemoryRegion mem_regs; MemoryRegion mem_extregs; =20 - QEMUSoundCard card; + AudioBackend *audio_be; SWVoiceOut *voice; uint8_t *mixbuf; int samples; diff --git a/include/hw/audio/virtio-snd.h b/include/hw/audio/virtio-snd.h index 8dafedb276..0ad80bc9be 100644 --- a/include/hw/audio/virtio-snd.h +++ b/include/hw/audio/virtio-snd.h @@ -216,7 +216,7 @@ struct VirtIOSound { VirtQueue *queues[VIRTIO_SND_VQ_MAX]; uint64_t features; VirtIOSoundPCM *pcm; - QEMUSoundCard card; + AudioBackend *audio_be; VMChangeStateEntry *vmstate; virtio_snd_config snd_conf; QemuMutex cmdq_mutex; diff --git a/include/hw/display/xlnx_dp.h b/include/hw/display/xlnx_dp.h index e86a87f235..802a1427c9 100644 --- a/include/hw/display/xlnx_dp.h +++ b/include/hw/display/xlnx_dp.h @@ -84,7 +84,7 @@ struct XlnxDPState { struct PixmanPlane v_plane; struct PixmanPlane bout_plane; =20 - QEMUSoundCard aud_card; + AudioBackend *audio_be; SWVoiceOut *amixer_output_stream; int16_t audio_buffer_0[AUD_CHBUF_MAX_DEPTH]; int16_t audio_buffer_1[AUD_CHBUF_MAX_DEPTH]; diff --git a/include/hw/isa/vt82c686.h b/include/hw/isa/vt82c686.h index da1722daf2..48c412ce81 100644 --- a/include/hw/isa/vt82c686.h +++ b/include/hw/isa/vt82c686.h @@ -24,7 +24,7 @@ OBJECT_DECLARE_SIMPLE_TYPE(ViaAC97State, VIA_AC97); =20 struct ViaAC97State { PCIDevice dev; - QEMUSoundCard card; + AudioBackend *audio_be; MemoryRegion sgd; MemoryRegion fm; MemoryRegion midi; diff --git a/include/hw/qdev-properties-system.h b/include/hw/qdev-properti= es-system.h index 9601a11a09..1bd7a7634b 100644 --- a/include/hw/qdev-properties-system.h +++ b/include/hw/qdev-properties-system.h @@ -87,7 +87,7 @@ extern const PropertyInfo qdev_prop_virtio_gpu_output_lis= t; .set_default =3D true) =20 #define DEFINE_PROP_AUDIODEV(_n, _s, _f) \ - DEFINE_PROP(_n, _s, _f, qdev_prop_audiodev, QEMUSoundCard) + DEFINE_PROP(_n, _s, _f, qdev_prop_audiodev, AudioBackend *) =20 #define DEFINE_PROP_UUID_NODEFAULT(_name, _state, _field) \ DEFINE_PROP(_name, _state, _field, qdev_prop_uuid, QemuUUID) diff --git a/audio/audio.c b/audio/audio.c index 8a7489ec82..a2350cfe23 100644 --- a/audio/audio.c +++ b/audio/audio.c @@ -1620,7 +1620,6 @@ static void audio_be_init(Object *obj) QLIST_INIT (&s->hw_head_out); QLIST_INIT (&s->hw_head_in); QLIST_INIT (&s->cap_head); - QLIST_INIT (&s->card_head); s->ts =3D timer_new_ns(QEMU_CLOCK_VIRTUAL, audio_timer, s); =20 s->vmse =3D qemu_add_vm_change_state_handler(audio_vm_change_state_han= dler, s); @@ -1812,28 +1811,20 @@ AudioBackend *audio_get_default_audio_be(Error **er= rp) return default_audio_be; } =20 -bool AUD_register_card (const char *name, QEMUSoundCard *card, Error **err= p) +bool AUD_backend_check (AudioBackend **be, Error **errp) { - if (!card->be) { - card->be =3D audio_get_default_audio_be(errp); - if (!card->be) { + assert(be !=3D NULL); + + if (!*be) { + *be =3D audio_get_default_audio_be(errp); + if (!*be) { return false; } } =20 - card->name =3D g_strdup (name); - memset (&card->entries, 0, sizeof (card->entries)); - QLIST_INSERT_HEAD(&card->be->card_head, card, entries); - return true; } =20 -void AUD_remove_card (QEMUSoundCard *card) -{ - QLIST_REMOVE (card, entries); - g_free (card->name); -} - static struct audio_pcm_ops capture_pcm_ops; =20 CaptureVoiceOut *AUD_add_capture( @@ -2232,11 +2223,11 @@ AudioBackend *audio_be_by_name(const char *name, Er= ror **errp) } } =20 -const char *audio_get_id(QEMUSoundCard *card) +const char *audio_be_get_id(AudioBackend *be) { - if (card->be) { - assert(card->be->dev); - return card->be->dev->id; + if (be) { + assert(be->dev); + return be->dev->id; } else { return ""; } diff --git a/hw/audio/ac97.c b/hw/audio/ac97.c index 1b2ce601a6..d23cfcf325 100644 --- a/hw/audio/ac97.c +++ b/hw/audio/ac97.c @@ -120,7 +120,7 @@ typedef struct AC97BusMasterRegs { =20 struct AC97LinkState { PCIDevice dev; - QEMUSoundCard card; + AudioBackend *audio_be; uint32_t glob_cnt; uint32_t glob_sta; uint32_t cas; @@ -316,7 +316,7 @@ static void open_voice(AC97LinkState *s, int index, int= freq) switch (index) { case PI_INDEX: s->voice_pi =3D AUD_open_in( - &s->card, + s->audio_be, s->voice_pi, "ac97.pi", s, @@ -327,7 +327,7 @@ static void open_voice(AC97LinkState *s, int index, int= freq) =20 case PO_INDEX: s->voice_po =3D AUD_open_out( - &s->card, + s->audio_be, s->voice_po, "ac97.po", s, @@ -338,7 +338,7 @@ static void open_voice(AC97LinkState *s, int index, int= freq) =20 case MC_INDEX: s->voice_mc =3D AUD_open_in( - &s->card, + s->audio_be, s->voice_mc, "ac97.mc", s, @@ -351,17 +351,17 @@ static void open_voice(AC97LinkState *s, int index, i= nt freq) s->invalid_freq[index] =3D freq; switch (index) { case PI_INDEX: - AUD_close_in(&s->card, s->voice_pi); + AUD_close_in(s->audio_be, s->voice_pi); s->voice_pi =3D NULL; break; =20 case PO_INDEX: - AUD_close_out(&s->card, s->voice_po); + AUD_close_out(s->audio_be, s->voice_po); s->voice_po =3D NULL; break; =20 case MC_INDEX: - AUD_close_in(&s->card, s->voice_mc); + AUD_close_in(s->audio_be, s->voice_mc); s->voice_mc =3D NULL; break; } @@ -1271,7 +1271,7 @@ static void ac97_realize(PCIDevice *dev, Error **errp) AC97LinkState *s =3D AC97(dev); uint8_t *c =3D s->dev.config; =20 - if (!AUD_register_card ("ac97", &s->card, errp)) { + if (!AUD_backend_check (&s->audio_be, errp)) { return; } =20 @@ -1316,14 +1316,13 @@ static void ac97_exit(PCIDevice *dev) { AC97LinkState *s =3D AC97(dev); =20 - AUD_close_in(&s->card, s->voice_pi); - AUD_close_out(&s->card, s->voice_po); - AUD_close_in(&s->card, s->voice_mc); - AUD_remove_card(&s->card); + AUD_close_in(s->audio_be, s->voice_pi); + AUD_close_out(s->audio_be, s->voice_po); + AUD_close_in(s->audio_be, s->voice_mc); } =20 static const Property ac97_properties[] =3D { - DEFINE_AUDIO_PROPERTIES(AC97LinkState, card), + DEFINE_AUDIO_PROPERTIES(AC97LinkState, audio_be), }; =20 static void ac97_class_init(ObjectClass *klass, const void *data) diff --git a/hw/audio/adlib.c b/hw/audio/adlib.c index 231055b8b5..1b3d2b8bfc 100644 --- a/hw/audio/adlib.c +++ b/hw/audio/adlib.c @@ -53,7 +53,7 @@ OBJECT_DECLARE_SIMPLE_TYPE(AdlibState, ADLIB) struct AdlibState { ISADevice parent_obj; =20 - QEMUSoundCard card; + AudioBackend *audio_be; uint32_t freq; uint32_t port; int ticking[2]; @@ -236,7 +236,6 @@ static void Adlib_fini (AdlibState *s) =20 s->active =3D 0; s->enabled =3D 0; - AUD_remove_card (&s->card); } =20 static MemoryRegionPortio adlib_portio_list[] =3D { @@ -251,7 +250,7 @@ static void adlib_realizefn (DeviceState *dev, Error **= errp) AdlibState *s =3D ADLIB(dev); struct audsettings as; =20 - if (!AUD_register_card ("adlib", &s->card, errp)) { + if (!AUD_backend_check(&s->audio_be, errp)) { return; } =20 @@ -271,7 +270,7 @@ static void adlib_realizefn (DeviceState *dev, Error **= errp) as.endianness =3D HOST_BIG_ENDIAN; =20 s->voice =3D AUD_open_out ( - &s->card, + s->audio_be, s->voice, "adlib", s, @@ -294,7 +293,7 @@ static void adlib_realizefn (DeviceState *dev, Error **= errp) } =20 static const Property adlib_properties[] =3D { - DEFINE_AUDIO_PROPERTIES(AdlibState, card), + DEFINE_AUDIO_PROPERTIES(AdlibState, audio_be), DEFINE_PROP_UINT32 ("iobase", AdlibState, port, 0x220), DEFINE_PROP_UINT32 ("freq", AdlibState, freq, 44100), }; diff --git a/hw/audio/asc.c b/hw/audio/asc.c index 991316e984..5c3f6c8f86 100644 --- a/hw/audio/asc.c +++ b/hw/audio/asc.c @@ -634,8 +634,6 @@ static void asc_unrealize(DeviceState *dev) =20 g_free(s->mixbuf); g_free(s->silentbuf); - - AUD_remove_card(&s->card); } =20 static void asc_realize(DeviceState *dev, Error **errp) @@ -643,7 +641,7 @@ static void asc_realize(DeviceState *dev, Error **errp) ASCState *s =3D ASC(dev); struct audsettings as; =20 - if (!AUD_register_card("Apple Sound Chip", &s->card, errp)) { + if (!AUD_backend_check(&s->audio_be, errp)) { return; } =20 @@ -652,10 +650,9 @@ static void asc_realize(DeviceState *dev, Error **errp) as.fmt =3D AUDIO_FORMAT_U8; as.endianness =3D HOST_BIG_ENDIAN; =20 - s->voice =3D AUD_open_out(&s->card, s->voice, "asc.out", s, asc_out_cb, + s->voice =3D AUD_open_out(s->audio_be, s->voice, "asc.out", s, asc_out= _cb, &as); if (!s->voice) { - AUD_remove_card(&s->card); error_setg(errp, "Initializing audio stream failed"); return; } @@ -702,7 +699,7 @@ static void asc_init(Object *obj) } =20 static const Property asc_properties[] =3D { - DEFINE_AUDIO_PROPERTIES(ASCState, card), + DEFINE_AUDIO_PROPERTIES(ASCState, audio_be), DEFINE_PROP_UINT8("asctype", ASCState, type, ASC_TYPE_ASC), }; =20 diff --git a/hw/audio/cs4231a.c b/hw/audio/cs4231a.c index 062af7628b..9049065a0e 100644 --- a/hw/audio/cs4231a.c +++ b/hw/audio/cs4231a.c @@ -65,7 +65,7 @@ DECLARE_INSTANCE_CHECKER(CSState, CS4231A, =20 struct CSState { ISADevice dev; - QEMUSoundCard card; + AudioBackend *audio_be; MemoryRegion ioports; qemu_irq pic; uint32_t regs[CS_REGS]; @@ -324,7 +324,7 @@ static void cs_reset_voices (CSState *s, uint32_t val) } =20 s->voice =3D AUD_open_out ( - &s->card, + s->audio_be, s->voice, "cs4231a", s, @@ -674,7 +674,7 @@ static void cs4231a_realizefn (DeviceState *dev, Error = **errp) return; } =20 - if (!AUD_register_card ("cs4231a", &s->card, errp)) { + if (!AUD_backend_check(&s->audio_be, errp)) { return; } =20 @@ -690,7 +690,7 @@ static void cs4231a_realizefn (DeviceState *dev, Error = **errp) } =20 static const Property cs4231a_properties[] =3D { - DEFINE_AUDIO_PROPERTIES(CSState, card), + DEFINE_AUDIO_PROPERTIES(CSState, audio_be), DEFINE_PROP_UINT32 ("iobase", CSState, port, 0x534), DEFINE_PROP_UINT32 ("irq", CSState, irq, 9), DEFINE_PROP_UINT32 ("dma", CSState, dma, 3), diff --git a/hw/audio/es1370.c b/hw/audio/es1370.c index ac5a6aba85..a8ca2045b3 100644 --- a/hw/audio/es1370.c +++ b/hw/audio/es1370.c @@ -258,7 +258,7 @@ struct chan { =20 struct ES1370State { PCIDevice dev; - QEMUSoundCard card; + AudioBackend *audio_be; MemoryRegion io; struct chan chan[NB_CHANNELS]; SWVoiceOut *dac_voice[2]; @@ -330,10 +330,10 @@ static void es1370_reset (ES1370State *s) d->scount =3D 0; d->leftover =3D 0; if (i =3D=3D ADC_CHANNEL) { - AUD_close_in (&s->card, s->adc_voice); + AUD_close_in(s->audio_be, s->adc_voice); s->adc_voice =3D NULL; } else { - AUD_close_out (&s->card, s->dac_voice[i]); + AUD_close_out(s->audio_be, s->dac_voice[i]); s->dac_voice[i] =3D NULL; } } @@ -412,7 +412,7 @@ static void es1370_update_voices (ES1370State *s, uint3= 2_t ctl, uint32_t sctl) if (i =3D=3D ADC_CHANNEL) { s->adc_voice =3D AUD_open_in ( - &s->card, + s->audio_be, s->adc_voice, "es1370.adc", s, @@ -422,7 +422,7 @@ static void es1370_update_voices (ES1370State *s, uint3= 2_t ctl, uint32_t sctl) } else { s->dac_voice[i] =3D AUD_open_out ( - &s->card, + s->audio_be, s->dac_voice[i], i ? "es1370.dac2" : "es1370.dac1", s, @@ -784,12 +784,12 @@ static int es1370_post_load (void *opaque, int versio= n_id) for (i =3D 0; i < NB_CHANNELS; ++i) { if (i =3D=3D ADC_CHANNEL) { if (s->adc_voice) { - AUD_close_in (&s->card, s->adc_voice); + AUD_close_in(s->audio_be, s->adc_voice); s->adc_voice =3D NULL; } } else { if (s->dac_voice[i]) { - AUD_close_out (&s->card, s->dac_voice[i]); + AUD_close_out(s->audio_be, s->dac_voice[i]); s->dac_voice[i] =3D NULL; } } @@ -833,7 +833,7 @@ static void es1370_realize(PCIDevice *dev, Error **errp) ES1370State *s =3D ES1370(dev); uint8_t *c =3D s->dev.config; =20 - if (!AUD_register_card ("es1370", &s->card, errp)) { + if (!AUD_backend_check(&s->audio_be, errp)) { return; } =20 @@ -861,15 +861,14 @@ static void es1370_exit(PCIDevice *dev) int i; =20 for (i =3D 0; i < 2; ++i) { - AUD_close_out(&s->card, s->dac_voice[i]); + AUD_close_out(s->audio_be, s->dac_voice[i]); } =20 - AUD_close_in(&s->card, s->adc_voice); - AUD_remove_card(&s->card); + AUD_close_in(s->audio_be, s->adc_voice); } =20 static const Property es1370_properties[] =3D { - DEFINE_AUDIO_PROPERTIES(ES1370State, card), + DEFINE_AUDIO_PROPERTIES(ES1370State, audio_be), }; =20 static void es1370_class_init(ObjectClass *klass, const void *data) diff --git a/hw/audio/gus.c b/hw/audio/gus.c index 40073f2d4f..434fa58136 100644 --- a/hw/audio/gus.c +++ b/hw/audio/gus.c @@ -45,7 +45,7 @@ OBJECT_DECLARE_SIMPLE_TYPE(GUSState, GUS) struct GUSState { ISADevice dev; GUSEmuState emu; - QEMUSoundCard card; + AudioBackend *audio_be; uint32_t freq; uint32_t port; int pos, left, shift, irqs; @@ -238,7 +238,7 @@ static void gus_realizefn (DeviceState *dev, Error **er= rp) IsaDmaClass *k; struct audsettings as; =20 - if (!AUD_register_card ("gus", &s->card, errp)) { + if (!AUD_backend_check(&s->audio_be, errp)) { return; } =20 @@ -254,7 +254,7 @@ static void gus_realizefn (DeviceState *dev, Error **er= rp) as.endianness =3D HOST_BIG_ENDIAN; =20 s->voice =3D AUD_open_out ( - &s->card, + s->audio_be, NULL, "gus", s, @@ -263,7 +263,6 @@ static void gus_realizefn (DeviceState *dev, Error **er= rp) ); =20 if (!s->voice) { - AUD_remove_card (&s->card); error_setg(errp, "No voice"); return; } @@ -288,7 +287,7 @@ static void gus_realizefn (DeviceState *dev, Error **er= rp) } =20 static const Property gus_properties[] =3D { - DEFINE_AUDIO_PROPERTIES(GUSState, card), + DEFINE_AUDIO_PROPERTIES(GUSState, audio_be), DEFINE_PROP_UINT32 ("freq", GUSState, freq, 44100), DEFINE_PROP_UINT32 ("iobase", GUSState, port, 0x240), DEFINE_PROP_UINT32 ("irq", GUSState, emu.gusirq, 7), diff --git a/hw/audio/hda-codec.c b/hw/audio/hda-codec.c index cc87557954..f7ae2aa1fd 100644 --- a/hw/audio/hda-codec.c +++ b/hw/audio/hda-codec.c @@ -178,7 +178,7 @@ struct HDAAudioState { HDACodecDevice hda; const char *name; =20 - QEMUSoundCard card; + AudioBackend *audio_be; const desc_codec *desc; HDAAudioStream st[4]; bool running_compat[16]; @@ -491,7 +491,7 @@ static void hda_audio_setup(HDAAudioStream *st) } else { cb =3D hda_audio_compat_output_cb; } - st->voice.out =3D AUD_open_out(&st->state->card, st->voice.out, + st->voice.out =3D AUD_open_out(st->state->audio_be, st->voice.out, st->node->name, st, cb, &st->as); } else { if (use_timer) { @@ -500,7 +500,7 @@ static void hda_audio_setup(HDAAudioStream *st) } else { cb =3D hda_audio_compat_input_cb; } - st->voice.in =3D AUD_open_in(&st->state->card, st->voice.in, + st->voice.in =3D AUD_open_in(st->state->audio_be, st->voice.in, st->node->name, st, cb, &st->as); } } @@ -696,7 +696,7 @@ static void hda_audio_init(HDACodecDevice *hda, const desc_param *param; uint32_t i, type; =20 - if (!AUD_register_card("hda", &a->card, errp)) { + if (!AUD_backend_check(&a->audio_be, errp)) { return; } =20 @@ -754,12 +754,11 @@ static void hda_audio_exit(HDACodecDevice *hda) } timer_free(st->buft); if (st->output) { - AUD_close_out(&a->card, st->voice.out); + AUD_close_out(a->audio_be, st->voice.out); } else { - AUD_close_in(&a->card, st->voice.in); + AUD_close_in(a->audio_be, st->voice.in); } } - AUD_remove_card(&a->card); } =20 static int hda_audio_post_load(void *opaque, int version) @@ -858,7 +857,7 @@ static const VMStateDescription vmstate_hda_audio =3D { }; =20 static const Property hda_audio_properties[] =3D { - DEFINE_AUDIO_PROPERTIES(HDAAudioState, card), + DEFINE_AUDIO_PROPERTIES(HDAAudioState, audio_be), DEFINE_PROP_UINT32("debug", HDAAudioState, debug, 0), DEFINE_PROP_BOOL("mixer", HDAAudioState, mixer, true), DEFINE_PROP_BOOL("use-timer", HDAAudioState, use_timer, true), diff --git a/hw/audio/lm4549.c b/hw/audio/lm4549.c index dccbf56068..c51ec0e66f 100644 --- a/hw/audio/lm4549.c +++ b/hw/audio/lm4549.c @@ -190,7 +190,7 @@ void lm4549_write(lm4549_state *s, as.endianness =3D 0; =20 s->voice =3D AUD_open_out( - &s->card, + s->audio_be, s->voice, "lm4549.out", s, @@ -260,7 +260,7 @@ static int lm4549_post_load(void *opaque, int version_i= d) as.endianness =3D 0; =20 s->voice =3D AUD_open_out( - &s->card, + s->audio_be, s->voice, "lm4549.out", s, @@ -282,7 +282,7 @@ void lm4549_init(lm4549_state *s, lm4549_callback data_= req_cb, void* opaque, struct audsettings as; =20 /* Register an audio card */ - if (!AUD_register_card("lm4549", &s->card, errp)) { + if (!AUD_backend_check(&s->audio_be, errp)) { return; } =20 @@ -300,7 +300,7 @@ void lm4549_init(lm4549_state *s, lm4549_callback data_= req_cb, void* opaque, as.endianness =3D 0; =20 s->voice =3D AUD_open_out( - &s->card, + s->audio_be, s->voice, "lm4549.out", s, diff --git a/hw/audio/pcspk.c b/hw/audio/pcspk.c index e9ab5ac41b..36efb038f3 100644 --- a/hw/audio/pcspk.c +++ b/hw/audio/pcspk.c @@ -48,7 +48,7 @@ struct PCSpkState { MemoryRegion ioport; uint32_t iobase; uint8_t sample_buf[PCSPK_BUF_LEN]; - QEMUSoundCard card; + AudioBackend *audio_be; SWVoiceOut *voice; PITCommonState *pit; unsigned int pit_count; @@ -122,7 +122,7 @@ static int pcspk_audio_init(PCSpkState *s) return 0; } =20 - s->voice =3D AUD_open_out(&s->card, s->voice, s_spk, s, pcspk_callback= , &as); + s->voice =3D AUD_open_out(s->audio_be, s->voice, s_spk, s, pcspk_callb= ack, &as); if (!s->voice) { error_report("pcspk: Could not open voice"); return -1; @@ -188,8 +188,9 @@ static void pcspk_realizefn(DeviceState *dev, Error **e= rrp) =20 isa_register_ioport(isadev, &s->ioport, s->iobase); =20 - if (s->card.be && AUD_register_card(s_spk, &s->card, errp)) { + if (s->audio_be && AUD_backend_check(&s->audio_be, errp)) { pcspk_audio_init(s); + return; } } =20 @@ -213,7 +214,7 @@ static const VMStateDescription vmstate_spk =3D { }; =20 static const Property pcspk_properties[] =3D { - DEFINE_AUDIO_PROPERTIES(PCSpkState, card), + DEFINE_AUDIO_PROPERTIES(PCSpkState, audio_be), DEFINE_PROP_UINT32("iobase", PCSpkState, iobase, 0x61), DEFINE_PROP_BOOL("migrate", PCSpkState, migrate, true), DEFINE_PROP_LINK("pit", PCSpkState, pit, TYPE_PIT_COMMON, PITCommonSta= te *), diff --git a/hw/audio/pl041.c b/hw/audio/pl041.c index 5d9d6c1178..fd3d09611f 100644 --- a/hw/audio/pl041.c +++ b/hw/audio/pl041.c @@ -626,7 +626,7 @@ static const VMStateDescription vmstate_pl041 =3D { }; =20 static const Property pl041_device_properties[] =3D { - DEFINE_AUDIO_PROPERTIES(PL041State, codec.card), + DEFINE_AUDIO_PROPERTIES(PL041State, codec.audio_be), /* Non-compact FIFO depth property */ DEFINE_PROP_UINT32("nc_fifo_depth", PL041State, fifo_depth, DEFAULT_FIFO_DEPTH), diff --git a/hw/audio/sb16.c b/hw/audio/sb16.c index 069cf6e120..4978c2c014 100644 --- a/hw/audio/sb16.c +++ b/hw/audio/sb16.c @@ -50,7 +50,7 @@ OBJECT_DECLARE_SIMPLE_TYPE(SB16State, SB16) struct SB16State { ISADevice parent_obj; =20 - QEMUSoundCard card; + AudioBackend *audio_be; qemu_irq pic; uint32_t irq; uint32_t dma; @@ -212,7 +212,7 @@ static void continue_dma8 (SB16State *s) as.endianness =3D 0; =20 s->voice =3D AUD_open_out ( - &s->card, + s->audio_be, s->voice, "sb16", s, @@ -375,7 +375,7 @@ static void dma_cmd (SB16State *s, uint8_t cmd, uint8_t= d0, int dma_len) as.endianness =3D 0; =20 s->voice =3D AUD_open_out ( - &s->card, + s->audio_be, s->voice, "sb16", s, @@ -876,7 +876,7 @@ static void legacy_reset (SB16State *s) as.endianness =3D 0; =20 s->voice =3D AUD_open_out ( - &s->card, + s->audio_be, s->voice, "sb16", s, @@ -1283,7 +1283,7 @@ static int sb16_post_load (void *opaque, int version_= id) SB16State *s =3D opaque; =20 if (s->voice) { - AUD_close_out (&s->card, s->voice); + AUD_close_out(s->audio_be, s->voice); s->voice =3D NULL; } =20 @@ -1299,7 +1299,7 @@ static int sb16_post_load (void *opaque, int version_= id) as.endianness =3D 0; =20 s->voice =3D AUD_open_out ( - &s->card, + s->audio_be, s->voice, "sb16", s, @@ -1397,7 +1397,7 @@ static void sb16_realizefn (DeviceState *dev, Error *= *errp) SB16State *s =3D SB16 (dev); IsaDmaClass *k; =20 - if (!AUD_register_card ("sb16", &s->card, errp)) { + if (!AUD_backend_check(&s->audio_be, errp)) { return; } =20 @@ -1436,7 +1436,7 @@ static void sb16_realizefn (DeviceState *dev, Error *= *errp) } =20 static const Property sb16_properties[] =3D { - DEFINE_AUDIO_PROPERTIES(SB16State, card), + DEFINE_AUDIO_PROPERTIES(SB16State, audio_be), DEFINE_PROP_UINT32 ("version", SB16State, ver, 0x0405), /* 4.5 */ DEFINE_PROP_UINT32 ("iobase", SB16State, port, 0x220), DEFINE_PROP_UINT32 ("irq", SB16State, irq, 5), diff --git a/hw/audio/via-ac97.c b/hw/audio/via-ac97.c index 62341e5600..019d296853 100644 --- a/hw/audio/via-ac97.c +++ b/hw/audio/via-ac97.c @@ -239,7 +239,7 @@ static void open_voice_out(ViaAC97State *s) .fmt =3D s->aur.type & BIT(5) ? AUDIO_FORMAT_S16 : AUDIO_FORMAT_S8, .endianness =3D 0, }; - s->vo =3D AUD_open_out(&s->card, s->vo, "via-ac97.out", s, out_cb, &as= ); + s->vo =3D AUD_open_out(s->audio_be, s->vo, "via-ac97.out", s, out_cb, = &as); } =20 static uint64_t sgd_read(void *opaque, hwaddr addr, unsigned size) @@ -426,7 +426,7 @@ static void via_ac97_realize(PCIDevice *pci_dev, Error = **errp) ViaAC97State *s =3D VIA_AC97(pci_dev); Object *o =3D OBJECT(s); =20 - if (!AUD_register_card ("via-ac97", &s->card, errp)) { + if (!AUD_backend_check(&s->audio_be, errp)) { return; } =20 @@ -455,12 +455,11 @@ static void via_ac97_exit(PCIDevice *dev) { ViaAC97State *s =3D VIA_AC97(dev); =20 - AUD_close_out(&s->card, s->vo); - AUD_remove_card(&s->card); + AUD_close_out(s->audio_be, s->vo); } =20 static const Property via_ac97_properties[] =3D { - DEFINE_AUDIO_PROPERTIES(ViaAC97State, card), + DEFINE_AUDIO_PROPERTIES(ViaAC97State, audio_be), }; =20 static void via_ac97_class_init(ObjectClass *klass, const void *data) diff --git a/hw/audio/virtio-snd.c b/hw/audio/virtio-snd.c index 88777977a9..9101560f38 100644 --- a/hw/audio/virtio-snd.c +++ b/hw/audio/virtio-snd.c @@ -78,7 +78,7 @@ static const VMStateDescription vmstate_virtio_snd =3D { }; =20 static const Property virtio_snd_properties[] =3D { - DEFINE_AUDIO_PROPERTIES(VirtIOSound, card), + DEFINE_AUDIO_PROPERTIES(VirtIOSound, audio_be), DEFINE_PROP_UINT32("jacks", VirtIOSound, snd_conf.jacks, VIRTIO_SOUND_JACK_DEFAULT), DEFINE_PROP_UINT32("streams", VirtIOSound, snd_conf.streams, @@ -391,10 +391,10 @@ static void virtio_snd_pcm_close(VirtIOSoundPCMStream= *stream) if (stream) { virtio_snd_pcm_flush(stream); if (stream->info.direction =3D=3D VIRTIO_SND_D_OUTPUT) { - AUD_close_out(&stream->pcm->snd->card, stream->voice.out); + AUD_close_out(stream->pcm->snd->audio_be, stream->voice.out); stream->voice.out =3D NULL; } else if (stream->info.direction =3D=3D VIRTIO_SND_D_INPUT) { - AUD_close_in(&stream->pcm->snd->card, stream->voice.in); + AUD_close_in(stream->pcm->snd->audio_be, stream->voice.in); stream->voice.in =3D NULL; } } @@ -457,7 +457,7 @@ static uint32_t virtio_snd_pcm_prepare(VirtIOSound *s, = uint32_t stream_id) stream->as =3D as; =20 if (stream->info.direction =3D=3D VIRTIO_SND_D_OUTPUT) { - stream->voice.out =3D AUD_open_out(&s->card, + stream->voice.out =3D AUD_open_out(s->audio_be, stream->voice.out, "virtio-sound.out", stream, @@ -465,7 +465,7 @@ static uint32_t virtio_snd_pcm_prepare(VirtIOSound *s, = uint32_t stream_id) &as); AUD_set_volume_out_lr(stream->voice.out, 0, 255, 255); } else { - stream->voice.in =3D AUD_open_in(&s->card, + stream->voice.in =3D AUD_open_in(s->audio_be, stream->voice.in, "virtio-sound.in", stream, @@ -1053,7 +1053,7 @@ static void virtio_snd_realize(DeviceState *dev, Erro= r **errp) return; } =20 - if (!AUD_register_card("virtio-sound", &vsnd->card, errp)) { + if (!AUD_backend_check(&vsnd->audio_be, errp)) { return; } =20 @@ -1330,7 +1330,6 @@ static void virtio_snd_unrealize(DeviceState *dev) g_free(vsnd->pcm); vsnd->pcm =3D NULL; } - AUD_remove_card(&vsnd->card); qemu_mutex_destroy(&vsnd->cmdq_mutex); virtio_delete_queue(vsnd->queues[VIRTIO_SND_VQ_CONTROL]); virtio_delete_queue(vsnd->queues[VIRTIO_SND_VQ_EVENT]); diff --git a/hw/audio/wm8750.c b/hw/audio/wm8750.c index 7a36c4bd3f..d399c335c3 100644 --- a/hw/audio/wm8750.c +++ b/hw/audio/wm8750.c @@ -34,7 +34,7 @@ struct WM8750State { =20 uint8_t i2c_data[2]; int i2c_len; - QEMUSoundCard card; + AudioBackend *audio_be; SWVoiceIn *adc_voice[IN_PORT_N]; SWVoiceOut *dac_voice[OUT_PORT_N]; int enable; @@ -188,12 +188,12 @@ static void wm8750_set_format(WM8750State *s) =20 for (i =3D 0; i < IN_PORT_N; i ++) if (s->adc_voice[i]) { - AUD_close_in(&s->card, s->adc_voice[i]); + AUD_close_in(s->audio_be, s->adc_voice[i]); s->adc_voice[i] =3D NULL; } for (i =3D 0; i < OUT_PORT_N; i ++) if (s->dac_voice[i]) { - AUD_close_out(&s->card, s->dac_voice[i]); + AUD_close_out(s->audio_be, s->dac_voice[i]); s->dac_voice[i] =3D NULL; } =20 @@ -206,11 +206,11 @@ static void wm8750_set_format(WM8750State *s) in_fmt.freq =3D s->adc_hz; in_fmt.fmt =3D AUDIO_FORMAT_S16; =20 - s->adc_voice[0] =3D AUD_open_in(&s->card, s->adc_voice[0], + s->adc_voice[0] =3D AUD_open_in(s->audio_be, s->adc_voice[0], CODEC ".input1", s, wm8750_audio_in_cb, &in_fmt); - s->adc_voice[1] =3D AUD_open_in(&s->card, s->adc_voice[1], + s->adc_voice[1] =3D AUD_open_in(s->audio_be, s->adc_voice[1], CODEC ".input2", s, wm8750_audio_in_cb, &in_fmt); - s->adc_voice[2] =3D AUD_open_in(&s->card, s->adc_voice[2], + s->adc_voice[2] =3D AUD_open_in(s->audio_be, s->adc_voice[2], CODEC ".input3", s, wm8750_audio_in_cb, &in_fmt); =20 /* Setup output */ @@ -219,12 +219,12 @@ static void wm8750_set_format(WM8750State *s) out_fmt.freq =3D s->dac_hz; out_fmt.fmt =3D AUDIO_FORMAT_S16; =20 - s->dac_voice[0] =3D AUD_open_out(&s->card, s->dac_voice[0], + s->dac_voice[0] =3D AUD_open_out(s->audio_be, s->dac_voice[0], CODEC ".speaker", s, wm8750_audio_out_cb, &out_fmt); - s->dac_voice[1] =3D AUD_open_out(&s->card, s->dac_voice[1], + s->dac_voice[1] =3D AUD_open_out(s->audio_be, s->dac_voice[1], CODEC ".headphone", s, wm8750_audio_out_cb, &out_fmt); /* MONOMIX is also in stereo for simplicity */ - s->dac_voice[2] =3D AUD_open_out(&s->card, s->dac_voice[2], + s->dac_voice[2] =3D AUD_open_out(s->audio_be, s->dac_voice[2], CODEC ".monomix", s, wm8750_audio_out_cb, &out_fmt); /* no sense emulating OUT3 which is a mix of other outputs */ =20 @@ -624,7 +624,7 @@ static void wm8750_realize(DeviceState *dev, Error **er= rp) { WM8750State *s =3D WM8750(dev); =20 - if (!AUD_register_card(CODEC, &s->card, errp)) { + if (!AUD_backend_check(&s->audio_be, errp)) { return; } =20 @@ -637,7 +637,6 @@ static void wm8750_fini(I2CSlave *i2c) WM8750State *s =3D WM8750(i2c); =20 wm8750_reset(I2C_SLAVE(s)); - AUD_remove_card(&s->card); g_free(s); } #endif @@ -707,7 +706,7 @@ void wm8750_set_bclk_in(void *opaque, int new_hz) } =20 static const Property wm8750_properties[] =3D { - DEFINE_AUDIO_PROPERTIES(WM8750State, card), + DEFINE_AUDIO_PROPERTIES(WM8750State, audio_be), }; =20 static void wm8750_class_init(ObjectClass *klass, const void *data) diff --git a/hw/core/qdev-properties-system.c b/hw/core/qdev-properties-sys= tem.c index c83a52fc62..578cbdc015 100644 --- a/hw/core/qdev-properties-system.c +++ b/hw/core/qdev-properties-system.c @@ -487,18 +487,17 @@ static void get_audiodev(Object *obj, Visitor *v, con= st char* name, void *opaque, Error **errp) { const Property *prop =3D opaque; - QEMUSoundCard *card =3D object_field_prop_ptr(obj, prop); - char *p =3D g_strdup(audio_get_id(card)); + AudioBackend **be =3D object_field_prop_ptr(obj, prop); + g_autofree char *id =3D g_strdup(audio_be_get_id(*be)); =20 - visit_type_str(v, name, &p, errp); - g_free(p); + visit_type_str(v, name, (char **)&id, errp); } =20 static void set_audiodev(Object *obj, Visitor *v, const char* name, void *opaque, Error **errp) { const Property *prop =3D opaque; - QEMUSoundCard *card =3D object_field_prop_ptr(obj, prop); + AudioBackend **be =3D object_field_prop_ptr(obj, prop); AudioBackend *state; g_autofree char *str =3D NULL; =20 @@ -508,7 +507,7 @@ static void set_audiodev(Object *obj, Visitor *v, const= char* name, =20 state =3D audio_be_by_name(str, errp); if (state) { - card->be =3D state; + *be =3D state; } } =20 diff --git a/hw/display/xlnx_dp.c b/hw/display/xlnx_dp.c index 882ae3c4b4..96cbb1b3a7 100644 --- a/hw/display/xlnx_dp.c +++ b/hw/display/xlnx_dp.c @@ -1306,7 +1306,7 @@ static void xlnx_dp_realize(DeviceState *dev, Error *= *errp) DisplaySurface *surface; struct audsettings as; =20 - if (!AUD_register_card("xlnx_dp.audio", &s->aud_card, errp)) { + if (!AUD_backend_check(&s->audio_be, errp)) { return; } =20 @@ -1328,7 +1328,7 @@ static void xlnx_dp_realize(DeviceState *dev, Error *= *errp) as.fmt =3D AUDIO_FORMAT_S16; as.endianness =3D 0; =20 - s->amixer_output_stream =3D AUD_open_out(&s->aud_card, + s->amixer_output_stream =3D AUD_open_out(s->audio_be, s->amixer_output_stream, "xlnx_dp.audio.out", s, @@ -1392,7 +1392,7 @@ static void xlnx_dp_reset(DeviceState *dev) } =20 static const Property xlnx_dp_device_properties[] =3D { - DEFINE_AUDIO_PROPERTIES(XlnxDPState, aud_card), + DEFINE_AUDIO_PROPERTIES(XlnxDPState, audio_be), }; =20 static void xlnx_dp_class_init(ObjectClass *oc, const void *data) diff --git a/hw/usb/dev-audio.c b/hw/usb/dev-audio.c index f59e5a53f0..c8e032ab64 100644 --- a/hw/usb/dev-audio.c +++ b/hw/usb/dev-audio.c @@ -635,7 +635,7 @@ static uint8_t *streambuf_get(struct streambuf *buf, si= ze_t *len) struct USBAudioState { /* qemu interfaces */ USBDevice dev; - QEMUSoundCard card; + AudioBackend *audio_be; =20 /* state */ struct { @@ -931,8 +931,7 @@ static void usb_audio_unrealize(USBDevice *dev) } =20 usb_audio_set_output_altset(s, ALTSET_OFF); - AUD_close_out(&s->card, s->out.voice); - AUD_remove_card(&s->card); + AUD_close_out(s->audio_be, s->out.voice); =20 streambuf_fini(&s->out.buf); } @@ -942,7 +941,7 @@ static void usb_audio_realize(USBDevice *dev, Error **e= rrp) USBAudioState *s =3D USB_AUDIO(dev); int i; =20 - if (!AUD_register_card(TYPE_USB_AUDIO, &s->card, errp)) { + if (!AUD_backend_check(&s->audio_be, errp)) { return; } =20 @@ -979,7 +978,7 @@ static void usb_audio_reinit(USBDevice *dev, unsigned c= hannels) s->out.as.endianness =3D 0; streambuf_init(&s->out.buf, s->buffer, s->out.channels); =20 - s->out.voice =3D AUD_open_out(&s->card, s->out.voice, TYPE_USB_AUDIO, + s->out.voice =3D AUD_open_out(s->audio_be, s->out.voice, TYPE_USB_AUDI= O, s, output_callback, &s->out.as); AUD_set_volume_out(s->out.voice, &s->out.vol); AUD_set_active_out(s->out.voice, 0); @@ -991,7 +990,7 @@ static const VMStateDescription vmstate_usb_audio =3D { }; =20 static const Property usb_audio_properties[] =3D { - DEFINE_AUDIO_PROPERTIES(USBAudioState, card), + DEFINE_AUDIO_PROPERTIES(USBAudioState, audio_be), DEFINE_PROP_UINT32("debug", USBAudioState, debug, 0), DEFINE_PROP_UINT32("buffer", USBAudioState, buffer_user, 0), DEFINE_PROP_BOOL("multi", USBAudioState, multi, false), --=20 2.51.0 From nobody Fri Nov 14 18:21:23 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1761116680; cv=none; d=zohomail.com; s=zohoarc; b=OYkPEpY234ScWrcyD+L9K5wx/PeKvPgL5lfyRtIRm09CVwp8ubqw6+2pMfRt2UBX4O25OrgAvcBVUd+FxxOwWlbCjvvR9xpH68tESl1QYnQz9V6VmlU9YOlNNau4MQYSrKTUwITl6kljUNXIjFD2E6RHXMJk08P+xl0ZLS2NUt0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761116680; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=FjSR33DsJvkrIe60x4ku9xd2w76HTZjoQHJctCihqkc=; b=hP3mA3xgQkIsXCA0pgFdwZrSrR9QgjBGExiRgfR/NSIR+C4nxhZLCHiYiTUN9biZVkNM7RKfhhbKiqFtaIFicffJEioRPfdUbKA498OeETtdk7Dr9LhShWxMDIJz2yzwKsJ88MDC2F/ldLZhJOvTUaAN8Ss190p9KlwvCuyabqY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1761116679997416.98333183903867; Wed, 22 Oct 2025 00:04:39 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vBSqG-00016A-W8; Wed, 22 Oct 2025 03:01:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vBSpe-0000t6-HR for qemu-devel@nongnu.org; Wed, 22 Oct 2025 03:00:30 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vBSpU-0000CJ-Rs for qemu-devel@nongnu.org; Wed, 22 Oct 2025 03:00:22 -0400 Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-164-VAzbYpjXNo-rGasQMb2SLQ-1; Wed, 22 Oct 2025 03:00:10 -0400 Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id F2D16195608A; Wed, 22 Oct 2025 07:00:08 +0000 (UTC) Received: from localhost (unknown [10.44.22.9]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 84FF818003FC; Wed, 22 Oct 2025 07:00:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761116415; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=FjSR33DsJvkrIe60x4ku9xd2w76HTZjoQHJctCihqkc=; b=jKvrZY73V3LVWok3tGdXmjtxjEP0isWeXO4UCv+X5t32pgqD1OQcrXeBcjIT+1MRNUqvFF ZmOrW26eNAw9am2UkEG9uycQw9gBD3BlMr+Jqu1DbXa9AeLLr1fNFvVyQD6+1yoCDNs/N+ F833hxKDnQ27mqB6sPkDddxaz4bntzE= X-MC-Unique: VAzbYpjXNo-rGasQMb2SLQ-1 X-Mimecast-MFC-AGG-ID: VAzbYpjXNo-rGasQMb2SLQ_1761116409 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Volker=20R=C3=BCmelin?= , Paolo Bonzini , BALATON Zoltan , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Gerd Hoffmann Subject: [PATCH v2 36/42] audio/dbus: use a helper function to set the backend dbus server Date: Wed, 22 Oct 2025 10:56:31 +0400 Message-ID: <20251022065640.1172785-37-marcandre.lureau@redhat.com> In-Reply-To: <20251022065640.1172785-1-marcandre.lureau@redhat.com> References: <20251022065640.1172785-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1761116696721158500 From: Marc-Andr=C3=A9 Lureau Signed-off-by: Marc-Andr=C3=A9 Lureau --- audio/audio.h | 6 ++++++ audio/audio_int.h | 2 +- audio/audio.c | 14 ++++++++++++++ audio/dbusaudio.c | 6 ++++-- ui/dbus.c | 8 +------- 5 files changed, 26 insertions(+), 10 deletions(-) diff --git a/audio/audio.h b/audio/audio.h index 4c596fcc7f..216b95eb4f 100644 --- a/audio/audio.h +++ b/audio/audio.h @@ -28,6 +28,9 @@ #include "qemu/queue.h" #include "qapi/qapi-types-audio.h" #include "hw/qdev-properties-system.h" +#ifdef CONFIG_GIO +#include "gio/gio.h" +#endif =20 typedef void (*audio_callback_fn) (void *opaque, int avail); =20 @@ -150,6 +153,9 @@ void audio_help(void); AudioBackend *audio_be_by_name(const char *name, Error **errp); AudioBackend *audio_get_default_audio_be(Error **errp); const char *audio_be_get_id(AudioBackend *be); +#ifdef CONFIG_GIO +bool audio_be_set_dbus_server(AudioBackend *be, GDBusObjectManagerServer *= server, bool p2p, Error **errp); +#endif =20 #define DEFINE_AUDIO_PROPERTIES(_s, _f) \ DEFINE_PROP_AUDIODEV("audiodev", _s, _f) diff --git a/audio/audio_int.h b/audio/audio_int.h index 210457e0c4..f077f741c8 100644 --- a/audio/audio_int.h +++ b/audio/audio_int.h @@ -145,7 +145,7 @@ struct audio_driver { void *(*init) (Audiodev *, Error **); void (*fini) (void *); #ifdef CONFIG_GIO - void (*set_dbus_server) (AudioBackend *s, GDBusObjectManagerServer *ma= nager, bool p2p); + bool (*set_dbus_server) (AudioBackend *be, GDBusObjectManagerServer *m= anager, bool p2p, Error **errp); #endif struct audio_pcm_ops *pcm_ops; int max_voices_out; diff --git a/audio/audio.c b/audio/audio.c index a2350cfe23..92768fc81c 100644 --- a/audio/audio.c +++ b/audio/audio.c @@ -2223,6 +2223,20 @@ AudioBackend *audio_be_by_name(const char *name, Err= or **errp) } } =20 +#ifdef CONFIG_GIO +bool audio_be_set_dbus_server(AudioBackend *be, GDBusObjectManagerServer *= server, bool p2p, Error **errp) +{ + assert(be !=3D NULL); + + if (!be->drv->set_dbus_server) { + error_setg(errp, "Audiodev '%s' is not compatible with DBus", be->= dev->id); + return false; + } + + return be->drv->set_dbus_server(be, server, p2p, errp); +} +#endif + const char *audio_be_get_id(AudioBackend *be) { if (be) { diff --git a/audio/dbusaudio.c b/audio/dbusaudio.c index 49cef38e3e..33d6365811 100644 --- a/audio/dbusaudio.c +++ b/audio/dbusaudio.c @@ -645,8 +645,8 @@ dbus_audio_register_in_listener(AudioBackend *s, arg_listener, false); } =20 -static void -dbus_audio_set_server(AudioBackend *s, GDBusObjectManagerServer *server, b= ool p2p) +static bool +dbus_audio_set_server(AudioBackend *s, GDBusObjectManagerServer *server, b= ool p2p, Error **errp) { DBusAudio *da =3D s->drv_opaque; =20 @@ -669,6 +669,8 @@ dbus_audio_set_server(AudioBackend *s, GDBusObjectManag= erServer *server, bool p2 g_dbus_object_skeleton_add_interface(G_DBUS_OBJECT_SKELETON(da->audio), G_DBUS_INTERFACE_SKELETON(da->ifa= ce)); g_dbus_object_manager_server_export(da->server, da->audio); + + return true; } =20 static struct audio_pcm_ops dbus_pcm_ops =3D { diff --git a/ui/dbus.c b/ui/dbus.c index 84cff47ec7..fbe108af1e 100644 --- a/ui/dbus.c +++ b/ui/dbus.c @@ -221,15 +221,9 @@ dbus_display_complete(UserCreatable *uc, Error **errp) =20 if (dd->audiodev && *dd->audiodev) { AudioBackend *audio_be =3D audio_be_by_name(dd->audiodev, errp); - if (!audio_be) { + if (!audio_be || !audio_be_set_dbus_server(audio_be, dd->server, d= d->p2p, errp)) { return; } - if (!g_str_equal(audio_be->drv->name, "dbus")) { - error_setg(errp, "Audiodev '%s' is not compatible with DBus", - dd->audiodev); - return; - } - audio_be->drv->set_dbus_server(audio_be, dd->server, dd->p2p); } =20 consoles =3D g_array_new(FALSE, FALSE, sizeof(guint32)); --=20 2.51.0 From nobody Fri Nov 14 18:21:23 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1761116779; cv=none; d=zohomail.com; s=zohoarc; b=ThP9y1b5ZPVD9nj2I4cF558Bd0sgBzBn0I9g2q30GFjTVJGcp9Sxl+H/FIAG+9945zkziHFuQT3Jnp0SsyL5abIcC9Z22abXl7RcMrdVDan/TCAT1CfaEqVBE7Bbm43Qz9Ujuop78io1W4i1Len9SbIAhYg29MEA0WPikQx+eH0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761116779; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=+f82GTGcNSqsxK7t2WYVk7cYafvMMKWrVe//nwV7v5E=; b=OKCQ4ARNOaC+6CTd26in46XHa8jvORIqNZogeAX67y0DR51wUg6+B4wjLSCnUndtvAI9H75m5My31QDXcyySU5gu5w0DMZd79oFpQM1zSJDuHt2y7CzuLs+pQC5CfnCKfuXpuLgQu+F1lkx9OWnmQewH4Hz8h8xYluxmocIsK+c= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1761116779698111.47456240606618; Wed, 22 Oct 2025 00:06:19 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vBSqQ-0001HW-RS; Wed, 22 Oct 2025 03:01:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vBSpj-0000uR-8f for qemu-devel@nongnu.org; Wed, 22 Oct 2025 03:00:35 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vBSpe-0000Dg-By for qemu-devel@nongnu.org; Wed, 22 Oct 2025 03:00:30 -0400 Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-474-e870Jf4rPZCYgKVQiyQ2jQ-1; Wed, 22 Oct 2025 03:00:20 -0400 Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 3350B19560B5; Wed, 22 Oct 2025 07:00:16 +0000 (UTC) Received: from localhost (unknown [10.44.22.9]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 8FDFE1800584; Wed, 22 Oct 2025 07:00:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761116425; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=+f82GTGcNSqsxK7t2WYVk7cYafvMMKWrVe//nwV7v5E=; b=gjnOvALLmONXX0/mF8dLOXfjxJXMsUgPqvSLA6JFlJ9XHEz82b+Rt3QVfZoGPX9JcoTLRI okT2ky5vo1M/DIAipwEfYFvkFh5+Mb29pdsaO/rEwfQ3TBttLez8qDI81R2sCReM+W0fZ3 X0Df0TmqCHtJe0KxRyBu2PFT6tYKs/I= X-MC-Unique: e870Jf4rPZCYgKVQiyQ2jQ-1 X-Mimecast-MFC-AGG-ID: e870Jf4rPZCYgKVQiyQ2jQ_1761116417 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Volker=20R=C3=BCmelin?= , Paolo Bonzini , BALATON Zoltan , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Gerd Hoffmann , Christian Schoenebeck , Akihiko Odaki , Thomas Huth , Alexandre Ratchov , Peter Maydell , Jan Kiszka , Alistair Francis , "Edgar E. Iglesias" , Laurent Vivier , Eduardo Habkost , Marcel Apfelbaum , Yanan Wang , Zhao Liu , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , =?UTF-8?q?Herv=C3=A9=20Poussineau?= , Manos Pitsidianakis , Jiaxun Yang , =?UTF-8?q?Alex=20Benn=C3=A9e?= , qemu-arm@nongnu.org (open list:Integrator CP), qemu-ppc@nongnu.org (open list:PReP) Subject: [PATCH v2 37/42] audio: move audio.h under include/qemu/ Date: Wed, 22 Oct 2025 10:56:32 +0400 Message-ID: <20251022065640.1172785-38-marcandre.lureau@redhat.com> In-Reply-To: <20251022065640.1172785-1-marcandre.lureau@redhat.com> References: <20251022065640.1172785-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1761116782060154100 From: Marc-Andr=C3=A9 Lureau Signed-off-by: Marc-Andr=C3=A9 Lureau --- audio/audio_int.h | 2 +- hw/audio/lm4549.h | 2 +- include/hw/audio/asc.h | 2 +- include/hw/audio/virtio-snd.h | 2 +- include/hw/display/xlnx_dp.h | 2 +- include/hw/isa/vt82c686.h | 2 +- {audio =3D> include/qemu}/audio.h | 0 include/system/replay.h | 2 +- ui/vnc.h | 2 +- audio/alsaaudio.c | 2 +- audio/audio.c | 2 +- audio/audio_win_int.c | 2 +- audio/dbusaudio.c | 2 +- audio/dsoundaudio.c | 2 +- audio/jackaudio.c | 2 +- audio/mixeng.c | 2 +- audio/noaudio.c | 2 +- audio/ossaudio.c | 2 +- audio/paaudio.c | 2 +- audio/pwaudio.c | 2 +- audio/sdlaudio.c | 2 +- audio/sndioaudio.c | 2 +- audio/spiceaudio.c | 2 +- audio/wavaudio.c | 2 +- hw/arm/integratorcp.c | 2 +- hw/arm/musicpal.c | 2 +- hw/arm/realview.c | 2 +- hw/arm/versatilepb.c | 2 +- hw/arm/vexpress.c | 2 +- hw/arm/xlnx-zcu102.c | 2 +- hw/audio/ac97.c | 2 +- hw/audio/adlib.c | 2 +- hw/audio/asc.c | 2 +- hw/audio/cs4231a.c | 2 +- hw/audio/es1370.c | 2 +- hw/audio/gus.c | 2 +- hw/audio/hda-codec.c | 2 +- hw/audio/lm4549.c | 2 +- hw/audio/marvell_88w8618.c | 2 +- hw/audio/pcspk.c | 2 +- hw/audio/sb16.c | 2 +- hw/audio/wm8750.c | 2 +- hw/core/machine.c | 2 +- hw/core/qdev-properties-system.c | 2 +- hw/ppc/prep.c | 2 +- hw/usb/dev-audio.c | 2 +- replay/replay-audio.c | 2 +- system/runstate.c | 2 +- system/vl.c | 2 +- ui/dbus.c | 3 +-- audio/coreaudio.m | 2 +- scripts/codeconverter/codeconverter/test_regexps.py | 2 +- 52 files changed, 51 insertions(+), 52 deletions(-) rename {audio =3D> include/qemu}/audio.h (100%) diff --git a/audio/audio_int.h b/audio/audio_int.h index f077f741c8..a97edd77dd 100644 --- a/audio/audio_int.h +++ b/audio/audio_int.h @@ -29,7 +29,7 @@ #define FLOAT_MIXENG /* #define RECIPROCAL */ #endif -#include "audio.h" +#include "qemu/audio.h" #include "mixeng.h" =20 #ifdef CONFIG_GIO diff --git a/hw/audio/lm4549.h b/hw/audio/lm4549.h index 1d858e2a04..bbd73057bf 100644 --- a/hw/audio/lm4549.h +++ b/hw/audio/lm4549.h @@ -12,7 +12,7 @@ #ifndef HW_LM4549_H #define HW_LM4549_H =20 -#include "audio/audio.h" +#include "qemu/audio.h" #include "exec/hwaddr.h" =20 typedef void (*lm4549_callback)(void *opaque); diff --git a/include/hw/audio/asc.h b/include/hw/audio/asc.h index a60c2f597c..bb51e9a3d1 100644 --- a/include/hw/audio/asc.h +++ b/include/hw/audio/asc.h @@ -14,7 +14,7 @@ #define HW_AUDIO_ASC_H =20 #include "hw/sysbus.h" -#include "audio/audio.h" +#include "qemu/audio.h" =20 #define ASC_FREQ 22257 =20 diff --git a/include/hw/audio/virtio-snd.h b/include/hw/audio/virtio-snd.h index 0ad80bc9be..c176066584 100644 --- a/include/hw/audio/virtio-snd.h +++ b/include/hw/audio/virtio-snd.h @@ -17,7 +17,7 @@ #define QEMU_VIRTIO_SOUND_H =20 #include "hw/virtio/virtio.h" -#include "audio/audio.h" +#include "qemu/audio.h" #include "standard-headers/linux/virtio_ids.h" #include "standard-headers/linux/virtio_snd.h" =20 diff --git a/include/hw/display/xlnx_dp.h b/include/hw/display/xlnx_dp.h index 802a1427c9..af859e477d 100644 --- a/include/hw/display/xlnx_dp.h +++ b/include/hw/display/xlnx_dp.h @@ -33,7 +33,7 @@ #include "qemu/fifo8.h" #include "qemu/units.h" #include "hw/dma/xlnx_dpdma.h" -#include "audio/audio.h" +#include "qemu/audio.h" #include "qom/object.h" #include "hw/ptimer.h" =20 diff --git a/include/hw/isa/vt82c686.h b/include/hw/isa/vt82c686.h index 48c412ce81..ace9e6650e 100644 --- a/include/hw/isa/vt82c686.h +++ b/include/hw/isa/vt82c686.h @@ -2,7 +2,7 @@ #define HW_VT82C686_H =20 #include "hw/pci/pci_device.h" -#include "audio/audio.h" +#include "qemu/audio.h" =20 #define TYPE_VT82C686B_ISA "vt82c686b-isa" #define TYPE_VT82C686B_USB_UHCI "vt82c686b-usb-uhci" diff --git a/audio/audio.h b/include/qemu/audio.h similarity index 100% rename from audio/audio.h rename to include/qemu/audio.h diff --git a/include/system/replay.h b/include/system/replay.h index 1e63c0784c..68f91bdfbf 100644 --- a/include/system/replay.h +++ b/include/system/replay.h @@ -16,7 +16,7 @@ #include "qapi/qapi-types-run-state.h" #include "qapi/qapi-types-ui.h" #include "block/aio.h" -#include "audio/audio.h" +#include "qemu/audio.h" =20 /* replay clock kinds */ enum ReplayClockKind { diff --git a/ui/vnc.h b/ui/vnc.h index e2137c5ed1..4d8363ebf3 100644 --- a/ui/vnc.h +++ b/ui/vnc.h @@ -31,7 +31,7 @@ #include "qemu/thread.h" #include "ui/clipboard.h" #include "ui/console.h" -#include "audio/audio.h" +#include "qemu/audio.h" #include "qemu/bitmap.h" #include "crypto/tlssession.h" #include "qemu/buffer.h" diff --git a/audio/alsaaudio.c b/audio/alsaaudio.c index 797cb478e6..d1e4817081 100644 --- a/audio/alsaaudio.c +++ b/audio/alsaaudio.c @@ -26,7 +26,7 @@ #include #include "qemu/main-loop.h" #include "qemu/module.h" -#include "audio.h" +#include "qemu/audio.h" #include "trace.h" =20 #pragma GCC diagnostic ignored "-Waddress" diff --git a/audio/audio.c b/audio/audio.c index 92768fc81c..5d3fb799f9 100644 --- a/audio/audio.c +++ b/audio/audio.c @@ -23,7 +23,7 @@ */ =20 #include "qemu/osdep.h" -#include "audio.h" +#include "qemu/audio.h" #include "migration/vmstate.h" #include "qemu/timer.h" #include "qapi/error.h" diff --git a/audio/audio_win_int.c b/audio/audio_win_int.c index 316f118f50..44a8ff24a6 100644 --- a/audio/audio_win_int.c +++ b/audio/audio_win_int.c @@ -7,7 +7,7 @@ #include #include =20 -#include "audio.h" +#include "qemu/audio.h" #include "audio_int.h" #include "audio_win_int.h" =20 diff --git a/audio/dbusaudio.c b/audio/dbusaudio.c index 33d6365811..abae8d20ae 100644 --- a/audio/dbusaudio.c +++ b/audio/dbusaudio.c @@ -35,7 +35,7 @@ #include "ui/dbus-display1.h" =20 #define AUDIO_CAP "dbus" -#include "audio.h" +#include "qemu/audio.h" #include "audio_int.h" #include "trace.h" =20 diff --git a/audio/dsoundaudio.c b/audio/dsoundaudio.c index 003ef27365..fbb8890f5c 100644 --- a/audio/dsoundaudio.c +++ b/audio/dsoundaudio.c @@ -27,7 +27,7 @@ */ =20 #include "qemu/osdep.h" -#include "audio.h" +#include "qemu/audio.h" =20 #define AUDIO_CAP "dsound" #include "audio_int.h" diff --git a/audio/jackaudio.c b/audio/jackaudio.c index 974a3caad3..28face9989 100644 --- a/audio/jackaudio.c +++ b/audio/jackaudio.c @@ -26,7 +26,7 @@ #include "qemu/module.h" #include "qemu/atomic.h" #include "qemu/main-loop.h" -#include "audio.h" +#include "qemu/audio.h" =20 #define AUDIO_CAP "jack" #include "audio_int.h" diff --git a/audio/mixeng.c b/audio/mixeng.c index af9ec3d4d2..e63c76e021 100644 --- a/audio/mixeng.c +++ b/audio/mixeng.c @@ -24,7 +24,7 @@ */ #include "qemu/osdep.h" #include "qemu/bswap.h" -#include "audio.h" +#include "qemu/audio.h" =20 #define AUDIO_CAP "mixeng" #include "audio_int.h" diff --git a/audio/noaudio.c b/audio/noaudio.c index 34ff1d2a27..b136b74e26 100644 --- a/audio/noaudio.c +++ b/audio/noaudio.c @@ -24,7 +24,7 @@ =20 #include "qemu/osdep.h" #include "qemu/module.h" -#include "audio.h" +#include "qemu/audio.h" =20 #define AUDIO_CAP "noaudio" #include "audio_int.h" diff --git a/audio/ossaudio.c b/audio/ossaudio.c index 4a549b26a2..5ba91f6793 100644 --- a/audio/ossaudio.c +++ b/audio/ossaudio.c @@ -29,7 +29,7 @@ #include "qemu/module.h" #include "qemu/host-utils.h" #include "qapi/error.h" -#include "audio.h" +#include "qemu/audio.h" #include "trace.h" =20 #define AUDIO_CAP "oss" diff --git a/audio/paaudio.c b/audio/paaudio.c index 93030f3fc8..8eb80ede45 100644 --- a/audio/paaudio.c +++ b/audio/paaudio.c @@ -2,7 +2,7 @@ =20 #include "qemu/osdep.h" #include "qemu/module.h" -#include "audio.h" +#include "qemu/audio.h" #include "qapi/error.h" =20 #include diff --git a/audio/pwaudio.c b/audio/pwaudio.c index 8e13b58286..8f6c0900c8 100644 --- a/audio/pwaudio.c +++ b/audio/pwaudio.c @@ -10,7 +10,7 @@ =20 #include "qemu/osdep.h" #include "qemu/module.h" -#include "audio.h" +#include "qemu/audio.h" #include "qemu/error-report.h" #include "qapi/error.h" #include diff --git a/audio/sdlaudio.c b/audio/sdlaudio.c index 641357e5ee..4ef73c8dfb 100644 --- a/audio/sdlaudio.c +++ b/audio/sdlaudio.c @@ -27,7 +27,7 @@ #include #include "qemu/module.h" #include "qapi/error.h" -#include "audio.h" +#include "qemu/audio.h" =20 #ifndef _WIN32 #ifdef __sun__ diff --git a/audio/sndioaudio.c b/audio/sndioaudio.c index 8eb35e1e53..f4f53b1c6f 100644 --- a/audio/sndioaudio.c +++ b/audio/sndioaudio.c @@ -18,7 +18,7 @@ #include #include #include "qemu/main-loop.h" -#include "audio.h" +#include "qemu/audio.h" #include "trace.h" =20 #define AUDIO_CAP "sndio" diff --git a/audio/spiceaudio.c b/audio/spiceaudio.c index 7e737bff9a..77ba89ffaa 100644 --- a/audio/spiceaudio.c +++ b/audio/spiceaudio.c @@ -26,7 +26,7 @@ #include "ui/qemu-spice.h" =20 #define AUDIO_CAP "spice" -#include "audio.h" +#include "qemu/audio.h" #include "audio_int.h" =20 #if SPICE_INTERFACE_PLAYBACK_MAJOR > 1 || SPICE_INTERFACE_PLAYBACK_MINOR >= =3D 3 diff --git a/audio/wavaudio.c b/audio/wavaudio.c index a098b20cad..4d9c921305 100644 --- a/audio/wavaudio.c +++ b/audio/wavaudio.c @@ -24,7 +24,7 @@ =20 #include "qemu/osdep.h" #include "qemu/module.h" -#include "audio.h" +#include "qemu/audio.h" =20 #define AUDIO_CAP "wav" #include "audio_int.h" diff --git a/hw/arm/integratorcp.c b/hw/arm/integratorcp.c index b1d8fbd470..81ed051b98 100644 --- a/hw/arm/integratorcp.c +++ b/hw/arm/integratorcp.c @@ -26,7 +26,7 @@ #include "hw/irq.h" #include "hw/sd/sd.h" #include "qom/object.h" -#include "audio/audio.h" +#include "qemu/audio.h" #include "target/arm/cpu-qom.h" =20 #define TYPE_INTEGRATOR_CM "integrator_core" diff --git a/hw/arm/musicpal.c b/hw/arm/musicpal.c index 329b162eb2..6032301bb6 100644 --- a/hw/arm/musicpal.c +++ b/hw/arm/musicpal.c @@ -36,7 +36,7 @@ #include "qemu/cutils.h" #include "qom/object.h" #include "hw/net/mv88w8618_eth.h" -#include "audio/audio.h" +#include "qemu/audio.h" #include "qemu/error-report.h" #include "target/arm/cpu-qom.h" =20 diff --git a/hw/arm/realview.c b/hw/arm/realview.c index 5c9050490b..892bdc8db2 100644 --- a/hw/arm/realview.c +++ b/hw/arm/realview.c @@ -29,7 +29,7 @@ #include "hw/irq.h" #include "hw/i2c/arm_sbcon_i2c.h" #include "hw/sd/sd.h" -#include "audio/audio.h" +#include "qemu/audio.h" #include "target/arm/cpu-qom.h" =20 #define SMP_BOOT_ADDR 0xe0000000 diff --git a/hw/arm/versatilepb.c b/hw/arm/versatilepb.c index 5cf1a70d10..cba77864e8 100644 --- a/hw/arm/versatilepb.c +++ b/hw/arm/versatilepb.c @@ -25,7 +25,7 @@ #include "hw/char/pl011.h" #include "hw/sd/sd.h" #include "qom/object.h" -#include "audio/audio.h" +#include "qemu/audio.h" #include "target/arm/cpu-qom.h" #include "qemu/log.h" =20 diff --git a/hw/arm/vexpress.c b/hw/arm/vexpress.c index 35f8d05ea1..14d38cea8b 100644 --- a/hw/arm/vexpress.c +++ b/hw/arm/vexpress.c @@ -44,7 +44,7 @@ #include "hw/sd/sd.h" #include "qobject/qlist.h" #include "qom/object.h" -#include "audio/audio.h" +#include "qemu/audio.h" #include "target/arm/cpu-qom.h" =20 #define VEXPRESS_BOARD_ID 0x8e0 diff --git a/hw/arm/xlnx-zcu102.c b/hw/arm/xlnx-zcu102.c index 14b6641a71..4ed346a88d 100644 --- a/hw/arm/xlnx-zcu102.c +++ b/hw/arm/xlnx-zcu102.c @@ -25,7 +25,7 @@ #include "system/device_tree.h" #include "qom/object.h" #include "net/can_emu.h" -#include "audio/audio.h" +#include "qemu/audio.h" =20 struct XlnxZCU102 { MachineState parent_obj; diff --git a/hw/audio/ac97.c b/hw/audio/ac97.c index d23cfcf325..d2298e02b2 100644 --- a/hw/audio/ac97.c +++ b/hw/audio/ac97.c @@ -19,7 +19,7 @@ =20 #include "qemu/osdep.h" #include "hw/audio/model.h" -#include "audio/audio.h" +#include "qemu/audio.h" #include "hw/pci/pci_device.h" #include "hw/qdev-properties.h" #include "migration/vmstate.h" diff --git a/hw/audio/adlib.c b/hw/audio/adlib.c index 1b3d2b8bfc..27a4030bda 100644 --- a/hw/audio/adlib.c +++ b/hw/audio/adlib.c @@ -26,7 +26,7 @@ #include "qapi/error.h" #include "qemu/module.h" #include "hw/audio/model.h" -#include "audio/audio.h" +#include "qemu/audio.h" #include "hw/isa/isa.h" #include "hw/qdev-properties.h" #include "qemu/error-report.h" diff --git a/hw/audio/asc.c b/hw/audio/asc.c index 5c3f6c8f86..0abb106979 100644 --- a/hw/audio/asc.c +++ b/hw/audio/asc.c @@ -15,7 +15,7 @@ #include "qapi/error.h" #include "hw/sysbus.h" #include "hw/irq.h" -#include "audio/audio.h" +#include "qemu/audio.h" #include "hw/audio/asc.h" #include "hw/qdev-properties.h" #include "migration/vmstate.h" diff --git a/hw/audio/cs4231a.c b/hw/audio/cs4231a.c index 9049065a0e..8f3a49e9b8 100644 --- a/hw/audio/cs4231a.c +++ b/hw/audio/cs4231a.c @@ -24,7 +24,7 @@ =20 #include "qemu/osdep.h" #include "hw/audio/model.h" -#include "audio/audio.h" +#include "qemu/audio.h" #include "hw/irq.h" #include "hw/isa/isa.h" #include "hw/qdev-properties.h" diff --git a/hw/audio/es1370.c b/hw/audio/es1370.c index a8ca2045b3..4abb32c170 100644 --- a/hw/audio/es1370.c +++ b/hw/audio/es1370.c @@ -27,7 +27,7 @@ =20 #include "qemu/osdep.h" #include "hw/audio/model.h" -#include "audio/audio.h" +#include "qemu/audio.h" #include "hw/pci/pci_device.h" #include "migration/vmstate.h" #include "qemu/cutils.h" diff --git a/hw/audio/gus.c b/hw/audio/gus.c index 434fa58136..bfd5b0a8af 100644 --- a/hw/audio/gus.c +++ b/hw/audio/gus.c @@ -26,7 +26,7 @@ #include "qapi/error.h" #include "qemu/module.h" #include "hw/audio/model.h" -#include "audio/audio.h" +#include "qemu/audio.h" #include "hw/irq.h" #include "hw/isa/isa.h" #include "hw/qdev-properties.h" diff --git a/hw/audio/hda-codec.c b/hw/audio/hda-codec.c index f7ae2aa1fd..e90c9de046 100644 --- a/hw/audio/hda-codec.c +++ b/hw/audio/hda-codec.c @@ -25,7 +25,7 @@ #include "qemu/host-utils.h" #include "qemu/module.h" #include "intel-hda-defs.h" -#include "audio/audio.h" +#include "qemu/audio.h" #include "trace.h" #include "qom/object.h" =20 diff --git a/hw/audio/lm4549.c b/hw/audio/lm4549.c index c51ec0e66f..745441bd79 100644 --- a/hw/audio/lm4549.c +++ b/hw/audio/lm4549.c @@ -15,7 +15,7 @@ =20 #include "qemu/osdep.h" #include "hw/hw.h" -#include "audio/audio.h" +#include "qemu/audio.h" #include "lm4549.h" #include "migration/vmstate.h" =20 diff --git a/hw/audio/marvell_88w8618.c b/hw/audio/marvell_88w8618.c index c5c79d083a..a483f4e70d 100644 --- a/hw/audio/marvell_88w8618.c +++ b/hw/audio/marvell_88w8618.c @@ -16,7 +16,7 @@ #include "hw/irq.h" #include "hw/qdev-properties.h" #include "hw/audio/wm8750.h" -#include "audio/audio.h" +#include "qemu/audio.h" #include "qapi/error.h" #include "qemu/module.h" #include "qom/object.h" diff --git a/hw/audio/pcspk.c b/hw/audio/pcspk.c index 36efb038f3..5f045b670e 100644 --- a/hw/audio/pcspk.c +++ b/hw/audio/pcspk.c @@ -25,7 +25,7 @@ #include "qemu/osdep.h" #include "hw/isa/isa.h" #include "hw/audio/model.h" -#include "audio/audio.h" +#include "qemu/audio.h" #include "qemu/module.h" #include "qemu/timer.h" #include "qemu/error-report.h" diff --git a/hw/audio/sb16.c b/hw/audio/sb16.c index 4978c2c014..c8af6fa441 100644 --- a/hw/audio/sb16.c +++ b/hw/audio/sb16.c @@ -24,7 +24,7 @@ =20 #include "qemu/osdep.h" #include "hw/audio/model.h" -#include "audio/audio.h" +#include "qemu/audio.h" #include "hw/irq.h" #include "hw/isa/isa.h" #include "hw/qdev-properties.h" diff --git a/hw/audio/wm8750.c b/hw/audio/wm8750.c index d399c335c3..336fb6d20b 100644 --- a/hw/audio/wm8750.c +++ b/hw/audio/wm8750.c @@ -12,7 +12,7 @@ #include "migration/vmstate.h" #include "qemu/module.h" #include "hw/audio/wm8750.h" -#include "audio/audio.h" +#include "qemu/audio.h" #include "qom/object.h" =20 #define IN_PORT_N 3 diff --git a/hw/core/machine.c b/hw/core/machine.c index 2de8b89606..a82eb86415 100644 --- a/hw/core/machine.c +++ b/hw/core/machine.c @@ -36,7 +36,7 @@ #include "hw/virtio/virtio-net.h" #include "hw/virtio/virtio-iommu.h" #include "hw/acpi/generic_event_device.h" -#include "audio/audio.h" +#include "qemu/audio.h" =20 GlobalProperty hw_compat_10_1[] =3D { { TYPE_ACPI_GED, "x-has-hest-addr", "false" }, diff --git a/hw/core/qdev-properties-system.c b/hw/core/qdev-properties-sys= tem.c index 578cbdc015..6560205f9f 100644 --- a/hw/core/qdev-properties-system.c +++ b/hw/core/qdev-properties-system.c @@ -27,7 +27,7 @@ #include "qemu/error-report.h" #include "qdev-prop-internal.h" =20 -#include "audio/audio.h" +#include "qemu/audio.h" #include "chardev/char-fe.h" #include "system/block-backend.h" #include "system/blockdev.h" diff --git a/hw/ppc/prep.c b/hw/ppc/prep.c index 982e40e53e..8e4ee71c0a 100644 --- a/hw/ppc/prep.c +++ b/hw/ppc/prep.c @@ -46,7 +46,7 @@ #include "trace.h" #include "elf.h" #include "qemu/units.h" -#include "audio/audio.h" +#include "qemu/audio.h" =20 /* SMP is not enabled, for now */ #define MAX_CPUS 1 diff --git a/hw/usb/dev-audio.c b/hw/usb/dev-audio.c index c8e032ab64..8dd9d26599 100644 --- a/hw/usb/dev-audio.c +++ b/hw/usb/dev-audio.c @@ -35,7 +35,7 @@ #include "hw/usb.h" #include "migration/vmstate.h" #include "desc.h" -#include "audio/audio.h" +#include "qemu/audio.h" #include "qom/object.h" =20 static void usb_audio_reinit(USBDevice *dev, unsigned channels); diff --git a/replay/replay-audio.c b/replay/replay-audio.c index 3413801062..1b614f4137 100644 --- a/replay/replay-audio.c +++ b/replay/replay-audio.c @@ -13,7 +13,7 @@ #include "qemu/error-report.h" #include "system/replay.h" #include "replay-internal.h" -#include "audio/audio.h" +#include "qemu/audio.h" =20 void replay_audio_out(size_t *played) { diff --git a/system/runstate.c b/system/runstate.c index 32467aa882..e3ec16ab74 100644 --- a/system/runstate.c +++ b/system/runstate.c @@ -23,7 +23,7 @@ */ =20 #include "qemu/osdep.h" -#include "audio/audio.h" +#include "qemu/audio.h" #include "block/block.h" #include "block/export.h" #include "chardev/char.h" diff --git a/system/vl.c b/system/vl.c index 9245ec986c..7bc6c44ebe 100644 --- a/system/vl.c +++ b/system/vl.c @@ -87,7 +87,7 @@ #include "system/tpm.h" #include "system/dma.h" #include "hw/audio/model.h" -#include "audio/audio.h" +#include "qemu/audio.h" #include "system/cpus.h" #include "system/cpu-timers.h" #include "exec/icount.h" diff --git a/ui/dbus.c b/ui/dbus.c index fbe108af1e..d2dff33258 100644 --- a/ui/dbus.c +++ b/ui/dbus.c @@ -34,8 +34,7 @@ #include "ui/egl-helpers.h" #include "ui/egl-context.h" #endif -#include "audio/audio.h" -#include "audio/audio_int.h" +#include "qemu/audio.h" #include "qapi/error.h" #include "trace.h" =20 diff --git a/audio/coreaudio.m b/audio/coreaudio.m index cadd729d50..8b3cd6db16 100644 --- a/audio/coreaudio.m +++ b/audio/coreaudio.m @@ -28,7 +28,7 @@ =20 #include "qemu/main-loop.h" #include "qemu/module.h" -#include "audio.h" +#include "qemu/audio.h" =20 #define AUDIO_CAP "coreaudio" #include "audio_int.h" diff --git a/scripts/codeconverter/codeconverter/test_regexps.py b/scripts/= codeconverter/codeconverter/test_regexps.py index fe7354b473..b00e9ef15b 100644 --- a/scripts/codeconverter/codeconverter/test_regexps.py +++ b/scripts/codeconverter/codeconverter/test_regexps.py @@ -265,7 +265,7 @@ def test_initial_includes(): =20 #include "qemu/osdep.h" #include "hw/audio/model.h" -#include "audio/audio.h" +#include "qemu/audio.h" #include "hw/pci/pci.h" #include "migration/vmstate.h" #include "qemu/module.h" --=20 2.51.0 From nobody Fri Nov 14 18:21:23 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1761116608; cv=none; d=zohomail.com; s=zohoarc; b=UTRFylOVYCm1UxkwBzhRRoXAHTTYTaQnX+jcSdeRsLwJW5VIWxe3yTYpC/lWYounpzSb+HJ+Hg3U0LOf4QDR+H4h9nVVQC/S4o1sRf3rZIir4lRtqQb8v9XBeKy90IAcMZPeTcGNeLsI+j8JM96wJpWVVHkDW66ZjJDoA/kZ+cg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761116608; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=alKpb0u140eXNITQrcibzH0f3MuJh6yEoE2ncrsRI7Y=; b=AOhBY6RlKcSDr3L+KbIVlh/HablEaZ8bZK9F/9h+hEVeHeEIvdiPcvVTbcpIqSvINYS1g4AlzhUYweE9/IVB1mdKOO3WDt27rTV+x9SqpiDGYXtLBbJPeH5eTQ1MLO7CmscnfgB0YlPVvyqGFBo3UQ93GtABJc+tRWilDO9shnM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1761116608480532.8392197621374; Wed, 22 Oct 2025 00:03:28 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vBSqR-0001OE-RP; Wed, 22 Oct 2025 03:01:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vBSpj-0000uS-BZ for qemu-devel@nongnu.org; Wed, 22 Oct 2025 03:00:35 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vBSpf-0000Dv-2q for qemu-devel@nongnu.org; Wed, 22 Oct 2025 03:00:31 -0400 Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-322-zRYCHJMiMnSnUhxJEhy3dw-1; Wed, 22 Oct 2025 03:00:23 -0400 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id DC7321956066; Wed, 22 Oct 2025 07:00:21 +0000 (UTC) Received: from localhost (unknown [10.44.22.9]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 956651956056; Wed, 22 Oct 2025 07:00:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761116426; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=alKpb0u140eXNITQrcibzH0f3MuJh6yEoE2ncrsRI7Y=; b=FNT4HLtNP2CiO9DHyn1nnREPbE+e22AtscexfadklR/YlUO+V/t/E68dU6ex+5fWBHDHpO quaPErkyQ+18RM/n/EBq2kBKiAgNokIN7p+mzY4pklJHaAJjQ2K1JFpiIESQ3K0/cjuGRi UMgfK6JZAEiZdHoTQ0WNEY78w/Wug+U= X-MC-Unique: zRYCHJMiMnSnUhxJEhy3dw-1 X-Mimecast-MFC-AGG-ID: zRYCHJMiMnSnUhxJEhy3dw_1761116422 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Volker=20R=C3=BCmelin?= , Paolo Bonzini , BALATON Zoltan , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Gerd Hoffmann Subject: [PATCH v2 38/42] audio: remove dependency on spice header Date: Wed, 22 Oct 2025 10:56:33 +0400 Message-ID: <20251022065640.1172785-39-marcandre.lureau@redhat.com> In-Reply-To: <20251022065640.1172785-1-marcandre.lureau@redhat.com> References: <20251022065640.1172785-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1761116609756154100 From: Marc-Andr=C3=A9 Lureau It is no longer required. Signed-off-by: Marc-Andr=C3=A9 Lureau --- audio/meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/audio/meson.build b/audio/meson.build index 59f0a431d5..37789437fb 100644 --- a/audio/meson.build +++ b/audio/meson.build @@ -1,5 +1,5 @@ -system_ss.add([spice_headers, files('audio.c')]) system_ss.add(files( + 'audio.c', 'audio-hmp-cmds.c', 'mixeng.c', 'noaudio.c', --=20 2.51.0 From nobody Fri Nov 14 18:21:23 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1761116741; cv=none; d=zohomail.com; s=zohoarc; b=PUFMqg1T8gXirDGsRnZQ3mgo4E6/y1HSQtl/OEQQjxZu/Kr9b37FQzTd6xxnEOxfFP9AkTvdq72ZcWqu0HI/oULmpcTdjMsGMRfrmd26e/M0+7MdyIYt98V4mWAeWfsvpCMlmZLFqnzQlj0HIxi1TxJzEQ+v1rQeUByCj9GJnwE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761116741; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=DnLe61ygDv1FsiVfp0nHph7Jpk9Z4SNrgseXUEGcIBc=; b=NRnXpD5z9MZfCXCtvj9MZDf2NElAXrBNioMFuZGQO16mccdV30qRz5w12iU71nChSPx+WZMQvymQjTmQKkKM4KoVKZncTUjJq4yIA8e5Hn76lWFb0OG86BYhFsQW2OTDifhLiyt+M5Qp5H61ldzTDrhmCvVoN5asfp2SLl3DINw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1761116741437216.3185671906965; Wed, 22 Oct 2025 00:05:41 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vBSqQ-0001Fl-DI; Wed, 22 Oct 2025 03:01:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vBSq6-000150-CC for qemu-devel@nongnu.org; Wed, 22 Oct 2025 03:01:04 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vBSq3-0000L9-D2 for qemu-devel@nongnu.org; Wed, 22 Oct 2025 03:00:54 -0400 Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-346-MZVyOh0JPPOBCewmigtwyQ-1; Wed, 22 Oct 2025 03:00:28 -0400 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 49EDC19560B2; Wed, 22 Oct 2025 07:00:27 +0000 (UTC) Received: from localhost (unknown [10.44.22.9]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id EEC9119560B0; Wed, 22 Oct 2025 07:00:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761116446; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=DnLe61ygDv1FsiVfp0nHph7Jpk9Z4SNrgseXUEGcIBc=; b=jChjhnZytEiIr/27AFBcyeTVX+gbLbFJSc+qM1qNUkyWKd73V2nICj5jzpfzxW4bsYOV4A 1yemdEK/TTyKWarad2dMDdXLY+cOrr66lmu0CREI7GMs2mvx2shduR48NT9KDt9lUH0sij Go4bUvhRreUPs/Yiw9G+gl5KgAylQjc= X-MC-Unique: MZVyOh0JPPOBCewmigtwyQ-1 X-Mimecast-MFC-AGG-ID: MZVyOh0JPPOBCewmigtwyQ_1761116427 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Volker=20R=C3=BCmelin?= , Paolo Bonzini , BALATON Zoltan , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Gerd Hoffmann Subject: [PATCH v2 39/42] audio: cleanup, use bool for booleans Date: Wed, 22 Oct 2025 10:56:34 +0400 Message-ID: <20251022065640.1172785-40-marcandre.lureau@redhat.com> In-Reply-To: <20251022065640.1172785-1-marcandre.lureau@redhat.com> References: <20251022065640.1172785-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1761116743293154100 From: Marc-Andr=C3=A9 Lureau Use slightly better types for the job. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- audio/audio_int.h | 12 ++++++------ audio/audio_template.h | 6 +++--- include/qemu/audio.h | 8 ++++---- audio/audio.c | 30 +++++++++++++++--------------- 4 files changed, 28 insertions(+), 28 deletions(-) diff --git a/audio/audio_int.h b/audio/audio_int.h index a97edd77dd..c804302e51 100644 --- a/audio/audio_int.h +++ b/audio/audio_int.h @@ -67,9 +67,9 @@ typedef struct STSampleBuffer { =20 typedef struct HWVoiceOut { AudioBackend *s; - int enabled; + bool enabled; int poll_mode; - int pending_disable; + bool pending_disable; struct audio_pcm_info info; =20 f_sample *clip; @@ -88,7 +88,7 @@ typedef struct HWVoiceOut { =20 typedef struct HWVoiceIn { AudioBackend *s; - int enabled; + bool enabled; int poll_mode; struct audio_pcm_info info; =20 @@ -114,8 +114,8 @@ struct SWVoiceOut { STSampleBuffer resample_buf; void *rate; size_t total_hw_samples_mixed; - int active; - int empty; + bool active; + bool empty; HWVoiceOut *hw; char *name; struct mixeng_volume vol; @@ -125,7 +125,7 @@ struct SWVoiceOut { =20 struct SWVoiceIn { AudioBackend *s; - int active; + bool active; struct audio_pcm_info info; void *rate; size_t total_hw_samples_acquired; diff --git a/audio/audio_template.h b/audio/audio_template.h index 97305445c8..f9dfc0eabd 100644 --- a/audio/audio_template.h +++ b/audio/audio_template.h @@ -166,10 +166,10 @@ static int glue (audio_pcm_sw_init_, TYPE) ( =20 audio_pcm_init_info (&sw->info, as); sw->hw =3D hw; - sw->active =3D 0; + sw->active =3D false; #ifdef DAC sw->total_hw_samples_mixed =3D 0; - sw->empty =3D 1; + sw->empty =3D true; #endif =20 if (sw->info.is_float) { @@ -564,7 +564,7 @@ SW *glue (AUD_open_, TYPE) ( return NULL; } =20 -int glue (AUD_is_active_, TYPE) (SW *sw) +bool glue (AUD_is_active_, TYPE) (SW *sw) { return sw ? sw->active : 0; } diff --git a/include/qemu/audio.h b/include/qemu/audio.h index 216b95eb4f..f5c32550dc 100644 --- a/include/qemu/audio.h +++ b/include/qemu/audio.h @@ -98,8 +98,8 @@ SWVoiceOut *AUD_open_out ( void AUD_close_out (AudioBackend *be, SWVoiceOut *sw); size_t AUD_write (SWVoiceOut *sw, void *pcm_buf, size_t size); int AUD_get_buffer_size_out (SWVoiceOut *sw); -void AUD_set_active_out (SWVoiceOut *sw, int on); -int AUD_is_active_out (SWVoiceOut *sw); +void AUD_set_active_out (SWVoiceOut *sw, bool on); +bool AUD_is_active_out (SWVoiceOut *sw); =20 void AUD_init_time_stamp_out (SWVoiceOut *sw, QEMUAudioTimeStamp *ts); uint64_t AUD_get_elapsed_usec_out (SWVoiceOut *sw, QEMUAudioTimeStamp *ts); @@ -128,8 +128,8 @@ SWVoiceIn *AUD_open_in ( =20 void AUD_close_in (AudioBackend *be, SWVoiceIn *sw); size_t AUD_read (SWVoiceIn *sw, void *pcm_buf, size_t size); -void AUD_set_active_in (SWVoiceIn *sw, int on); -int AUD_is_active_in (SWVoiceIn *sw); +void AUD_set_active_in (SWVoiceIn *sw, bool on); +bool AUD_is_active_in (SWVoiceIn *sw); =20 void AUD_init_time_stamp_in (SWVoiceIn *sw, QEMUAudioTimeStamp *ts); uint64_t AUD_get_elapsed_usec_in (SWVoiceIn *sw, QEMUAudioTimeStamp *ts); diff --git a/audio/audio.c b/audio/audio.c index 5d3fb799f9..a9df7d73cd 100644 --- a/audio/audio.c +++ b/audio/audio.c @@ -405,7 +405,7 @@ static void audio_notify_capture (CaptureVoiceOut *cap,= audcnotification_e cmd) } } =20 -static void audio_capture_maybe_changed (CaptureVoiceOut *cap, int enabled) +static void audio_capture_maybe_changed (CaptureVoiceOut *cap, bool enable= d) { if (cap->hw.enabled !=3D enabled) { audcnotification_e cmd; @@ -419,11 +419,11 @@ static void audio_recalc_and_notify_capture (CaptureV= oiceOut *cap) { HWVoiceOut *hw =3D &cap->hw; SWVoiceOut *sw; - int enabled =3D 0; + bool enabled =3D false; =20 for (sw =3D hw->sw_head.lh_first; sw; sw =3D sw->entries.le_next) { if (sw->active) { - enabled =3D 1; + enabled =3D true; break; } } @@ -475,7 +475,7 @@ static int audio_attach_capture (HWVoiceOut *hw) sw =3D &sc->sw; sw->hw =3D hw_cap; sw->info =3D hw->info; - sw->empty =3D 1; + sw->empty =3D true; sw->active =3D hw->enabled; sw->vol =3D nominal_volume; sw->rate =3D st_rate_start (sw->info.freq, hw_cap->info.freq); @@ -911,7 +911,7 @@ int AUD_get_buffer_size_out(SWVoiceOut *sw) return sw->hw->samples * sw->hw->info.bytes_per_frame; } =20 -void AUD_set_active_out (SWVoiceOut *sw, int on) +void AUD_set_active_out (SWVoiceOut *sw, bool on) { HWVoiceOut *hw; =20 @@ -928,7 +928,7 @@ void AUD_set_active_out (SWVoiceOut *sw, int on) if (on) { hw->pending_disable =3D 0; if (!hw->enabled) { - hw->enabled =3D 1; + hw->enabled =3D true; if (s->vm_running) { if (hw->pcm_ops->enable_out) { hw->pcm_ops->enable_out(hw, true); @@ -959,7 +959,7 @@ void AUD_set_active_out (SWVoiceOut *sw, int on) } } =20 -void AUD_set_active_in (SWVoiceIn *sw, int on) +void AUD_set_active_in (SWVoiceIn *sw, bool on) { HWVoiceIn *hw; =20 @@ -974,7 +974,7 @@ void AUD_set_active_in (SWVoiceIn *sw, int on) =20 if (on) { if (!hw->enabled) { - hw->enabled =3D 1; + hw->enabled =3D true; if (s->vm_running) { if (hw->pcm_ops->enable_in) { hw->pcm_ops->enable_in(hw, true); @@ -993,7 +993,7 @@ void AUD_set_active_in (SWVoiceIn *sw, int on) } =20 if (nb_active =3D=3D 1) { - hw->enabled =3D 0; + hw->enabled =3D false; if (hw->pcm_ops->enable_in) { hw->pcm_ops->enable_in(hw, false); } @@ -1152,8 +1152,8 @@ static void audio_run_out (AudioBackend *s) sw =3D hw->sw_head.lh_first; =20 if (hw->pending_disable) { - hw->enabled =3D 0; - hw->pending_disable =3D 0; + hw->enabled =3D false; + hw->pending_disable =3D false; if (hw->pcm_ops->enable_out) { hw->pcm_ops->enable_out(hw, false); } @@ -1206,13 +1206,13 @@ static void audio_run_out (AudioBackend *s) #ifdef DEBUG_OUT dolog ("Disabling voice\n"); #endif - hw->enabled =3D 0; - hw->pending_disable =3D 0; + hw->enabled =3D false; + hw->pending_disable =3D false; if (hw->pcm_ops->enable_out) { hw->pcm_ops->enable_out(hw, false); } for (sc =3D hw->cap_head.lh_first; sc; sc =3D sc->entries.le_n= ext) { - sc->sw.active =3D 0; + sc->sw.active =3D false; audio_recalc_and_notify_capture (sc->cap); } continue; @@ -1257,7 +1257,7 @@ static void audio_run_out (AudioBackend *s) sw->total_hw_samples_mixed -=3D played; =20 if (!sw->total_hw_samples_mixed) { - sw->empty =3D 1; + sw->empty =3D true; } } } --=20 2.51.0 From nobody Fri Nov 14 18:21:23 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1761116511; cv=none; d=zohomail.com; s=zohoarc; b=oKASMvCjLOj9Q6sfIPgrb7kqh2lJ2UtulGHU3AIznPBxanUCmMHEtxnZVUJ6BfL4YUAJUkWNt1Vy3NeC9p1WwL0QTSBvpK2VKvILA1HhRBgkCqefPPJcU2mzix5lvClltoduvXbpvHIGjU1PwM8lRrGKG1Rf++Ly4nXj7SNe6nU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761116511; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=/3cq6jtUYE3rMP8QZ8dEAo0trqg2Yeet2AKkjkk6y1k=; b=RIdAnrscwvXcalyjWi1sOPUzFG5YX3edXc9VqLO/1Y1gfeYxU/p174H8xOh7NPJQ7kgHSx7ASXWbtf6l4xH2pq3qftyRZNoUjKCxsUh83BZAHIRha+gjnLKp7pZrLcjRxtBODxx//zp4ywqb3qXwMncFh1UaE6E11Z9g5FVf0Bs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1761116511100110.86069234225204; Wed, 22 Oct 2025 00:01:51 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vBSqM-0001Bf-Qk; Wed, 22 Oct 2025 03:01:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vBSpw-0000z4-Cu for qemu-devel@nongnu.org; Wed, 22 Oct 2025 03:00:48 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vBSpp-0000Hq-RX for qemu-devel@nongnu.org; Wed, 22 Oct 2025 03:00:42 -0400 Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-416-5TmCLdG9OGGT0zoCjRC_Xg-1; Wed, 22 Oct 2025 03:00:33 -0400 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 5C0191805C0D; Wed, 22 Oct 2025 07:00:32 +0000 (UTC) Received: from localhost (unknown [10.44.22.9]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 5FC901956056; Wed, 22 Oct 2025 07:00:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761116436; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=/3cq6jtUYE3rMP8QZ8dEAo0trqg2Yeet2AKkjkk6y1k=; b=S4u5eOk8xfQGy3tXA0m2xWdCyoe6Pi/gTuQq2blGWxeO7ilXjwTEYVlv+gl6YgVNV5dHlS 79O4Q5Fx0NOyhtM22S9LJUPufJ1dKHp80Ej1n1bES7N7OuruwrckoWOOjz+NNY9E0IGvZU u8A8rBflOEe1fog33I72dSzdL0MgIGQ= X-MC-Unique: 5TmCLdG9OGGT0zoCjRC_Xg-1 X-Mimecast-MFC-AGG-ID: 5TmCLdG9OGGT0zoCjRC_Xg_1761116432 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Volker=20R=C3=BCmelin?= , Paolo Bonzini , BALATON Zoltan , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Gerd Hoffmann Subject: [PATCH v2 40/42] audio: move capture API to own header Date: Wed, 22 Oct 2025 10:56:35 +0400 Message-ID: <20251022065640.1172785-41-marcandre.lureau@redhat.com> In-Reply-To: <20251022065640.1172785-1-marcandre.lureau@redhat.com> References: <20251022065640.1172785-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1761116512591154100 From: Marc-Andr=C3=A9 Lureau For modularity/clarity reasons, move the capture API in a specific header. Signed-off-by: Marc-Andr=C3=A9 Lureau --- audio/audio_int.h | 1 + include/qemu/audio-capture.h | 43 ++++++++++++++++++++++++++++++++++++ include/qemu/audio.h | 30 ------------------------- ui/vnc.h | 2 +- 4 files changed, 45 insertions(+), 31 deletions(-) create mode 100644 include/qemu/audio-capture.h diff --git a/audio/audio_int.h b/audio/audio_int.h index c804302e51..c669a0e36f 100644 --- a/audio/audio_int.h +++ b/audio/audio_int.h @@ -30,6 +30,7 @@ /* #define RECIPROCAL */ #endif #include "qemu/audio.h" +#include "qemu/audio-capture.h" #include "mixeng.h" =20 #ifdef CONFIG_GIO diff --git a/include/qemu/audio-capture.h b/include/qemu/audio-capture.h new file mode 100644 index 0000000000..f07e70d06e --- /dev/null +++ b/include/qemu/audio-capture.h @@ -0,0 +1,43 @@ +/* + * QEMU Audio subsystem + * + * SPDX-License-Identifier: MIT + */ +#ifndef QEMU_AUDIO_CAPTURE_H +#define QEMU_AUDIO_CAPTURE_H + +#include "audio.h" + +typedef struct CaptureVoiceOut CaptureVoiceOut; + +typedef enum { + AUD_CNOTIFY_ENABLE, + AUD_CNOTIFY_DISABLE +} audcnotification_e; + +struct audio_capture_ops { + void (*notify) (void *opaque, audcnotification_e cmd); + void (*capture) (void *opaque, const void *buf, int size); + void (*destroy) (void *opaque); +}; + +struct capture_ops { + void (*info) (void *opaque); + void (*destroy) (void *opaque); +}; + +typedef struct CaptureState { + void *opaque; + struct capture_ops ops; + QLIST_ENTRY (CaptureState) entries; +} CaptureState; + +CaptureVoiceOut *AUD_add_capture( + AudioBackend *be, + struct audsettings *as, + struct audio_capture_ops *ops, + void *opaque + ); +void AUD_del_capture (CaptureVoiceOut *cap, void *cb_opaque); + +#endif /* QEMU_AUDIO_CAPTURE_H */ diff --git a/include/qemu/audio.h b/include/qemu/audio.h index f5c32550dc..f2de1fa5b3 100644 --- a/include/qemu/audio.h +++ b/include/qemu/audio.h @@ -41,30 +41,7 @@ typedef struct audsettings { int endianness; } audsettings; =20 -typedef enum { - AUD_CNOTIFY_ENABLE, - AUD_CNOTIFY_DISABLE -} audcnotification_e; - -struct audio_capture_ops { - void (*notify) (void *opaque, audcnotification_e cmd); - void (*capture) (void *opaque, const void *buf, int size); - void (*destroy) (void *opaque); -}; - -struct capture_ops { - void (*info) (void *opaque); - void (*destroy) (void *opaque); -}; - -typedef struct CaptureState { - void *opaque; - struct capture_ops ops; - QLIST_ENTRY (CaptureState) entries; -} CaptureState; - typedef struct SWVoiceOut SWVoiceOut; -typedef struct CaptureVoiceOut CaptureVoiceOut; typedef struct SWVoiceIn SWVoiceIn; =20 struct AudioBackendClass { @@ -78,13 +55,6 @@ typedef struct QEMUAudioTimeStamp { } QEMUAudioTimeStamp; =20 bool AUD_backend_check (AudioBackend **be, Error **errp); -CaptureVoiceOut *AUD_add_capture( - AudioBackend *s, - struct audsettings *as, - struct audio_capture_ops *ops, - void *opaque - ); -void AUD_del_capture (CaptureVoiceOut *cap, void *cb_opaque); =20 SWVoiceOut *AUD_open_out ( AudioBackend *be, diff --git a/ui/vnc.h b/ui/vnc.h index 4d8363ebf3..ec8d0c91b5 100644 --- a/ui/vnc.h +++ b/ui/vnc.h @@ -31,7 +31,7 @@ #include "qemu/thread.h" #include "ui/clipboard.h" #include "ui/console.h" -#include "qemu/audio.h" +#include "qemu/audio-capture.h" #include "qemu/bitmap.h" #include "crypto/tlssession.h" #include "qemu/buffer.h" --=20 2.51.0 From nobody Fri Nov 14 18:21:23 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1761116717; cv=none; d=zohomail.com; s=zohoarc; b=AWEjzolbGq/RWXr+w+PrXj+l2tyuhqB1Gc0MU7/z1XfyzjPq1KPQHrqQIQ7ofRenC6jQ5SsTKFVH7Kfp3v2suEyrC5q5VHqRNeYJWl6+IpQqSiFkISSYrx5dFazdnjutdCRnuYyV4JSbuAZqNRPaaNufHbVCjpP+miGa3AHpyIc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761116717; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=OAXmPexSmFyJsxaNsDjZRC4NyniIAGeOBz95+dSKihY=; b=P5iGfMyMBzlN+n6CokrmX7P0V4PDNSRCpMSSj7dbcGjcmDod1BcQRnzAnNrwzvkiqmNpC20E9W93ieJR1UfSfhCaoAtIStD283Z3qnYXtcqz+rDMELeAZy6otdPKWeYd8a4CvuJGSsdGOnOoo2yjGYTizh6a1u3fUtSbPPpxRaA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1761116717178553.5152283678196; Wed, 22 Oct 2025 00:05:17 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vBSqU-0001V5-1o; Wed, 22 Oct 2025 03:01:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vBSpz-0000zW-JM for qemu-devel@nongnu.org; Wed, 22 Oct 2025 03:00:48 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vBSpx-0000JU-CU for qemu-devel@nongnu.org; Wed, 22 Oct 2025 03:00:47 -0400 Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-374-NZIpPWg0NDa6lFvNogigUw-1; Wed, 22 Oct 2025 03:00:40 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 60D981956053; Wed, 22 Oct 2025 07:00:38 +0000 (UTC) Received: from localhost (unknown [10.44.22.9]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 8D24D3000221; Wed, 22 Oct 2025 07:00:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761116443; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=OAXmPexSmFyJsxaNsDjZRC4NyniIAGeOBz95+dSKihY=; b=S/Pbn/GMmp35YWHCakxNEztO2SH7lxx/kXDctGPYly3yeHdAnUJ/Mp7g/Av0gI3Mz6zxk2 UUf7g5HQvvBl6XjM5u+CkbxSKhaiIglJTqGqjvft7zJqaDpoqVn5jaTJhi6sFG8tRWDIZF KE2VJpRzdphDz/OL/+9VGaF4IV8exZM= X-MC-Unique: NZIpPWg0NDa6lFvNogigUw-1 X-Mimecast-MFC-AGG-ID: NZIpPWg0NDa6lFvNogigUw_1761116438 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Volker=20R=C3=BCmelin?= , Paolo Bonzini , BALATON Zoltan , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Gerd Hoffmann , Christian Schoenebeck , Akihiko Odaki , Thomas Huth , Alexandre Ratchov Subject: [PATCH v2 41/42] audio: drop needless audio_driver "descr" field Date: Wed, 22 Oct 2025 10:56:36 +0400 Message-ID: <20251022065640.1172785-42-marcandre.lureau@redhat.com> In-Reply-To: <20251022065640.1172785-1-marcandre.lureau@redhat.com> References: <20251022065640.1172785-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1761116719834154100 From: Marc-Andr=C3=A9 Lureau Was it ever used? Signed-off-by: Marc-Andr=C3=A9 Lureau --- audio/audio_int.h | 1 - audio/alsaaudio.c | 1 - audio/dbusaudio.c | 1 - audio/dsoundaudio.c | 1 - audio/jackaudio.c | 1 - audio/noaudio.c | 1 - audio/ossaudio.c | 1 - audio/paaudio.c | 1 - audio/pwaudio.c | 1 - audio/sdlaudio.c | 1 - audio/sndioaudio.c | 1 - audio/spiceaudio.c | 1 - audio/wavaudio.c | 1 - audio/coreaudio.m | 1 - 14 files changed, 14 deletions(-) diff --git a/audio/audio_int.h b/audio/audio_int.h index c669a0e36f..e0e4da5b70 100644 --- a/audio/audio_int.h +++ b/audio/audio_int.h @@ -142,7 +142,6 @@ struct SWVoiceIn { typedef struct audio_driver audio_driver; struct audio_driver { const char *name; - const char *descr; void *(*init) (Audiodev *, Error **); void (*fini) (void *); #ifdef CONFIG_GIO diff --git a/audio/alsaaudio.c b/audio/alsaaudio.c index d1e4817081..89f6dad1a9 100644 --- a/audio/alsaaudio.c +++ b/audio/alsaaudio.c @@ -956,7 +956,6 @@ static struct audio_pcm_ops alsa_pcm_ops =3D { =20 static struct audio_driver alsa_audio_driver =3D { .name =3D "alsa", - .descr =3D "ALSA http://www.alsa-project.org", .init =3D alsa_audio_init, .fini =3D alsa_audio_fini, .pcm_ops =3D &alsa_pcm_ops, diff --git a/audio/dbusaudio.c b/audio/dbusaudio.c index abae8d20ae..9a6b5e586f 100644 --- a/audio/dbusaudio.c +++ b/audio/dbusaudio.c @@ -692,7 +692,6 @@ static struct audio_pcm_ops dbus_pcm_ops =3D { =20 static struct audio_driver dbus_audio_driver =3D { .name =3D "dbus", - .descr =3D "Timer based audio exposed with DBus interface", .init =3D dbus_audio_init, .fini =3D dbus_audio_fini, .set_dbus_server =3D dbus_audio_set_server, diff --git a/audio/dsoundaudio.c b/audio/dsoundaudio.c index fbb8890f5c..e75d235514 100644 --- a/audio/dsoundaudio.c +++ b/audio/dsoundaudio.c @@ -685,7 +685,6 @@ static struct audio_pcm_ops dsound_pcm_ops =3D { =20 static struct audio_driver dsound_audio_driver =3D { .name =3D "dsound", - .descr =3D "DirectSound http://wikipedia.org/wiki/DirectSound= ", .init =3D dsound_audio_init, .fini =3D dsound_audio_fini, .pcm_ops =3D &dsound_pcm_ops, diff --git a/audio/jackaudio.c b/audio/jackaudio.c index 28face9989..7a3fcaedba 100644 --- a/audio/jackaudio.c +++ b/audio/jackaudio.c @@ -672,7 +672,6 @@ static struct audio_pcm_ops jack_pcm_ops =3D { =20 static struct audio_driver jack_driver =3D { .name =3D "jack", - .descr =3D "JACK Audio Connection Kit Client", .init =3D qjack_init, .fini =3D qjack_fini, .pcm_ops =3D &jack_pcm_ops, diff --git a/audio/noaudio.c b/audio/noaudio.c index b136b74e26..4ed9d2156c 100644 --- a/audio/noaudio.c +++ b/audio/noaudio.c @@ -129,7 +129,6 @@ static struct audio_pcm_ops no_pcm_ops =3D { =20 static struct audio_driver no_audio_driver =3D { .name =3D "none", - .descr =3D "Timer based audio emulation", .init =3D no_audio_init, .fini =3D no_audio_fini, .pcm_ops =3D &no_pcm_ops, diff --git a/audio/ossaudio.c b/audio/ossaudio.c index 5ba91f6793..ab8791bece 100644 --- a/audio/ossaudio.c +++ b/audio/ossaudio.c @@ -779,7 +779,6 @@ static struct audio_pcm_ops oss_pcm_ops =3D { =20 static struct audio_driver oss_audio_driver =3D { .name =3D "oss", - .descr =3D "OSS http://www.opensound.com", .init =3D oss_audio_init, .fini =3D oss_audio_fini, .pcm_ops =3D &oss_pcm_ops, diff --git a/audio/paaudio.c b/audio/paaudio.c index 8eb80ede45..6b9b6d219a 100644 --- a/audio/paaudio.c +++ b/audio/paaudio.c @@ -922,7 +922,6 @@ static struct audio_pcm_ops qpa_pcm_ops =3D { =20 static struct audio_driver pa_audio_driver =3D { .name =3D "pa", - .descr =3D "http://www.pulseaudio.org/", .init =3D qpa_audio_init, .fini =3D qpa_audio_fini, .pcm_ops =3D &qpa_pcm_ops, diff --git a/audio/pwaudio.c b/audio/pwaudio.c index 8f6c0900c8..0fd59d9fe6 100644 --- a/audio/pwaudio.c +++ b/audio/pwaudio.c @@ -838,7 +838,6 @@ static struct audio_pcm_ops qpw_pcm_ops =3D { =20 static struct audio_driver pw_audio_driver =3D { .name =3D "pipewire", - .descr =3D "http://www.pipewire.org/", .init =3D qpw_audio_init, .fini =3D qpw_audio_fini, .pcm_ops =3D &qpw_pcm_ops, diff --git a/audio/sdlaudio.c b/audio/sdlaudio.c index 4ef73c8dfb..a7a9652d29 100644 --- a/audio/sdlaudio.c +++ b/audio/sdlaudio.c @@ -490,7 +490,6 @@ static struct audio_pcm_ops sdl_pcm_ops =3D { =20 static struct audio_driver sdl_audio_driver =3D { .name =3D "sdl", - .descr =3D "SDL http://www.libsdl.org", .init =3D sdl_audio_init, .fini =3D sdl_audio_fini, .pcm_ops =3D &sdl_pcm_ops, diff --git a/audio/sndioaudio.c b/audio/sndioaudio.c index f4f53b1c6f..8197b8b0b4 100644 --- a/audio/sndioaudio.c +++ b/audio/sndioaudio.c @@ -546,7 +546,6 @@ static struct audio_pcm_ops sndio_pcm_ops =3D { =20 static struct audio_driver sndio_audio_driver =3D { .name =3D "sndio", - .descr =3D "sndio https://sndio.org", .init =3D sndio_audio_init, .fini =3D sndio_audio_fini, .pcm_ops =3D &sndio_pcm_ops, diff --git a/audio/spiceaudio.c b/audio/spiceaudio.c index 77ba89ffaa..7db2d1f0df 100644 --- a/audio/spiceaudio.c +++ b/audio/spiceaudio.c @@ -316,7 +316,6 @@ static struct audio_pcm_ops audio_callbacks =3D { =20 static struct audio_driver spice_audio_driver =3D { .name =3D "spice", - .descr =3D "spice audio driver", .init =3D spice_audio_init, .fini =3D spice_audio_fini, .pcm_ops =3D &audio_callbacks, diff --git a/audio/wavaudio.c b/audio/wavaudio.c index 4d9c921305..46460a5d57 100644 --- a/audio/wavaudio.c +++ b/audio/wavaudio.c @@ -205,7 +205,6 @@ static struct audio_pcm_ops wav_pcm_ops =3D { =20 static struct audio_driver wav_audio_driver =3D { .name =3D "wav", - .descr =3D "WAV renderer http://wikipedia.org/wiki/WAV", .init =3D wav_audio_init, .fini =3D wav_audio_fini, .pcm_ops =3D &wav_pcm_ops, diff --git a/audio/coreaudio.m b/audio/coreaudio.m index 8b3cd6db16..997017a1e9 100644 --- a/audio/coreaudio.m +++ b/audio/coreaudio.m @@ -664,7 +664,6 @@ static void coreaudio_audio_fini (void *opaque) =20 static struct audio_driver coreaudio_audio_driver =3D { .name =3D "coreaudio", - .descr =3D "CoreAudio http://developer.apple.com/audio/coreau= dio.html", .init =3D coreaudio_audio_init, .fini =3D coreaudio_audio_fini, .pcm_ops =3D &coreaudio_pcm_ops, --=20 2.51.0 From nobody Fri Nov 14 18:21:23 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1761116635; cv=none; d=zohomail.com; s=zohoarc; b=WGNpAfmXiO7Fc7yZbu4ZzSDTq0w3tw3yz/s5zFJIboXU8+SM4mgY1YOT2BUbNv+B3N21ej9Fq/d8+F2RVJVhExL5xW0S1r5a8d8Zz1g65YOtH/CbFHdkGUTYN9E69OJVejg1vU4rRWFiOJyidbw8sE0yTpN9j6mAJtKD7q3H9ng= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761116635; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=H9quFj1kc8GcFcrXgts+32Be2wYOyQrTvnJ7+W0o4Xo=; b=Nc3kqb1rMgd2EZRctR+G7vaVWMy/nWRMpJRwzvF3Zp+ZJ94ZtQvNsbpFsRUSJ5peA9Euc3bO2l5Oy3GuHYh6MdTwY4OLgRZ9FAR0kejns6+wi4PA9OzPT3DtTkQBEL6JmnfCUPeUTZYvGodIDKUvfRazr0pOvg4S1e4a0JqeAkc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1761116635313338.6254583240801; Wed, 22 Oct 2025 00:03:55 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vBSrL-00022w-4f; Wed, 22 Oct 2025 03:02:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vBSq6-00014z-CH for qemu-devel@nongnu.org; Wed, 22 Oct 2025 03:01:04 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vBSq3-0000LQ-EU for qemu-devel@nongnu.org; Wed, 22 Oct 2025 03:00:53 -0400 Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-313-dDruFRCINWetcAGN4OJ3JQ-1; Wed, 22 Oct 2025 03:00:44 -0400 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 92FE81808997; Wed, 22 Oct 2025 07:00:43 +0000 (UTC) Received: from localhost (unknown [10.44.22.9]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 5555019560B4; Wed, 22 Oct 2025 07:00:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761116448; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=H9quFj1kc8GcFcrXgts+32Be2wYOyQrTvnJ7+W0o4Xo=; b=YbTOJAlz/jpYwDBH1W+6kxYLdiyqpiTSwWk9CVa1cnuSQ1j8h/hK08ccLR7eky51NacxIg 9stzsMM3N+qSdXRlVa8JwDOhTwlPYJ0c34NWpav8arYGH3tvykz2ZvNrz+4NQAPON/IWFW priGf2LcwzPYiBkHoF3o0p6ZNaxGw3k= X-MC-Unique: dDruFRCINWetcAGN4OJ3JQ-1 X-Mimecast-MFC-AGG-ID: dDruFRCINWetcAGN4OJ3JQ_1761116443 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Volker=20R=C3=BCmelin?= , Paolo Bonzini , BALATON Zoltan , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Eduardo Habkost Subject: [PATCH v2 42/42] docs: Update mentions of removed '-soundhw' command line option Date: Wed, 22 Oct 2025 10:56:37 +0400 Message-ID: <20251022065640.1172785-43-marcandre.lureau@redhat.com> In-Reply-To: <20251022065640.1172785-1-marcandre.lureau@redhat.com> References: <20251022065640.1172785-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1761116638076154100 From: Philippe Mathieu-Daud=C3=A9 The `-soundhw` CLI was removed in commit 039a68373c4 ("introduce -audio as a replacement for -soundhw"). Remove outdated comments and update the document mentioning the old usage. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Marc-Andr=C3=A9 Lureau --- docs/qdev-device-use.txt | 4 ++-- system/qdev-monitor.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/qdev-device-use.txt b/docs/qdev-device-use.txt index 043ae46114..fb420da2a9 100644 --- a/docs/qdev-device-use.txt +++ b/docs/qdev-device-use.txt @@ -311,9 +311,9 @@ constraints. =20 Host and guest part of audio devices have always been separate. =20 -The old way to define guest audio devices is -soundhw C1,... +The old way to define guest audio devices was -soundhw C1,... =20 -The new way is to define each guest audio device separately with +The current way is to define each guest audio device separately with -device. =20 Map from -soundhw sound card name to -device: diff --git a/system/qdev-monitor.c b/system/qdev-monitor.c index 9ed05d5d5a..f2aa400a77 100644 --- a/system/qdev-monitor.c +++ b/system/qdev-monitor.c @@ -73,9 +73,9 @@ typedef struct QDevAlias =20 /* Please keep this table sorted by typename. */ static const QDevAlias qdev_alias_table[] =3D { - { "AC97", "ac97" }, /* -soundhw name */ + { "AC97", "ac97" }, { "e1000", "e1000-82540em" }, - { "ES1370", "es1370" }, /* -soundhw name */ + { "ES1370", "es1370" }, { "ich9-ahci", "ahci" }, { "lsi53c895a", "lsi" }, { "virtio-9p-device", "virtio-9p", QEMU_ARCH_VIRTIO_MMIO }, --=20 2.51.0 From nobody Fri Nov 14 18:21:23 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1761119664; cv=none; d=zohomail.com; s=zohoarc; b=YsqeMO4Q+pwqSmGxeoUrowT28S3JmDiwP3lIgsHE1fSuU0uBf5jJkKjBsbq5VVMk9Fx+6fny0gXY5gB/RUHQDBs9VnKNBZpUw59fbo2fugLLUYFeac3sc4JhcEV5rX3Hd4ZjWuvRyrcH1OneemNfBrIUUljEvvZm6Zqd5QouhGA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761119664; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=iVCEnsuHTS4VEYUMvVbmqRXXIIigQTR/oqoQzVaXJGs=; b=bWnsthMuwMU/j5pwD2PlnSgqEkzgcAakvGZsUvZmsuBlPpFdebk5kG4dMDRKyvo8XNPmqTAgRAYzd7281iVTPRbNb1yVgyIWe42oDEUi8DCEErJH8n7ee11hJvHSQZsSB0ij1dMIT7qGnxv2Knhr+jFgbtyW4phr0JEQOpnlUCs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1761119664388500.1753421738673; Wed, 22 Oct 2025 00:54:24 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vBTfW-0004Bp-Bu; Wed, 22 Oct 2025 03:54:02 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vBTfU-0004Bg-23 for qemu-devel@nongnu.org; Wed, 22 Oct 2025 03:54:00 -0400 Received: from mail-wm1-x336.google.com ([2a00:1450:4864:20::336]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vBTfR-0000Kn-8c for qemu-devel@nongnu.org; Wed, 22 Oct 2025 03:53:59 -0400 Received: by mail-wm1-x336.google.com with SMTP id 5b1f17b1804b1-4711b95226dso53528875e9.0 for ; Wed, 22 Oct 2025 00:53:56 -0700 (PDT) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-475c42b48c9sm33124385e9.15.2025.10.22.00.53.53 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 22 Oct 2025 00:53:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1761119634; x=1761724434; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=iVCEnsuHTS4VEYUMvVbmqRXXIIigQTR/oqoQzVaXJGs=; b=ru/4/QBQ6ikq89G9Ue7GaqDhNtdIj8ohHb/ftwGtJbkv0YgpbdiZes21MQrLS5/DrO 9uq8zutipwRb9SO6GmKc1o8J12FeH13uw4YN34VNKWMKk7cfYVbJaeF6kEGWghCdA/Gv Cct/2yAg+O44ZJpK7nr5W1HqbJ3HLVwB4Awz4vgU26/9JqBuJJCHY97aQ3NTOWAx2xDW jgBfckIcnW6m7B8l+qSI64Xr5IWGLVJreJiPGk85YmI/7a2H98W3HxumCxZ7+ZFtkD9w TuGpeE8ZSGV9eCCyEhH8IUMPg/Xo/lw+2TsLLXfD0xjHlDdpuAxVUzLv4V1QDxUAWvHb MCGA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761119634; x=1761724434; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=iVCEnsuHTS4VEYUMvVbmqRXXIIigQTR/oqoQzVaXJGs=; b=J3ov09ExuoWM9mJBcFV6Xc8ZzHyumk7fu4GzSk4AecYIWgeFT/mo331zOqD9in5jmz kxRMB9ZZDkn9/mqwDMK8vXmLh7DkB04RU9CODjXdW4Olajr6cEXOaYGPDgaqxOE3pW5Z AWKIsGh3Nb6P+3ELRvskMDiGk/fPbgjbi9X4JCMsWWajM9aLY2nc645AF85Y0439mk74 jrDbwNUe/1qOAmevFHkEJovCK4vky8RU+fZoQdZY5vmZA/ylQQMhuiJfjcKPMq1eBdYR +AfQbZXO4SNO/hmy6kEa+PodOGbWFs1z9ECi0Df/QBNKeAabjpR30RvbQqpt6knESfMH OeFA== X-Gm-Message-State: AOJu0YxDM1fpHd5X+TKyRB1QTeF6qLWgrDIC6xg39sGp/BqtKadQK/ha OlyeYxpFbBmXn34Exud7xWfmwOhpSMqA6udQZ0nfIiiPeONcygKVoZPgtAYB2TZtThwC/gctEk9 EtjhMtAE= X-Gm-Gg: ASbGncs8SJFQgxV5Y/En9MAlvQTO49IFY8mFooaJ+PXqCvQwNHU/UEW0+YJsBwbRSru RBwaxNLwzFFUySJqcMZNMpBNyi5TM6Z0inLd8xWdDc99mRssGfR7KNzhiGhsQK+oFaVU5xDv80Q mMSTyY9CAaEJikicBqYpIegGxWCNPfQTTtCtuBA1RhSGDKxSET9prMSzFLVPyRb6tETQCKwnfcO tZ81Hnks+LeJmIubStBLKAV/Lmc5QP+th9EoCw+0PITvRRQl8ATT5EwwA/zYTvXJWWldPeqJlwH iHBsKkYg4YKMb+LKM7JElhT2kkGSMZFYzL5oIvd0mkJpiEdPoWPu72lFxklWyQHsJHuXTLuJjqQ Dvwb6U8bQTinRDPqnF6FQksA8EyJYNeEIRPJdRPjYEzcmhUSbvoVNH2jpI9oRW88G31zNj/ep2M K28jVuvd/GKQiSw9yaPitrzjjEcnteMpgiCe2Ahrb3WdLAOumIdPTV/DLelYG5 X-Google-Smtp-Source: AGHT+IH05y36Yrr0lnxj2JoMDkWhMQagaWuY5/Ob939sY41ofMvdfUpz+mxfe46NprD4Hi8+s4/Elw== X-Received: by 2002:a05:600c:444d:b0:46e:4cd3:7d54 with SMTP id 5b1f17b1804b1-471178b124amr130480545e9.18.1761119634493; Wed, 22 Oct 2025 00:53:54 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , Christian Schoenebeck , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Thomas Huth , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v2 43/42] audio: Remove pointless local variables Date: Wed, 22 Oct 2025 09:53:51 +0200 Message-ID: <20251022075352.66756-1-philmd@linaro.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251022065640.1172785-1-marcandre.lureau@redhat.com> References: <20251022065640.1172785-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::336; envelope-from=philmd@linaro.org; helo=mail-wm1-x336.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1761119665605154100 Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Marc-Andr=C3=A9 Lureau --- audio/ossaudio.c | 12 ++---------- audio/sdlaudio.c | 12 ++---------- 2 files changed, 4 insertions(+), 20 deletions(-) diff --git a/audio/ossaudio.c b/audio/ossaudio.c index ab8791bece9..86c4805675e 100644 --- a/audio/ossaudio.c +++ b/audio/ossaudio.c @@ -493,10 +493,8 @@ static int oss_init_out(HWVoiceOut *hw, struct audsett= ings *as, { OSSVoiceOut *oss =3D (OSSVoiceOut *) hw; struct oss_params req, obt; - int endianness; int err; int fd; - AudioFormat effective_fmt; struct audsettings obt_as; Audiodev *dev =3D drv_opaque; AudiodevOssOptions *oopts =3D &dev->u.oss; @@ -511,7 +509,7 @@ static int oss_init_out(HWVoiceOut *hw, struct audsetti= ngs *as, return -1; } =20 - err =3D oss_to_audfmt (obt.fmt, &effective_fmt, &endianness); + err =3D oss_to_audfmt(obt.fmt, &obt_as.fmt, &obt_as.endianness); if (err) { oss_anal_close (&fd); return -1; @@ -519,8 +517,6 @@ static int oss_init_out(HWVoiceOut *hw, struct audsetti= ngs *as, =20 obt_as.freq =3D obt.freq; obt_as.nchannels =3D obt.nchannels; - obt_as.fmt =3D effective_fmt; - obt_as.endianness =3D endianness; =20 audio_pcm_init_info (&hw->info, &obt_as); oss->nfrags =3D obt.nfrags; @@ -628,10 +624,8 @@ static int oss_init_in(HWVoiceIn *hw, struct audsettin= gs *as, void *drv_opaque) { OSSVoiceIn *oss =3D (OSSVoiceIn *) hw; struct oss_params req, obt; - int endianness; int err; int fd; - AudioFormat effective_fmt; struct audsettings obt_as; Audiodev *dev =3D drv_opaque; =20 @@ -644,7 +638,7 @@ static int oss_init_in(HWVoiceIn *hw, struct audsetting= s *as, void *drv_opaque) return -1; } =20 - err =3D oss_to_audfmt (obt.fmt, &effective_fmt, &endianness); + err =3D oss_to_audfmt(obt.fmt, &obt_as.fmt, &obt_as.endianness); if (err) { oss_anal_close (&fd); return -1; @@ -652,8 +646,6 @@ static int oss_init_in(HWVoiceIn *hw, struct audsetting= s *as, void *drv_opaque) =20 obt_as.freq =3D obt.freq; obt_as.nchannels =3D obt.nchannels; - obt_as.fmt =3D effective_fmt; - obt_as.endianness =3D endianness; =20 audio_pcm_init_info (&hw->info, &obt_as); oss->nfrags =3D obt.nfrags; diff --git a/audio/sdlaudio.c b/audio/sdlaudio.c index a7a9652d29d..707110973ac 100644 --- a/audio/sdlaudio.c +++ b/audio/sdlaudio.c @@ -338,9 +338,7 @@ static int sdl_init_out(HWVoiceOut *hw, struct audsetti= ngs *as, { SDLVoiceOut *sdl =3D (SDLVoiceOut *)hw; SDL_AudioSpec req, obt; - int endianness; int err; - AudioFormat effective_fmt; Audiodev *dev =3D drv_opaque; AudiodevSdlPerDirectionOptions *spdo =3D dev->u.sdl.out; struct audsettings obt_as; @@ -360,7 +358,7 @@ static int sdl_init_out(HWVoiceOut *hw, struct audsetti= ngs *as, return -1; } =20 - err =3D sdl_to_audfmt(obt.format, &effective_fmt, &endianness); + err =3D sdl_to_audfmt(obt.format, &obt_as.fmt, &obt_as.endianness); if (err) { sdl_close_out(sdl); return -1; @@ -368,8 +366,6 @@ static int sdl_init_out(HWVoiceOut *hw, struct audsetti= ngs *as, =20 obt_as.freq =3D obt.freq; obt_as.nchannels =3D obt.channels; - obt_as.fmt =3D effective_fmt; - obt_as.endianness =3D endianness; =20 audio_pcm_init_info (&hw->info, &obt_as); hw->samples =3D (spdo->has_buffer_count ? spdo->buffer_count : 4) * @@ -398,9 +394,7 @@ static int sdl_init_in(HWVoiceIn *hw, audsettings *as, = void *drv_opaque) { SDLVoiceIn *sdl =3D (SDLVoiceIn *)hw; SDL_AudioSpec req, obt; - int endianness; int err; - AudioFormat effective_fmt; Audiodev *dev =3D drv_opaque; AudiodevSdlPerDirectionOptions *spdo =3D dev->u.sdl.in; struct audsettings obt_as; @@ -420,7 +414,7 @@ static int sdl_init_in(HWVoiceIn *hw, audsettings *as, = void *drv_opaque) return -1; } =20 - err =3D sdl_to_audfmt(obt.format, &effective_fmt, &endianness); + err =3D sdl_to_audfmt(obt.format, &obt_as.fmt, &obt_as.endianness); if (err) { sdl_close_in(sdl); return -1; @@ -428,8 +422,6 @@ static int sdl_init_in(HWVoiceIn *hw, audsettings *as, = void *drv_opaque) =20 obt_as.freq =3D obt.freq; obt_as.nchannels =3D obt.channels; - obt_as.fmt =3D effective_fmt; - obt_as.endianness =3D endianness; =20 audio_pcm_init_info(&hw->info, &obt_as); hw->samples =3D (spdo->has_buffer_count ? spdo->buffer_count : 4) * --=20 2.51.0 From nobody Fri Nov 14 18:21:23 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1761119686; cv=none; d=zohomail.com; s=zohoarc; b=LbDDKDXqZaKqftVAlAvyF/A2IDDQhYMMXDFb8TKfqY7Zn2jBG4Ha8DrJFnbr4pAUwnsJJ+YJdtJrG26HRCE5ZKU5FsuBNMxG4gNgzns7pTYgaXvyLaNFYOuB1/DJdRjSZpT8BQsGoDVPUU2Gatv+qL/spFjhgVjXiWdFc9sFMXg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761119686; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=Y4MZQWzJTVmD3yaNo5gw4GFMojWDARfanU6wGvPLqkA=; b=DUwMUM9ei3zdAVN3LotUkg9upJaRn+LiLSmvHTmsgGlRxbR8C4fKsr5GclKyLyK52vFvaahFMM9aCwtD1DSqJc4Tkh2xnWln4Guvq1iXLINI9At/zxAL1YzBeJ653i37urFkvuv4wh8jTXirlf80eW3Aiml9a0qowf8R5Nl073E= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1761119686257709.7470555356821; Wed, 22 Oct 2025 00:54:46 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vBTfn-0004DP-Fr; Wed, 22 Oct 2025 03:54:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vBTfl-0004Cp-Na for qemu-devel@nongnu.org; Wed, 22 Oct 2025 03:54:17 -0400 Received: from mail-wm1-x32c.google.com ([2a00:1450:4864:20::32c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vBTfj-0000M1-9p for qemu-devel@nongnu.org; Wed, 22 Oct 2025 03:54:17 -0400 Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-471066cfc2aso17923315e9.0 for ; Wed, 22 Oct 2025 00:54:14 -0700 (PDT) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-475c4369b3esm29695475e9.13.2025.10.22.00.54.05 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 22 Oct 2025 00:54:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1761119653; x=1761724453; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Y4MZQWzJTVmD3yaNo5gw4GFMojWDARfanU6wGvPLqkA=; b=GHge5aNOGz6GyYlwrT+Iz7tGjSxOmOTKxc4eFZ9UWVp2Lij2Aa2yMuD+2peG3gowCl T5hjYymW9gNhuEMWmcphVRb7CYSZS/ufbIT5jr7IsdxzF5qiMPTxk2HUq9PDJvDGeTGL MCT2SA2/7n1dcO7jMbeg3nrq+I7ixfvxnl9AijI1fG+I57fPzInR9xV3cf22ah7Gulqh v910UMf74Tm+mALP2WmHZOnT0ps5PR5OyF0oKzZQbkdJh+SxJItQxHNv1zSp5y1A5Bx8 fiPkwLvHazczf+O8SwM1hXTZ2UxFifuq8v31TsC9wqQQ6HDY6LyAEutF4Fbeh/aPxtVT JhZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761119653; x=1761724453; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Y4MZQWzJTVmD3yaNo5gw4GFMojWDARfanU6wGvPLqkA=; b=Le4g/q96Bv+EPrlEYnb4BWyNdyfO1rrZPVlXHXzNSlL1H2h6dqcb7rXovb9hPNcG5m /Jhho0fN8GvBncpwB7oz1Jc4emWynXKsxUCfzh5b23tA84DYWDSiwd3UZTa6iQIKXsj3 ZU6O4vlGQFeRhxfzmBDwCSrCVtmFUr5x/xNQz1z02LFRgwyZ1aShWAW2z5uGJFWf06zc unbBp8NuVaab+avMEECtbRwEqG6uFLZy2kWkK6Yfv8jANKI79eje1i6MtRJ5OYDccX7w LJ4dmxkAe03H5Cgt0uzxkTqGjw+dW7SBsgQKpBfC5Jhcpt9LGU2TTxOb7Klce5hW+dWI DUMg== X-Gm-Message-State: AOJu0YyTFR09adA/5g/z+UmDrI3QtG0Et+WWPgESYR2UDsP3tkUzvb55 xF1G4/DGV8qIL87mGwuvsUWpt/oIdUxWgJ91/dVAIBnyQCDQRxorI4jGcHMmP99A9XFFt96SA9S /Hu/3nqE= X-Gm-Gg: ASbGncuS5PYcRzFkrPw8EUHUs+3964Us9xEagxD5EEentf1igVENvklVg4rUZaLds52 SGcrYCuESfFq9PLOjLESlS3Tl09h3PvnmfU6Q+3KjqnOW4fmjt6iPcBzy9nWLh57f1wNRSWheli rj48KgYJxakwndDEF02CaAdqYq0nS26nVgFh5BFSrki0oqYZq48yyOZLByFe5PKcOC48TqeyUpG A/rgnw5jY6rn+IyOXfbziCmhWHJyhyogQU5o9/X4gtxXHUsEZrywO+M8ZDwdQI/DIWgGYl9JvAn dlb2Q6Pf44ceKhY7Kw9BR1HMYm0EoM2ChXKetOourozN9Kb+r1ASAU5alrRLZYAz1lyiAc0kXfM +Likc5fuXG6Tk6veGPG6Q0Xjsu1AdOzefyRB06gQBqhcwkWQ0jVWaBufeMdDpzCaZ2N6JC9lXAL hRg8Ldqu9MFqhkefKAH28eRwkREsIlD7tlj3181VHw/5LQIEYguzYdUMaDx2qO X-Google-Smtp-Source: AGHT+IHQZrui2EnH9cKr2IQ+/7FLftX3O6jn2DRlNpF4DMusNNT/IpwKR0R+vyiwpjfV8r2q89KVGw== X-Received: by 2002:a05:600c:8b0c:b0:46e:731b:db0f with SMTP id 5b1f17b1804b1-47117912b5fmr162839725e9.28.1761119652647; Wed, 22 Oct 2025 00:54:12 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , Christian Schoenebeck , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Thomas Huth , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v2 44/42] audio: Rename @endianness argument as @big_endian for clarity Date: Wed, 22 Oct 2025 09:53:52 +0200 Message-ID: <20251022075352.66756-2-philmd@linaro.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251022065640.1172785-1-marcandre.lureau@redhat.com> References: <20251022065640.1172785-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32c; envelope-from=philmd@linaro.org; helo=mail-wm1-x32c.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1761119687575154100 @endianness is used as a boolean, rename for clarity. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Marc-Andr=C3=A9 Lureau --- audio/alsaaudio.c | 32 ++++++-------------------------- audio/ossaudio.c | 14 +++----------- audio/paaudio.c | 8 ++++---- audio/pwaudio.c | 12 ++++++------ 4 files changed, 19 insertions(+), 47 deletions(-) diff --git a/audio/alsaaudio.c b/audio/alsaaudio.c index 89f6dad1a97..7d7da576dc9 100644 --- a/audio/alsaaudio.c +++ b/audio/alsaaudio.c @@ -264,7 +264,7 @@ static int alsa_poll_in (HWVoiceIn *hw) return alsa_poll_helper (alsa->handle, &alsa->pollhlp, POLLIN); } =20 -static snd_pcm_format_t aud_to_alsafmt (AudioFormat fmt, int endianness) +static snd_pcm_format_t aud_to_alsafmt(AudioFormat fmt, bool big_endian) { switch (fmt) { case AUDIO_FORMAT_S8: @@ -274,39 +274,19 @@ static snd_pcm_format_t aud_to_alsafmt (AudioFormat f= mt, int endianness) return SND_PCM_FORMAT_U8; =20 case AUDIO_FORMAT_S16: - if (endianness) { - return SND_PCM_FORMAT_S16_BE; - } else { - return SND_PCM_FORMAT_S16_LE; - } + return big_endian ? SND_PCM_FORMAT_S16_BE : SND_PCM_FORMAT_S16_LE; =20 case AUDIO_FORMAT_U16: - if (endianness) { - return SND_PCM_FORMAT_U16_BE; - } else { - return SND_PCM_FORMAT_U16_LE; - } + return big_endian ? SND_PCM_FORMAT_U16_BE : SND_PCM_FORMAT_U16_LE; =20 case AUDIO_FORMAT_S32: - if (endianness) { - return SND_PCM_FORMAT_S32_BE; - } else { - return SND_PCM_FORMAT_S32_LE; - } + return big_endian ? SND_PCM_FORMAT_S32_BE : SND_PCM_FORMAT_S32_LE; =20 case AUDIO_FORMAT_U32: - if (endianness) { - return SND_PCM_FORMAT_U32_BE; - } else { - return SND_PCM_FORMAT_U32_LE; - } + return big_endian ? SND_PCM_FORMAT_U32_BE : SND_PCM_FORMAT_U32_LE; =20 case AUDIO_FORMAT_F32: - if (endianness) { - return SND_PCM_FORMAT_FLOAT_BE; - } else { - return SND_PCM_FORMAT_FLOAT_LE; - } + return big_endian ? SND_PCM_FORMAT_FLOAT_BE : SND_PCM_FORMAT_FLOAT= _LE; =20 default: dolog ("Internal logic error: Bad audio format %d\n", fmt); diff --git a/audio/ossaudio.c b/audio/ossaudio.c index 86c4805675e..c6cad47a015 100644 --- a/audio/ossaudio.c +++ b/audio/ossaudio.c @@ -131,7 +131,7 @@ static void oss_poll_in (HWVoiceIn *hw) qemu_set_fd_handler(oss->fd, oss_helper_poll_in, NULL, hw->s); } =20 -static int aud_to_ossfmt (AudioFormat fmt, int endianness) +static int aud_to_ossfmt(AudioFormat fmt, bool big_endian) { switch (fmt) { case AUDIO_FORMAT_S8: @@ -141,18 +141,10 @@ static int aud_to_ossfmt (AudioFormat fmt, int endian= ness) return AFMT_U8; =20 case AUDIO_FORMAT_S16: - if (endianness) { - return AFMT_S16_BE; - } else { - return AFMT_S16_LE; - } + return big_endian ? AFMT_S16_BE : AFMT_S16_LE; =20 case AUDIO_FORMAT_U16: - if (endianness) { - return AFMT_U16_BE; - } else { - return AFMT_U16_LE; - } + return big_endian ? AFMT_U16_BE : AFMT_U16_LE; =20 default: dolog ("Internal logic error: Bad audio format %d\n", fmt); diff --git a/audio/paaudio.c b/audio/paaudio.c index 6b9b6d219ab..0c06a397195 100644 --- a/audio/paaudio.c +++ b/audio/paaudio.c @@ -316,7 +316,7 @@ unlock_and_fail: return 0; } =20 -static pa_sample_format_t audfmt_to_pa (AudioFormat afmt, int endianness) +static pa_sample_format_t audfmt_to_pa(AudioFormat afmt, bool big_endian) { int format; =20 @@ -327,14 +327,14 @@ static pa_sample_format_t audfmt_to_pa (AudioFormat a= fmt, int endianness) break; case AUDIO_FORMAT_S16: case AUDIO_FORMAT_U16: - format =3D endianness ? PA_SAMPLE_S16BE : PA_SAMPLE_S16LE; + format =3D big_endian ? PA_SAMPLE_S16BE : PA_SAMPLE_S16LE; break; case AUDIO_FORMAT_S32: case AUDIO_FORMAT_U32: - format =3D endianness ? PA_SAMPLE_S32BE : PA_SAMPLE_S32LE; + format =3D big_endian ? PA_SAMPLE_S32BE : PA_SAMPLE_S32LE; break; case AUDIO_FORMAT_F32: - format =3D endianness ? PA_SAMPLE_FLOAT32BE : PA_SAMPLE_FLOAT32LE; + format =3D big_endian ? PA_SAMPLE_FLOAT32BE : PA_SAMPLE_FLOAT32LE; break; default: dolog ("Internal logic error: Bad audio format %d\n", afmt); diff --git a/audio/pwaudio.c b/audio/pwaudio.c index 0fd59d9fe60..30f717ccacf 100644 --- a/audio/pwaudio.c +++ b/audio/pwaudio.c @@ -324,7 +324,7 @@ done_unlock: } =20 static int -audfmt_to_pw(AudioFormat fmt, int endianness) +audfmt_to_pw(AudioFormat fmt, bool big_endian) { int format; =20 @@ -336,19 +336,19 @@ audfmt_to_pw(AudioFormat fmt, int endianness) format =3D SPA_AUDIO_FORMAT_U8; break; case AUDIO_FORMAT_S16: - format =3D endianness ? SPA_AUDIO_FORMAT_S16_BE : SPA_AUDIO_FORMAT= _S16_LE; + format =3D big_endian ? SPA_AUDIO_FORMAT_S16_BE : SPA_AUDIO_FORMAT= _S16_LE; break; case AUDIO_FORMAT_U16: - format =3D endianness ? SPA_AUDIO_FORMAT_U16_BE : SPA_AUDIO_FORMAT= _U16_LE; + format =3D big_endian ? SPA_AUDIO_FORMAT_U16_BE : SPA_AUDIO_FORMAT= _U16_LE; break; case AUDIO_FORMAT_S32: - format =3D endianness ? SPA_AUDIO_FORMAT_S32_BE : SPA_AUDIO_FORMAT= _S32_LE; + format =3D big_endian ? SPA_AUDIO_FORMAT_S32_BE : SPA_AUDIO_FORMAT= _S32_LE; break; case AUDIO_FORMAT_U32: - format =3D endianness ? SPA_AUDIO_FORMAT_U32_BE : SPA_AUDIO_FORMAT= _U32_LE; + format =3D big_endian ? SPA_AUDIO_FORMAT_U32_BE : SPA_AUDIO_FORMAT= _U32_LE; break; case AUDIO_FORMAT_F32: - format =3D endianness ? SPA_AUDIO_FORMAT_F32_BE : SPA_AUDIO_FORMAT= _F32_LE; + format =3D big_endian ? SPA_AUDIO_FORMAT_F32_BE : SPA_AUDIO_FORMAT= _F32_LE; break; default: dolog("Internal logic error: Bad audio format %d\n", fmt); --=20 2.51.0