From nobody Fri Nov 14 17:01:14 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=1761893312; cv=none; d=zohomail.com; s=zohoarc; b=NmJm/H3r8wbQOVg4jBeQh3fB2DNhLDyDyrvjhvpiDX456ZGqvotvP4CL1XUCMACvSVWRnEnXgWaOGDYW1H6hvNDuZ+ghtX23Pyk4fc3IXAVVJDPBRw8bjDj+JBm9F/TlmxJ4F0e77XOYdrd6iA55S3Sj1+dieZiy0uXMuFN0wx8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761893312; 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=7zuGxxVVCSgxNFDPmoLOBA8z2XywOXaU7n24pz50sDQ=; b=ipDhPEBzJSRLGk9s9IJrzjItxbXfVelKVxVFFUwxEVxt6KDWDTrdAI9PFkx6TNkHfmaqwKUYT93I7oZjiqhxsHe6KCB+y0waLQVSsSyijnG+FfFvBnyBt5gsG0neXV/3CYAY/TKV0S3IfLgzOLyauttIdX9xgUmLsfMH02FpFtE= 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 1761893312563535.6171786719026; Thu, 30 Oct 2025 23:48:32 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vEiuf-0004pu-I4; Fri, 31 Oct 2025 02:47: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 1vEiuX-0004hd-CV for qemu-devel@nongnu.org; Fri, 31 Oct 2025 02:46:57 -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 1vEiuP-0003lT-0I for qemu-devel@nongnu.org; Fri, 31 Oct 2025 02:46: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-654-_OVeLFcpPsqcS-_EWAE_6Q-1; Fri, 31 Oct 2025 02:46:44 -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 751CD1829E1B; Fri, 31 Oct 2025 06:46:43 +0000 (UTC) Received: from localhost (unknown [10.45.242.5]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 11C821800579; Fri, 31 Oct 2025 06:46:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761893207; 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=7zuGxxVVCSgxNFDPmoLOBA8z2XywOXaU7n24pz50sDQ=; b=Z4Av7RCKUFBTEgY4AgfbCcMYaTutoHR/ovtGamGQuRNtaOLfJk6xgST3EczYaca3jbyXhT 5nOfaAEjk7KsLmOsAf39mAr16SA5bKLh42Cvil7HLMs6tSsX66Fh05tqehySiCQtLVaBGd +DiWeFKvRUBfWWqkGCRH7aG7fP2gMqw= X-MC-Unique: _OVeLFcpPsqcS-_EWAE_6Q-1 X-Mimecast-MFC-AGG-ID: _OVeLFcpPsqcS-_EWAE_6Q_1761893203 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: richard.henderson@linaro.org, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Paolo Bonzini , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Eduardo Habkost Subject: [PULL 01/36] qdev: add qdev_find_default_bus() Date: Fri, 31 Oct 2025 10:45:54 +0400 Message-ID: <20251031064631.134651-2-marcandre.lureau@redhat.com> In-Reply-To: <20251031064631.134651-1-marcandre.lureau@redhat.com> References: <20251031064631.134651-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: 1761893326654158500 From: Marc-Andr=C3=A9 Lureau This helper is used next by -audio code. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- 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 ec4a2394ce..f2aa400a77 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.1 From nobody Fri Nov 14 17:01:14 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=1761893264; cv=none; d=zohomail.com; s=zohoarc; b=R16lzpBR4aXr6hRif/bcbnv+ac5sA1DeusvqrLCprWd5RwZutFfNA8T/4FV9Gex8eKegsF/56Qu/k7O6DDfrJ6V0k4HssfygVsudX3ok3vrvrtuC0dvwRudoTg4ndvo1qfQsMX0nNnqAF6JuKIbQOvj7HrT+Dkf0mZXxny0dSfQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761893264; 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=7n+9u29Qm9hRbfDLebIID7kbz6WpIBdT8iNI2RgbBsg=; b=X+cA3MHZRRgtqh1nN9LNCXB6jMZYJpgQxStfDJR5T6nvXp1xBfJ5V9AJXfIkmwCBEunrnzfa/2j2F5x922ZOLOhWubRhvmVI3GYcIt8D/nDnMnchlqn2NgAvtgLZPlCpjGYZcRzKVWjy1rM1GZw7m2wEC//2hNKVBuzx3iERTnE= 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 1761893264110239.28130339755808; Thu, 30 Oct 2025 23:47:44 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vEiug-0004rS-NO; Fri, 31 Oct 2025 02:47: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 1vEiuc-0004mn-Su for qemu-devel@nongnu.org; Fri, 31 Oct 2025 02:47:03 -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 1vEiuW-0003ll-EY for qemu-devel@nongnu.org; Fri, 31 Oct 2025 02:47:00 -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-138-JvCDBlf-PTikI8_lMXAtQw-1; Fri, 31 Oct 2025 02:46:50 -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-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id AE8D11955DD1; Fri, 31 Oct 2025 06:46:49 +0000 (UTC) Received: from localhost (unknown [10.45.242.5]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 282201800594; Fri, 31 Oct 2025 06:46:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761893213; 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=7n+9u29Qm9hRbfDLebIID7kbz6WpIBdT8iNI2RgbBsg=; b=it75HpSwq1k7zqgxOB2t7nSK91gksvh+DWmWrScb0BSi+ldPCoaeCOMV8yhT2cj+DVetQp yxEIGnbj8co8BDYfo/i3YR3NXPTmc1EW3HbbSvzBJccPi86IqucUoqB5oI339xHYXK/RSf Ko/pv8SkKKjaYEyzfVvrjSu7wCZ7e+k= X-MC-Unique: JvCDBlf-PTikI8_lMXAtQw-1 X-Mimecast-MFC-AGG-ID: JvCDBlf-PTikI8_lMXAtQw_1761893209 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: richard.henderson@linaro.org, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Gerd Hoffmann Subject: [PULL 02/36] hw/audio: look up the default bus from the device class Date: Fri, 31 Oct 2025 10:45:55 +0400 Message-ID: <20251031064631.134651-3-marcandre.lureau@redhat.com> In-Reply-To: <20251031064631.134651-1-marcandre.lureau@redhat.com> References: <20251031064631.134651-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: 1761893265991158500 From: Marc-Andr=C3=A9 Lureau Generalize and simplify the device model creation. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- 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 63a6855635..29158c115c 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.1 From nobody Fri Nov 14 17:01:14 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=1761893244; cv=none; d=zohomail.com; s=zohoarc; b=TdSHmM0S4pi940zQbxuX+7UTeVdOua+juYlZLTPKG1D/IfnrHIHqaGl3pk8X056VdoEzdn5U+ssH0WOpcy3hASP2r5q1rz8n3W5avOGZALLBh9OqEr4Y/i6yjFDLCpLThELzhS5faDe+1GBItATJTFwJ/DgogFsNrv8fWONhrGo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761893244; 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=R/vqanHLtax18RsTrPEpjv0rNxMFpyDYZOi0iBbficU=; b=QImi6bKcCOVwLY8jvLELY4UGgsvBCX6/l6MdxO6+wWx2kHPG52pgamSCM1YZmuiDyIJ5uc3RkSLEE8bxRpq5sF/FhutEffNYuStV6yB2CELycY+7a07euzbfjL+Sy5RmNu37N5ISkGVmSwWGDJtIhA2bqc09FDpYURoatXdTf6I= 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 1761893244625515.8474550198468; Thu, 30 Oct 2025 23:47:24 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vEiuk-0004s2-GM; Fri, 31 Oct 2025 02:47: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 1vEiuh-0004rl-SB for qemu-devel@nongnu.org; Fri, 31 Oct 2025 02:47:07 -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 1vEiud-0003mC-MI for qemu-devel@nongnu.org; Fri, 31 Oct 2025 02:47:07 -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-518-tznmdIHEMGiDQ3jMyv7YYg-1; Fri, 31 Oct 2025 02:46:57 -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 3972E195D020; Fri, 31 Oct 2025 06:46:56 +0000 (UTC) Received: from localhost (unknown [10.45.242.5]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 6468919560A2; Fri, 31 Oct 2025 06:46:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761893221; 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=R/vqanHLtax18RsTrPEpjv0rNxMFpyDYZOi0iBbficU=; b=Y1BtXj3LgiXsJTABJ2OBhIkPZjVE+FDDdlUtntw6gXoGk7O/V5/2xrkhiJhY2xsTwX9xik DtFw3k5ubseFjyDCM0Aac5zZ+qtegwFOLidoxRTnSO+JJMAgK3vTCxpbSLF4pOZaGxGqyz +GBjp0RbrRg/LJeatmfwU3uKDd3WzZc= X-MC-Unique: tznmdIHEMGiDQ3jMyv7YYg-1 X-Mimecast-MFC-AGG-ID: tznmdIHEMGiDQ3jMyv7YYg_1761893216 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: richard.henderson@linaro.org, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Gerd Hoffmann , Paolo Bonzini Subject: [PULL 03/36] audio: rename audio_define->audio_add_audiodev() Date: Fri, 31 Oct 2025 10:45:56 +0400 Message-ID: <20251031064631.134651-4-marcandre.lureau@redhat.com> In-Reply-To: <20251031064631.134651-1-marcandre.lureau@redhat.com> References: <20251031064631.134651-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: 1761893256115158501 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 17bbc092c8..4814ef11da 100644 --- a/system/vl.c +++ b/system/vl.c @@ -2265,7 +2265,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 @@ -3087,11 +3087,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.1 From nobody Fri Nov 14 17:01:14 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=1761893295; cv=none; d=zohomail.com; s=zohoarc; b=GLiVcERMPtqAJqRhOroHCeLfMboWYA+aYh8TTdeNrhvvMHXrNoOd2/YTxh2CJdIH+WA+H2qcTqlpN0lJ6ncc7qBIbsoAuTw5/Gj2XuGXGDWQKW5csMcw6eCBeQ2oTlWXwUIMUKFpAEhYcFqRn/tFpipIU76poe19uYXFdPN3z5w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761893295; 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=zV/Ek8KmPSbTAPmZWNpmxuqkRn5TrDs4PR04p7HXjGM=; b=CLnrInqA5Cg7R3x36RSS8oeHcXYBRyS9PP8YGw6aetuWhqigZhFFUvROx8uuJeFjqW+Usfb1cYhsNAjdchkr3pS10JVBLdmwpFQsyg2Jnnq9nmhZn10E4Fm3JpFuWE2qJbwqdfjMnl72SVoB9yuAACcFHT+4r2O+IIuwnOX+yMc= 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 1761893295809595.5126152477422; Thu, 30 Oct 2025 23:48:15 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vEiuv-0004uX-K3; Fri, 31 Oct 2025 02:47:21 -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 1vEiut-0004tm-RJ for qemu-devel@nongnu.org; Fri, 31 Oct 2025 02:47:20 -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 1vEiuh-0003mP-Ne for qemu-devel@nongnu.org; Fri, 31 Oct 2025 02:47:11 -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-339-ivCqIfOKPRS7fDpLOBIa-A-1; Fri, 31 Oct 2025 02:47:03 -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 481951834519; Fri, 31 Oct 2025 06:47:02 +0000 (UTC) Received: from localhost (unknown [10.45.242.5]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 8F82119560A2; Fri, 31 Oct 2025 06:47:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761893225; 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=zV/Ek8KmPSbTAPmZWNpmxuqkRn5TrDs4PR04p7HXjGM=; b=KNmav38YQZl17w87keHiXcDz1pJoHU1GxwNcTWWI8p5dm5bPuqx9YbqKpeSTPbnlC07fFb 7eub3wADU+b+9TUOGajy7GUM8AiNfJZPdlfnvBe7w29GE+sFKxOhYp1PB3lARab0YTEX8N wsGKbpeJBhPBxrCMQ91D+1O+b7p6ZQc= X-MC-Unique: ivCqIfOKPRS7fDpLOBIa-A-1 X-Mimecast-MFC-AGG-ID: ivCqIfOKPRS7fDpLOBIa-A_1761893222 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: richard.henderson@linaro.org, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Gerd Hoffmann , "Michael S. Tsirkin" , Manos Pitsidianakis , Eduardo Habkost , Paolo Bonzini Subject: [PULL 04/36] hw/audio: use better naming for -audio model handling code Date: Fri, 31 Oct 2025 10:45:57 +0400 Message-ID: <20251031064631.134651-5-marcandre.lureau@redhat.com> In-Reply-To: <20251031064631.134651-1-marcandre.lureau@redhat.com> References: <20251031064631.134651-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: 1761893298621158500 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. deprecated_register_soundhw() was actually not a function to be removed since it's used for "-audio model=3D" aliasing. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- include/hw/audio/model.h | 14 +++++ 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, 65 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..aa237e9eb6 --- /dev/null +++ b/include/hw/audio/model.h @@ -0,0 +1,14 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +#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 828333b66a..9dee5bb143 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" @@ -1362,8 +1362,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 772435f04c..d0b2817843 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 7931fcfec8..0979cf5f16 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 6b0da0746e..066b9906fa 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 91d07e0f81..d5b1e62135 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" @@ -320,7 +320,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 29158c115c..ddfefea706 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; 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 a719912872..48ef830292 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 03c82f2777..5faa3f5fe3 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" @@ -1470,8 +1470,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 4814ef11da..dc2ea4c298 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" @@ -2732,7 +2732,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); @@ -3088,7 +3088,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.1 From nobody Fri Nov 14 17:01:14 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=1761893322; cv=none; d=zohomail.com; s=zohoarc; b=i/KVjbjBlq7Ra5tVbu3UNJsCSuP6LeTMX72eJ/0GO+igcqN8waZloQ0qZDRGZFzVe0UWRr0FPzZ9n4oSSYKS2cHCKTqJymZ1oL2VffTvNoWdB4d8HktIa7yPU/xd+Houe/EQmcyHzIZB5Eo5aX3oxeYlskV6n8ooZLJAesM2DCo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761893322; 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=MlveFY9guWYHWuskFjTooodTwxieGjPdtwAy5kOO1DQ=; b=mIRyVL7olLtcNXCCHnJL2zJQHhK8PI/iLDpvOtzJ8F6lUyp8krRRaI2vMAbUlmFRQvsrKPGd9LVZgolOArqxD8QSFMpl7njfPeaxKIMLFkDEIfskWjEzESA4tpdKi++PNGjOie3T+teI46uNaCLrs1cDN7nkx5FMqNe1ZTEOKS8= 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 176189332213926.234314303178735; Thu, 30 Oct 2025 23:48:42 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vEiv8-00056x-5f; Fri, 31 Oct 2025 02:47: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 1vEiv4-000565-67 for qemu-devel@nongnu.org; Fri, 31 Oct 2025 02:47: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 1vEius-0003ml-Od for qemu-devel@nongnu.org; Fri, 31 Oct 2025 02:47:29 -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-326-R9WYL2SwMAOYc_OlaIxFEQ-1; Fri, 31 Oct 2025 02:47:10 -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 32826183452A; Fri, 31 Oct 2025 06:47:09 +0000 (UTC) Received: from localhost (unknown [10.45.242.5]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id B10A119560A2; Fri, 31 Oct 2025 06:47:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761893235; 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=MlveFY9guWYHWuskFjTooodTwxieGjPdtwAy5kOO1DQ=; b=OQmNIHLYTNesaCgSFQT0Hb15xaS/ZfpjNG/BU0JoKN6IFjCYJuWaFFBj4Sos6oHEF6TK8K ipe7AADuyaS9qavcxhKyLeng2qDIviQWJ0YXPtz5Hb3kX1t7DyHEgfpfajX3VXgDf1Chih a6OGT/P2dge5pR3oBxk8nbibT192e5w= X-MC-Unique: R9WYL2SwMAOYc_OlaIxFEQ-1 X-Mimecast-MFC-AGG-ID: R9WYL2SwMAOYc_OlaIxFEQ_1761893229 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: richard.henderson@linaro.org, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , "Michael S. Tsirkin" , Gerd Hoffmann , Manos Pitsidianakis Subject: [PULL 05/36] hw/audio/virtio-snd-pci: remove custom model callback Date: Fri, 31 Oct 2025 10:45:58 +0400 Message-ID: <20251031064631.134651-6-marcandre.lureau@redhat.com> In-Reply-To: <20251031064631.134651-1-marcandre.lureau@redhat.com> References: <20251031064631.134651-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_PASS=-0.001, T_SPF_HELO_TEMPERROR=0.01 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: 1761893332681158500 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 Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- 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.1 From nobody Fri Nov 14 17:01:14 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=1761893259; cv=none; d=zohomail.com; s=zohoarc; b=kTb5vwjDWvF7UI4KjJQRFDhpVPOkRGL3eiR70DiiyaipE4/CE8upF1xzXZx6zvarzUti3pXC3E55+x/XBS8C+zE+aICnWwmYgxVPurjCkemCx8pzn3jVms8HEvZHjTGx6S9oddcQTUT3eOosvUgtzWF+6gkw50wRAuf4uWcM/6c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761893259; 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=Ca5govH6QV2HNdGSc77K2aY+Td2HcDtR7U/Aqv/iciU=; b=dObAmEEWw+5j9YvYthduYuyNXLWIoPcPW5hG24X7zDx0kO5ICG/I59+3uv4dejuFXeJ4lbG/x/ZM68w+NJRFqejftAUPvz+e3klIYULamysRQ6ZU7zi0z1Fku48vc1B6qofGCe25qxVUBo/V0TvV7xaRpLQqUZeo/8iU0maB0yo= 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 1761893259889986.0878148169626; Thu, 30 Oct 2025 23:47:39 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vEiv2-00053x-QV; Fri, 31 Oct 2025 02:47: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 1vEiv0-00053Z-3U for qemu-devel@nongnu.org; Fri, 31 Oct 2025 02:47:26 -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 1vEiuu-0003mp-AW for qemu-devel@nongnu.org; Fri, 31 Oct 2025 02:47:25 -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-616-c6Z7S4QZMIqBFqQSNLZbag-1; Fri, 31 Oct 2025 02:47:16 -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-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 2DD041834528; Fri, 31 Oct 2025 06:47:15 +0000 (UTC) Received: from localhost (unknown [10.45.242.5]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 836D1180057E; Fri, 31 Oct 2025 06:47:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761893238; 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=Ca5govH6QV2HNdGSc77K2aY+Td2HcDtR7U/Aqv/iciU=; b=Qgn6PhEAdXo8QU25KjqHoYMgjuzAXXfT9BtXqFXGJsuGqDSqlNEFjGoZQaWIquOHrwpiDN PboI/lvURb1n03d+w+mM1vaWYHz3s5ORGlQD0jA4zrNqtv8m1i6XFPtdyOzjC0cB5Fjarn 5wECHt8cvxpaLiHYqWbRnnYw5XgNtQI= X-MC-Unique: c6Z7S4QZMIqBFqQSNLZbag-1 X-Mimecast-MFC-AGG-ID: c6Z7S4QZMIqBFqQSNLZbag_1761893235 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: richard.henderson@linaro.org, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Gerd Hoffmann Subject: [PULL 06/36] hw/audio: simplify 'hda' audio init code Date: Fri, 31 Oct 2025 10:45:59 +0400 Message-ID: <20251031064631.134651-7-marcandre.lureau@redhat.com> In-Reply-To: <20251031064631.134651-1-marcandre.lureau@redhat.com> References: <20251031064631.134651-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: 1761893261132154100 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... This allows to make init() callback bus-agnostic next. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- hw/audio/intel-hda.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/hw/audio/intel-hda.c b/hw/audio/intel-hda.c index 6a0db0dd9e..c46b195b62 100644 --- a/hw/audio/intel-hda.c +++ b/hw/audio/intel-hda.c @@ -21,16 +21,16 @@ #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" #include "qemu/module.h" -#include "qemu/error-report.h" #include "hw/audio/model.h" #include "intel-hda.h" #include "migration/vmstate.h" #include "intel-hda-defs.h" -#include "system/dma.h" +#include "qobject/qdict.h" #include "qapi/error.h" #include "qom/object.h" =20 @@ -1305,15 +1305,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.1 From nobody Fri Nov 14 17:01:14 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=1761893281; cv=none; d=zohomail.com; s=zohoarc; b=RjADu4hRkurqrVQHHSycW48SRdHJ3lkhh0r/oGieaBjtG9vMqlHRT0kylNhhnQe1QI+VoQrUGj/VjiuxuQ7w99S2J+AjmkiAit1KbUwZarnzqodKkEONAzK1GbTs/QveUhcst5+a5iOfBNphDCe2jIO/sHS+7KU2tppkuEOjKl0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761893281; 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=RfQ2XWUHbQnYLJSZTe/RpBjY+hjS5Hfs+5ZlPmfwr38=; b=WFd3/Y9N+yoCtvOUctlVHiem84cUYv665UMa4EznL4B77TNzv7NYXB1UOjEvSpicudlCi3s0KZ2rNvqKkK71AlKsLq1FL8lkEg1YUXvv7DqJrM1wkw36c2aQrI726FFkJVCnHB1hfaNvZVAMa+tIkD8QGt19AYSVQPXtOHBrcXs= 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 176189328171149.20021219430021; Thu, 30 Oct 2025 23:48:01 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vEivC-0005D8-SD; Fri, 31 Oct 2025 02:47:38 -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 1vEivA-0005CE-FS for qemu-devel@nongnu.org; Fri, 31 Oct 2025 02:47:36 -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 1vEiv1-0003nB-31 for qemu-devel@nongnu.org; Fri, 31 Oct 2025 02:47:36 -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-457-ajYi15tQM8WDxW8tXbm9Qw-1; Fri, 31 Oct 2025 02:47:22 -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 7947A1953977; Fri, 31 Oct 2025 06:47:21 +0000 (UTC) Received: from localhost (unknown [10.45.242.5]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id F08BF30001A6; Fri, 31 Oct 2025 06:47:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761893244; 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=RfQ2XWUHbQnYLJSZTe/RpBjY+hjS5Hfs+5ZlPmfwr38=; b=QCwuyyhlC4vHvN7NxqlOwB7fvTfBGDAdPgv4/MR+Q8UzeMJIXEev8j8L+RKlIn3HuKWORE B+3PNJW/ZlAIaFX+wkHCuhyqCHEsGdRQ1xEwaozkJoaPVcUbP2YtlK7RSMk/7+XfctDTTJ cFc6lGuGSfjPT3ENfWE3x+H1JGnB3EY= X-MC-Unique: ajYi15tQM8WDxW8tXbm9Qw-1 X-Mimecast-MFC-AGG-ID: ajYi15tQM8WDxW8tXbm9Qw_1761893241 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: richard.henderson@linaro.org, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Gerd Hoffmann Subject: [PULL 07/36] hw/audio: generalize audio_model.init() Date: Fri, 31 Oct 2025 10:46:00 +0400 Message-ID: <20251031064631.134651-8-marcandre.lureau@redhat.com> In-Reply-To: <20251031064631.134651-1-marcandre.lureau@redhat.com> References: <20251031064631.134651-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, T_SPF_TEMPERROR=0.01 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: 1761893283095154100 From: Marc-Andr=C3=A9 Lureau It is no longer PCI bus only. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- include/hw/audio/model.h | 2 +- hw/audio/intel-hda.c | 4 +--- hw/audio/model.c | 12 ++++-------- 3 files changed, 6 insertions(+), 12 deletions(-) diff --git a/include/hw/audio/model.h b/include/hw/audio/model.h index aa237e9eb6..4d0be93042 100644 --- a/include/hw/audio/model.h +++ b/include/hw/audio/model.h @@ -3,7 +3,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)); + void (*init_audio_model)(const char *aud= iodev)); 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 c46b195b62..758e130c93 100644 --- a/hw/audio/intel-hda.c +++ b/hw/audio/intel-hda.c @@ -1303,7 +1303,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 void intel_hda_and_codec_init(const char *audiodev) { g_autoptr(QDict) props =3D qdict_new(); DeviceState *intel_hda, *codec; @@ -1317,8 +1317,6 @@ static int intel_hda_and_codec_init(PCIBus *bus, cons= t char *audiodev) qdev_prop_set_string(codec, "audiodev", audiodev); qdev_realize_and_unref(codec, hdabus, &error_fatal); object_unref(intel_hda); - - return 0; } =20 static void intel_hda_register_types(void) diff --git a/hw/audio/model.c b/hw/audio/model.c index ddfefea706..7af0d960f5 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); + void (*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)) + void (*init_audio_model)(const char *aud= iodev)) { 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.1 From nobody Fri Nov 14 17:01:14 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=1761893277; cv=none; d=zohomail.com; s=zohoarc; b=Gmf5npR3r//99NXY5G+dxp9PRR78zl/VsN54sIld8+VTfJvH6GpEXiE8+s6UPshf7ap47SYThD7WfANFli2nP9NmyBDHwo6bPZep7jceCuBWiHN3lAJAobqLLoHuV61A0W4iogSGNh7hxW0VWuvDqud0Dk5PxVbfY/bCRuMMG1Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761893277; 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=LQwaAVpG6gZ05ogK3rb8CY+CPfGmzOGj/qO9r9Vmf6g=; b=kAw14sYt2UemFxtHe4Yz3pFmH/WbHMZXSj2XxCvvkuEaTg/3oYhTvAwMVnWGAOGQFKQbxQQpa1Se6HVnAu8442Mdg/OAHBdPsuE3G1Ex3VKwXe0UQQsgWGYGhewF+IdlkAyM5FtPooJcKeCFU7i3n1VEVuLebz5fR7ONQUJCbC0= 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 1761893277679229.28214896683141; Thu, 30 Oct 2025 23:47:57 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vEivF-0005GP-Tl; Fri, 31 Oct 2025 02:47:43 -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 1vEivC-0005D7-H3 for qemu-devel@nongnu.org; Fri, 31 Oct 2025 02:47:39 -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 1vEiv9-0003nV-SH for qemu-devel@nongnu.org; Fri, 31 Oct 2025 02:47:38 -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-27-slIbk2a8MFmqy2n7BJgRmQ-1; Fri, 31 Oct 2025 02:47:28 -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 71D9A1953965; Fri, 31 Oct 2025 06:47:27 +0000 (UTC) Received: from localhost (unknown [10.45.242.5]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id EBE971955BE3; Fri, 31 Oct 2025 06:47:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761893251; 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=LQwaAVpG6gZ05ogK3rb8CY+CPfGmzOGj/qO9r9Vmf6g=; b=Uxe5nPYGztGTYOqTr00706THRn3wAcStBaEl7O29GSnf3TUpEgHqcHYG6qMJ39X0Ldl8Ae M2FW9v76x7T9OH7wBDtMUa3tMdRl7F23U/tMz5zZ6DpLm8PB9E5TdYQZak8wcb0TocH7rH /9+fErePd6YXLMSLmgtriZHIsvjRy+s= X-MC-Unique: slIbk2a8MFmqy2n7BJgRmQ-1 X-Mimecast-MFC-AGG-ID: slIbk2a8MFmqy2n7BJgRmQ_1761893247 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: richard.henderson@linaro.org, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Gerd Hoffmann , Manos Pitsidianakis , "Michael S. Tsirkin" Subject: [PULL 08/36] hw/audio: drop audio_model.isa Date: Fri, 31 Oct 2025 10:46:01 +0400 Message-ID: <20251031064631.134651-9-marcandre.lureau@redhat.com> In-Reply-To: <20251031064631.134651-1-marcandre.lureau@redhat.com> References: <20251031064631.134651-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: 1761893279177154100 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 | 8 +------- hw/audio/sb16.c | 2 +- hw/audio/virtio-snd-pci.c | 2 +- 9 files changed, 9 insertions(+), 15 deletions(-) diff --git a/include/hw/audio/model.h b/include/hw/audio/model.h index 4d0be93042..c38b359413 100644 --- a/include/hw/audio/model.h +++ b/include/hw/audio/model.h @@ -5,7 +5,7 @@ void audio_register_model_with_cb(const char *name, const char *descr, void (*init_audio_model)(const char *aud= iodev)); 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 9dee5bb143..6b9013ebb8 100644 --- a/hw/audio/ac97.c +++ b/hw/audio/ac97.c @@ -1362,7 +1362,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 d0b2817843..6aae365f47 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 0979cf5f16..3b80a61378 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 066b9906fa..721c02be0a 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 d5b1e62135..45ea04bf89 100644 --- a/hw/audio/gus.c +++ b/hw/audio/gus.c @@ -320,7 +320,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 7af0d960f5..40929c6e77 100644 --- a/hw/audio/model.c +++ b/hw/audio/model.c @@ -26,16 +26,13 @@ #include "monitor/qdev.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/audio/model.h" =20 struct audio_model { const char *name; const char *descr; const char *typename; - int isa; void (*init)(const char *audiodev); }; =20 @@ -48,18 +45,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 +115,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 5faa3f5fe3..e86aafd488 100644 --- a/hw/audio/sb16.c +++ b/hw/audio/sb16.c @@ -1470,7 +1470,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.1 From nobody Fri Nov 14 17:01:14 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=1761893317; cv=none; d=zohomail.com; s=zohoarc; b=XfB7+Lsi2sd1PpwpqZcqKrjaTYTlWjTEnn17lVJqeUSUIVFIHskT5MbiIDs7B0Lcu2jdr6VaTVytuMgiJYXT3ijtJwgwZgPwfGmvVucpiLrU+1r/bJdx8QLUak5ZGcY/GFVRuYMb1OQkjkp16e1f5dGjZO34SvneMgSucgiwdlA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761893317; 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=TNtgnjCv8OYzqHgDjTIS8kbVn0Np6mDRqXCNrlfeR5o=; b=cCK59OCjO9VbvrM4584cacsYmGCrx5CFaKLqBJ94TO6iKyKKezMs3/9wgDiUV5X5ALtvzVMO3ZpMq7qW3Vk50ZbBscj44mwwqhhRSpsijH2CiZGqC4F8Cz+cekCni5H27jY6b5qUDSOKT/Grgmv1aQn7Ygz93M8rS2QF1JtgVYo= 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 1761893317109413.42420980063184; Thu, 30 Oct 2025 23:48:37 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vEivq-0006BF-G7; Fri, 31 Oct 2025 02:48: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 1vEivT-0005j5-Sc for qemu-devel@nongnu.org; Fri, 31 Oct 2025 02:47:56 -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 1vEivE-0003nn-Ow for qemu-devel@nongnu.org; Fri, 31 Oct 2025 02:47:55 -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-695-cOpseqh1MsyIxoshmK6CDw-1; Fri, 31 Oct 2025 02:47:34 -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 744271955E75; Fri, 31 Oct 2025 06:47:33 +0000 (UTC) Received: from localhost (unknown [10.45.242.5]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 5545830001A1; Fri, 31 Oct 2025 06:47:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761893256; 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=TNtgnjCv8OYzqHgDjTIS8kbVn0Np6mDRqXCNrlfeR5o=; b=Ohh49iW2xs5jjM3N9brrm1vxsr76KwUkYBQx0yohTQhXMcMJua5cEXC7oOU3wHhay+MBCl m4ViRbrHoj/7C7KUqFz6x52hIVkjV9WEI2DouOtbZ+iwD50brBDyLqD8KM3troZG+XrWQ2 laY+7Yx6jH3wPWv4Uege/N1t+HWLAZg= X-MC-Unique: cOpseqh1MsyIxoshmK6CDw-1 X-Mimecast-MFC-AGG-ID: cOpseqh1MsyIxoshmK6CDw_1761893253 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: richard.henderson@linaro.org, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Gerd Hoffmann Subject: [PULL 09/36] audio: start making AudioState a QOM Object Date: Fri, 31 Oct 2025 10:46:02 +0400 Message-ID: <20251031064631.134651-10-marcandre.lureau@redhat.com> In-Reply-To: <20251031064631.134651-1-marcandre.lureau@redhat.com> References: <20251031064631.134651-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_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: 1761893319366154100 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..e1696403ae 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 drivers 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.1 From nobody Fri Nov 14 17:01:14 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=1761893315; cv=none; d=zohomail.com; s=zohoarc; b=mhnYyLu7FRj9qXEeMaGSYWjpntTdY33ib2KKTJ6GzPLNkjiDHm9rSeAvINIkDu+xuc13BGDgIxIIu8glzzYHchpEJZzmiT7GcB+to8L1+dsM9Nba7LYcBfOJ1hOA/9L67UHqZcZ4wqG2QEhYmS8nQIYPrCbIXeQXkknWlzAVC+w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761893315; 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=LbzMEnS1rVIl4yt776Y/gOQ9bV5mI+TdAcamExeDZoY=; b=FSKQiGOS1/uyD0UWjPvSwk3ZBqeSH7Q7q1ahKeikeKXqhNTmoX2kf57AiretXsCZbac4EeaPV0MrFPUfXcoYa0lgyid7EBe4ieocIEmWBVrmO8B4a6b6A7SXnNLaE1g2SVucI+4NyPz9oUf+dtcfKlmQ4YoETTRT8g6qlx+8xgw= 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 1761893315613611.3961783641967; Thu, 30 Oct 2025 23:48:35 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vEivp-0006J5-Iu; Fri, 31 Oct 2025 02:48: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 1vEivU-0005kf-QL for qemu-devel@nongnu.org; Fri, 31 Oct 2025 02:48: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 1vEivQ-0003oo-Us for qemu-devel@nongnu.org; Fri, 31 Oct 2025 02:47:56 -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-194-VPgzFkfzNdW2TtCgSC9tRQ-1; Fri, 31 Oct 2025 02:47:46 -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-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 803DE1955E75; Fri, 31 Oct 2025 06:47:45 +0000 (UTC) Received: from localhost (unknown [10.45.242.5]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 610B01800594; Fri, 31 Oct 2025 06:47:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761893270; 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=LbzMEnS1rVIl4yt776Y/gOQ9bV5mI+TdAcamExeDZoY=; b=Qw/L3HLlL7uv+5FpQ4YSCbHURnOCjdY4Mb4gBrYFTKb3BiJnswC/UBG6/IMLlJETBio2Bk BIpQ5xk9LCS/I4lKx2y+R/NCAA7yirGeUTvmwYnMxgXU/o5KEzYUajx/wbXunNp9Yf1ecR KRdA/QEh2DWD5JW6U7PYVk3OkdrXCxY= X-MC-Unique: VPgzFkfzNdW2TtCgSC9tRQ-1 X-Mimecast-MFC-AGG-ID: VPgzFkfzNdW2TtCgSC9tRQ_1761893265 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: richard.henderson@linaro.org, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Gerd Hoffmann , Paolo Bonzini , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Eduardo Habkost Subject: [PULL 10/36] audio: register backends in /audiodevs container Date: Fri, 31 Oct 2025 10:46:03 +0400 Message-ID: <20251031064631.134651-11-marcandre.lureau@redhat.com> In-Reply-To: <20251031064631.134651-1-marcandre.lureau@redhat.com> References: <20251031064631.134651-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: 1761893317474154100 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 e1696403ae..c291fd3e65 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.1 From nobody Fri Nov 14 17:01:14 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=1761893622; cv=none; d=zohomail.com; s=zohoarc; b=YeqPIhsp4kPZyu4RhO8kzp1ZUE5uaFeV/gaGF536ipkcRV7EpEJgYR25WItY/lFwlnDeqVh4GeVx6Ja9a1lwki4R6vzNkDPp7ZYFM5Rc7rtR8GCq+TZiYp/ofE9sdB+UZKrtO9LAG0AcK+NS1E4NKWVBMKnIKpPlcbSVYDDdzNg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761893622; 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=AqE3kGewM8FGRWT3AdFdYND4jR402h3wBKyZk/6vNzs=; b=CgbJgBECmbnQdbmU5981LIDrPpIliNSIWDNl13rmxoC2UsOY1PRS1D9HEr8oLa6HUxiEyn8PIJkQ90pKhpnoGwK0tGShgJC64KdGTOlkRZnz58A1Y0LvWq6UEZSW47Z6k4iqiBdD5TFeG7uePKBn4ZGXeEram0jLZ3k/wD8JzzM= 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 176189362211390.81124088567333; Thu, 30 Oct 2025 23:53:42 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vEivs-0006bq-Fv; Fri, 31 Oct 2025 02:48:20 -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 1vEivd-0005ng-HQ for qemu-devel@nongnu.org; Fri, 31 Oct 2025 02:48:12 -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 1vEivW-0003pK-Fv for qemu-devel@nongnu.org; Fri, 31 Oct 2025 02:48:05 -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-81-oQokk-1BM9uPSKiEEZLtXA-1; Fri, 31 Oct 2025 02:47:52 -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 A9FD71955DD6; Fri, 31 Oct 2025 06:47:51 +0000 (UTC) Received: from localhost (unknown [10.45.242.5]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 2079E1955BE3; Fri, 31 Oct 2025 06:47:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761893277; 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=AqE3kGewM8FGRWT3AdFdYND4jR402h3wBKyZk/6vNzs=; b=flo8mFRnO58HFnKDwirMa7oq9Kv+GWXI2wHEpCiO+8HKrohqc2kABjdTCZccP/zmoPLegE 8XSnQ8rYkSCmTGADIvxn3FXMw7oK9IfZ2063ohFYlR7qm9uMgUiOylWjP1LjPS/ZS/TxMl JcIy4k4BLqSkUZMNPN0c3UbGT5yMRws= X-MC-Unique: oQokk-1BM9uPSKiEEZLtXA-1 X-Mimecast-MFC-AGG-ID: oQokk-1BM9uPSKiEEZLtXA_1761893271 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: richard.henderson@linaro.org, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Gerd Hoffmann Subject: [PULL 11/36] audio: use /audiodevs QOM container Date: Fri, 31 Oct 2025 10:46:04 +0400 Message-ID: <20251031064631.134651-12-marcandre.lureau@redhat.com> In-Reply-To: <20251031064631.134651-1-marcandre.lureau@redhat.com> References: <20251031064631.134651-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: 1761893624973154100 From: Marc-Andr=C3=A9 Lureau audio_cleanup() is already called at exit (similar to chardev) Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- 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 c291fd3e65..5bf4307fbd 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.1 From nobody Fri Nov 14 17:01:14 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=1761893333; cv=none; d=zohomail.com; s=zohoarc; b=eJc3CAC6QzXIKZ5y+ZGG0qFxQGTXiSsqQ7zYV0YLgWMBE025uPggMdAYloSDkGT+uuiE5GrTUi3O1iw8WOB4TSiuYusl/003WSH2BvqyTqXLg88KlFeOV++FQVRVmI+Fn8iemmgN7fT+2Q7lcDHMqX4dq11gYLhVIOYVqVXLe0Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761893333; 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=tpASkYS/t70hNn5GY7VCHkTrgmBuPXtl7G4M5sSpgSw=; b=no+D9odkZfFCbz6BxJCnKDFp1KZjDe+AzkpMCAgOygfWokccxU5+qoivos+gWUDGNOf00dVrJ4CcFLLZJEWoa2w5kL91h2aPDn6G/LBAhgbNbvejwQBCcIOAI0w43Yz9yWn3rrFyRubCSRKB5l9eBsIQHwpqoCgLypKnCjarL3A= 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 1761893333421413.67157960907355; Thu, 30 Oct 2025 23:48:53 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vEivv-0006sU-N1; Fri, 31 Oct 2025 02:48:23 -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 1vEive-0005nh-2O for qemu-devel@nongnu.org; Fri, 31 Oct 2025 02:48:12 -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 1vEivb-0003pi-U4 for qemu-devel@nongnu.org; Fri, 31 Oct 2025 02:48:05 -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-412-T6h6fbNfMoaz7IFJzKKU1A-1; Fri, 31 Oct 2025 02:47:58 -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 A141B1955DAA; Fri, 31 Oct 2025 06:47:57 +0000 (UTC) Received: from localhost (unknown [10.45.242.5]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 36DF41800583; Fri, 31 Oct 2025 06:47:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761893281; 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=tpASkYS/t70hNn5GY7VCHkTrgmBuPXtl7G4M5sSpgSw=; b=MIRXulnGIXIEn9c4hGj4I1yJKn2pwejhLF0zdqAMcTP8n9sH8w4N++QoZPosX/0qAfwL0P DmwsSyk908HSS5jCWA9F17u70NAHCLkQgJwL+uJFON0Q3m9BP0Pzs65odvAiJ9tkExp3NY UEqfm6Kk/gCZhZ0WfbLkOrnpuvAEyn0= X-MC-Unique: T6h6fbNfMoaz7IFJzKKU1A-1 X-Mimecast-MFC-AGG-ID: T6h6fbNfMoaz7IFJzKKU1A_1761893277 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: richard.henderson@linaro.org, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Gerd Hoffmann Subject: [PULL 12/36] audio/paaudio: remove needless return value Date: Fri, 31 Oct 2025 10:46:05 +0400 Message-ID: <20251031064631.134651-13-marcandre.lureau@redhat.com> In-Reply-To: <20251031064631.134651-1-marcandre.lureau@redhat.com> References: <20251031064631.134651-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: 1761893334704158500 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.1 From nobody Fri Nov 14 17:01:14 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=1761893355; cv=none; d=zohomail.com; s=zohoarc; b=WMSyWVlu1p/yLyKfxlNwRv7Bda90MYrCHuSjknvAkmKPQdcLlrkVItfpQmJWihDRYMEEUeUdJkyAF93jivAVw0kOjKgjvDaFY6y2qwNOlyhpBJjSa2cD2WZ38zYQNmUzRjOTv05vfpxffazNGJzF4OiFnW/Egn570Qz4efOq870= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761893355; 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=EnHuJt01YxKm69T0x95B5ESs3I+4ASAEQVrLsiXBo34=; b=kB3Tsf3e6CpSqZDvKlQjVMfCjPtvnZIpFsIny5u2U1JvlxuyCXjFJ3VK89/a22ecMufX3/AG7MQz6erslPcDIklqAUVdhihn/2FPVerwcWYYWYvDkxcBHbCtJkHeKepxDZJQRePi8p9EuPA9s/IXqmfB7hXJsWTugWNX7aifBO8= 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 1761893355385118.7243815121368; Thu, 30 Oct 2025 23:49:15 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vEiwN-0007dx-W9; Fri, 31 Oct 2025 02:48:52 -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 1vEivx-00070S-Kv for qemu-devel@nongnu.org; Fri, 31 Oct 2025 02:48:25 -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 1vEivj-0003q3-1u for qemu-devel@nongnu.org; Fri, 31 Oct 2025 02:48:25 -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-404-5BVdSjjfM3WYnu4heSX3Vw-1; Fri, 31 Oct 2025 02:48:04 -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 41A951955D85; Fri, 31 Oct 2025 06:48:03 +0000 (UTC) Received: from localhost (unknown [10.45.242.5]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 0F6461955BE3; Fri, 31 Oct 2025 06:48:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761893286; 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=EnHuJt01YxKm69T0x95B5ESs3I+4ASAEQVrLsiXBo34=; b=UcLoxxPYwmjvx5xKgodWyXF7RUGyGWIDkm9WsUeJktKfAQn2mA0tNQlNriO+ZQkOQHjV8Y UC1hqnmbUU5y01GxuCXvukwEZIGyokWAs88UOj+rXPFPNWMC6/l41Y6x1sxWV6s2ALTNs/ li5gRjXEOV4kexuNaZtO/3X4xKBzpXY= X-MC-Unique: 5BVdSjjfM3WYnu4heSX3Vw-1 X-Mimecast-MFC-AGG-ID: 5BVdSjjfM3WYnu4heSX3Vw_1761893283 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: richard.henderson@linaro.org, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Gerd Hoffmann Subject: [PULL 13/36] audio/dsound: simplify init() Date: Fri, 31 Oct 2025 10:46:06 +0400 Message-ID: <20251031064631.134651-14-marcandre.lureau@redhat.com> In-Reply-To: <20251031064631.134651-1-marcandre.lureau@redhat.com> References: <20251031064631.134651-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_PASS=-0.001, T_SPF_HELO_TEMPERROR=0.01 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: 1761893358991158500 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 Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- audio/dsoundaudio.c | 29 +++++++++++------------------ 1 file changed, 11 insertions(+), 18 deletions(-) diff --git a/audio/dsoundaudio.c b/audio/dsoundaudio.c index f3bb48d007..c8745a3df0 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.1 From nobody Fri Nov 14 17:01:14 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=1761893344; cv=none; d=zohomail.com; s=zohoarc; b=DyvqH6NT6kYBezO0CDYt8Q50fu9a6aPzm2weSRjPaggbbogB7u61fGWNChRETSbRLPCqAYqra6f6/OpTbvybuNtm0WW2Rr8ETSpzeKncnU7ybNakeR5eiAv+qwIghCZoI1hgETDLdyAu3fGgyzU4IEmTMYCKYYxguhH3BymsGKc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761893344; 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=AtYsjuztbXqZIXvJzOChqeqiNWmlNBPVkm7CJiwD/zs=; b=JVJD9iJg4xa+uN0wSHZ4ut/U+wLR57F4lKK5nCk62VvU3z5u12KKpt7QL1F0+4RjJF9Nz4E5MU3YsEL81CuBU/CBq8KBAEBPWWMWv7h0ga+j9AJWiA1q6k7+MXcVtjwlYZvMiZlE7Cu3aJfXZl8tw4HU7xftDej9yp8wNTtZpbM= 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 1761893344334235.61020683113009; Thu, 30 Oct 2025 23:49:04 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vEiwG-0007Lu-31; Fri, 31 Oct 2025 02:48: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 1vEivx-00070R-K8 for qemu-devel@nongnu.org; Fri, 31 Oct 2025 02:48:25 -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 1vEivl-0003qF-HK for qemu-devel@nongnu.org; Fri, 31 Oct 2025 02:48:25 -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-486-4QOs978XOxKsT4dzKIVxvw-1; Fri, 31 Oct 2025 02:48: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-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 52D9A1955DB5; Fri, 31 Oct 2025 06:48:09 +0000 (UTC) Received: from localhost (unknown [10.45.242.5]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id C26161800592; Fri, 31 Oct 2025 06:48:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761893292; 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=AtYsjuztbXqZIXvJzOChqeqiNWmlNBPVkm7CJiwD/zs=; b=FNXZN7ksxfNmMYWXe1wDDW1t+0lkMy5aoKnEBtl4guPGf8OYhbpHkwgQdiNleeL7pz+98h Jl769WzzuN4BObmGhuj8kc5cbSi7pjVDP8MSfI5FAMmlFbOoH7z20DBpuSShpwij3H6MrE vhvLA4zqqZ8HzRoJb3+8sw02HybBDB4= X-MC-Unique: 4QOs978XOxKsT4dzKIVxvw-1 X-Mimecast-MFC-AGG-ID: 4QOs978XOxKsT4dzKIVxvw_1761893289 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: richard.henderson@linaro.org, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Gerd Hoffmann Subject: [PULL 14/36] audio/dsound: report init error via **errp Date: Fri, 31 Oct 2025 10:46:07 +0400 Message-ID: <20251031064631.134651-15-marcandre.lureau@redhat.com> In-Reply-To: <20251031064631.134651-1-marcandre.lureau@redhat.com> References: <20251031064631.134651-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: 1761893345837154100 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 Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- audio/dsoundaudio.c | 182 +++++++++++++++++++------------------------- 1 file changed, 79 insertions(+), 103 deletions(-) diff --git a/audio/dsoundaudio.c b/audio/dsoundaudio.c index c8745a3df0..d476e9b441 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; } =20 - AUD_log (AUDIO_CAP, "Reason: %s\n", str); +} + +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); + + 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.1 From nobody Fri Nov 14 17:01:14 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=1761893363; cv=none; d=zohomail.com; s=zohoarc; b=KNbkxnMUQzRcnvd0xSQR585QoF/V/dg0JJDCxLplroQSwHOCMGGIPpINdptT5EJfbNo4fA6u2MrvAinCq3gehRkK517ae2S1XhMynL4Q0+hQZQ+XjzCoYDDbqMoU2pmMesAntlmE2+JV+i9j7SVP737kQpn54LDxLbK8nborWr0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761893363; 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=b0xjMVCVojnHguNTAUQW8Mi6H+WKgCLtdKyM3TnBi60=; b=csPajfoOP0MOmQCJdJXECtf+DP34PdjNxis7LNbOhy7IVaeGK6UeaQyoUqwGNmgQ3m805yX9TrLwMnpBWw+3RlumBWz5CetV751q1txv9FrClKgMlI818iFMQd9bFyvrOO5CcwdXKiSgbu8fVLZnl4NDhNZZ3DGRmge1Gmq9zdI= 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 1761893363230610.6604143505674; Thu, 30 Oct 2025 23:49:23 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vEiwP-0007ha-Ct; Fri, 31 Oct 2025 02:48: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 1vEiw3-0007Fq-Lg for qemu-devel@nongnu.org; Fri, 31 Oct 2025 02:48:34 -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 1vEivv-0003qa-6D for qemu-devel@nongnu.org; Fri, 31 Oct 2025 02:48:31 -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-553-3qw4USDGOSCUtR9getsOVw-1; Fri, 31 Oct 2025 02:48:15 -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-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id DEE631955DBD; Fri, 31 Oct 2025 06:48:14 +0000 (UTC) Received: from localhost (unknown [10.45.242.5]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id D54231800592; Fri, 31 Oct 2025 06:48:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761893300; 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=b0xjMVCVojnHguNTAUQW8Mi6H+WKgCLtdKyM3TnBi60=; b=JY+OVgek3n2ItRXoCar3j/EantZepyH/pIIf+m+pe2sJNA73Wxy7WHewsQT25fKve7a9d/ ndXw8Tm7ONNq1KMlsOM0NGRMzb4a7lTOdhxFCJWdCJjoPhnISX7xNGkKfvma8A+jAViFDd RX/WCafpsVGU4p0bOnae+Ps/6SMOMbI= X-MC-Unique: 3qw4USDGOSCUtR9getsOVw-1 X-Mimecast-MFC-AGG-ID: 3qw4USDGOSCUtR9getsOVw_1761893295 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: richard.henderson@linaro.org, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Gerd Hoffmann Subject: [PULL 15/36] audio: simplify audio_driver_init() Date: Fri, 31 Oct 2025 10:46:08 +0400 Message-ID: <20251031064631.134651-16-marcandre.lureau@redhat.com> In-Reply-To: <20251031064631.134651-1-marcandre.lureau@redhat.com> References: <20251031064631.134651-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_PASS=-0.001, T_SPF_HELO_TEMPERROR=0.01 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: 1761893365929154100 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 Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- audio/audio.c | 48 ++++++++++++++++++++---------------------------- 1 file changed, 20 insertions(+), 28 deletions(-) diff --git a/audio/audio.c b/audio/audio.c index 5bf4307fbd..087e1946e7 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.1 From nobody Fri Nov 14 17:01:14 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=1761893681; cv=none; d=zohomail.com; s=zohoarc; b=fh7Oc/0rEAP6OPM9YsrbLjE3tdyRYofip+5Gna/pmVNDME0egdjH5WSRwkOMW3TMMeqHyGHlzK1klBepbdlu45jUtf7oOOtSgRxCEa7xXufZDVHaa8+LtMM+JKlMoiOPnR2uW6l2Q0JCuFnaZvXAfetQHMlad0R/YZ6JeB427uU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761893681; 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=qkIFT2BrXSsOiT8q9B28C9O+ecSweAo6IQPcjykFdxM=; b=Jgl4LrNYP4x6nIzMowKycGp5ltgHZwcJkiCCRK53pi6Z4SqQeszrToLF4cUharyVgDvwzspxzddGSPP+RVMrJPr191vdRXlMejvbM8hWDEXUvSTeU/Owewefmpaz3lCqMP3Iv2YQg7DWnGLIAoTb04rG8iQjel7rNNShATnL7XE= 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 1761893681565607.3452505396178; Thu, 30 Oct 2025 23:54:41 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vEiwT-0007m4-HS; Fri, 31 Oct 2025 02:48:58 -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 1vEiw8-0007Lx-QW for qemu-devel@nongnu.org; Fri, 31 Oct 2025 02:48:41 -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 1vEivz-0003qs-PN for qemu-devel@nongnu.org; Fri, 31 Oct 2025 02:48:36 -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-490-wKWav1_FP_a4OLyAw3rmxA-1; Fri, 31 Oct 2025 02:48:23 -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 DD1E0180A22D; Fri, 31 Oct 2025 06:48:20 +0000 (UTC) Received: from localhost (unknown [10.45.242.5]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 7BA2119560A2; Fri, 31 Oct 2025 06:48:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761893305; 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=qkIFT2BrXSsOiT8q9B28C9O+ecSweAo6IQPcjykFdxM=; b=OhVoU/Q5t9l9m8AgvVjtKR8zHUzJ0hR7AWB3yCVSZt2+fKbrOdV/LEP6gHDuelOLE7geMw +rOv4YHOzLupUEJ7WmVZ6mrpBhv7DoCtsDeikoQitFSNBeRXYwzBZH/E49len+LK9ln/wh GjPNADVEy6+a926F0Vj/475Ov317BPg= X-MC-Unique: wKWav1_FP_a4OLyAw3rmxA-1 X-Mimecast-MFC-AGG-ID: wKWav1_FP_a4OLyAw3rmxA_1761893301 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: richard.henderson@linaro.org, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Gerd Hoffmann Subject: [PULL 16/36] audio: move period tick initialization Date: Fri, 31 Oct 2025 10:46:09 +0400 Message-ID: <20251031064631.134651-17-marcandre.lureau@redhat.com> In-Reply-To: <20251031064631.134651-1-marcandre.lureau@redhat.com> References: <20251031064631.134651-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: 1761893683745154100 From: Marc-Andr=C3=A9 Lureau Part of QOM-ification. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- audio/audio.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/audio/audio.c b/audio/audio.c index 087e1946e7..43db7380f0 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.1 From nobody Fri Nov 14 17:01:14 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=1761893482; cv=none; d=zohomail.com; s=zohoarc; b=AZvHMQRlKonhwjUPX9/d7c/bOoBwP1XQDvMj2GeQXkiNOtM13hjJ+ZQYLXj3F5Syl2yZNQUeYuB3iWdjyzkInUfVBb4j8oBzmydp2bQfGY1e22VWjprJIDiNO8AVWTvUEijCJnIucwhhEue2mHwoyUi6UwZfwYU1vSiQQ3+yPW4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761893482; 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=5ipQWMsGD14fTvPGYQ6f3KeYGKUxPkGFmUjL2XnpB4Y=; b=OJPFluy1Zce2MDi5Qik2El6fRFKlK0nxWDyN7ZUPt8j/ITqcU7ZpUleHW+zUTVVArRFiAhkqCxmqlMyelDvSE2doaHGPboTn+Zl+h84mbRXlMf7Cu/AFl7JdKUnkStbvCBlCwtxCr3dW+oPYGwW+00JweSz8knW3pfLtafoU5yQ= 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 1761893482778850.4558161700597; Thu, 30 Oct 2025 23:51:22 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vEiwQ-0007qE-KV; Fri, 31 Oct 2025 02:48: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 1vEiwC-0007PW-Cm for qemu-devel@nongnu.org; Fri, 31 Oct 2025 02:48:44 -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 1vEiw7-0003rF-Fu for qemu-devel@nongnu.org; Fri, 31 Oct 2025 02:48:38 -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-43-OgUk-slFOeiwvqXqC0LWFw-1; Fri, 31 Oct 2025 02:48: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 297D9195DE37; Fri, 31 Oct 2025 06:48:30 +0000 (UTC) Received: from localhost (unknown [10.45.242.5]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 9ECD630001A1; Fri, 31 Oct 2025 06:48:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761893313; 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=5ipQWMsGD14fTvPGYQ6f3KeYGKUxPkGFmUjL2XnpB4Y=; b=gJujFIosbdnJp/+T1QK6JsT+H1uj7Gu3qvuUDGKk6VAYW4n5mUFtjhl/+PZ/5Y2L2KwBqM VEBPDBrivYNnB1iM7TKXtRl+FCdjKjcyBrpiYXAT84LIWxExl6ptAc0Na8VYkGPwm/pJhU gJdN3XxS369NwiR+lXyfFC4P3yq62fk= X-MC-Unique: OgUk-slFOeiwvqXqC0LWFw-1 X-Mimecast-MFC-AGG-ID: OgUk-slFOeiwvqXqC0LWFw_1761893310 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: richard.henderson@linaro.org, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Gerd Hoffmann Subject: [PULL 17/36] audio: drop needless error message Date: Fri, 31 Oct 2025 10:46:10 +0400 Message-ID: <20251031064631.134651-18-marcandre.lureau@redhat.com> In-Reply-To: <20251031064631.134651-1-marcandre.lureau@redhat.com> References: <20251031064631.134651-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: 1761893498827158500 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 Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- audio/audio.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/audio/audio.c b/audio/audio.c index 43db7380f0..155809dee7 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.1 From nobody Fri Nov 14 17:01:14 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=1761893363; cv=none; d=zohomail.com; s=zohoarc; b=FsqzHUJgoM5DdxyRrGjdMWgLSGW3jNZzWHHDMVForErU4iyveLidw8R33QWH0MeeSd25/QPW9nVI/PjtKGhBrfhvjO0bV80q9raQ216nj9lI1gnQ3ccXGmluVAZUPvKfsL8Oy7ED3h9EmaLC3p/DvXfSygYKWo6bB8LHK9ahicc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761893363; 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=idcdkmu2bOy5TQeCa1u4Cww/6eEZuWkfS99E4FxwbJc=; b=ZFb5ueLECcbh4EBlqIglJNs+G9tkrFcbCpqCP/JnKS577/io32f6usQuVIcCEhlCNeGF/n4mqFCfPLsjtaNEON4SiU540P2dLFjpYTQM+IbmEqJ0H/BNDOAtZxiNuydA5fV7QgDsqIhBLsI7NeNKx9vHMg/eabMhgeRWEzMljt4= 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 1761893363589265.277890593332; Thu, 30 Oct 2025 23:49:23 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vEiwg-0008JC-Gm; Fri, 31 Oct 2025 02:49:11 -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 1vEiwN-0007ev-AB for qemu-devel@nongnu.org; Fri, 31 Oct 2025 02:48:51 -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 1vEiwF-0003sR-9R for qemu-devel@nongnu.org; Fri, 31 Oct 2025 02:48:51 -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-214-tZKlnpjhNFKwlWhc327hQw-1; Fri, 31 Oct 2025 02:48:37 -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 7476C1955D85; Fri, 31 Oct 2025 06:48:36 +0000 (UTC) Received: from localhost (unknown [10.45.242.5]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id D3A431955BE3; Fri, 31 Oct 2025 06:48:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761893321; 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=idcdkmu2bOy5TQeCa1u4Cww/6eEZuWkfS99E4FxwbJc=; b=JmHmLJ1wvkx4Zj0kTYHkGwb6PdfnubVZyV4K5rw4E06D/zHjw0Ypk7NPZ8uk0S7beZ0NtU wuLCyf8Ky6hkmhmqt3IguPvoREZt2UiAMi1Q72nyeyFFJdlHKL/thORmpTCuYrbyk/vP5t x/avwYbnxcDGDYxIc2IXbxn9m2HpClE= X-MC-Unique: tZKlnpjhNFKwlWhc327hQw-1 X-Mimecast-MFC-AGG-ID: tZKlnpjhNFKwlWhc327hQw_1761893316 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: richard.henderson@linaro.org, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Gerd Hoffmann Subject: [PULL 18/36] audio: keep vmstate handle with AudioState Date: Fri, 31 Oct 2025 10:46:11 +0400 Message-ID: <20251031064631.134651-19-marcandre.lureau@redhat.com> In-Reply-To: <20251031064631.134651-1-marcandre.lureau@redhat.com> References: <20251031064631.134651-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_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: 1761893365953154100 From: Marc-Andr=C3=A9 Lureau QOM-ification continues. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- 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 155809dee7..4c3c3fd52f 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.1 From nobody Fri Nov 14 17:01:14 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=1761893678; cv=none; d=zohomail.com; s=zohoarc; b=e4kPPPfqRRyZbjMf4HU7XPHY0mhgVzPO1DIPlCD8W9FeVueyA1E3Gj9ZPthkz/PLUO75++dttgeWp0Qs5yOT4cVgu3k1rN/vYGK5IDIEnghqmdnWeCk/s+4Rbzbwz76HOPz0ctiSS+pvNXVisGiIeKxGoQeglzRYu1fMt0JxNag= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761893678; 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=iaTRZZopkfZtRrS9JMoiXkd5OnX21LT7v4mz7sPGUxw=; b=JnB5XHPOpxXATJlrZaEdBJqLTkcgPPYpPMua95MQ3OsfLWUu3sRnzikmdY0OV4lfBPfq1ky6qZSNCqsVJ7QAMsTlgmwXDBQteRtVh2D62D7V4fNJP7lWcQkccPivrWXrNCCDQK73hLl+1bxKtjSK1gxe+IdMlhQ7p3CmtIrsFMI= 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 1761893678209180.97096009330392; Thu, 30 Oct 2025 23:54:38 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vEiwp-0008Vz-BC; Fri, 31 Oct 2025 02:49: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 1vEiwM-0007eV-UY for qemu-devel@nongnu.org; Fri, 31 Oct 2025 02:48:51 -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 1vEiwJ-0003tW-7v for qemu-devel@nongnu.org; Fri, 31 Oct 2025 02:48:49 -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-461-yhwVOBi-PKmMnoyqteFyIg-1; Fri, 31 Oct 2025 02:48:43 -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 42A97183453C; Fri, 31 Oct 2025 06:48:42 +0000 (UTC) Received: from localhost (unknown [10.45.242.5]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 358EE1955BE3; Fri, 31 Oct 2025 06:48:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761893326; 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=iaTRZZopkfZtRrS9JMoiXkd5OnX21LT7v4mz7sPGUxw=; b=fWu2FvjyUapW8vgR0eVlfKzSQ/T9grqaWhHEjvTb9YfE+UvsljOoVfPwupjWTtjXXMcBCg 6VeipTfBFNRuNrVVtXI2vi4N4/feejNW9Zfq7eRITp/e5U1u3kasxaoCAH0KOwfm9x+PLQ tM0KYoe1J60DUx5cP0C231SDbM1UkvU= X-MC-Unique: yhwVOBi-PKmMnoyqteFyIg-1 X-Mimecast-MFC-AGG-ID: yhwVOBi-PKmMnoyqteFyIg_1761893322 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: richard.henderson@linaro.org, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Gerd Hoffmann Subject: [PULL 19/36] audio: register and unregister vmstate with AudioState Date: Fri, 31 Oct 2025 10:46:12 +0400 Message-ID: <20251031064631.134651-20-marcandre.lureau@redhat.com> In-Reply-To: <20251031064631.134651-1-marcandre.lureau@redhat.com> References: <20251031064631.134651-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: 1761893683042158500 From: Marc-Andr=C3=A9 Lureau Proper lifecycle management with QOM state. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- audio/audio.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/audio/audio.c b/audio/audio.c index 4c3c3fd52f..853930bb48 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.1 From nobody Fri Nov 14 17:01:14 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=1761893435; cv=none; d=zohomail.com; s=zohoarc; b=IcG+5jvie+B8Yci95hkBuyfexzRcRtMLLeCGR+GTXyk5cli/bkOMd1d6OG6ZLNCAxVLkytDmfLjEUym2E/0D+U8QeADNY+cKtcjZvxCeLZY7qfrRYo8WttpeknvuA/xjkNun8Mj5HSr93mZRkMLRRzkj1yCqNKmxewMgaYGqXmk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761893435; 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=c9CdRGuKExeDZPShNSwMLPmFlIR6mnQvawwk3qRtQwQ=; b=A0ya3xJf7D5o8L0WzNE1154yYPmjtirv9gSOn8YwVSoLbj7o0CZDnRObw4ERJy3ymbvoLPi3LKeekQaiYlwPauzWqyMlEynxC7s+MI97rNXbHUYzn2j8FlxSAgbYWbJWHINkmOi6bEvV8mLkcg8VpKseIIor6iSNuGHGaktsGw4= 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 1761893435832836.2602887438163; Thu, 30 Oct 2025 23:50:35 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vEiwu-0000L0-79; Fri, 31 Oct 2025 02:49: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 1vEiwW-000861-2i for qemu-devel@nongnu.org; Fri, 31 Oct 2025 02:49: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 1vEiwS-0003vX-Pi for qemu-devel@nongnu.org; Fri, 31 Oct 2025 02:48:59 -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-451-3e--rrLWPwey2waRcpDQMA-1; Fri, 31 Oct 2025 02:48:49 -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 63AEB1955DB5; Fri, 31 Oct 2025 06:48:48 +0000 (UTC) Received: from localhost (unknown [10.45.242.5]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 0CE161955BE3; Fri, 31 Oct 2025 06:48:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761893333; 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=c9CdRGuKExeDZPShNSwMLPmFlIR6mnQvawwk3qRtQwQ=; b=WsMuxD2a/6m6THA36sOeRInVOp0OSJJL1x8Qp2tELzl+a/pm3e/0XLezTLM/XoAyS9cRKC f7DPgbaDLWwJVJ8OTZIUoLld5L1NAB22kMQfUKr7AkJ6y2BAJO/5pBtG/OZRbWhfRICK1S So0NubvoxvTYc3MKXmcK7HLueGCPvoU= X-MC-Unique: 3e--rrLWPwey2waRcpDQMA-1 X-Mimecast-MFC-AGG-ID: 3e--rrLWPwey2waRcpDQMA_1761893328 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: richard.henderson@linaro.org, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Gerd Hoffmann Subject: [PULL 20/36] audio: initialize card_head during object init Date: Fri, 31 Oct 2025 10:46:13 +0400 Message-ID: <20251031064631.134651-21-marcandre.lureau@redhat.com> In-Reply-To: <20251031064631.134651-1-marcandre.lureau@redhat.com> References: <20251031064631.134651-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: 1761893440192158500 From: Marc-Andr=C3=A9 Lureau Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- audio/audio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/audio/audio.c b/audio/audio.c index 853930bb48..bdaee7855f 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.1 From nobody Fri Nov 14 17:01:14 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=1761893763; cv=none; d=zohomail.com; s=zohoarc; b=AS0HKy4bEDpsjxkrzTW3lN3p7l6RHbZxh/3kBHV1V+jtlM6rfSntDISFJLJJ6Hkj4q49NWT0HG+4rBd7ceEh4WLyuUTghx71Ma2fgdZH7wzRbjwdFIGaXXgj8apfAYxts1c+F/JDcbZ/kWUdq/GjweFdlA4rnQjRRrm0iEGA0R4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761893763; 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=R72p0c70eMIYXQ4hzvrSgO7xykqymOIaDelsQfgC+ls=; b=DpO4NmIh+lFt2/pTrWAu1Q6tMEIABY+OGs4XfD0U/150Vp45q9AUG9syEw6+HGqek3Es5NhVdTK62vaPc5pYBT3wbuTiLXbrbs6QcNYr8DePLh1Qc/Kz5vvrHeOIIpaJoqGUSOl1jJt7/BOtfktpQwhyVmCc5IYaIemb3fJaeus= 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 1761893763881224.4410503782401; Thu, 30 Oct 2025 23:56:03 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vEiwp-00006Q-Lm; Fri, 31 Oct 2025 02:49: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 1vEiwd-0008KR-Ki for qemu-devel@nongnu.org; Fri, 31 Oct 2025 02:49:09 -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 1vEiwX-0003vu-R2 for qemu-devel@nongnu.org; Fri, 31 Oct 2025 02:49:07 -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-688-a4b6ZEWaMIOVwObj2jnCwg-1; Fri, 31 Oct 2025 02:48:55 -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 658E71953965; Fri, 31 Oct 2025 06:48:54 +0000 (UTC) Received: from localhost (unknown [10.45.242.5]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id EF7631955BE3; Fri, 31 Oct 2025 06:48:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761893339; 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=R72p0c70eMIYXQ4hzvrSgO7xykqymOIaDelsQfgC+ls=; b=cv6TyxdR5EFfDQU6o5E29+6V+b1t6jPEUQ2XWYV4T2LUbRzNEGxIFz1QMzEgPH2n07Vyvc ZnuGshmpfjaWrRBk2DxDt+T2nyn9KZOCr14E9xqHJrUUc5eKdGUNGdk9pedu+7ba7VjUeT nvSGzkXZDJeKXaVmr9oJVRPptAxnl9U= X-MC-Unique: a4b6ZEWaMIOVwObj2jnCwg-1 X-Mimecast-MFC-AGG-ID: a4b6ZEWaMIOVwObj2jnCwg_1761893334 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: richard.henderson@linaro.org, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Gerd Hoffmann Subject: [PULL 21/36] audio: remove some needless headers Date: Fri, 31 Oct 2025 10:46:14 +0400 Message-ID: <20251031064631.134651-22-marcandre.lureau@redhat.com> In-Reply-To: <20251031064631.134651-1-marcandre.lureau@redhat.com> References: <20251031064631.134651-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, T_SPF_TEMPERROR=0.01 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: 1761893778097158500 From: Marc-Andr=C3=A9 Lureau Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- 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 bdaee7855f..f334030d96 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 d476e9b441..bd00c50e80 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.1 From nobody Fri Nov 14 17:01:14 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=1761893850; cv=none; d=zohomail.com; s=zohoarc; b=ga1XXfMMSQj9CQLWj/iTwqfalhph1JIvitzbxWT/j1Ccv/+16nnyINeTPM9xikiu5zWnFe8TyDZZvidAtsWVoI2BqykgO3eVpM6pwBoqw4TLPtwT0rPVTV6svXtqno6XzBx0oJmWwT4322hoWosiFiOQ6e7Cd1ROhrVATPlSIkw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761893850; 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=pAi6/TjfRTISHrBjXrRdIToAwhXS/+qZenv56liLF5o=; b=mneYClXc1iKJx1P0bbxVmJj55Aunjrk916r9kNameOhFb066/ijiHVWzk93hNd43UOJk0HXOpXELdiEGIAQNM/SKfStG2v1QlRLePn0Qvj6VYzdOnNErg0xkouU3A+P+0fzlx442/WlE/l/sRTNwWZiMBFKxOYu+/8O/dG4uA/I= 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 1761893850857723.1588487389897; Thu, 30 Oct 2025 23:57:30 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vEiwv-0000Oq-1i; Fri, 31 Oct 2025 02:49: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 1vEiwl-0008Tn-F5 for qemu-devel@nongnu.org; Fri, 31 Oct 2025 02:49: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 1vEiwd-0003xB-6z for qemu-devel@nongnu.org; Fri, 31 Oct 2025 02:49:13 -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-515-Bvp2UhtiMqumdIY6V_vHgw-1; Fri, 31 Oct 2025 02:49:01 -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 AB7041955D8E; Fri, 31 Oct 2025 06:49:00 +0000 (UTC) Received: from localhost (unknown [10.45.242.5]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 18F6C19560A2; Fri, 31 Oct 2025 06:48:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761893344; 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=pAi6/TjfRTISHrBjXrRdIToAwhXS/+qZenv56liLF5o=; b=DxIn+8wcPYgtXdsHC6cpDQShevEctGOwMqy3kEdRAH7AkK5Yx9frQsf94/DgUXtWxg3nL1 Ym5xOL9XKN4rxMNLwyRCCg5XoQTDiKhVfHyFU5UpID1AL4qFbjYVAkqIsZ0kpqiudAOP4T RnwV1xTGr/Dkl3w5NNTOrmUoQX7OXo8= X-MC-Unique: Bvp2UhtiMqumdIY6V_vHgw-1 X-Mimecast-MFC-AGG-ID: Bvp2UhtiMqumdIY6V_vHgw_1761893340 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: richard.henderson@linaro.org, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Gerd Hoffmann , Laurent Vivier Subject: [PULL 22/36] audio: remove AUDIO_HOST_ENDIANNESS Date: Fri, 31 Oct 2025 10:46:15 +0400 Message-ID: <20251031064631.134651-23-marcandre.lureau@redhat.com> In-Reply-To: <20251031064631.134651-1-marcandre.lureau@redhat.com> References: <20251031064631.134651-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_PASS=-0.001, T_SPF_HELO_TEMPERROR=0.01 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: 1761893853674154100 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 f334030d96..18bc9188db 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 6aae365f47..45c0a458f2 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 3b80a61378..0a5d614f8b 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 45ea04bf89..d13a95eb5a 100644 --- a/hw/audio/gus.c +++ b/hw/audio/gus.c @@ -255,7 +255,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.1 From nobody Fri Nov 14 17:01:14 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=1761893389; cv=none; d=zohomail.com; s=zohoarc; b=F5oobYHdJPcml32Dx+Bie1C1ADkkHOglteNIDyKJiAGckGl5Upa7WTSUiTGYeg827gPRRtAXQi9k4JTMuRMuYZWjL8ANdRtlQSjDzAqoSjv/utkviuLKupvWsYibYZC0r/1hYYg3vWYaSom8igBJBS6LsXP5crRfgXyMOgrpGqE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761893389; 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=BbcjwYUzdo/9wvqYfOowpJlCwXjvUjVjrsTbK4qbdnM=; b=WttaumNX1X04yv/WbrPb7aQrSFjCcObRHRDvFlGKRG86uwj1a/c6Tq7yFKjt7EWXYHoNsKpXCnTRWlEwQYsrpY5tPIfBBMLzMAC2wCrO9Vz5tJx6ffaBfLP+gfl6l0CjrDFVmN7EYBt6y4y8dSY4rht//OtvCR2Gf4PEBkXkxFs= 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 1761893389795440.7073958530267; Thu, 30 Oct 2025 23:49:49 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vEiww-0000Z9-NC; Fri, 31 Oct 2025 02:49: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 1vEiwr-0000MN-Tr for qemu-devel@nongnu.org; Fri, 31 Oct 2025 02:49:22 -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 1vEiwj-0003yU-U7 for qemu-devel@nongnu.org; Fri, 31 Oct 2025 02:49:21 -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-340-BsneB1qjMcaLoA0y8Ape_w-1; Fri, 31 Oct 2025 02:49:08 -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 A71D11953977; Fri, 31 Oct 2025 06:49:06 +0000 (UTC) Received: from localhost (unknown [10.45.242.5]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 2B8751955BE3; Fri, 31 Oct 2025 06:49:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761893351; 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=BbcjwYUzdo/9wvqYfOowpJlCwXjvUjVjrsTbK4qbdnM=; b=AEK4Qu97dbeQ2gvdtXDl9ISAXfaguVunTxLJx98nd6YilUeoVinzf3+IWDWGl77SWgalag cNkj7ZWxj/pVgZKW+T+aw2WgMbTSPkX8dMrtYsVbXB3KInybjev4hfj+oI8hFbRFSATVvq HaNsSfBPdEWrmlELnWYh4lBFW3kIkFQ= X-MC-Unique: BsneB1qjMcaLoA0y8Ape_w-1 X-Mimecast-MFC-AGG-ID: BsneB1qjMcaLoA0y8Ape_w_1761893346 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: richard.henderson@linaro.org, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Gerd Hoffmann , Laurent Vivier , "Michael S. Tsirkin" , Manos Pitsidianakis , Alistair Francis , "Edgar E. Iglesias" , Peter Maydell , qemu-arm@nongnu.org (open list:Xilinx ZynqMP and...) Subject: [PULL 23/36] audio: introduce AUD_set_volume_{in,out}_lr() Date: Fri, 31 Oct 2025 10:46:16 +0400 Message-ID: <20251031064631.134651-24-marcandre.lureau@redhat.com> In-Reply-To: <20251031064631.134651-1-marcandre.lureau@redhat.com> References: <20251031064631.134651-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=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: 1761893401517158500 From: Marc-Andr=C3=A9 Lureau There are 2 sets of functions since the introduction of multi-channel Volume structure: AUD_set_volume_{in,out} and audio_set_volume_{in,out}. Use the AUD_ prefix for consistency with other audio.c functions. Rename the stereo function with "_lr" suffix. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- audio/audio.h | 21 ++++++++++++++++----- 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, 36 insertions(+), 37 deletions(-) diff --git a/audio/audio.h b/audio/audio.h index 0af911fd9a..c8515afcd2 100644 --- a/audio/audio.h +++ b/audio/audio.h @@ -119,9 +119,6 @@ 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 AUDIO_MAX_CHANNELS 16 typedef struct Volume { bool mute; @@ -129,8 +126,22 @@ 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); + +static inline void +AUD_set_volume_out_lr(SWVoiceOut *sw, bool mut, uint8_t lvol, uint8_t rvol= ) { + AUD_set_volume_out(sw, &(Volume) { + .mute =3D mut, .channels =3D 2, .vol =3D { lvol, rvol } + }); +} + +static inline void +AUD_set_volume_in_lr(SWVoiceIn *sw, bool mut, uint8_t lvol, uint8_t rvol) { + AUD_set_volume_in(sw, &(Volume) { + .mute =3D mut, .channels =3D 2, .vol =3D { lvol, rvol } + }); +} =20 SWVoiceIn *AUD_open_in ( QEMUSoundCard *card, diff --git a/audio/audio.c b/audio/audio.c index 18bc9188db..8723f4e66e 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 6b9013ebb8..c3e5f9c8bb 100644 --- a/hw/audio/ac97.c +++ b/hw/audio/ac97.c @@ -416,7 +416,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) @@ -427,7 +427,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.1 From nobody Fri Nov 14 17:01:14 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=1761893394; cv=none; d=zohomail.com; s=zohoarc; b=RcEYpgZiEsSdwPHNuUUY+MGVo5NwWTzV4D6JihRJEHrbhm3QJlJfYJZRTewrMi++3M0o8UHX0icEwuyH77WLu1pDm6cxYzZ0MLVqK+eXKzutjRhgd5iIq0XA3RFBCGNH1Ed3Q09ZJwSXJBO2fR1ilJEP0o0qoIrheLem8cPRSQk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761893394; 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=gCdbWtFZihkKTavziLION6J9g9AlNulwWzLZIQa6r7E=; b=CPVLUFQtB0H/btHG4kczX4lrtMqoCwq9d6RMbBVI6Qnotfc0Ky6W/3GaSjTN5bqogeQP9rG3TR1LipUQDmkwTeu8X+vp7gUWEV8PwQMWRisYpHx7hsC235iOMLv7ahzqmYEW5nRgVBFnaQg9C2lCeYnyQHZINKRNLp2/APOe+xg= 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 1761893394313773.7723271363516; Thu, 30 Oct 2025 23:49:54 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vEix2-0001IR-SU; Fri, 31 Oct 2025 02:49: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 1vEiwz-00013J-AP for qemu-devel@nongnu.org; Fri, 31 Oct 2025 02:49:29 -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 1vEiwq-0003zU-88 for qemu-devel@nongnu.org; Fri, 31 Oct 2025 02:49:29 -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-132-ghaq61aaMrCmrByp8AbmVg-1; Fri, 31 Oct 2025 02:49:13 -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 AF3C41955DD1; Fri, 31 Oct 2025 06:49:12 +0000 (UTC) Received: from localhost (unknown [10.45.242.5]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 3F8E630001A1; Fri, 31 Oct 2025 06:49:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761893355; 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=gCdbWtFZihkKTavziLION6J9g9AlNulwWzLZIQa6r7E=; b=gRAbkNlNZ0/lbnHGjD1f2eeuKSNRQv29ECdvu3SkkFsx1FPMyX8ARSTrttze7NoVu41HMx necP9YfofcLGW2HQdn4sVUBlp0YkILH5v2mfTclq9doM12bvVZ/Ys4z4ArXhmKro9XF6Wk YCseIlg5JlRAWtKZeGsmP40hzJ4GPTc= X-MC-Unique: ghaq61aaMrCmrByp8AbmVg-1 X-Mimecast-MFC-AGG-ID: ghaq61aaMrCmrByp8AbmVg_1761893352 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: richard.henderson@linaro.org, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Gerd Hoffmann , Paolo Bonzini , =?UTF-8?q?Alex=20Benn=C3=A9e?= Subject: [PULL 24/36] audio/replay: fix type punning Date: Fri, 31 Oct 2025 10:46:17 +0400 Message-ID: <20251031064631.134651-25-marcandre.lureau@redhat.com> In-Reply-To: <20251031064631.134651-1-marcandre.lureau@redhat.com> References: <20251031064631.134651-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: 1761893405609158500 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/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 c8515afcd2..61ff900b7e 100644 --- a/audio/audio.h +++ b/audio/audio.h @@ -171,9 +171,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.1 From nobody Fri Nov 14 17:01:14 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=1761893768; cv=none; d=zohomail.com; s=zohoarc; b=HygjbYtUhpeuj6CgW4IEA8VQFDnMYuiul/od2CK2+Msd200Dw3ldsmAyaHVvpDU41I1OVeidxX+W57tUkGDGJVctN3yzSYGsqUkv9UpthG+9NmsZOEz4P0PYbIBZL4Qhh2qcJJU5aVFjeS5iNYPAXsSCWzBsH+wiulwhTH0pdNM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761893768; 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=ER8FInLgJwwuEfcx8+sVr34uHL4RXo6OAK5qRewMmp8=; b=DXCi/y03/14/lOSiqwzVKAWJfig2p7beCqStubEDSV6sF7e8P7MsGlCLvol9JCJEDOcBUbx9bFAp0fRxjVTaLmIgfRCj96+/xI9+/5GTblcxhWfhnAbkDKcfAXpfeckC6L3nZCXZJYUX1w60mLcY8gss3YiATlgyWMdOS7XelV8= 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 1761893768868318.0915424454365; Thu, 30 Oct 2025 23:56:08 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vEix8-0001iC-F1; Fri, 31 Oct 2025 02:49:38 -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 1vEix5-0001aR-7l for qemu-devel@nongnu.org; Fri, 31 Oct 2025 02:49:35 -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 1vEiwv-00040x-7o for qemu-devel@nongnu.org; Fri, 31 Oct 2025 02:49:34 -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-73-Vhb2VL6qNbWRbpy1CI1hgw-1; Fri, 31 Oct 2025 02:49:19 -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 A54C01834587; Fri, 31 Oct 2025 06:49:18 +0000 (UTC) Received: from localhost (unknown [10.45.242.5]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 3FC721955BE3; Fri, 31 Oct 2025 06:49:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761893363; 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=ER8FInLgJwwuEfcx8+sVr34uHL4RXo6OAK5qRewMmp8=; b=YachnOC+0EG1YulLCBMssHgLyqxU9+frDIcBSBkP0xI40cWV9CiAyfY8TQQTZ/18BVSxwi rHPOCB6SyBahf3fpOaU8fkhtjbiGNyjwcln/lxoexa+M24txWscxXta9Era0kUSkb8WE+o C6oEkQvX5yDdnAPP4Uw/oAPnOV2zBus= X-MC-Unique: Vhb2VL6qNbWRbpy1CI1hgw-1 X-Mimecast-MFC-AGG-ID: Vhb2VL6qNbWRbpy1CI1hgw_1761893358 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: richard.henderson@linaro.org, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Gerd Hoffmann Subject: [PULL 25/36] audio: move internal APIs to audio_int.h Date: Fri, 31 Oct 2025 10:46:18 +0400 Message-ID: <20251031064631.134651-26-marcandre.lureau@redhat.com> In-Reply-To: <20251031064631.134651-1-marcandre.lureau@redhat.com> References: <20251031064631.134651-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, T_SPF_TEMPERROR=0.01 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: 1761893771978158500 From: Marc-Andr=C3=A9 Lureau Fix some check-patch issues while at it. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- audio/audio.h | 21 --------------------- audio/audio_int.h | 24 ++++++++++++++++++++++++ audio/audio-hmp-cmds.c | 2 +- audio/wavcapture.c | 2 +- 4 files changed, 26 insertions(+), 23 deletions(-) diff --git a/audio/audio.h b/audio/audio.h index 61ff900b7e..c0cad7d976 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( @@ -160,15 +148,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..d1badbf235 100644 --- a/audio/audio_int.h +++ b/audio/audio_int.h @@ -29,12 +29,19 @@ #define FLOAT_MIXENG /* #define RECIPROCAL */ #endif +#include "audio.h" #include "mixeng.h" =20 #ifdef CONFIG_GIO #include #endif =20 +void G_GNUC_PRINTF(2, 0) +AUD_vlog(const char *cap, const char *fmt, va_list ap); + +void G_GNUC_PRINTF(2, 3) +AUD_log(const char *cap, const char *fmt, ...); + struct audio_pcm_ops; =20 struct audio_callback { @@ -187,6 +194,23 @@ 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, size_t incr) +{ + return (uint8_t *)p + 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.1 From nobody Fri Nov 14 17:01:14 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=1761893675; cv=none; d=zohomail.com; s=zohoarc; b=B7RZVxqcETEKMrQDUBbjuqvEbgvL9mK9i4mjWtK16nLRA9KWdNvHO3YTtK3Jn5twRt02IFaWmr7ICddHsS8ukrkKJattxSc76ezFW2/ipYiojCVprtC1qGpRDW9f6CyEMEOgfv7gP+5QQD0ZPt3t5xIcufx/lEPuQiCK/tPMb4U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761893675; 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=tVfcrKntbees8E8JS94mROvCUbutFz5W+MwtI4yRgHI=; b=nTz7wizwek0iutqxI812KTXn3dMYWSgDLG3s8xzoitGQlPEJfwir7xAw9UUhXddK433z2mBYIkXeq5jjbsFHl8QLnB7nbmHLOtFFCfYZ8CxtB2/irbTH7u6a68NebuBGOMhlwvwDq/qmlgGhY8OMLxzYydRtNzjEC0oBNPv1GJg= 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 1761893675921387.49908189691166; Thu, 30 Oct 2025 23:54:35 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vEixD-00026i-9y; Fri, 31 Oct 2025 02:49:43 -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 1vEixA-00022k-U9 for qemu-devel@nongnu.org; Fri, 31 Oct 2025 02:49:40 -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 1vEix6-00043J-G2 for qemu-devel@nongnu.org; Fri, 31 Oct 2025 02:49:40 -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-102-drn4l-TiNuK7uSiPVRccUQ-1; Fri, 31 Oct 2025 02:49: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-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 09B02195DB9A; Fri, 31 Oct 2025 06:49:25 +0000 (UTC) Received: from localhost (unknown [10.45.242.5]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 3124F30001A1; Fri, 31 Oct 2025 06:49:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761893370; 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=tVfcrKntbees8E8JS94mROvCUbutFz5W+MwtI4yRgHI=; b=H4UFO9cnehJyeSWVEUJIakpkirHfJoGyyCNnTus+IvLeIaAKZ/vivVPDHFR1DJky0SK2Ak XJne4CgIyyAudWW2Zq4KgR/M8Gkl9nFMNU9NHqbssZWwSibyvea7Btn1/5vKYJX+SGtQkW N4IjMtrlWzt5QqfIDqPVgZDcGPiMP3c= X-MC-Unique: drn4l-TiNuK7uSiPVRccUQ-1 X-Mimecast-MFC-AGG-ID: drn4l-TiNuK7uSiPVRccUQ_1761893365 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: richard.henderson@linaro.org, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Gerd Hoffmann , Christian Schoenebeck , Eduardo Habkost , Marcel Apfelbaum , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Yanan Wang , Zhao Liu , Paolo Bonzini , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Subject: [PULL 26/36] audio: rename AudioState -> AudioBackend Date: Fri, 31 Oct 2025 10:46:19 +0400 Message-ID: <20251031064631.134651-27-marcandre.lureau@redhat.com> In-Reply-To: <20251031064631.134651-1-marcandre.lureau@redhat.com> References: <20251031064631.134651-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: 1761893677744154100 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 Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- 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 c0cad7d976..1d56f111ea 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 @@ -164,14 +164,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 d1badbf235..338af38fd1 100644 --- a/audio/audio_int.h +++ b/audio/audio_int.h @@ -60,7 +60,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 { @@ -69,7 +69,7 @@ typedef struct STSampleBuffer { } STSampleBuffer; =20 typedef struct HWVoiceOut { - AudioState *s; + AudioBackend *s; int enabled; int poll_mode; int pending_disable; @@ -90,7 +90,7 @@ typedef struct HWVoiceOut { } HWVoiceOut; =20 typedef struct HWVoiceIn { - AudioState *s; + AudioBackend *s; int enabled; int poll_mode; struct audio_pcm_info info; @@ -112,7 +112,7 @@ typedef struct HWVoiceIn { =20 struct SWVoiceOut { QEMUSoundCard *card; - AudioState *s; + AudioBackend *s; struct audio_pcm_info info; t_sample *conv; STSampleBuffer resample_buf; @@ -129,7 +129,7 @@ struct SWVoiceOut { =20 struct SWVoiceIn { QEMUSoundCard *card; - AudioState *s; + AudioBackend *s; int active; struct audio_pcm_info info; void *rate; @@ -150,7 +150,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 *man= ager, bool p2p); #endif struct audio_pcm_ops *pcm_ops; int max_voices_out; @@ -208,7 +208,7 @@ static inline void *advance(void *p, size_t incr) return (uint8_t *)p + 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); @@ -240,7 +240,7 @@ struct SWVoiceCap { QLIST_ENTRY (SWVoiceCap) entries; }; =20 -typedef struct AudioState { +typedef struct AudioBackend { Object parent; =20 struct audio_driver *drv; @@ -260,7 +260,7 @@ typedef struct AudioState { bool timer_running; uint64_t timer_last; VMChangeStateEntry *vmse; -} AudioState; +} AudioBackend; =20 extern const struct mixeng_volume nominal_volume; =20 @@ -273,7 +273,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 8723f4e66e..8044d55c5c 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 drivers 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 48ef830292..e0b0949918 100644 --- a/hw/audio/pcspk.c +++ b/hw/audio/pcspk.c @@ -196,7 +196,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 cd63803000..28d2833c5d 100644 --- a/hw/core/machine.c +++ b/hw/core/machine.c @@ -760,7 +760,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 13cc91680b..4d815684d1 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.1 From nobody Fri Nov 14 17:01:14 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=1761893536; cv=none; d=zohomail.com; s=zohoarc; b=UdhYk10VL3Y/i+CkE23gHuDucGVuM/zSaIHfNluj6MFFSZJAtonNeXovSInHyKmvbB7OIew60lL0XgfW5/VYio+Ao16S+uLDMURk0IK+Xo1JyPHDJJPs/QC1j2inMhQ6dcSivEkGU1KCaKnc8Ep/NZCmVR+Fur3flRQwn9hGN/8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761893536; 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=0h5rYrERYSNQzBvuQsBy7ep2J+3DgaCLpBCNfPjDZfI=; b=IY/iOrs7jObKIQFZx+QZ+1I4QLMWSqa7fuxrfOri7PAXazPmQ16wMbYb3AlfVFwRlcxsMHY7/yiVx3CrXNe+gOrixZ9HQg4bHmi4XgQAAAYDxTEy6T1VYTTvJBh5qy4VyPvFPmuuUw0tA3bZrPLZO3tf94oQebwaPCpWYN5WA8k= 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 1761893536746721.2980433503857; Thu, 30 Oct 2025 23:52:16 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vEixS-0002Xs-9d; Fri, 31 Oct 2025 02:49:58 -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 1vEixQ-0002Wd-MQ for qemu-devel@nongnu.org; Fri, 31 Oct 2025 02:49:56 -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 1vEixD-00043x-Hv for qemu-devel@nongnu.org; Fri, 31 Oct 2025 02:49: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-647-Lvmyy950OYKp2cvsn78OTQ-1; Fri, 31 Oct 2025 02:49:34 -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 C4D191834519; Fri, 31 Oct 2025 06:49:32 +0000 (UTC) Received: from localhost (unknown [10.45.242.5]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id EA15130001A1; Fri, 31 Oct 2025 06:49:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761893379; 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=0h5rYrERYSNQzBvuQsBy7ep2J+3DgaCLpBCNfPjDZfI=; b=Q9Jl5MvBjxlk2R5HLdhps3CvD4BZQWwQQqXnyHVooo1QQQyUK+1sQc7CN1q9NV5CFG5Zlt wijaRoAChikQGLZdhtY7kcqme5oE4hc4nCfQkE8UKSSnQTzm67tqkE0ke31EF8oatFBq+b 7umYRU7G7KItkFXZTWmD1LqbsaOM9K0= X-MC-Unique: Lvmyy950OYKp2cvsn78OTQ-1 X-Mimecast-MFC-AGG-ID: Lvmyy950OYKp2cvsn78OTQ_1761893373 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: richard.henderson@linaro.org, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Gerd Hoffmann , Laurent Vivier , Manos Pitsidianakis , "Michael S. Tsirkin" , Paolo Bonzini , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Eduardo Habkost , Alistair Francis , "Edgar E. Iglesias" , Peter Maydell , BALATON Zoltan , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Jiaxun Yang , qemu-arm@nongnu.org (open list:Xilinx ZynqMP and...) Subject: [PULL 27/36] audio: remove QEMUSoundCard Date: Fri, 31 Oct 2025 10:46:20 +0400 Message-ID: <20251031064631.134651-28-marcandre.lureau@redhat.com> In-Reply-To: <20251031064631.134651-1-marcandre.lureau@redhat.com> References: <20251031064631.134651-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=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: 1761893545665158500 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 Suggested-by: Paolo Bonzini Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- audio/audio.h | 21 ++++++++------------- 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, 131 insertions(+), 162 deletions(-) diff --git a/audio/audio.h b/audio/audio.h index 1d56f111ea..0a016bdabc 100644 --- a/audio/audio.h +++ b/audio/audio.h @@ -69,18 +69,13 @@ 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 +85,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 +93,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); @@ -131,8 +126,8 @@ AUD_set_volume_in_lr(SWVoiceIn *sw, bool mut, uint8_t l= vol, uint8_t rvol) { }); } =20 -SWVoiceIn *AUD_open_in ( - QEMUSoundCard *card, +SWVoiceIn *AUD_open_in( + AudioBackend *be, SWVoiceIn *sw, const char *name, void *callback_opaque, @@ -140,7 +135,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); @@ -166,7 +161,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 338af38fd1..c4453b3a29 100644 --- a/audio/audio_int.h +++ b/audio/audio_int.h @@ -111,7 +111,6 @@ typedef struct HWVoiceIn { } HWVoiceIn; =20 struct SWVoiceOut { - QEMUSoundCard *card; AudioBackend *s; struct audio_pcm_info info; t_sample *conv; @@ -128,7 +127,6 @@ struct SWVoiceOut { }; =20 struct SWVoiceIn { - QEMUSoundCard *card; AudioBackend *s; int active; struct audio_pcm_info info; @@ -248,7 +246,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..d621008f38 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 5c6cc5eae8..45687be005 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 8044d55c5c..d9a5695eb8 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 c3e5f9c8bb..a91bf52b95 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; @@ -320,7 +320,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, @@ -331,7 +331,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, @@ -342,7 +342,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, @@ -355,17 +355,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; } @@ -1275,7 +1275,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 @@ -1320,14 +1320,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 45c0a458f2..4e6c80b8e0 100644 --- a/hw/audio/adlib.c +++ b/hw/audio/adlib.c @@ -57,7 +57,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]; @@ -240,7 +240,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 { @@ -255,7 +254,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 @@ -275,7 +274,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, @@ -298,7 +297,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 0a5d614f8b..ec9643b817 100644 --- a/hw/audio/cs4231a.c +++ b/hw/audio/cs4231a.c @@ -69,7 +69,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]; @@ -328,7 +328,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, @@ -678,7 +678,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 @@ -694,7 +694,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 721c02be0a..0628f03310 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 d13a95eb5a..d253329021 100644 --- a/hw/audio/gus.c +++ b/hw/audio/gus.c @@ -49,7 +49,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; @@ -242,7 +242,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 @@ -258,7 +258,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, @@ -267,7 +267,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; } @@ -292,7 +291,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 e0b0949918..a41f5b11f0 100644 --- a/hw/audio/pcspk.c +++ b/hw/audio/pcspk.c @@ -49,7 +49,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; @@ -123,7 +123,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; @@ -196,8 +196,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 @@ -221,7 +222,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 e86aafd488..8109d124d1 100644 --- a/hw/audio/sb16.c +++ b/hw/audio/sb16.c @@ -54,7 +54,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; @@ -216,7 +216,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, @@ -379,7 +379,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, @@ -880,7 +880,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, @@ -1287,7 +1287,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 @@ -1303,7 +1303,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, @@ -1401,7 +1401,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 @@ -1440,7 +1440,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 4d815684d1..24c835c5f4 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.1 From nobody Fri Nov 14 17:01:14 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=1761893540; cv=none; d=zohomail.com; s=zohoarc; b=ecGsOcNE6Lb1Nyrp90ioZvMILYiQc1GxGidVdrPKLRivh/VNT5n25sEvaYeHqs2boGZXo8c37QzGbhL6isFTntzBxQRhTCRO/qax/9/ISIBkDNn11CpFaBb3PljhiKKm5NBG9vxUpDjz0dUAUVrE7+6R+XuPmCAmMzWkjbK8fJk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761893540; 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=3vcN7c2q7ApEIuezAycDq9xRQa4lV6TBvMpmZRZ04JE=; b=kWHmdHQiSbvFi+Hkuud7i1RgxtODGX6EwVdMfyTlMNVsdM/qRGfDp9bY4GFRRyXqsMA/mq41HbiwUG1AZO2Ku9GmuRV41PhD/JIMELeaKgmxHkdGj5jf1WbaLlTPR6QB7eP5m43bHAk5hVdym3z+SzL22TNL4PYT4qE1Iu+bsvM= 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 1761893540041163.59823487071571; Thu, 30 Oct 2025 23:52:20 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vEixK-0002QJ-Bf; Fri, 31 Oct 2025 02:49:50 -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 1vEixJ-0002PZ-LJ for qemu-devel@nongnu.org; Fri, 31 Oct 2025 02:49: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 1vEixD-00044K-8H for qemu-devel@nongnu.org; Fri, 31 Oct 2025 02:49:49 -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-633-VOH_7-ToMoW4PieoOAdPAg-1; Fri, 31 Oct 2025 02:49:39 -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 8EB881955DB5; Fri, 31 Oct 2025 06:49:38 +0000 (UTC) Received: from localhost (unknown [10.45.242.5]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 2BC60180035A; Fri, 31 Oct 2025 06:49:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761893382; 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=3vcN7c2q7ApEIuezAycDq9xRQa4lV6TBvMpmZRZ04JE=; b=CACT38tYHCKEBOfmK79AHs86kQziizb5B5GvdGgC1Jy+1Ef8kyhV0vfz7QtFM7uq72GOTN dVisaVO/inIET6LKavfV/npzLXVmOaM4+LDEfTT6Jwjt/9WOaQCApGfASsIKa/6zUlBYDo Ei1kq5fya8L0N/WbRsT1/AkVILKnlLA= X-MC-Unique: VOH_7-ToMoW4PieoOAdPAg-1 X-Mimecast-MFC-AGG-ID: VOH_7-ToMoW4PieoOAdPAg_1761893378 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: richard.henderson@linaro.org, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Gerd Hoffmann Subject: [PULL 28/36] audio/dbus: use a helper function to set the backend dbus server Date: Fri, 31 Oct 2025 10:46:21 +0400 Message-ID: <20251031064631.134651-29-marcandre.lureau@redhat.com> In-Reply-To: <20251031064631.134651-1-marcandre.lureau@redhat.com> References: <20251031064631.134651-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: 1761893547412158500 From: Marc-Andr=C3=A9 Lureau Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- audio/audio.h | 9 +++++++++ audio/audio_int.h | 5 ++++- audio/audio.c | 17 +++++++++++++++++ audio/dbusaudio.c | 9 +++++++-- ui/dbus.c | 8 +------- 5 files changed, 38 insertions(+), 10 deletions(-) diff --git a/audio/audio.h b/audio/audio.h index 0a016bdabc..08753f621a 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 @@ -162,6 +165,12 @@ 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 c4453b3a29..d66f7aac32 100644 --- a/audio/audio_int.h +++ b/audio/audio_int.h @@ -148,7 +148,10 @@ struct audio_driver { void *(*init) (Audiodev *, Error **); void (*fini) (void *); #ifdef CONFIG_GIO - void (*set_dbus_server)(AudioBackend *s, GDBusObjectManagerServer *man= ager, bool p2p); + bool (*set_dbus_server)(AudioBackend *be, + GDBusObjectManagerServer *manager, + 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 d9a5695eb8..3229829bef 100644 --- a/audio/audio.c +++ b/audio/audio.c @@ -2223,6 +2223,23 @@ 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..c97c34b486 100644 --- a/audio/dbusaudio.c +++ b/audio/dbusaudio.c @@ -645,8 +645,11 @@ 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, + bool p2p, + Error **errp) { DBusAudio *da =3D s->drv_opaque; =20 @@ -669,6 +672,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.1 From nobody Fri Nov 14 17:01:14 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=1761893665; cv=none; d=zohomail.com; s=zohoarc; b=bzqfD3snK8gJhmwIfSYJRXyPCdbZTSMDlgtQsAfBltrJRCXj4ChOMvGDmDaDhF6r7OijHlUjYPCPy3dE8BslIE6pOOiqtbULFQLtfYrSCj1jOFQkaeWjtXnwZ2o2il6fpAUKCVVgH2KhegVRbWvjPM50ly0c5Vx12l802Oyw+1U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761893665; 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=OdSfypjLASQ4ra3y3UmVNHG81+R+supeaLW+PWv5kmo=; b=TFfd2FMMg2oHExr34qjE4a10e1PYSTKqD2w4k7L6MY3SqwzLoWN9ao4BknoENvkEf2XO5U9HGrKasEsIkwYd1QXVeDbqsOnZEQTSseo2UAtt+jCxdxPdn7+S+MQL16DguRRFoTongL+mrhsCSY3MkwsbLBK7MFEte+u3eRrlYbM= 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 1761893665523148.42059975737857; Thu, 30 Oct 2025 23:54:25 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vEixY-0002Zv-EX; Fri, 31 Oct 2025 02:50: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 1vEixU-0002Yr-M8 for qemu-devel@nongnu.org; Fri, 31 Oct 2025 02:50: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 1vEixR-00045g-2b for qemu-devel@nongnu.org; Fri, 31 Oct 2025 02:50:00 -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-319-FbNGQd2NNoinry0XfH8AOQ-1; Fri, 31 Oct 2025 02:49:52 -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-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id CA5B71955DA5; Fri, 31 Oct 2025 06:49:47 +0000 (UTC) Received: from localhost (unknown [10.45.242.5]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id A613018002AD; Fri, 31 Oct 2025 06:49:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761893395; 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=OdSfypjLASQ4ra3y3UmVNHG81+R+supeaLW+PWv5kmo=; b=FiABnNPmkpFZbVUQMpc0bhdIAqUckcvuS7o9HreYHrvEud+N9k25Ca/XFYnlqXkNyLnccO lNb7SdlJjVJcFlK9/3woorJn8pb4VfbB/T59f5RWlzdvyLfKDWuOn76iejFj14Q5+Ywts7 IjuH8ypP4QtWymovVPOnZJdXEwOUxH8= X-MC-Unique: FbNGQd2NNoinry0XfH8AOQ-1 X-Mimecast-MFC-AGG-ID: FbNGQd2NNoinry0XfH8AOQ_1761893389 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: richard.henderson@linaro.org, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Gerd Hoffmann , Christian Schoenebeck , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , 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 , Paolo Bonzini , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , =?UTF-8?q?Herv=C3=A9=20Poussineau?= , Manos Pitsidianakis , BALATON Zoltan , 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: [PULL 29/36] audio: move audio.h under include/qemu/ Date: Fri, 31 Oct 2025 10:46:22 +0400 Message-ID: <20251031064631.134651-30-marcandre.lureau@redhat.com> In-Reply-To: <20251031064631.134651-1-marcandre.lureau@redhat.com> References: <20251031064631.134651-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: 1761893668156154100 From: Marc-Andr=C3=A9 Lureau Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Akihiko Odaki --- MAINTAINERS | 1 + 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 +- 53 files changed, 52 insertions(+), 52 deletions(-) rename {audio =3D> include/qemu}/audio.h (100%) diff --git a/MAINTAINERS b/MAINTAINERS index 64491c800c..24323e8800 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -2977,6 +2977,7 @@ X: audio/paaudio.c X: audio/sdlaudio.c X: audio/sndioaudio.c X: audio/spiceaudio.c +F: include/qemu/audio.h F: qapi/audio.json =20 ALSA Audio backend diff --git a/audio/audio_int.h b/audio/audio_int.h index d66f7aac32..8d4f4ca8fc 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 3229829bef..19499abe16 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 c97c34b486..157d36428e 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 bd00c50e80..8b773ded21 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 60cd375fe7..d26a07f0f5 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 a91bf52b95..be7a39377f 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 4e6c80b8e0..19d3a5f128 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 ec9643b817..98fdbc5b72 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 0628f03310..9873ffadab 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 d253329021..68f89e994c 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 a41f5b11f0..916c56fa4c 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 8109d124d1..1e3c4caf5e 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 28d2833c5d..0580550e12 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 24c835c5f4..7aa5cbb510 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 c2fe16e985..5654a60c59 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 dc2ea4c298..29f5389151 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.1 From nobody Fri Nov 14 17:01:14 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=1761893482; cv=none; d=zohomail.com; s=zohoarc; b=FoEBs7ClhgPSgTvioeoBk9YDqjLqCV7VsBGSJN9Wc6TLhzhARQLHoLSpA/y55lk6cESiKuii75SgTSM+/hxcMQtcG9sNrbRFPjhbV3pQXfjbc18B57xryWscIHaV1GGLutpztryyHyG6yS88BY+eaIBrOojqyuGuCuIE6ZLGiBE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761893482; 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=6voCrehLVi4uJA2s5XuT+BZuSVtGXnV9/bbKQ1MFxM0=; b=OXVLlIzI5aAexZHmlpt2qoLAAD0JTsp7lcZkLichv9ZxCsEc1OI0dfVcx+1oAwEE0LHyMtkCTp9qkJWeiM+9revnq+uLHDJ1s5jJ9FsDfmH3G4Yx+NsgkrB5hIEkXZK6NUCprzySQtCt7J4D6TQsxNVttmDBwQV4kIFQJzGpuMA= 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 1761893482297702.4095438300656; Thu, 30 Oct 2025 23:51:22 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vEixn-0002yj-Qd; Fri, 31 Oct 2025 02:50:20 -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 1vEixa-0002g5-QK for qemu-devel@nongnu.org; Fri, 31 Oct 2025 02:50:08 -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 1vEixT-000466-Ma for qemu-devel@nongnu.org; Fri, 31 Oct 2025 02:50:06 -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-251-23O7uwjAPiaj6ZKHEEXWBg-1; Fri, 31 Oct 2025 02:49:54 -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 0C2F81834580; Fri, 31 Oct 2025 06:49:54 +0000 (UTC) Received: from localhost (unknown [10.45.242.5]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id A90B51955BE3; Fri, 31 Oct 2025 06:49:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761893398; 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=6voCrehLVi4uJA2s5XuT+BZuSVtGXnV9/bbKQ1MFxM0=; b=TwGV9PpALf21Wf4VlTmvZECPHIyumBR1xChORWA8+bVes0oGfDI4wLVDncOTm72GD75Eis BSzi3LbWfZ70w7/rfCqaqAOywwsAqOZoPj8qefsdJ4uiyBpGF6mfwc/GyN/X7+aMMu1WLe u/vBl9av25I62ZqqoiphKidGWl+elQM= X-MC-Unique: 23O7uwjAPiaj6ZKHEEXWBg-1 X-Mimecast-MFC-AGG-ID: 23O7uwjAPiaj6ZKHEEXWBg_1761893394 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: richard.henderson@linaro.org, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Gerd Hoffmann Subject: [PULL 30/36] audio: remove dependency on spice header Date: Fri, 31 Oct 2025 10:46:23 +0400 Message-ID: <20251031064631.134651-31-marcandre.lureau@redhat.com> In-Reply-To: <20251031064631.134651-1-marcandre.lureau@redhat.com> References: <20251031064631.134651-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_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: 1761893484669158500 From: Marc-Andr=C3=A9 Lureau It is no longer required. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- 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.1 From nobody Fri Nov 14 17:01:14 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=1761893682; cv=none; d=zohomail.com; s=zohoarc; b=W0Z0n1RYl3DKcD4YESsn9gxrm5VEZmJXKbkCZwkdIqgreFkdRM8L8P/1F04q0Rm9/ObOF0Si6X+/AINyLrn8UFRbDxVzjFU+F2jdaloOFQ63Q9us8w/xtqEEogg/1vhHsTK3fi5D5QMCmasvzaTWVmeQZwQx3r6E/Uva0W3BUss= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761893682; 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=qJ5Ul0ylGFW/+Q3uwo8dFTnLpKsJ65vff/teVfkbsiA=; b=Le4EXdJ/MqHU9tGFqWObQaBMKZ0FaXvgfmgrseeDRyD6U8oSSNiNBKGam+frDsW/g2sYMiFwnItFg4+P3sil8VcGoukzUoIsiRJ0NJ3hK73RTgpv85zGBQTm32JbQag21eQ+HuASP9CgAWur2XhYAGNDghMDGr1lNEufwLY/+eI= 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 1761893682298365.97182479191986; Thu, 30 Oct 2025 23:54:42 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vEixx-0003K9-AG; Fri, 31 Oct 2025 02:50:30 -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 1vEixo-00037e-Rp for qemu-devel@nongnu.org; Fri, 31 Oct 2025 02:50:21 -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 1vEixc-00049H-KC for qemu-devel@nongnu.org; Fri, 31 Oct 2025 02:50:19 -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-303-3-IakWcCPnKy__tbm51f6w-1; Fri, 31 Oct 2025 02:50:01 -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 542661955D97; Fri, 31 Oct 2025 06:50:00 +0000 (UTC) Received: from localhost (unknown [10.45.242.5]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id CC15930001A1; Fri, 31 Oct 2025 06:49:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761893403; 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=qJ5Ul0ylGFW/+Q3uwo8dFTnLpKsJ65vff/teVfkbsiA=; b=J4A8ZpKZ8DJzxri8uw+lRrgSWJgTyu4KAe4FaDM2lEj90bSSxzL8iFP2lRYF0KpqFcmO6z B+fG1z3XAmYqKAeM9DFWJVCfviE+sr7TSdKGmiKr4swrMm97M7D9qSe0X6luqQGEhiwSpN 76/JH1FFpWhOQRzUHrei5DEJVzcIV+c= X-MC-Unique: 3-IakWcCPnKy__tbm51f6w-1 X-Mimecast-MFC-AGG-ID: 3-IakWcCPnKy__tbm51f6w_1761893400 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: richard.henderson@linaro.org, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Gerd Hoffmann Subject: [PULL 31/36] audio: cleanup, use bool for booleans Date: Fri, 31 Oct 2025 10:46:24 +0400 Message-ID: <20251031064631.134651-32-marcandre.lureau@redhat.com> In-Reply-To: <20251031064631.134651-1-marcandre.lureau@redhat.com> References: <20251031064631.134651-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_PASS=-0.001, T_SPF_HELO_TEMPERROR=0.01 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: 1761893683866154100 From: Marc-Andr=C3=A9 Lureau Use slightly better types for the job. Fix some checkpatch issues. 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 8d4f4ca8fc..df13a466e4 100644 --- a/audio/audio_int.h +++ b/audio/audio_int.h @@ -70,9 +70,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; @@ -91,7 +91,7 @@ typedef struct HWVoiceOut { =20 typedef struct HWVoiceIn { AudioBackend *s; - int enabled; + bool enabled; int poll_mode; struct audio_pcm_info info; =20 @@ -117,8 +117,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; @@ -128,7 +128,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 d621008f38..7a8c431f2d 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 08753f621a..0f224810c7 100644 --- a/include/qemu/audio.h +++ b/include/qemu/audio.h @@ -99,8 +99,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); @@ -140,8 +140,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 19499abe16..86e674410a 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 enabled) { 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.1 From nobody Fri Nov 14 17:01:14 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=1761893851; cv=none; d=zohomail.com; s=zohoarc; b=fzYGbETyI1Nafz7OoKMgiR2Rpja6+1Rb9CTNdoZo7UscOn/7v1wzamldcDYaK3H/5u1HRiymtxiyaViriTRaJ0qijdaI0YyWAAMK63L1ddtWo0Gi6cpViU5DWBDd8lp2r/ogU1on8eCLSySxa2+ehUvpB+jGxYEdfU52Ee5ZP2I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761893851; 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=7F1uWKrfDRlDi2YyV2H6l6ipF83SDAuQw1JsdxjlRnQ=; b=SOsI86w6eirkz4GzWwrK610LAwGPkPBbrTqZYrX9Rvez0lV7zijWSIEqT/2BLM4jBy2qV5g/CdiLQz5kelkoUSA+hxNcX5idVIbq2w5Bv1keFuDfOijt/z84XT0FQ2Tj3Taj+E8gFvXH/niDNiNA2Qf3Kr46GSLdTuIzG1kWyY0= 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 1761893851279606.9460616646616; Thu, 30 Oct 2025 23:57:31 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vEixv-0003D2-Bf; Fri, 31 Oct 2025 02:50:27 -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 1vEixo-00036F-Cm for qemu-devel@nongnu.org; Fri, 31 Oct 2025 02:50:20 -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 1vEixi-0004K1-5s for qemu-devel@nongnu.org; Fri, 31 Oct 2025 02:50:19 -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-379-moIbU2FXNnSR6lL60QiWNA-1; Fri, 31 Oct 2025 02:50:07 -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-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 51BED1955DE4; Fri, 31 Oct 2025 06:50:06 +0000 (UTC) Received: from localhost (unknown [10.45.242.5]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id BC8F118002AD; Fri, 31 Oct 2025 06:50:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761893409; 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=7F1uWKrfDRlDi2YyV2H6l6ipF83SDAuQw1JsdxjlRnQ=; b=ETesRf5OKMuefC/WU/9cErSV5xFpHqqUJoIs2ouKeSYcAU7Wc9tih2hsHW5zX+jGTKH9Ex 1N0Lt/uAUu/T0jCWf7mrnc+KCPqdrV+fVNrJMeFFBhWBlV5kQPsM1j9F3Bz57VNuB6ctKc OdMk8I6py6n1pnCi9ndtHNp4f1HXLdw= X-MC-Unique: moIbU2FXNnSR6lL60QiWNA-1 X-Mimecast-MFC-AGG-ID: moIbU2FXNnSR6lL60QiWNA_1761893406 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: richard.henderson@linaro.org, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Gerd Hoffmann Subject: [PULL 32/36] audio: move capture API to own header Date: Fri, 31 Oct 2025 10:46:25 +0400 Message-ID: <20251031064631.134651-33-marcandre.lureau@redhat.com> In-Reply-To: <20251031064631.134651-1-marcandre.lureau@redhat.com> References: <20251031064631.134651-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, T_SPF_TEMPERROR=0.01 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: 1761893852901158500 From: Marc-Andr=C3=A9 Lureau For modularity/clarity reasons, move the capture API in a specific header. The current audio/ header license is MIT. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- MAINTAINERS | 2 +- audio/audio_int.h | 1 + include/qemu/audio-capture.h | 43 ++++++++++++++++++++++++++++++++++++ include/qemu/audio.h | 31 -------------------------- ui/vnc.h | 2 +- 5 files changed, 46 insertions(+), 33 deletions(-) create mode 100644 include/qemu/audio-capture.h diff --git a/MAINTAINERS b/MAINTAINERS index 24323e8800..c78aa1f565 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -2977,7 +2977,7 @@ X: audio/paaudio.c X: audio/sdlaudio.c X: audio/sndioaudio.c X: audio/spiceaudio.c -F: include/qemu/audio.h +F: include/qemu/audio*.h F: qapi/audio.json =20 ALSA Audio backend diff --git a/audio/audio_int.h b/audio/audio_int.h index df13a466e4..5834ebea5e 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..a07412db85 --- /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 0f224810c7..c56af895d6 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 { @@ -79,14 +56,6 @@ typedef struct QEMUAudioTimeStamp { =20 bool AUD_backend_check(AudioBackend **be, Error **errp); =20 -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); - SWVoiceOut *AUD_open_out ( AudioBackend *be, SWVoiceOut *sw, 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.1 From nobody Fri Nov 14 17:01:14 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=1761893765; cv=none; d=zohomail.com; s=zohoarc; b=Lx8cKdWaQ5u6XF+OVtmIbRvL9ri98l1dysE2R5uAfeIzoo0/I2DPvHxCZLOdxWwA5pEfM7BcPDNyCeJAbg1Zf6+LJ/FbUdRf+isoAJFzEe5SGSTrfEn/TFtn7zlSjJoMdb7cdjX6c91XqHRw1AIhYaB+pEm1Bgt2L80GL19oWK4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761893765; 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=JnLtb6UVjRKb000izMSN9Ey2e70s+X7Xd1xFPnNMpSs=; b=SwC+R5OsZ3/tn8yujX2YIY2uMhcTWb0Ou0P3b1Rje0qOSxS+0I4m4uPP/sD0LXgMsrL4pwvmMoTOtthcgcDbCWfEbwOskwCZiqVD5vlxWJzOyXmpDZ2hUFaDRATXKh+iFctqd4mKUCckZ/Kqt50TQ787mVrahc7NTb51L5uQ0a8= 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 176189376552795.25410780428183; Thu, 30 Oct 2025 23:56:05 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vEiy7-0003Xv-TE; Fri, 31 Oct 2025 02:50:41 -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 1vEixw-0003IP-0f for qemu-devel@nongnu.org; Fri, 31 Oct 2025 02:50: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 1vEixn-0004Kx-M6 for qemu-devel@nongnu.org; Fri, 31 Oct 2025 02:50:27 -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-327-j_5uTGgGMhmhaQZRGHObCw-1; Fri, 31 Oct 2025 02:50:14 -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 D931C1955D85; Fri, 31 Oct 2025 06:50:12 +0000 (UTC) Received: from localhost (unknown [10.45.242.5]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id D83A61955BE3; Fri, 31 Oct 2025 06:50:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761893418; 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=JnLtb6UVjRKb000izMSN9Ey2e70s+X7Xd1xFPnNMpSs=; b=M8pcj0iK1QCdgzVBwSQsx0B7To53Mtt5pWakxghJCqLICxhQ0Jr3fNq/DTlodqPLlLHElf GJBEbU+fIIkiFxjk6+qFKejlDXuetHV73jqvwuurmPWeEL/fzUpp8sIRPUFC/vgt+lNpt8 sCjrPMBfCVb6X6mLF2jHD5x68d2qXwE= X-MC-Unique: j_5uTGgGMhmhaQZRGHObCw-1 X-Mimecast-MFC-AGG-ID: j_5uTGgGMhmhaQZRGHObCw_1761893413 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: richard.henderson@linaro.org, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Gerd Hoffmann , Christian Schoenebeck , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Akihiko Odaki , Thomas Huth , Alexandre Ratchov Subject: [PULL 33/36] audio: drop needless audio_driver "descr" field Date: Fri, 31 Oct 2025 10:46:26 +0400 Message-ID: <20251031064631.134651-34-marcandre.lureau@redhat.com> In-Reply-To: <20251031064631.134651-1-marcandre.lureau@redhat.com> References: <20251031064631.134651-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: 1761893767318154100 From: Marc-Andr=C3=A9 Lureau Was it ever used? Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Akihiko Odaki Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- 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 5834ebea5e..b2b8002477 100644 --- a/audio/audio_int.h +++ b/audio/audio_int.h @@ -145,7 +145,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 157d36428e..d729a810aa 100644 --- a/audio/dbusaudio.c +++ b/audio/dbusaudio.c @@ -695,7 +695,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 8b773ded21..7a03d1dad8 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.1 From nobody Fri Nov 14 17:01:14 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=1761893610; cv=none; d=zohomail.com; s=zohoarc; b=hrRDl1a0o41BBV4CiEiVvHbLmDzJIEIinVlMUEVNDbJ90G7VxqqmQwb3LQU3gZ7UGyQhrc47K1ySodUOzNMudA/HhPc5FCArgdnMi+dAGHhzvRN5f4ZcJdRku+FDTK33rqL/82KvpcDQ6koTqE4VEradhMagFPH6NxrGw1u0bnI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761893610; 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=PdFOoUZqPgpq1vXup7Go1DPuLcw0UFGhnSDFzop+e0E=; b=Mf8zx/icLejDPtXK5emhK7pMSmToaZSyzypV0ZQ3hCBmLlq2oVGirFwLMFsNto2t+2kbbK4+p42TJVKIS0+8zzTqp78URk7+qjtz7K7J80FeWXaKRs3UNHjHydCJFYf2ir/fjMVzqTCwV2mOQkHiLs668qXLMnzmFrCKZp0+VXA= 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 1761893610444546.7429878749385; Thu, 30 Oct 2025 23:53:30 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vEiyC-0003bH-KY; Fri, 31 Oct 2025 02:50: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 1vEixy-0003Of-3N for qemu-devel@nongnu.org; Fri, 31 Oct 2025 02:50:30 -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 1vEixu-0004LN-9a for qemu-devel@nongnu.org; Fri, 31 Oct 2025 02:50:29 -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-145-6yH_kiffOay78xP--1YeTg-1; Fri, 31 Oct 2025 02:50:20 -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 07AC21834525; Fri, 31 Oct 2025 06:50:19 +0000 (UTC) Received: from localhost (unknown [10.45.242.5]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 8BB9618002AD; Fri, 31 Oct 2025 06:50:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761893424; 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=PdFOoUZqPgpq1vXup7Go1DPuLcw0UFGhnSDFzop+e0E=; b=H9ZZtigpOxM4x5r9Eywgai5JCUoQ1L0mg2PpSaXd9zScxFCQEqt2yW+WoKlnDNZzbhpzom TwGwmjUu2dAYGqjrx3dl4xfwKX9JMhAtfUP72sNrtqFMguya0m4+QvbCk1jxg53Cs5/DFP EFtDYbfJbPRb/BuCUpJVa8B6x3wAD4g= X-MC-Unique: 6yH_kiffOay78xP--1YeTg-1 X-Mimecast-MFC-AGG-ID: 6yH_kiffOay78xP--1YeTg_1761893419 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: richard.henderson@linaro.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Gerd Hoffmann , Thomas Huth Subject: [PULL 34/36] audio: Remove pointless local variables Date: Fri, 31 Oct 2025 10:46:27 +0400 Message-ID: <20251031064631.134651-35-marcandre.lureau@redhat.com> In-Reply-To: <20251031064631.134651-1-marcandre.lureau@redhat.com> References: <20251031064631.134651-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: 1761893616433158500 From: Philippe Mathieu-Daud=C3=A9 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 ab8791bece..86c4805675 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 a7a9652d29..707110973a 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.1 From nobody Fri Nov 14 17:01:14 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=1761893621; cv=none; d=zohomail.com; s=zohoarc; b=CROhFkhNk6DGvypgNm2a4BBKnf/TkMH3T15+j9lv7cLxOrp/ee0NL83M7+v1f/wWE81wZhkZ16TvJB3wjGruePh1g3dgz4x9+He7Nfc+lx9YjhC3LOU7EkrYPLtmfjpGWuYRBAGN1wIjJSWvLphRMj4boHyy/GJr/2WxNu7qnrs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761893621; 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=4dluily4u7oXJhJbKHmjdloX3ti4c+FaRdIZgW/LGZs=; b=a7y6yiE95SVCi+8f/yCPVz/Gr2V7rg+0LRu8fT1jjpfeoEz6eicSD8tScDcRsZScxn+wgb+NxVTs9vsfuoo6FAU9zZMAlLk2AzIPfEVL24O33u1f6CY2YERVIAE9rXKawq1FJQv2r7hzD2VvMa0nrxHRmL7926pozAXYwBJhbhw= 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 1761893621850797.6925652490352; Thu, 30 Oct 2025 23:53:41 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vEiyH-0003kC-W6; Fri, 31 Oct 2025 02:50:50 -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 1vEiy6-0003Xt-4W for qemu-devel@nongnu.org; Fri, 31 Oct 2025 02:50:38 -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 1vEixx-0004Lg-TM for qemu-devel@nongnu.org; Fri, 31 Oct 2025 02:50:36 -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-136-v5LLcRn5ODai40-al8Quvw-1; Fri, 31 Oct 2025 02:50: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-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id E0C09195D037; Fri, 31 Oct 2025 06:50:24 +0000 (UTC) Received: from localhost (unknown [10.45.242.5]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 7467930001A6; Fri, 31 Oct 2025 06:50:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761893427; 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=4dluily4u7oXJhJbKHmjdloX3ti4c+FaRdIZgW/LGZs=; b=UO0sNZHi+GygbFVjvQZVK0bdR4cAYRNCOKGJnVr+xKM/QFPULtrKjDugYY/om0w44RjeTT aaBp0UVwkgX05Ayi0vf+IfECSWOJQToSXP8kpuaSCeHDivQqgAQFnkAYh6LSC/XS166bVw Z0CtJDIbsPGD2kcqTEeDnqDzbi8knUc= X-MC-Unique: v5LLcRn5ODai40-al8Quvw-1 X-Mimecast-MFC-AGG-ID: v5LLcRn5ODai40-al8Quvw_1761893425 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: richard.henderson@linaro.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Gerd Hoffmann , Christian Schoenebeck , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Subject: [PULL 35/36] audio: Rename @endianness argument as @big_endian for clarity Date: Fri, 31 Oct 2025 10:46:28 +0400 Message-ID: <20251031064631.134651-36-marcandre.lureau@redhat.com> In-Reply-To: <20251031064631.134651-1-marcandre.lureau@redhat.com> References: <20251031064631.134651-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_PASS=-0.001, T_SPF_HELO_TEMPERROR=0.01 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: 1761893625047154101 From: Philippe Mathieu-Daud=C3=A9 @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 89f6dad1a9..7d7da576dc 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 86c4805675..c6cad47a01 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 6b9b6d219a..0c06a39719 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 0fd59d9fe6..30f717ccac 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.1 From nobody Fri Nov 14 17:01:14 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass(p=reject dis=none) header.from=lists.libvirt.org ARC-Seal: i=1; a=rsa-sha256; t=1761893514; cv=none; d=zohomail.com; s=zohoarc; b=PrHz715XeTpZb0KS3SVb4Osw2wHWV58Hm8+gynadzpqtn7NTWat5MX/IfQwPd52yInnnrKtMO2hcOCDl9kOV0FlML2jJ+NgvKRZ1w/9/uRYTspv1VmA6RP+ssaXBLVDegEb/6bSDmPoCF4HEP9Vm/JOfWjCVKJ4kG7rkPbggSOE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761893514; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Owner:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Subject:Subject:To:To:Message-Id; bh=fbPBC/kbbxjTAHogvMh1uN5OqrpzsFVG1nGmmsuw47c=; b=e7ncp4+f7ijGSOF5mlE9j5L+S/F0SLLq5AQ58auD5JD59Q770KxiAgekhTHM+hxuaMVC2DGust52FeSiRpZKFpA4PHo5ZzUfaHD9YXV4XZaPmKnTXMS54MDTjQK3IAoImZjOszqF8WqhleWCGf5A4w0ISOLQbyckLnMh6OuxO2s= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1761893514494366.0831778894087; Thu, 30 Oct 2025 23:51:54 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 993) id A03C23F341; Fri, 31 Oct 2025 02:51:50 -0400 (EDT) Received: from [172.19.199.29] (lists.libvirt.org [8.43.85.245]) by lists.libvirt.org (Postfix) with ESMTP id 1BF6B43F41; Fri, 31 Oct 2025 02:50:45 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 993) id 92D5441A31; Fri, 31 Oct 2025 02:50:38 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (3072 bits) server-digest SHA256) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 6D9CB41C2D for ; Fri, 31 Oct 2025 02:50:35 -0400 (EDT) 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-444-d25_UxdKMKGnZrGD3eT6xQ-1; Fri, 31 Oct 2025 02:50:32 -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-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 27B251833786; Fri, 31 Oct 2025 06:50:31 +0000 (UTC) Received: from localhost (unknown [10.45.242.5]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 87BBF1955BE3; Fri, 31 Oct 2025 06:50:29 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-5.0 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_PASS autolearn=unavailable autolearn_force=no version=4.0.1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761893435; 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=fbPBC/kbbxjTAHogvMh1uN5OqrpzsFVG1nGmmsuw47c=; b=bf7LVd8RU+NCNYff392Pw4Ni9I6iJkzd+x1DOWzE/XIybT3T6W2XR8ecuGfu4raM8/zjyx Zp74pCdJ6F5p62h0v0Ck+10U+ZbHw9dvD1bSbxpC34KIbnLbJeJjFiuWWRjlyCW/Pq/5rw NXlBlsg8DHsGohUW32VTrWMKnyJFtgM= X-MC-Unique: d25_UxdKMKGnZrGD3eT6xQ-1 X-Mimecast-MFC-AGG-ID: d25_UxdKMKGnZrGD3eT6xQ_1761893431 To: qemu-devel@nongnu.org Subject: [PULL 36/36] audio: deprecate HMP audio commands Date: Fri, 31 Oct 2025 10:46:29 +0400 Message-ID: <20251031064631.134651-37-marcandre.lureau@redhat.com> In-Reply-To: <20251031064631.134651-1-marcandre.lureau@redhat.com> References: <20251031064631.134651-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 Message-ID-Hash: AHNLK746KWZGTPRMDJUCHEJ533CQWARJ X-Message-ID-Hash: AHNLK746KWZGTPRMDJUCHEJ533CQWARJ X-MailFrom: marcandre.lureau@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; header-match-devel.lists.libvirt.org-0; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: richard.henderson@linaro.org, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Gerd Hoffmann , "reviewer:Incompatible changes" , "Dr. David Alan Gilbert" X-Mailman-Version: 3.3.10 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: "marcandre.lureau--- via Devel" Reply-To: marcandre.lureau@redhat.com X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1761893515199158500 From: Marc-Andr=C3=A9 Lureau The command is niche and better served by the host audio system. There is no QMP equivalent, fortunately. You can capture the audio stream via remote desktop protocols too (dbus, vnc, spice). Signed-off-by: Marc-Andr=C3=A9 Lureau Acked-by: Dr. David Alan Gilbert Reviewed-by: Daniel P. Berrang=C3=A9 Message-Id: <20251022105753.1474739-1-marcandre.lureau@redhat.com> --- docs/about/deprecated.rst | 20 ++++++++++++++++++++ audio/audio-hmp-cmds.c | 7 +++++++ audio/meson.build | 5 +++-- hmp-commands-info.hx | 6 ++++-- hmp-commands.hx | 9 +++++++-- 5 files changed, 41 insertions(+), 6 deletions(-) diff --git a/docs/about/deprecated.rst b/docs/about/deprecated.rst index ca6b3769b5..4ee98d6646 100644 --- a/docs/about/deprecated.rst +++ b/docs/about/deprecated.rst @@ -169,6 +169,26 @@ Use ``job-finalize`` instead. =20 This argument has always been ignored. =20 +Human Machine Protocol (HMP) commands +------------------------------------- + +``wavcapture`` (since 10.2) +'''''''''''''''''''''''''''' + +The ``wavcapture`` command is deprecated and will be removed in a future r= elease. + +Use ``-audiodev wav`` or your host audio system to capture audio. + +``stopcapture`` (since 10.2) +'''''''''''''''''''''''''''' + +The ``stopcapture`` command is deprecated and will be removed in a future = release. + +``info`` argument ``capture`` (since 10.2) +'''''''''''''''''''''''''''''''''''''''''' + +The ``info capture`` command is deprecated and will be removed in a future= release. + Host Architectures ------------------ =20 diff --git a/audio/audio-hmp-cmds.c b/audio/audio-hmp-cmds.c index 1e56af21ab..1ffb5ebc74 100644 --- a/audio/audio-hmp-cmds.c +++ b/audio/audio-hmp-cmds.c @@ -28,6 +28,7 @@ #include "monitor/monitor.h" #include "qapi/error.h" #include "qobject/qdict.h" +#include "qemu/error-report.h" =20 static QLIST_HEAD (capture_list_head, CaptureState) capture_head; =20 @@ -36,6 +37,8 @@ void hmp_info_capture(Monitor *mon, const QDict *qdict) int i; CaptureState *s; =20 + warn_report_once("'info capture' is deprecated since v10.2, to be remo= ved"); + for (s =3D capture_head.lh_first, i =3D 0; s; s =3D s->entries.le_next= , ++i) { monitor_printf(mon, "[%d]: ", i); s->ops.info (s->opaque); @@ -48,6 +51,8 @@ void hmp_stopcapture(Monitor *mon, const QDict *qdict) int n =3D qdict_get_int(qdict, "n"); CaptureState *s; =20 + warn_report_once("'stopcapture' is deprecated since v10.2, to be remov= ed"); + for (s =3D capture_head.lh_first, i =3D 0; s; s =3D s->entries.le_next= , ++i) { if (i =3D=3D n) { s->ops.destroy (s->opaque); @@ -69,6 +74,8 @@ void hmp_wavcapture(Monitor *mon, const QDict *qdict) Error *local_err =3D NULL; AudioBackend *as =3D audio_be_by_name(audiodev, &local_err); =20 + warn_report_once("'wavcapture' is deprecated since v10.2, to be remove= d"); + if (!as) { error_report_err(local_err); return; diff --git a/audio/meson.build b/audio/meson.build index 37789437fb..b2dca2c640 100644 --- a/audio/meson.build +++ b/audio/meson.build @@ -1,12 +1,13 @@ system_ss.add(files( 'audio.c', - 'audio-hmp-cmds.c', 'mixeng.c', 'noaudio.c', 'wavaudio.c', - 'wavcapture.c', )) =20 +# deprecated since v10.2, to be removed +system_ss.add(files('audio-hmp-cmds.c', 'wavcapture.c')) + system_ss.add(when: coreaudio, if_true: files('coreaudio.m')) system_ss.add(when: dsound, if_true: files('dsoundaudio.c', 'audio_win_int= .c')) =20 diff --git a/hmp-commands-info.hx b/hmp-commands-info.hx index 2a7f5810d7..41674dcbe1 100644 --- a/hmp-commands-info.hx +++ b/hmp-commands-info.hx @@ -363,18 +363,20 @@ SRST Show host USB devices. ERST =20 +/* BEGIN deprecated */ { .name =3D "capture", .args_type =3D "", .params =3D "", - .help =3D "show capture information", + .help =3D "show capture information (deprecated)", .cmd =3D hmp_info_capture, }, =20 SRST ``info capture`` - Show capture information. + Show capture information (deprecated). ERST +/* END deprecated */ =20 { .name =3D "snapshots", diff --git a/hmp-commands.hx b/hmp-commands.hx index 15f6082596..5cc4788f12 100644 --- a/hmp-commands.hx +++ b/hmp-commands.hx @@ -764,11 +764,12 @@ SRST =20 ERST =20 +/* BEGIN deprecated */ { .name =3D "wavcapture", .args_type =3D "path:F,audiodev:s,freq:i?,bits:i?,nchannels:i?", .params =3D "path audiodev [frequency [bits [channels]]]", - .help =3D "capture audio to a wave file (default frequency= =3D44100 bits=3D16 channels=3D2)", + .help =3D "capture audio to a wave file (deprecated, default= frequency=3D44100 bits=3D16 channels=3D2)", .cmd =3D hmp_wavcapture, }, SRST @@ -782,13 +783,15 @@ SRST - Sample rate =3D 44100 Hz - CD quality - Bits =3D 16 - Number of channels =3D 2 - Stereo + + Deprecated. ERST =20 { .name =3D "stopcapture", .args_type =3D "n:i", .params =3D "capture index", - .help =3D "stop capture", + .help =3D "stop capture (deprecated)", .cmd =3D hmp_stopcapture, }, SRST @@ -797,7 +800,9 @@ SRST =20 info capture =20 + Deprecated. ERST +/* END deprecated */ =20 { .name =3D "memsave", --=20 2.51.1