From nobody Thu Oct 30 15:35:56 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=1761578522; cv=none; d=zohomail.com; s=zohoarc; b=fGWdkNEtkA4R3pPNz9zJ4EQOCiZDkGhyAkk0l2B9j+EMPXkfR0bgrD6Cz2DXy4+eg4GQvIJEDB6oWCPPSDvhgzAoJ9j5OCtLXmkQ2kVdOJmNRSXQklIdw2g612sCnLSfNP2TaJ8ugH4GGFdyD+OafqRgx37I+HkyGKzkC92tCOE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761578522; 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=j4aJ4u/eX28EZuhy4vNPnKeQoMgSUL/1mHewTfZYfnw=; b=WvVsnijBTbfexIB3MSOVBG8/TMn96WxmEDJq7hThKUqf8Nz4N+LIy1w99liKt9nXYxwZNgBpa4S4qnh+54nIF/wZbl3j8/jzSwJrDK5PQWmIcckgO1tK2SihBzgcogONXcMb0Nj1FxH/isgmV730mzVZesecnhcnrksIkRTTap8= 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 1761578522446624.6474364960101; Mon, 27 Oct 2025 08:22:02 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vDOsX-0001O3-Ju; Mon, 27 Oct 2025 11:11:25 -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 1vDOsU-0001MA-I6 for qemu-devel@nongnu.org; Mon, 27 Oct 2025 11:11:22 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vDOsI-0003VD-9H for qemu-devel@nongnu.org; Mon, 27 Oct 2025 11:11:21 -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-389-lblU7ZvlMrKkuqzvhndXpA-1; Mon, 27 Oct 2025 11:11:04 -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 86C251800D83; Mon, 27 Oct 2025 15:11: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 689F119560AD; Mon, 27 Oct 2025 15:10:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761577868; 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=j4aJ4u/eX28EZuhy4vNPnKeQoMgSUL/1mHewTfZYfnw=; b=gFSVzXlXEw316UDnuXFpFZZUR+/ItJn5M9wheff6wYAjcKNE4MK8AoswBfWr+UBIhjRqqy I3U7B+gSItJUz5c5WYtV5yuFR+V5Y9Fou/lxNRpalTW4WcWlmffXWsnYQ5iBP8O7wvR7gw 7ryGXyLNn/AniFphE31t/Mf7V39WPG8= X-MC-Unique: lblU7ZvlMrKkuqzvhndXpA-1 X-Mimecast-MFC-AGG-ID: lblU7ZvlMrKkuqzvhndXpA_1761577861 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Alexandre Ratchov , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Jan Kiszka , "Michael S. Tsirkin" , Marcel Apfelbaum , Yanan Wang , Thomas Huth , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Gerd Hoffmann , Peter Maydell , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Eduardo Habkost , Manos Pitsidianakis , qemu-ppc@nongnu.org, Jiaxun Yang , Akihiko Odaki , =?UTF-8?q?Herv=C3=A9=20Poussineau?= , qemu-arm@nongnu.org, Alistair Francis , Zhao Liu , =?UTF-8?q?Volker=20R=C3=BCmelin?= , Christian Schoenebeck , Paolo Bonzini , "Edgar E. Iglesias" , BALATON Zoltan , Laurent Vivier Subject: [PATCH v3 01/35] qdev: add qdev_find_default_bus() Date: Mon, 27 Oct 2025 19:10:08 +0400 Message-ID: <20251027151045.2863176-2-marcandre.lureau@redhat.com> In-Reply-To: <20251027151045.2863176-1-marcandre.lureau@redhat.com> References: <20251027151045.2863176-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=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: 1761578523688158500 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.0 From nobody Thu Oct 30 15:35:56 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=1761577983; cv=none; d=zohomail.com; s=zohoarc; b=GCRvWHWJy/+rus8nnekKhp/i70m06T0t1FvvQyvQdEMzF2IuQqtadI/COE54G+KTLTD6BnMpsy7qWWo0Kybq49UNXlYREjqt2C1oTV6W+fLCmtc/3uzqLgpq/KeW+huBKNCV385J/HrIV7a+Xeh1gpnlWmTZ2WnHNgoW2klu0w0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761577983; 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=0MyfB1XYiYAAsL7J3ZTAzkl74UqZnQ2uBGx52qq1kb4=; b=d5DvDVq2ZXIVLXwkvICBBbMzPDcPQ0x/i7WTeXEhoKoyBRgEGe9rcS7qpBf71ydyDRLbvctevnTvoTuriVLvTXS1+ZCwmsrZ1VxHnyPABHP/lBWK2/vfBL96qv4tLyWcoJbDJWx+taCwmHJ3GNhKkhJzfCO0HpoSnt2B0Q3jPw0= 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 176157798311719.92229999704648; Mon, 27 Oct 2025 08:13:03 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vDOsv-0001W7-W3; Mon, 27 Oct 2025 11:11:51 -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 1vDOsc-0001Pu-EA for qemu-devel@nongnu.org; Mon, 27 Oct 2025 11:11: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 1vDOsQ-0003W4-8m for qemu-devel@nongnu.org; Mon, 27 Oct 2025 11:11:29 -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-662-NUa0pAyoNFeFcV2lYNKnZg-1; Mon, 27 Oct 2025 11:11:11 -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 E31DF1800451; Mon, 27 Oct 2025 15:11:06 +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 AD6191800579; Mon, 27 Oct 2025 15:11:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761577876; 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=0MyfB1XYiYAAsL7J3ZTAzkl74UqZnQ2uBGx52qq1kb4=; b=INUNoEQ55EchLc+DW2s9Ezhklfs8H8rqskQE3gqFxDuMZYXK3RhnP9VN4IrwyAFjKetmQ5 MesRx7swuajQ9UJYkH9mWf2aAcgxu9CG+nwuYVzxCVhZ1DoqrUsBryiqpTFDtaHZkvCoIs RADdlVKQ9nRXRaoVW8dtZeW8pbxxar4= X-MC-Unique: NUa0pAyoNFeFcV2lYNKnZg-1 X-Mimecast-MFC-AGG-ID: NUa0pAyoNFeFcV2lYNKnZg_1761577868 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Alexandre Ratchov , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Jan Kiszka , "Michael S. Tsirkin" , Marcel Apfelbaum , Yanan Wang , Thomas Huth , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Gerd Hoffmann , Peter Maydell , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Eduardo Habkost , Manos Pitsidianakis , qemu-ppc@nongnu.org, Jiaxun Yang , Akihiko Odaki , =?UTF-8?q?Herv=C3=A9=20Poussineau?= , qemu-arm@nongnu.org, Alistair Francis , Zhao Liu , =?UTF-8?q?Volker=20R=C3=BCmelin?= , Christian Schoenebeck , Paolo Bonzini , "Edgar E. Iglesias" , BALATON Zoltan , Laurent Vivier Subject: [PATCH v3 02/35] hw/audio: look up the default bus from the device class Date: Mon, 27 Oct 2025 19:10:09 +0400 Message-ID: <20251027151045.2863176-3-marcandre.lureau@redhat.com> In-Reply-To: <20251027151045.2863176-1-marcandre.lureau@redhat.com> References: <20251027151045.2863176-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: -16 X-Spam_score: -1.7 X-Spam_bar: - X-Spam_report: (-1.7 / 5.0 requ) BAYES_00=-1.9, DKIM_INVALID=0.1, DKIM_SIGNED=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=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1761577991554158500 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.0 From nobody Thu Oct 30 15:35:56 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=1761578003; cv=none; d=zohomail.com; s=zohoarc; b=VwPhPMRdd6ejJnl8avKK3gBj0sRBFKSWmaRfjXPrPe0XYXNZBASS71C1COao9Jue7LrKorqEZI2mbweLXBDtuKMLv55/IzMr6KQCSLSWmZGIVwDBmuUbs4X+ZVOX7KZF1xCEWtMkQYOO1iV3ZqBCkiJYAWnHTSsHf9XOhKNH2o0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761578003; 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=gaqIYiEWWYqPATPX3QCfAkEHZiFitR8VsIDiyHoh+yI=; b=G7A2OAwCwQ4YB9HymdEsZAi870TgLdO+EK23n9xARh3u9fFrMYPYz99o0gzFk+sYYD1cVtGRrzytaIr3a1MrO3WSjl3Grx29Nix/L77Mq5amXOjGe3yVtDBwo5+yLJKvlDrcgre6i6I4k13eXiZED9fvEmubMVAdJjoklB6ZCuo= 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 1761578003104440.99755461169866; Mon, 27 Oct 2025 08:13:23 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vDOsy-0001Xr-W2; Mon, 27 Oct 2025 11:11:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vDOsj-0001Rs-7E for qemu-devel@nongnu.org; Mon, 27 Oct 2025 11:11:40 -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 1vDOsX-0003XF-Ha for qemu-devel@nongnu.org; Mon, 27 Oct 2025 11:11:32 -0400 Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-49-hPyDjXDGMxWG_szz9Qv_LA-1; Mon, 27 Oct 2025 11:11:18 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 15FA31808972; Mon, 27 Oct 2025 15:11:14 +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 16B2730001A7; Mon, 27 Oct 2025 15:11:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761577883; 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=gaqIYiEWWYqPATPX3QCfAkEHZiFitR8VsIDiyHoh+yI=; b=AvL2xshlxK/EDuqP8PTCUoNSuW4Tdtxx9mhflDyl5DUJs6qQniLEk61d2yeUHgbkFP0rth FO1G8cUHqwwzdE7815m/wdozpGssKmDZW5iFMY92JKaSXM7NtMMRHCm4nxI1mDEwW/NGAK qpszYNmmVxw/bv1b/OBnCUVjhhsZxx0= X-MC-Unique: hPyDjXDGMxWG_szz9Qv_LA-1 X-Mimecast-MFC-AGG-ID: hPyDjXDGMxWG_szz9Qv_LA_1761577875 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Alexandre Ratchov , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Jan Kiszka , "Michael S. Tsirkin" , Marcel Apfelbaum , Yanan Wang , Thomas Huth , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Gerd Hoffmann , Peter Maydell , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Eduardo Habkost , Manos Pitsidianakis , qemu-ppc@nongnu.org, Jiaxun Yang , Akihiko Odaki , =?UTF-8?q?Herv=C3=A9=20Poussineau?= , qemu-arm@nongnu.org, Alistair Francis , Zhao Liu , =?UTF-8?q?Volker=20R=C3=BCmelin?= , Christian Schoenebeck , Paolo Bonzini , "Edgar E. Iglesias" , BALATON Zoltan , Laurent Vivier Subject: [PATCH v3 03/35] audio: rename audio_define->audio_add_audiodev() Date: Mon, 27 Oct 2025 19:10:10 +0400 Message-ID: <20251027151045.2863176-4-marcandre.lureau@redhat.com> In-Reply-To: <20251027151045.2863176-1-marcandre.lureau@redhat.com> References: <20251027151045.2863176-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: 1761578005353154100 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.0 From nobody Thu Oct 30 15:35:56 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=1761577985; cv=none; d=zohomail.com; s=zohoarc; b=kvpp7ryu2TnWY7fv3CWLPWxIhDVFQVCIxF6MZ+d3wgY9U1ON/cp6w4Nc0V16nfti9yvVV2IlSnW17etL4rdv/QTqHKGqIhRi8D8EgwWeIh/lJutLHaKOZve2svJrsMLRAwaLXSbaPuP4Zssu9FdjCSeMfCdUlXQeru6wooIWCYI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761577985; 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=dzfYqy7pT6JSh7R8VigHurPFSvYSuhqMGSyp2fsHB9M=; b=R1cHvIhbICaFsKs17QTax6p6ZCH/VMSS4C6hz1DEgiXTGbz9If/cP7tlDgOivoAVpWsYgVZYMdFdx03CPfBsPbN6kbGObEWKNjB1pFSGogfvU2YnRPPacTNrdymaV6FeEqosZC3wK26gE+6Xqx9VgDt5Gf+e2Dx9YFruO+HFQG0= 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 17615779850171010.1898067537358; Mon, 27 Oct 2025 08:13:05 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vDOt3-0001bw-L3; Mon, 27 Oct 2025 11:11: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 1vDOsv-0001Ub-9m for qemu-devel@nongnu.org; Mon, 27 Oct 2025 11:11: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 1vDOsf-0003Xz-5I for qemu-devel@nongnu.org; Mon, 27 Oct 2025 11:11:44 -0400 Received: from mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-381-P-d05SHaP1KwRHvEgaxZCQ-1; Mon, 27 Oct 2025 11:11:24 -0400 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 9A18619541BB; Mon, 27 Oct 2025 15:11:20 +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 579E0180057C; Mon, 27 Oct 2025 15:11:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761577889; 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=dzfYqy7pT6JSh7R8VigHurPFSvYSuhqMGSyp2fsHB9M=; b=ZzWblg7SoDaJFd7DQ6Q8poq6w8cj8+jDD5uQw8jlppjqdtuyP9bjx2yST0F6T1LP/h6Fli DdLZjXegnzSRpWDjv2KDGz0Ov8txztqAosalR6iGBvJGFj+4FXUWqEIYXGMzBWLTiMx+SF o+uIP2ozgqPvQjxhorJhvr8H1W0ZCvw= X-MC-Unique: P-d05SHaP1KwRHvEgaxZCQ-1 X-Mimecast-MFC-AGG-ID: P-d05SHaP1KwRHvEgaxZCQ_1761577881 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Alexandre Ratchov , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Jan Kiszka , "Michael S. Tsirkin" , Marcel Apfelbaum , Yanan Wang , Thomas Huth , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Gerd Hoffmann , Peter Maydell , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Eduardo Habkost , Manos Pitsidianakis , qemu-ppc@nongnu.org, Jiaxun Yang , Akihiko Odaki , =?UTF-8?q?Herv=C3=A9=20Poussineau?= , qemu-arm@nongnu.org, Alistair Francis , Zhao Liu , =?UTF-8?q?Volker=20R=C3=BCmelin?= , Christian Schoenebeck , Paolo Bonzini , "Edgar E. Iglesias" , BALATON Zoltan , Laurent Vivier Subject: [PATCH v3 04/35] hw/audio: use better naming for -audio model handling code Date: Mon, 27 Oct 2025 19:10:11 +0400 Message-ID: <20251027151045.2863176-5-marcandre.lureau@redhat.com> In-Reply-To: <20251027151045.2863176-1-marcandre.lureau@redhat.com> References: <20251027151045.2863176-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: 1761577991683158500 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.0 From nobody Thu Oct 30 15:35:56 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=1761577975; cv=none; d=zohomail.com; s=zohoarc; b=QOUiynJBVGUqSXo6B4g/gdY06GeohaYdgDzOEALXR2GDOAoH/tPKebXCDakhnFFYVNGl4mnOgY0K9Y7WOPfb5B9fB4f4ImN7tQH1iBUT6cClz9IOYL8K+myGBu+V3/aUiXCu5xVfUeH4G9mQq2iyldCgOtAlYTx7yQH0cbMModE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761577975; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=GJHhV44xA2yV6Pwkj+xG4UfO7EkjL4EsvWC4IiZRDKY=; b=CeEtZVEZ+OdbAcXZ5800oicJJx2gyHShh7gdrUZwzRYiQvXYeO54J54Q/EMMUul0jNGsKUxaXzSqYUvBKq+bC4XEEJ5SPhPIKsV9oNrZqbTWOi5h1nFRoQHj9PAjAepVFQy3f4Far2UW66m0wpPlgZWjLQ7lOLr7RFHZ7tF+DZw= 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 1761577975168724.5127931327434; Mon, 27 Oct 2025 08:12:55 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vDOt6-0001fW-0a; Mon, 27 Oct 2025 11:12:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vDOsy-0001Wu-BA for qemu-devel@nongnu.org; Mon, 27 Oct 2025 11:11:52 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vDOsq-0003Yf-1v for qemu-devel@nongnu.org; Mon, 27 Oct 2025 11:11:50 -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-599-xcJsyIVXNRWM4RLFCWLHbQ-1; Mon, 27 Oct 2025 11:11: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 4B2A0195398A; Mon, 27 Oct 2025 15:11: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 21A7C30002DB; Mon, 27 Oct 2025 15:11:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761577898; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=GJHhV44xA2yV6Pwkj+xG4UfO7EkjL4EsvWC4IiZRDKY=; b=eYijc3aeb1kzNcPAzt37RTDzFwRomcwItUBkv/3hK3eEy+KtQFR3r/8Rk3EUfb7B0V790y a+GTJK8/ZkOXzQvSIKv5spwfk2Svlu45/o1flNIMY8oPRd9mycYg1Jxrb2NTlnxPCHDXvY EwKOpDBy6/XC/N2ex9LaOM0sziGnBXM= X-MC-Unique: xcJsyIVXNRWM4RLFCWLHbQ-1 X-Mimecast-MFC-AGG-ID: xcJsyIVXNRWM4RLFCWLHbQ_1761577890 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Alexandre Ratchov , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Jan Kiszka , "Michael S. Tsirkin" , Marcel Apfelbaum , Yanan Wang , Thomas Huth , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Gerd Hoffmann , Peter Maydell , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Eduardo Habkost , Manos Pitsidianakis , qemu-ppc@nongnu.org, Jiaxun Yang , Akihiko Odaki , =?UTF-8?q?Herv=C3=A9=20Poussineau?= , qemu-arm@nongnu.org, Alistair Francis , Zhao Liu , =?UTF-8?q?Volker=20R=C3=BCmelin?= , Christian Schoenebeck , Paolo Bonzini , "Edgar E. Iglesias" , BALATON Zoltan , Laurent Vivier Subject: [PATCH v3 05/35] hw/audio/virtio-snd-pci: remove custom model callback Date: Mon, 27 Oct 2025 19:10:12 +0400 Message-ID: <20251027151045.2863176-6-marcandre.lureau@redhat.com> In-Reply-To: <20251027151045.2863176-1-marcandre.lureau@redhat.com> References: <20251027151045.2863176-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: 1761577977432154100 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.0 From nobody Thu Oct 30 15:35:56 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=1761578254; cv=none; d=zohomail.com; s=zohoarc; b=GLMzCpBR4UI/ZpxPDLSN9jFL1HjCBWKwLUOcf19LDxU1m+rGdW0lyYBQ/dEerHGenx9w7igSvyXIuMWNAhMjGNsC/AZVcDlGN1A4PpNh611e0/f50lqmGLfCzQHRgZk13ddfbgG3qPT3AeRsyW7lUVayDu7G55AmqOi/yQd15wY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761578254; 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=+3Rg85jlM5UX+02vSFShnD0E8jXFrXnf+cl2ueU9+g0=; b=mLdKvR9WYaAW9UroZDIe/NFvGxSRvv5LVUjLWhYQfJWVKR+vWqkXxhpL0dP+QEF83H4WDcxrGfJKnzt3BM/5u4zR+2aEjCYvbtFOHI3mWbNsaI0lSxMOGPGggCEmBuXoS/LL3fgVqwzH2dyZmBR637+KASGWIye/9i2pNX62QJw= 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 1761578254255219.5363633861905; Mon, 27 Oct 2025 08:17:34 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vDOt4-0001fL-Sg; Mon, 27 Oct 2025 11:11: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 1vDOt0-0001aF-LL for qemu-devel@nongnu.org; Mon, 27 Oct 2025 11:11:55 -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 1vDOsv-0003ZC-Am for qemu-devel@nongnu.org; Mon, 27 Oct 2025 11:11:54 -0400 Received: from mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-687-7ExtPECcMM-1Cn9m5_gYoQ-1; Mon, 27 Oct 2025 11:11:41 -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-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id DCE1019541B2; Mon, 27 Oct 2025 15:11:36 +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 2519B30001A2; Mon, 27 Oct 2025 15:11:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761577906; 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=+3Rg85jlM5UX+02vSFShnD0E8jXFrXnf+cl2ueU9+g0=; b=EqSVNf1m/4vIkOSavlyXmMdZS3E6csq6zjo6jc8bvatCCF2pVIXshuqJL0aBmIrGzAj4bk MzKOGooci4hK7WzMstkIGc9yPaU799ubC6Bm5LCeyuKcJLe6r06MRlS7Rb6wuSrqDy02qG Eq9VimlodxjXlPcT5Z4NmC2u//iGmek= X-MC-Unique: 7ExtPECcMM-1Cn9m5_gYoQ-1 X-Mimecast-MFC-AGG-ID: 7ExtPECcMM-1Cn9m5_gYoQ_1761577897 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Alexandre Ratchov , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Jan Kiszka , "Michael S. Tsirkin" , Marcel Apfelbaum , Yanan Wang , Thomas Huth , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Gerd Hoffmann , Peter Maydell , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Eduardo Habkost , Manos Pitsidianakis , qemu-ppc@nongnu.org, Jiaxun Yang , Akihiko Odaki , =?UTF-8?q?Herv=C3=A9=20Poussineau?= , qemu-arm@nongnu.org, Alistair Francis , Zhao Liu , =?UTF-8?q?Volker=20R=C3=BCmelin?= , Christian Schoenebeck , Paolo Bonzini , "Edgar E. Iglesias" , BALATON Zoltan , Laurent Vivier Subject: [PATCH v3 06/35] hw/audio: simplify 'hda' audio init code Date: Mon, 27 Oct 2025 19:10:13 +0400 Message-ID: <20251027151045.2863176-7-marcandre.lureau@redhat.com> In-Reply-To: <20251027151045.2863176-1-marcandre.lureau@redhat.com> References: <20251027151045.2863176-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: 1761578268459158500 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.0 From nobody Thu Oct 30 15:35:56 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=1761578010; cv=none; d=zohomail.com; s=zohoarc; b=YV9YAZYGulg59beDQ+PVTCgutNE8ueGqKSmmoe6O9RpE361AkOXWM6geEgUwS9P2vTAyjvoMMw/4LbbrmBWyZPffNcwtmPuOBFmkhczTJK7cEln663yN81YbsS/NReuyFqnugAgGdCTx8+Tc5HPbQw7cKnRv7TkojwVsCOatXb4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761578010; 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=1TxxLbBB/nlbhAyoE+VGB060htJ/JfCS5v+EnXEJWcY=; b=jIKJuvm/K6wlpvaRzf+4OB3HQdTDqeL+oh1bU2WllskQafNL3/KbMP9O44Wt7vFvCyvL50o9/Qd5KEAL4jhPN5n9WsFJNJ8Wo1aZCIjD9SjUEDnxgK/KL5MaY5/kp0UPcO2NKPqLoUCj2nNqXgkfVhbvsoPv7byJlPVx/yd9Bmk= 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 1761578010184169.88239340659482; Mon, 27 Oct 2025 08:13:30 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vDOtY-0001uM-GK; Mon, 27 Oct 2025 11:12:29 -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 1vDOt6-0001hy-TR for qemu-devel@nongnu.org; Mon, 27 Oct 2025 11:12:01 -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 1vDOt2-0003al-Rq for qemu-devel@nongnu.org; Mon, 27 Oct 2025 11:12:00 -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-549-uFlJT-OnPkuqMLLTGsG-kg-1; Mon, 27 Oct 2025 11:11:49 -0400 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 40CAF1954225; Mon, 27 Oct 2025 15:11:43 +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 60D491800577; Mon, 27 Oct 2025 15:11:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761577913; 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=1TxxLbBB/nlbhAyoE+VGB060htJ/JfCS5v+EnXEJWcY=; b=QJbkcHnUDiX2ywh1rLk2LY4tyZvO/kZ8c2U537XLYeSuH0qv89fSDLLYGFhsXRrHh+qFBg tP2gXCrQkh1lL6K3ceesYX7m9WTio4I70x5M1+YtKoXwVeCMtvD67Jxfw14iAdG/gimdp8 AAKhfxW+v1CuDJWcs/5X2LzvF/sMjTA= X-MC-Unique: uFlJT-OnPkuqMLLTGsG-kg-1 X-Mimecast-MFC-AGG-ID: uFlJT-OnPkuqMLLTGsG-kg_1761577903 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Alexandre Ratchov , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Jan Kiszka , "Michael S. Tsirkin" , Marcel Apfelbaum , Yanan Wang , Thomas Huth , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Gerd Hoffmann , Peter Maydell , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Eduardo Habkost , Manos Pitsidianakis , qemu-ppc@nongnu.org, Jiaxun Yang , Akihiko Odaki , =?UTF-8?q?Herv=C3=A9=20Poussineau?= , qemu-arm@nongnu.org, Alistair Francis , Zhao Liu , =?UTF-8?q?Volker=20R=C3=BCmelin?= , Christian Schoenebeck , Paolo Bonzini , "Edgar E. Iglesias" , BALATON Zoltan , Laurent Vivier Subject: [PATCH v3 07/35] hw/audio: generalize audio_model.init() Date: Mon, 27 Oct 2025 19:10:14 +0400 Message-ID: <20251027151045.2863176-8-marcandre.lureau@redhat.com> In-Reply-To: <20251027151045.2863176-1-marcandre.lureau@redhat.com> References: <20251027151045.2863176-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=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: 1761578011595154100 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.0 From nobody Thu Oct 30 15:35:56 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=1761578125; cv=none; d=zohomail.com; s=zohoarc; b=Q5O+SOHIoDHRmOpvNeu9Kw0MAykw8KMO4OUDWlfrNHJnx+CG4rf0OWJ/jcDPxdynyJ95XRi9k/Ucu/o4SUH0DXUxixmtHSmasgGeMiDJGTi3cjvJsUNRUqyyEk4ULrIekqRQ4/QbHluaMlQa47hbvyneOWC/b99oQ0KGahRaVXY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761578125; 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=iSiQSKZntVmBjCBytiGRZ0l8hpfeJ8xCY61dDLVFUdM=; b=PBtlLnXsFENBA87ZkG+nCObkrIccuB9vROpcPtC4l0ZHl5RJILlGAm+jHFDV2suSYaxvh64uIxpIeS+abUReuktj/KdlJPSAYl00CW5FobrS5zLNXI6EPoSz+Blkjco0ILqJULWDwwATBaxSc2nBpr572iz0aj7Dsg198SJwTqo= 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 1761578125025709.3764430978921; Mon, 27 Oct 2025 08:15:25 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vDOte-00023I-8V; Mon, 27 Oct 2025 11:12:34 -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 1vDOtF-0001kd-Rj for qemu-devel@nongnu.org; Mon, 27 Oct 2025 11:12:10 -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 1vDOt3-0003bA-QQ for qemu-devel@nongnu.org; Mon, 27 Oct 2025 11:12:09 -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-144-aMdzFSBgMCmhuY5aOteaXQ-1; Mon, 27 Oct 2025 11:11: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-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 12AC618002E4; Mon, 27 Oct 2025 15:11: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 B65DE1800577; Mon, 27 Oct 2025 15:11:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761577915; 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=iSiQSKZntVmBjCBytiGRZ0l8hpfeJ8xCY61dDLVFUdM=; b=A5RW06/zN/XqPojS7AudIGSITbxYtREFOL6WadxWEnqo3D6tdz3US2l6Q/z6/VkMWh/4n8 pgB6/SUpeb9XzVVbWzGSNePlyP0ubrDuHqlz/+z4l75CXM4Y9Xwe+oB/yWHcWv/tEgW8Fu Mfab1dmQhShzlrluDYw8WtQ7G0to0Zg= X-MC-Unique: aMdzFSBgMCmhuY5aOteaXQ-1 X-Mimecast-MFC-AGG-ID: aMdzFSBgMCmhuY5aOteaXQ_1761577909 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Alexandre Ratchov , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Jan Kiszka , "Michael S. Tsirkin" , Marcel Apfelbaum , Yanan Wang , Thomas Huth , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Gerd Hoffmann , Peter Maydell , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Eduardo Habkost , Manos Pitsidianakis , qemu-ppc@nongnu.org, Jiaxun Yang , Akihiko Odaki , =?UTF-8?q?Herv=C3=A9=20Poussineau?= , qemu-arm@nongnu.org, Alistair Francis , Zhao Liu , =?UTF-8?q?Volker=20R=C3=BCmelin?= , Christian Schoenebeck , Paolo Bonzini , "Edgar E. Iglesias" , BALATON Zoltan , Laurent Vivier Subject: [PATCH v3 08/35] hw/audio: drop audio_model.isa Date: Mon, 27 Oct 2025 19:10:15 +0400 Message-ID: <20251027151045.2863176-9-marcandre.lureau@redhat.com> In-Reply-To: <20251027151045.2863176-1-marcandre.lureau@redhat.com> References: <20251027151045.2863176-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, T_SPF_TEMPERROR=0.01 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: 1761578132729158500 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.0 From nobody Thu Oct 30 15:35:56 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=1761578430; cv=none; d=zohomail.com; s=zohoarc; b=QW7JE3gWdXVwJj2vRdkijjXdoOEBEl5Q/iom0Qlx8G+flXsTfEo227JrFNcN6as8Es7Bbby1VIFtMZT0KyUGh2c3XIXkoHapPlltxM9w9hW1wQde2KQyxBGx2zOFm+x0l7smQehR6Y/3IHniAwSuxNgI9N1M9HF7oQfXKD0Qzfc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761578430; 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=+tOcIbEPQXMgrqnK8ejKYWH7W96K/uLeah8gDonspHM=; b=eByrVFMBgVK2Um+VignGkzV96+bqvIndGQvLCnWMUeq8aAEheslYxdjHEx/zfJ+rYNtDYNn9xW92Daa5qLldryrwa7I2zsw6iFnTttMhJhUR9X+v+fYYo+w8BxrewgVGCkh32ySkt1DaNPzpOVo1zi2GxpO04usdmEL9p/PtGJ0= 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 1761578430804439.2058725685496; Mon, 27 Oct 2025 08:20:30 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vDOta-0001xS-2Q; Mon, 27 Oct 2025 11:12:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vDOtJ-0001n0-TP for qemu-devel@nongnu.org; Mon, 27 Oct 2025 11:12:15 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vDOtB-0003co-MB for qemu-devel@nongnu.org; Mon, 27 Oct 2025 11:12:12 -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-248-7PrvkgxJMwGkTNc9gw4UaQ-1; Mon, 27 Oct 2025 11:11:59 -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 AC0AB19560B4; Mon, 27 Oct 2025 15:11:55 +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 F270C180057A; Mon, 27 Oct 2025 15:11:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761577920; 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=+tOcIbEPQXMgrqnK8ejKYWH7W96K/uLeah8gDonspHM=; b=Sab/jmj2+qFBUDKLb/qk/Qs/wGKI6QvJP583qdRdtlqsdoNshdrq/6eS1g6wQEyVRTl24q iaGDa9s1/40HhQkE7rCAMJRDa92wQMfuQ0CqOW9UilFG9Qk4DsrQUxxzE6j50X4LeWbY4p 6mlNMl8iYxh9GLDfSAuEIM9LlqKMpLo= X-MC-Unique: 7PrvkgxJMwGkTNc9gw4UaQ-1 X-Mimecast-MFC-AGG-ID: 7PrvkgxJMwGkTNc9gw4UaQ_1761577916 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Alexandre Ratchov , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Jan Kiszka , "Michael S. Tsirkin" , Marcel Apfelbaum , Yanan Wang , Thomas Huth , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Gerd Hoffmann , Peter Maydell , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Eduardo Habkost , Manos Pitsidianakis , qemu-ppc@nongnu.org, Jiaxun Yang , Akihiko Odaki , =?UTF-8?q?Herv=C3=A9=20Poussineau?= , qemu-arm@nongnu.org, Alistair Francis , Zhao Liu , =?UTF-8?q?Volker=20R=C3=BCmelin?= , Christian Schoenebeck , Paolo Bonzini , "Edgar E. Iglesias" , BALATON Zoltan , Laurent Vivier Subject: [PATCH v3 09/35] audio: start making AudioState a QOM Object Date: Mon, 27 Oct 2025 19:10:16 +0400 Message-ID: <20251027151045.2863176-10-marcandre.lureau@redhat.com> In-Reply-To: <20251027151045.2863176-1-marcandre.lureau@redhat.com> References: <20251027151045.2863176-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=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: 1761578432447158500 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.0 From nobody Thu Oct 30 15:35:56 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=1761578352; cv=none; d=zohomail.com; s=zohoarc; b=AuD4Oq8YoFSkbeiFUhDQBYfNgQBpHBXelB0FLH+YJQpbdF5zxc2gMQ2qvpcCLWLyCKJOYnZgppI5hEcuxOKgTi/LuVhD1Az4YNLq+SW5gWg8OgTUnTzA6aJ87nylWQ9hxnpe2F1aCzhYm5RvulITL1GAqHjODQqaAEv4d8wRvbk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761578352; 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=2xHw3hpnCoMP1RswkClFEptTsPa5ewLthiBoawt/yhI=; b=a4tGkrRC7RkbxYkTfBaU+rugogVyQmbu1TTZBReT695X+w4RuncmWgD6tfndfpWygMHW+FfTvrYmL1VfONJnrATa2oHyAp0oNdtBhHzHuyQtK8p/ksXZQn81wjL1N+iKKBg6a7vIYv2WkzHFTiSKjnVZXsikPv40z9a7xb2+vG0= 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 1761578352668842.2321159559398; Mon, 27 Oct 2025 08:19:12 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vDOtm-0002BH-7S; Mon, 27 Oct 2025 11:12:42 -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 1vDOtQ-0001tq-VQ for qemu-devel@nongnu.org; Mon, 27 Oct 2025 11:12:23 -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 1vDOtJ-0003e9-Ab for qemu-devel@nongnu.org; Mon, 27 Oct 2025 11:12:19 -0400 Received: from mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-208-gfCuw95fMzKFztQCjLgcgA-1; Mon, 27 Oct 2025 11:12:05 -0400 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 5A76E19541BE; Mon, 27 Oct 2025 15:12:02 +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 45F0A180057F; Mon, 27 Oct 2025 15:11:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761577927; 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=2xHw3hpnCoMP1RswkClFEptTsPa5ewLthiBoawt/yhI=; b=VmEHH9rLAM+d4hfhd9afxY8PpxJnx2XMtnhTLAcTzpknxPXWaybNR0KxsAMsKtf3DQecSU mcbasB5Dwjh+JigYEWWro3sE0korZQH2nS1yIW3VCew5bvIVfp7BucMaq/SGwt/LVISTIM /oOyFxfrIUt96HM9GdXh2Ku4oGJ3uoA= X-MC-Unique: gfCuw95fMzKFztQCjLgcgA-1 X-Mimecast-MFC-AGG-ID: gfCuw95fMzKFztQCjLgcgA_1761577922 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Alexandre Ratchov , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Jan Kiszka , "Michael S. Tsirkin" , Marcel Apfelbaum , Yanan Wang , Thomas Huth , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Gerd Hoffmann , Peter Maydell , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Eduardo Habkost , Manos Pitsidianakis , qemu-ppc@nongnu.org, Jiaxun Yang , Akihiko Odaki , =?UTF-8?q?Herv=C3=A9=20Poussineau?= , qemu-arm@nongnu.org, Alistair Francis , Zhao Liu , =?UTF-8?q?Volker=20R=C3=BCmelin?= , Christian Schoenebeck , Paolo Bonzini , "Edgar E. Iglesias" , BALATON Zoltan , Laurent Vivier Subject: [PATCH v3 10/35] audio: register backends in /audiodevs container Date: Mon, 27 Oct 2025 19:10:17 +0400 Message-ID: <20251027151045.2863176-11-marcandre.lureau@redhat.com> In-Reply-To: <20251027151045.2863176-1-marcandre.lureau@redhat.com> References: <20251027151045.2863176-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1761578355468154101 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.0 From nobody Thu Oct 30 15:35:56 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=1761578355; cv=none; d=zohomail.com; s=zohoarc; b=WCj1/CIAvLX61Sai8/elPvxS/vj46NRxxNuDhwJwH62FZtet1EkfREXEdBJYoN0ehRnY8cnP09LfuYVmQHOdSD3soaK6eKjO9w3wwrBpwxBV7swQhZhJRzfPeW7hhTgucjH2JV+U4bVhm52HIfBsb3BDPt+ANUHDZU9BRBfutjs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761578355; 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=AtyKwWInGjMQa13I0aU5SVdhFBc+UH3Hxc/0w9qjB3I=; b=QoopmdYho9U6IHCl93YAfpWU4gig/AJzlp2kjA+iMClghztdOOp1JwGDYMO1LZx9iJfUfiUB6zRFIg0SnLshvytrHVD85hD4k61Y9/DLnrb4v4IFtoGKGUauveYLdFtlC00zr0ue80Nc187S+Dp988kWU9kMK87oPoC/YnhQD/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 1761578355893781.2743234151671; Mon, 27 Oct 2025 08:19:15 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vDOtb-0001zq-R1; Mon, 27 Oct 2025 11:12:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vDOtS-0001uF-0A for qemu-devel@nongnu.org; Mon, 27 Oct 2025 11:12:24 -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 1vDOtO-0003hm-UX for qemu-devel@nongnu.org; Mon, 27 Oct 2025 11:12:21 -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-459-s-c1sNTQPju3TWLBjsdV5Q-1; Mon, 27 Oct 2025 11:12:12 -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 1378018001E4; Mon, 27 Oct 2025 15:12:09 +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 2755830001A2; Mon, 27 Oct 2025 15:12:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761577937; 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=AtyKwWInGjMQa13I0aU5SVdhFBc+UH3Hxc/0w9qjB3I=; b=RbZVqmyYqnR0NOkUrXBVf9xqjNUvJR+FH9FZ/ealwptT+MM/99ruOQNw1Rck57yvH4T31G NcHIV2n0QvGjgFbf/VBs1SswU1nmY+CH+Zmhk0xhqhhr/mz37YmyxRk+lUSJupIofPrbql 6HNkb0glqoq1fJ8q5nvquJF2kaYQ1rM= X-MC-Unique: s-c1sNTQPju3TWLBjsdV5Q-1 X-Mimecast-MFC-AGG-ID: s-c1sNTQPju3TWLBjsdV5Q_1761577929 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Alexandre Ratchov , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Jan Kiszka , "Michael S. Tsirkin" , Marcel Apfelbaum , Yanan Wang , Thomas Huth , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Gerd Hoffmann , Peter Maydell , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Eduardo Habkost , Manos Pitsidianakis , qemu-ppc@nongnu.org, Jiaxun Yang , Akihiko Odaki , =?UTF-8?q?Herv=C3=A9=20Poussineau?= , qemu-arm@nongnu.org, Alistair Francis , Zhao Liu , =?UTF-8?q?Volker=20R=C3=BCmelin?= , Christian Schoenebeck , Paolo Bonzini , "Edgar E. Iglesias" , BALATON Zoltan , Laurent Vivier Subject: [PATCH v3 11/35] audio: use /audiodevs QOM container Date: Mon, 27 Oct 2025 19:10:18 +0400 Message-ID: <20251027151045.2863176-12-marcandre.lureau@redhat.com> In-Reply-To: <20251027151045.2863176-1-marcandre.lureau@redhat.com> References: <20251027151045.2863176-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: 1761578357536154100 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.0 From nobody Thu Oct 30 15:35:56 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=1761578085; cv=none; d=zohomail.com; s=zohoarc; b=cJWpaxuFiAVReRWqtmIMeRt2yIbVOCO3pSDCFpo7k/JgDbCXz/KQ62nJw8tSW/x02Eqh9g1/0/FOYbSfQXGZHsaHPthZbu6NKMog6xjcI0wjpc57GdZhoNS797OY2Vub6YWPOiVXuioUFslfqI/DvbUk5vsCKmS10x1qT7horN8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761578085; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=DXHP6OdQkB89vcCyTKcDf3Nxv8JeBOGNotvi4AlxWwE=; b=X/gBIO/2dj3SMAxi436S8H7ya6pC6rCCVt04c55+JBPlXJy7HtiMJkbT0Q6Gh5wbu55UVrhvc1uXtmafq4LCnRvQUlzW6ntWZ2SBCtDP2wmQhdiEuImUdwdTVSv20sCDP0asSTRi8JHamX/AAmTHRnWSAR9ICWP5/lOg4VUymqY= 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 1761578085643524.2646500793813; Mon, 27 Oct 2025 08:14:45 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vDOtd-00023D-96; Mon, 27 Oct 2025 11:12:33 -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 1vDOtX-0001wW-Ml for qemu-devel@nongnu.org; Mon, 27 Oct 2025 11:12:29 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vDOtU-0003jj-TY for qemu-devel@nongnu.org; Mon, 27 Oct 2025 11:12:27 -0400 Received: from mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-47-Ncs5Km9fM8q6DtFBlj3cgw-1; Mon, 27 Oct 2025 11:12:18 -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-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id A6E3619560B6; Mon, 27 Oct 2025 15:12: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 54823180057C; Mon, 27 Oct 2025 15:12:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761577942; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=DXHP6OdQkB89vcCyTKcDf3Nxv8JeBOGNotvi4AlxWwE=; b=In5b6yyfAVV+Ft/8G1Jq5f2yfaFjHNtNYgSYloN4rfEwA+ovPJ05owxTll8sKqOew/Tfpc zLs1uIKhwzyx4DcFbs8pmIFfoxlF99WrG1nPHNq0AT43vVLuvrBPn2wzp4Fm6obBfmBKad F1mIY/0vJCc2y1aZQWhemMNT/EUfZMk= X-MC-Unique: Ncs5Km9fM8q6DtFBlj3cgw-1 X-Mimecast-MFC-AGG-ID: Ncs5Km9fM8q6DtFBlj3cgw_1761577934 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Alexandre Ratchov , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Jan Kiszka , "Michael S. Tsirkin" , Marcel Apfelbaum , Yanan Wang , Thomas Huth , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Gerd Hoffmann , Peter Maydell , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Eduardo Habkost , Manos Pitsidianakis , qemu-ppc@nongnu.org, Jiaxun Yang , Akihiko Odaki , =?UTF-8?q?Herv=C3=A9=20Poussineau?= , qemu-arm@nongnu.org, Alistair Francis , Zhao Liu , =?UTF-8?q?Volker=20R=C3=BCmelin?= , Christian Schoenebeck , Paolo Bonzini , "Edgar E. Iglesias" , BALATON Zoltan , Laurent Vivier Subject: [PATCH v3 12/35] audio/paaudio: remove needless return value Date: Mon, 27 Oct 2025 19:10:19 +0400 Message-ID: <20251027151045.2863176-13-marcandre.lureau@redhat.com> In-Reply-To: <20251027151045.2863176-1-marcandre.lureau@redhat.com> References: <20251027151045.2863176-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: 1761578088089158500 From: Marc-Andr=C3=A9 Lureau Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- audio/paaudio.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/audio/paaudio.c b/audio/paaudio.c index f3193b08c3..93030f3fc8 100644 --- a/audio/paaudio.c +++ b/audio/paaudio.c @@ -747,14 +747,13 @@ static void qpa_volume_in(HWVoiceIn *hw, Volume *vol) pa_threaded_mainloop_unlock(c->mainloop); } =20 -static int qpa_validate_per_direction_opts(Audiodev *dev, - AudiodevPaPerDirectionOptions *= pdo) +static void qpa_validate_per_direction_opts(Audiodev *dev, + AudiodevPaPerDirectionOptions = *pdo) { if (!pdo->has_latency) { pdo->has_latency =3D true; pdo->latency =3D 46440; } - return 1; } =20 /* common */ @@ -844,12 +843,8 @@ static void *qpa_audio_init(Audiodev *dev, Error **err= p) } } =20 - if (!qpa_validate_per_direction_opts(dev, popts->in)) { - return NULL; - } - if (!qpa_validate_per_direction_opts(dev, popts->out)) { - return NULL; - } + qpa_validate_per_direction_opts(dev, popts->in); + qpa_validate_per_direction_opts(dev, popts->out); =20 g =3D g_new0(paaudio, 1); server =3D popts->server; --=20 2.51.0 From nobody Thu Oct 30 15:35:56 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=1761578154; cv=none; d=zohomail.com; s=zohoarc; b=HkmiyGKbgVFbC/4HtOByRon9dr00pQ9bd71X21JmiuuxyY/okYkfDm9r6rnaQJ5VaxQZh3Ulxp8cksSytEKdTUsLGr0bCXXbJ+4nysf5iPkSDSNVOb1NhYGXFvmcnNOzJdM/H+GVhTf5MooQV01kZ7Ug8p7fqI5eF3ubV/tpPK8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761578154; 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=Ivw15n2eGgz0hbDON7Uymt7N26eR8ayKcunBK4tszNs=; b=GGIFJIn1tW42P7LH/utjdNrA3SqyFjQLtOt7xdFIXvl7YB3PE48c3YnQWHApz7Ty620N611prWnWdIpltfLrfR70rj19sDnjK+ge+6nzvD5FpGLbK7ykq4C5AhTnrTiXR8CvhALmJYPRb5lIwvO9mLGSDoqkb5ybU9hdF5lHN0I= 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 1761578154034346.36014766623543; Mon, 27 Oct 2025 08:15:54 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vDOti-00027M-GL; Mon, 27 Oct 2025 11:12: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 1vDOte-00023M-Nr for qemu-devel@nongnu.org; Mon, 27 Oct 2025 11:12: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 1vDOtb-0003l1-86 for qemu-devel@nongnu.org; Mon, 27 Oct 2025 11:12: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-245-Ttnqzm-RPi6ZxAjDGgXwBg-1; Mon, 27 Oct 2025 11:12:23 -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 B8ED31801359; Mon, 27 Oct 2025 15:12:20 +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 143CC30001A2; Mon, 27 Oct 2025 15:12:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761577947; 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=Ivw15n2eGgz0hbDON7Uymt7N26eR8ayKcunBK4tszNs=; b=ECC6hQ2thsnZ2sW3rlDl3h3EWPQ4xC4uiqO13ezXFCmQZbfJSbnzUeKJJN2CO2QGD4Jw3+ q+NjR0LovLd9bYgKVDleB23y/QERqi7WS1K2iTyjr3UWS+DDgj2GaBT7SPN7NEIvBcySxO qQG4fVpQbYGuSGKT9hBnx5HoX/ObwGE= X-MC-Unique: Ttnqzm-RPi6ZxAjDGgXwBg-1 X-Mimecast-MFC-AGG-ID: Ttnqzm-RPi6ZxAjDGgXwBg_1761577940 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Alexandre Ratchov , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Jan Kiszka , "Michael S. Tsirkin" , Marcel Apfelbaum , Yanan Wang , Thomas Huth , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Gerd Hoffmann , Peter Maydell , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Eduardo Habkost , Manos Pitsidianakis , qemu-ppc@nongnu.org, Jiaxun Yang , Akihiko Odaki , =?UTF-8?q?Herv=C3=A9=20Poussineau?= , qemu-arm@nongnu.org, Alistair Francis , Zhao Liu , =?UTF-8?q?Volker=20R=C3=BCmelin?= , Christian Schoenebeck , Paolo Bonzini , "Edgar E. Iglesias" , BALATON Zoltan , Laurent Vivier Subject: [PATCH v3 13/35] audio/dsound: simplify init() Date: Mon, 27 Oct 2025 19:10:20 +0400 Message-ID: <20251027151045.2863176-14-marcandre.lureau@redhat.com> In-Reply-To: <20251027151045.2863176-1-marcandre.lureau@redhat.com> References: <20251027151045.2863176-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: 1761578161011158500 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.0 From nobody Thu Oct 30 15:35:56 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=1761578010; cv=none; d=zohomail.com; s=zohoarc; b=PXQ13mAT9W4zFajQCsI8AdiYf0Lxx2miph4QKc6MShhulzLpnUI4kRdloPBNKwHa0Ys7Nw3CEmyY2jUxqqZYYKWTUXG+0gbncbCPSkWuTHJhZrOL0SKuKGc2+VGy7iYAAjQYDLLYQB8jh8bbqqCGsFO0Jwpe3/MjpVaUFXeU1jA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761578010; 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=iugCs/KFsO7Xi9wBOCZomWvOXkofmqkXLtgd0m071TE=; b=JifhYnriqbmfHP8IZe294fxIu9DBy9NfLRHtXIZ897B98I+unmgoARxHnWI0zbCWrCG8vvqthbFnFuw5sjqiUU6Adcmn7ToHiUMcMyRC26ts69K0SLYhbcTKiR8aBOqLn/A0r5BtRVpvKAfzSxE3ajNIw34EbasCr7bPPQK5ZpE= 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 1761578010628715.682562887944; Mon, 27 Oct 2025 08:13:30 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vDOtq-0002GD-GA; Mon, 27 Oct 2025 11:12: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 1vDOtm-0002CV-Sx for qemu-devel@nongnu.org; Mon, 27 Oct 2025 11:12:42 -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 1vDOte-0003nF-OG for qemu-devel@nongnu.org; Mon, 27 Oct 2025 11:12:42 -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-385-63q-7EJ-O_C-DZXOo5dPTA-1; Mon, 27 Oct 2025 11:12:29 -0400 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id CA478196F744; Mon, 27 Oct 2025 15:12:26 +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 37A36180057C; Mon, 27 Oct 2025 15:12:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761577953; 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=iugCs/KFsO7Xi9wBOCZomWvOXkofmqkXLtgd0m071TE=; b=JJfllnQRBC1w5oyYS6F6vs5y+S/5izKL3LzJUbu9dja0uL+lxKUIWvsmzF3Hl21cwIE8LF ydWa44IZH4bQ40+A1Zs/YLZIGCam4e2517CBfF9Mil0kvSRCK6ykOVU6fEbm5x7A5Maoz3 PLRt6iMH4UCQfEFd31sNGfNEg7giUWc= X-MC-Unique: 63q-7EJ-O_C-DZXOo5dPTA-1 X-Mimecast-MFC-AGG-ID: 63q-7EJ-O_C-DZXOo5dPTA_1761577946 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Alexandre Ratchov , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Jan Kiszka , "Michael S. Tsirkin" , Marcel Apfelbaum , Yanan Wang , Thomas Huth , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Gerd Hoffmann , Peter Maydell , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Eduardo Habkost , Manos Pitsidianakis , qemu-ppc@nongnu.org, Jiaxun Yang , Akihiko Odaki , =?UTF-8?q?Herv=C3=A9=20Poussineau?= , qemu-arm@nongnu.org, Alistair Francis , Zhao Liu , =?UTF-8?q?Volker=20R=C3=BCmelin?= , Christian Schoenebeck , Paolo Bonzini , "Edgar E. Iglesias" , BALATON Zoltan , Laurent Vivier Subject: [PATCH v3 14/35] audio/dsound: report init error via **errp Date: Mon, 27 Oct 2025 19:10:21 +0400 Message-ID: <20251027151045.2863176-15-marcandre.lureau@redhat.com> In-Reply-To: <20251027151045.2863176-1-marcandre.lureau@redhat.com> References: <20251027151045.2863176-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: 1761578011373158500 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.0 From nobody Thu Oct 30 15:35:56 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=1761578008; cv=none; d=zohomail.com; s=zohoarc; b=cF4vF5kSUhTdOIdbbxS4VlKhPBE1hI2N9OxG/14f/0kTK9xVg4JR3l2uILiHCTuquvmJ5k62E63uJ0MKNwKGo2f+iuZHwbBQ3XfADIZRsAx4Vf+VSJ952AifhC9DFDl9xetjQ7gMRYVcxDZw35bhMjEwed6Ok/ENPHsYH+wrS7s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761578008; 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=bTy2XfZWTNI82gqO1J9/Iw7lCvmW6GYnD3wFkHlzY5o=; b=Kx0UjpKyAD4HQjbMfl5abfPBJmDOqBuwnWaFAPOqGR/3B7kmTTHGY7C6fWuNCdfoM6eGSE+Letl0jIFp1NTodit/IdZex7x0HyNImpqV3a08AudLYh+DIwkQu3PK97E/oerN6nCiO30moatRAdkwiG647NMeODH2q7eKDbYO74U= 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 1761578008768114.08732403023498; Mon, 27 Oct 2025 08:13:28 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vDOtx-0002ST-4R; Mon, 27 Oct 2025 11:12:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vDOts-0002LV-QP for qemu-devel@nongnu.org; Mon, 27 Oct 2025 11:12:48 -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 1vDOtn-0003ok-BF for qemu-devel@nongnu.org; Mon, 27 Oct 2025 11:12:48 -0400 Received: from mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-657-uCZb4dcaMdGk6389T5s3pA-1; Mon, 27 Oct 2025 11:12:37 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 214421956095; Mon, 27 Oct 2025 15:12: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 6A49830001A2; Mon, 27 Oct 2025 15:12:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761577960; 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=bTy2XfZWTNI82gqO1J9/Iw7lCvmW6GYnD3wFkHlzY5o=; b=M+Krkmmtzc6wiT6cWT8DNSHafuUB+5LJ3YKiGMAw8T4LCLObMRgg6tQtafxhwzbix8tVLI pp7dLGTtUTnRsUzrHlbPAqtf8KFLjLqxCEl42RSGD0yj99PRrG1b/1FmmdT9icfPOIPVah Gx3pukNyPu6FbPdZSQdE/+uogo/a8Ho= X-MC-Unique: uCZb4dcaMdGk6389T5s3pA-1 X-Mimecast-MFC-AGG-ID: uCZb4dcaMdGk6389T5s3pA_1761577953 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Alexandre Ratchov , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Jan Kiszka , "Michael S. Tsirkin" , Marcel Apfelbaum , Yanan Wang , Thomas Huth , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Gerd Hoffmann , Peter Maydell , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Eduardo Habkost , Manos Pitsidianakis , qemu-ppc@nongnu.org, Jiaxun Yang , Akihiko Odaki , =?UTF-8?q?Herv=C3=A9=20Poussineau?= , qemu-arm@nongnu.org, Alistair Francis , Zhao Liu , =?UTF-8?q?Volker=20R=C3=BCmelin?= , Christian Schoenebeck , Paolo Bonzini , "Edgar E. Iglesias" , BALATON Zoltan , Laurent Vivier Subject: [PATCH v3 15/35] audio: simplify audio_driver_init() Date: Mon, 27 Oct 2025 19:10:22 +0400 Message-ID: <20251027151045.2863176-16-marcandre.lureau@redhat.com> In-Reply-To: <20251027151045.2863176-1-marcandre.lureau@redhat.com> References: <20251027151045.2863176-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: 1761578009155158500 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.0 From nobody Thu Oct 30 15:35:56 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=1761578119; cv=none; d=zohomail.com; s=zohoarc; b=bqOczPV5yJs8hIxTDSXFN1+hVVHVmTlhC2Xim3vg2Fg0ZPBAY8jW78sF1KDxG6bFEe2xdDZU9cWaHM4PcnMDrUOw0HlPYrnG9VkmxTjCLxqZqPZJDZlU3uwIDxkvDw7gFOTQetyJ1bjY7NCgmsH0GGhQ1pAR9nNVxhRkSKJvvtA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761578119; 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=NyK7D/H1Qi5xmEtGl32oA++O1kygrS8pRPRLpmHg6Pw=; b=WqnwNXUyHH+MkAAOk8Uax9BXYRIdVlKyRGTHB9GDWkcS4aZlHKVt2JsJGnxUiRPmtu0eFdIOi0efgagV/nqoTbuBnFhHQ7/SV/Bynu4e2T4iF5BrHU0tK9XGX8Pn2MV8ru3cFYDMJ5Ybxc7cqNhXkl+m0ujgrGr12OiC06SnkmU= 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 1761578119835125.5783085435595; Mon, 27 Oct 2025 08:15:19 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vDOu4-0002gp-75; Mon, 27 Oct 2025 11:13:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vDOu1-0002XU-1q for qemu-devel@nongnu.org; Mon, 27 Oct 2025 11:12: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 1vDOtv-0003pp-M2 for qemu-devel@nongnu.org; Mon, 27 Oct 2025 11:12: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-84-83Bee93fMxquqzuo45yFDw-1; Mon, 27 Oct 2025 11:12:43 -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 2A8FB180035A; Mon, 27 Oct 2025 15:12:39 +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 97A7E180035A; Mon, 27 Oct 2025 15:12:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761577967; 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=NyK7D/H1Qi5xmEtGl32oA++O1kygrS8pRPRLpmHg6Pw=; b=jPht8+y66+mP7esigBA2nSQxVNOpi62DpYjbyUccRVwFRnm/m8JCMR4xNZU0fnAJMhMGAl NTqsSHH3/SN5SnxShc2RfVbjumLs6sW5ujpFvsO776Mv5FxozEiUqZnBUgp/hEvOVrciPg TXKKukDD3me/Wa3kMH3LZggEXuwmp3g= X-MC-Unique: 83Bee93fMxquqzuo45yFDw-1 X-Mimecast-MFC-AGG-ID: 83Bee93fMxquqzuo45yFDw_1761577959 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Alexandre Ratchov , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Jan Kiszka , "Michael S. Tsirkin" , Marcel Apfelbaum , Yanan Wang , Thomas Huth , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Gerd Hoffmann , Peter Maydell , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Eduardo Habkost , Manos Pitsidianakis , qemu-ppc@nongnu.org, Jiaxun Yang , Akihiko Odaki , =?UTF-8?q?Herv=C3=A9=20Poussineau?= , qemu-arm@nongnu.org, Alistair Francis , Zhao Liu , =?UTF-8?q?Volker=20R=C3=BCmelin?= , Christian Schoenebeck , Paolo Bonzini , "Edgar E. Iglesias" , BALATON Zoltan , Laurent Vivier Subject: [PATCH v3 16/35] audio: move period tick initialization Date: Mon, 27 Oct 2025 19:10:23 +0400 Message-ID: <20251027151045.2863176-17-marcandre.lureau@redhat.com> In-Reply-To: <20251027151045.2863176-1-marcandre.lureau@redhat.com> References: <20251027151045.2863176-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=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: 1761578149072154100 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.0 From nobody Thu Oct 30 15:35:56 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=1761578292; cv=none; d=zohomail.com; s=zohoarc; b=kIhwNxuTcb1j+BLEv2+IGUZlHcx6a8RMUAK6ymrRRlFOWsnHjMMfnCtvdJFtRDHJlsrBWdWVylwzoFjF6xRHYXF0MODCubnSTfEY2J2Q/NPJVL+UEdXN1A5h3zk72is6tBMr5T+xl3uRETjnIdpyFVODjPPVTy8T402p4KVSs30= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761578292; 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=8Ydx6IlNLHpAefOhucwylgf3AM/R/vQp3X7l3bKcRpM=; b=NahaMQ5yT1yUng16FkFYvR85YyRC5hsXm874q+LhpIp8uPysVh1Xj8aqAF6GBSdJ3ivGpgzCLp+hoNagtXUzm94gVhSdsdVorZ9o4RXumQ+N+psj06TyMJV8i2KIiOezhlKff4As5t6MZ4uDR2bgwpamYlVN8UHoEBeaINjXbmQ= 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 17615782922091000.2134034727992; Mon, 27 Oct 2025 08:18:12 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vDOuC-0002pz-4L; Mon, 27 Oct 2025 11:13:08 -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 1vDOu5-0002mV-86 for qemu-devel@nongnu.org; Mon, 27 Oct 2025 11:13:01 -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 1vDOtx-0003rY-Ok for qemu-devel@nongnu.org; Mon, 27 Oct 2025 11:13: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-534-BZXhMbivNK-adCzOEY0Uvw-1; Mon, 27 Oct 2025 11:12:48 -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 805EB1956096; Mon, 27 Oct 2025 15:12: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 EB2291800577; Mon, 27 Oct 2025 15:12:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761577972; 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=8Ydx6IlNLHpAefOhucwylgf3AM/R/vQp3X7l3bKcRpM=; b=hN5hHK3hEQLZjX/IyUoRi9WIDLAAw5iFxk+0sHDSVsqOwU5OUXtmSX3uWSk5xdzkRKwN+t Cx0Cv3G5OfXcWoHMRYb5QGYs5qhWyw+m5J3f9IVwuPxwOJVNCuohN2sQmvqzjH32LZg4Ns esBRAQTsrtBV+T0xk6D6NoUxEhtnEVQ= X-MC-Unique: BZXhMbivNK-adCzOEY0Uvw-1 X-Mimecast-MFC-AGG-ID: BZXhMbivNK-adCzOEY0Uvw_1761577965 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Alexandre Ratchov , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Jan Kiszka , "Michael S. Tsirkin" , Marcel Apfelbaum , Yanan Wang , Thomas Huth , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Gerd Hoffmann , Peter Maydell , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Eduardo Habkost , Manos Pitsidianakis , qemu-ppc@nongnu.org, Jiaxun Yang , Akihiko Odaki , =?UTF-8?q?Herv=C3=A9=20Poussineau?= , qemu-arm@nongnu.org, Alistair Francis , Zhao Liu , =?UTF-8?q?Volker=20R=C3=BCmelin?= , Christian Schoenebeck , Paolo Bonzini , "Edgar E. Iglesias" , BALATON Zoltan , Laurent Vivier Subject: [PATCH v3 17/35] audio: drop needless error message Date: Mon, 27 Oct 2025 19:10:24 +0400 Message-ID: <20251027151045.2863176-18-marcandre.lureau@redhat.com> In-Reply-To: <20251027151045.2863176-1-marcandre.lureau@redhat.com> References: <20251027151045.2863176-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1761578296745158500 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.0 From nobody Thu Oct 30 15:35:56 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=1761578127; cv=none; d=zohomail.com; s=zohoarc; b=KxXi3/5j0YhobJIVrXS0xb3p89Cn78Ck/iorbSOrvoxfHgGa23XhfTP+5HNmPuuY2/S9hSPJ/cXjN/7Ludy6jqCfJ3lu91PX6rFCx6Pdy3putrGke0Hg3YT/buDh5DOibAPwG8x8D49mHsybCjTBUitsbF4jArC0sJINNk87fLA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761578127; 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=bOSLgVjPHdUB2gwynsz2wfdB4MYIe7lJk7NeWho0Ry8=; b=JNztjC9AelfWz0yaONlKAPL/fcR8Gq7EXoD5kMgSD7tIaN5fL3mFRt9XKjEOr9lKIkQE8Gb2FhoNRy83kYQF26AUWUTGiL7q3VBxGi/4ulWLVFSrxEjvmsxQPNV+lAFj07cAWVIy0inebkmZbHK7mDVLt2BCR724Ya5lgw52pmk= 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 1761578127677819.9890288778843; Mon, 27 Oct 2025 08:15:27 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vDOuL-00036L-PQ; Mon, 27 Oct 2025 11:13: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 1vDOuI-00032T-Dz for qemu-devel@nongnu.org; Mon, 27 Oct 2025 11:13:14 -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 1vDOuE-0003sk-44 for qemu-devel@nongnu.org; Mon, 27 Oct 2025 11:13:14 -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-381-eeISw9_WM4OFG4hsHH-W2A-1; Mon, 27 Oct 2025 11:12: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-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id D64E81800451; Mon, 27 Oct 2025 15:12: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 01E771955F1B; Mon, 27 Oct 2025 15:12:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761577978; 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=bOSLgVjPHdUB2gwynsz2wfdB4MYIe7lJk7NeWho0Ry8=; b=i55zmZ343wrN+oa1BCtInnTTih85lHHy4JXr+OQMyMIQ3itHJ2x/BU3vHI1+OnKMK46Izv mqiqjVicwwr/zaIyx6q80NO7QjLsTrtk519C1lCAQ6hkNRIH+ndgCj9fHEzI7TsFQHoNEj /tSTou+PbbONK9tb0JWHEr023ngUfXM= X-MC-Unique: eeISw9_WM4OFG4hsHH-W2A-1 X-Mimecast-MFC-AGG-ID: eeISw9_WM4OFG4hsHH-W2A_1761577972 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Alexandre Ratchov , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Jan Kiszka , "Michael S. Tsirkin" , Marcel Apfelbaum , Yanan Wang , Thomas Huth , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Gerd Hoffmann , Peter Maydell , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Eduardo Habkost , Manos Pitsidianakis , qemu-ppc@nongnu.org, Jiaxun Yang , Akihiko Odaki , =?UTF-8?q?Herv=C3=A9=20Poussineau?= , qemu-arm@nongnu.org, Alistair Francis , Zhao Liu , =?UTF-8?q?Volker=20R=C3=BCmelin?= , Christian Schoenebeck , Paolo Bonzini , "Edgar E. Iglesias" , BALATON Zoltan , Laurent Vivier Subject: [PATCH v3 18/35] audio: keep vmstate handle with AudioState Date: Mon, 27 Oct 2025 19:10:25 +0400 Message-ID: <20251027151045.2863176-19-marcandre.lureau@redhat.com> In-Reply-To: <20251027151045.2863176-1-marcandre.lureau@redhat.com> References: <20251027151045.2863176-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=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: 1761578128541158500 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.0 From nobody Thu Oct 30 15:35:56 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=1761578484; cv=none; d=zohomail.com; s=zohoarc; b=JpAKCTKSJua+V3hKvkPTtNiG63VeQTakDroQfMH06bSeptNR93+tN5RH6QbXvJ0XkQ4wO3T4Vkj+iyCKAjAhcDNEsIVjMGEfttaR641fI0wgZ+tq113Ai9MsGWyNCdCpstrGKDvJMXo5bABWqZrUBnNi+fAdQoshOTslZJ46csg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761578484; 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=As73ehZGzDMA3+aR7WvD+QJm4w/pt+FCK4s6oAej+rQ=; b=Gq0QeE2kCLQU1RrYjCt53lvJMu84fyJmAw/v180siVurhNchOIOu4BCUx9pDIv27+EB8jj4HGLICgixDCNBJ+ccUo5b0SQASyKH9urSUYbtzw0N9GbaGXYcu5LZQJQ9/sEEYpsFgBCXTNEQqDas/qmTgt78WIKM3ZRTnyYh+XN0= 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 1761578484806663.2677368196811; Mon, 27 Oct 2025 08:21:24 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vDOuS-0003CU-AW; Mon, 27 Oct 2025 11:13:25 -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 1vDOuL-00037W-6J for qemu-devel@nongnu.org; Mon, 27 Oct 2025 11:13:17 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vDOuE-0003tq-TN for qemu-devel@nongnu.org; Mon, 27 Oct 2025 11:13:16 -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-110-CJLULtClPmWTl8308stZqA-1; Mon, 27 Oct 2025 11:13:00 -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 19613180121B; Mon, 27 Oct 2025 15:12:58 +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 9862C180035A; Mon, 27 Oct 2025 15:12:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761577984; 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=As73ehZGzDMA3+aR7WvD+QJm4w/pt+FCK4s6oAej+rQ=; b=Qe9rBIoExzbRchAvbH9/HP0plBtkMHV+jO1iJR4Grj4djYvIyaaaNd33SkIblqqvmhwM4L 8AMjyI90o7eIU/ffBuEBZkwPVgmHf0/FspIgoGt0q+qxGPZO70+YWb4Txa6/81hCMZUan+ P85oQizQSLsU3eT8zRQR6Ctl7Rr0mg0= X-MC-Unique: CJLULtClPmWTl8308stZqA-1 X-Mimecast-MFC-AGG-ID: CJLULtClPmWTl8308stZqA_1761577978 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Alexandre Ratchov , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Jan Kiszka , "Michael S. Tsirkin" , Marcel Apfelbaum , Yanan Wang , Thomas Huth , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Gerd Hoffmann , Peter Maydell , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Eduardo Habkost , Manos Pitsidianakis , qemu-ppc@nongnu.org, Jiaxun Yang , Akihiko Odaki , =?UTF-8?q?Herv=C3=A9=20Poussineau?= , qemu-arm@nongnu.org, Alistair Francis , Zhao Liu , =?UTF-8?q?Volker=20R=C3=BCmelin?= , Christian Schoenebeck , Paolo Bonzini , "Edgar E. Iglesias" , BALATON Zoltan , Laurent Vivier Subject: [PATCH v3 19/35] audio: register and unregister vmstate with AudioState Date: Mon, 27 Oct 2025 19:10:26 +0400 Message-ID: <20251027151045.2863176-20-marcandre.lureau@redhat.com> In-Reply-To: <20251027151045.2863176-1-marcandre.lureau@redhat.com> References: <20251027151045.2863176-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: 1761578487124154100 From: Marc-Andr=C3=A9 Lureau Proper lifecycle management with QOM state. Signed-off-by: Marc-Andr=C3=A9 Lureau --- audio/audio.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/audio/audio.c b/audio/audio.c index 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.0 From nobody Thu Oct 30 15:35:56 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=1761578091; cv=none; d=zohomail.com; s=zohoarc; b=nlbTqrub4vfq32XGtFdRMdZ8f3AZL0uFLZDsFAElKwCnUTU32fS4MbgLZv2yZV6G6sccqZDoaVFTRFQIS76kgq7LGwAlfOW9Nd3rqa8tOxtjenU0CUe2HTfrGrBnR/naxjjZcSe72xCIkzQLVGdPnSt3hKp4a4imSCokdqwoF4c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761578091; 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=ICokOjjJvkBhHEvSKhn1V4b+1D2ZTn5cRxBK+gf+D2U=; b=lzCEpw/bu/Iu6H7404jPwfr+3Pm+zn4pxEDtZP88W9GdbiwK7Kx7fAsqWEsgFfwsR2aUtdGJ5Sy0R4OC09V/oP3hQcuJOYBenpThmBr2H9EjQHYFMetgPc+yFJHVw1N23T8yNPcxtRVN8aoldwnXDJngM+Qq8LJNrp9pVTN7P6Y= 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 176157809167192.79304477146786; Mon, 27 Oct 2025 08:14:51 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vDOum-0003MA-Jo; Mon, 27 Oct 2025 11:13: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 1vDOuO-0003Ca-Fx for qemu-devel@nongnu.org; Mon, 27 Oct 2025 11:13:22 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vDOuG-0003uj-ED for qemu-devel@nongnu.org; Mon, 27 Oct 2025 11:13:20 -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-677-r3y8zLxeMxC3N3fSl7p2nQ-1; Mon, 27 Oct 2025 11:13:06 -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 0276E1956096; Mon, 27 Oct 2025 15:13:04 +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 93DE11955F1B; Mon, 27 Oct 2025 15:13:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761577988; 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=ICokOjjJvkBhHEvSKhn1V4b+1D2ZTn5cRxBK+gf+D2U=; b=JFrLk0CkZ1DwANaxKsa7GdAz3tWZwZTx/Mi7ZoUza8Keu2G6YB7PQ6gXnvPWsLst6eXKHY /87y0054/IdowNkk9UH8abMHxE+J1LvMZNn2xmKru3yGxISs0TTUAwRUTHEWO4XT0dNA7K XuyLfiaYmRoBWmd7lLuHy1jYwEP6rx8= X-MC-Unique: r3y8zLxeMxC3N3fSl7p2nQ-1 X-Mimecast-MFC-AGG-ID: r3y8zLxeMxC3N3fSl7p2nQ_1761577984 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Alexandre Ratchov , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Jan Kiszka , "Michael S. Tsirkin" , Marcel Apfelbaum , Yanan Wang , Thomas Huth , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Gerd Hoffmann , Peter Maydell , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Eduardo Habkost , Manos Pitsidianakis , qemu-ppc@nongnu.org, Jiaxun Yang , Akihiko Odaki , =?UTF-8?q?Herv=C3=A9=20Poussineau?= , qemu-arm@nongnu.org, Alistair Francis , Zhao Liu , =?UTF-8?q?Volker=20R=C3=BCmelin?= , Christian Schoenebeck , Paolo Bonzini , "Edgar E. Iglesias" , BALATON Zoltan , Laurent Vivier Subject: [PATCH v3 20/35] audio: initialize card_head during object init Date: Mon, 27 Oct 2025 19:10:27 +0400 Message-ID: <20251027151045.2863176-21-marcandre.lureau@redhat.com> In-Reply-To: <20251027151045.2863176-1-marcandre.lureau@redhat.com> References: <20251027151045.2863176-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=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: 1761578096180158500 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.0 From nobody Thu Oct 30 15:35:56 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=1761578354; cv=none; d=zohomail.com; s=zohoarc; b=bsLCzD5/PyiY+Q+R/7vBlWe1n9394Mcs3QWBqpVs/DVKU4GgS9H3cBibpS2qMyraGgjbTZ2OOr0E5Yz3GvuXX2UAjVjMRMRtsKALlRMahtZM6rq66p7uZdMFwlz7Qjmue0hulBjcQKd3uuLvc+uPMw0v4VgQZlim7O0bWmjMYKQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761578354; 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=6iLaV5sOzsrYZ2P/ISRx0e0VIrZYAK4Ckmnkuj06O+s=; b=jl1HJQvQHRKg60lcDCzKVA9eNhjxohlZN69DuyIXK2Xi9tj3nDFYQw+tJwQySF0xTETqVuZHjhaqc3fmo7UNFEZlxyhIm/nICtAjcwmDHp3nmlDzSILH9pNEsf3lMLV+ZJ35ue0b8Y/sIBQ1GsQ3IR/dgFD7HNPXQVWNbKZrVVg= 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 1761578354417185.98734140465945; Mon, 27 Oct 2025 08:19:14 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vDOv6-0003dK-Hx; Mon, 27 Oct 2025 11:14: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 1vDOub-0003M0-S5 for qemu-devel@nongnu.org; Mon, 27 Oct 2025 11:13:36 -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 1vDOuM-0003w8-UZ for qemu-devel@nongnu.org; Mon, 27 Oct 2025 11:13:32 -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-634-LT09HOJFPS2jzKHCjmy0TQ-1; Mon, 27 Oct 2025 11:13:13 -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 19530196E0B1; Mon, 27 Oct 2025 15:13:10 +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 9D30119560AD; Mon, 27 Oct 2025 15:13:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761577996; 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=6iLaV5sOzsrYZ2P/ISRx0e0VIrZYAK4Ckmnkuj06O+s=; b=hackpA2JMG+PWjvqpHmwuVurfJdnzMwqq7Bsjq4+oBVOeluXJsyoYxXkZ07Y7qpE+/BdYb dI67P6um5C5CI6HrBV5UqJ81c4JqgaegbYih1oyoB4yx87/zXO9eSBbmWaJsFfE31qy1WH kv1TUyDbhFp1Wh0Xn0Pj2dkv0izR9HY= X-MC-Unique: LT09HOJFPS2jzKHCjmy0TQ-1 X-Mimecast-MFC-AGG-ID: LT09HOJFPS2jzKHCjmy0TQ_1761577990 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Alexandre Ratchov , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Jan Kiszka , "Michael S. Tsirkin" , Marcel Apfelbaum , Yanan Wang , Thomas Huth , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Gerd Hoffmann , Peter Maydell , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Eduardo Habkost , Manos Pitsidianakis , qemu-ppc@nongnu.org, Jiaxun Yang , Akihiko Odaki , =?UTF-8?q?Herv=C3=A9=20Poussineau?= , qemu-arm@nongnu.org, Alistair Francis , Zhao Liu , =?UTF-8?q?Volker=20R=C3=BCmelin?= , Christian Schoenebeck , Paolo Bonzini , "Edgar E. Iglesias" , BALATON Zoltan , Laurent Vivier Subject: [PATCH v3 21/35] audio: remove some needless headers Date: Mon, 27 Oct 2025 19:10:28 +0400 Message-ID: <20251027151045.2863176-22-marcandre.lureau@redhat.com> In-Reply-To: <20251027151045.2863176-1-marcandre.lureau@redhat.com> References: <20251027151045.2863176-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=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: 1761578361562158500 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.0 From nobody Thu Oct 30 15:35:56 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=1761578492; cv=none; d=zohomail.com; s=zohoarc; b=APvuEaBV1rfIcB6UAYiNFBDZW8CePjGpQY6WeYgkdHkIsOgCpqtUvtPKugwLtFbxbS0D8US8DTLGZVBeU8MyjhIOXNetafIV/DQuEJuzCqP+9PuYm2xNlPYBeq2tideYD1IZS9zaUi+PSjr+whXvqJBtN6G7C0dp25yQr/YiNMg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761578492; 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=hy4r03TiVsWUDCEtGQ377AJr9mo6eZ99I30huexBd+o=; b=hQSHfY4gh2aIJxlJ53y28C1tD6Fnw6+IAGqMZV/r/Nfe/vOOmMlr0wihMSQZQQaVd+yXOyZHLPwTNvjPqKjZT2mliTh2vZMHSZgL+wh2Gzc/zaxAD1+fvGLwBSeFVm/R2do8JwDS9Acd1B2R0FqJgo1UivkujOmhKFQxBeYU41A= 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 1761578492290990.4648751718801; Mon, 27 Oct 2025 08:21:32 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vDOva-0004Tw-Vh; Mon, 27 Oct 2025 11:14: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 1vDOuo-0003Ri-OA for qemu-devel@nongnu.org; Mon, 27 Oct 2025 11:13: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 1vDOuY-0003x3-9H for qemu-devel@nongnu.org; Mon, 27 Oct 2025 11:13:41 -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-503-DsO2r2GTNOaUEM264E1qjQ-1; Mon, 27 Oct 2025 11:13:19 -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 760801956096; Mon, 27 Oct 2025 15:13:16 +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 76B1330001A2; Mon, 27 Oct 2025 15:13:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761578004; 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=hy4r03TiVsWUDCEtGQ377AJr9mo6eZ99I30huexBd+o=; b=ec3QuFgbU5AJmUfqnnzqqrwmay2OLeh7+nl4q3wj7x357UtMU1F6jC87yWwXLNfQVTah74 bduEMUkoqOef2iLQSqLLMzQ1/hS58AjoruqM/kIB1cxnex+AkPr9GRiOdxMIIZ5zYDYHd9 YYsiBn+zVJnWqxCYSSOXv7opP8gnwu0= X-MC-Unique: DsO2r2GTNOaUEM264E1qjQ-1 X-Mimecast-MFC-AGG-ID: DsO2r2GTNOaUEM264E1qjQ_1761577996 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Alexandre Ratchov , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Jan Kiszka , "Michael S. Tsirkin" , Marcel Apfelbaum , Yanan Wang , Thomas Huth , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Gerd Hoffmann , Peter Maydell , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Eduardo Habkost , Manos Pitsidianakis , qemu-ppc@nongnu.org, Jiaxun Yang , Akihiko Odaki , =?UTF-8?q?Herv=C3=A9=20Poussineau?= , qemu-arm@nongnu.org, Alistair Francis , Zhao Liu , =?UTF-8?q?Volker=20R=C3=BCmelin?= , Christian Schoenebeck , Paolo Bonzini , "Edgar E. Iglesias" , BALATON Zoltan , Laurent Vivier Subject: [PATCH v3 22/35] audio: remove AUDIO_HOST_ENDIANNESS Date: Mon, 27 Oct 2025 19:10:29 +0400 Message-ID: <20251027151045.2863176-23-marcandre.lureau@redhat.com> In-Reply-To: <20251027151045.2863176-1-marcandre.lureau@redhat.com> References: <20251027151045.2863176-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=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: 1761578495210154100 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.0 From nobody Thu Oct 30 15:35:56 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=1761578454; cv=none; d=zohomail.com; s=zohoarc; b=YsXjlt9r9IAI/NZlN9dWDecSqqpK47/8MQmDuBojbjRHQ9PBH1LT161IlWSDA2mVF8+EFRCba50a+QX+ZNOUF9xoZg6LPw50BQFQhdzT6ub60NaDJJYmsLDSnTa65imhUBXfdj4tXjWHeGEJ57uMoa4+Pb39UlYzFabOEDzRnsI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761578454; 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=B5TpZOrKCJAWhsmyWhlOrTtSmB3kr2UvFtMNw43ySaA=; b=kCgEdW/bcRpLWlxZWhxhFqjWvGyO8kyIYp6v89lRnRWbKfaNpSfLvwJ4e6Ll5r1r7jZIcuk1izGXwNrzB1+EWC5g1tZnu5tFRrLmhyQDcHN036+uV9PQ6bYe5iCvMo4rjYpjowgmBNAWv2p7jsRKQJrbSlwA+85SobX5KgXG+ro= 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 1761578454066967.3232778349864; Mon, 27 Oct 2025 08:20:54 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vDOvR-0004Eb-B8; Mon, 27 Oct 2025 11:14: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 1vDOv9-0003jw-9f for qemu-devel@nongnu.org; Mon, 27 Oct 2025 11:14:08 -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 1vDOuo-0003xk-Gh for qemu-devel@nongnu.org; Mon, 27 Oct 2025 11:14:05 -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-674-GMqR_3u-Nj2F2cHHTrKvUQ-1; Mon, 27 Oct 2025 11:13:27 -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-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 37F0C19560AD; Mon, 27 Oct 2025 15:13:22 +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 CA79B19560AD; Mon, 27 Oct 2025 15:13:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761578010; 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=B5TpZOrKCJAWhsmyWhlOrTtSmB3kr2UvFtMNw43ySaA=; b=R21LcOntZc5A/i/BzYVIh37lI3Vzto2VShjwV5Bh7OfzE3J6fcBwHlmpUcnHeYE7jl1uVF Efk+ABNuYdbliRa75AqnwtM4sdWuAeHDGGbwOLzM75qxw8qc9Z/yJ8R22p80piJ1mcBtpr COYoH/akDYfj6RN3NWCMZABWv7/n3Rs= X-MC-Unique: GMqR_3u-Nj2F2cHHTrKvUQ-1 X-Mimecast-MFC-AGG-ID: GMqR_3u-Nj2F2cHHTrKvUQ_1761578002 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Alexandre Ratchov , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Jan Kiszka , "Michael S. Tsirkin" , Marcel Apfelbaum , Yanan Wang , Thomas Huth , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Gerd Hoffmann , Peter Maydell , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Eduardo Habkost , Manos Pitsidianakis , qemu-ppc@nongnu.org, Jiaxun Yang , Akihiko Odaki , =?UTF-8?q?Herv=C3=A9=20Poussineau?= , qemu-arm@nongnu.org, Alistair Francis , Zhao Liu , =?UTF-8?q?Volker=20R=C3=BCmelin?= , Christian Schoenebeck , Paolo Bonzini , "Edgar E. Iglesias" , BALATON Zoltan , Laurent Vivier Subject: [PATCH v3 23/35] audio: introduce AUD_set_volume_{in,out}_lr() Date: Mon, 27 Oct 2025 19:10:30 +0400 Message-ID: <20251027151045.2863176-24-marcandre.lureau@redhat.com> In-Reply-To: <20251027151045.2863176-1-marcandre.lureau@redhat.com> References: <20251027151045.2863176-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: 1761578456729154100 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.0 From nobody Thu Oct 30 15:35:56 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=1761578317; cv=none; d=zohomail.com; s=zohoarc; b=LMNTLbrHfBV0/gi8nLV8zLC3jsFeRgWebaS1SWtfmGfMSJDKKwpZXhBJTSxuF4WL35FQXJvr9YXcWIfpzcQOS40g2h9rD651KjBuVmPNfn2blH6QBWI7s4Tkk3xJuQ2IYiFuVUyC4mF2u2yKk2VFN2W3xJA5HEEshoHoyxWNGKk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761578317; 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=gOiGaNU1LEt6neU8d+Ay12Sjg5sFJrZ5dv6v4rlkU7s=; b=Zbru2nQRRCZRDkKGTBSXJsLB9cqnI0WoOLwcTN+5rOKotckVFXQAtrGkz4E61zZc52ydJuilHyKvaooXKfVka6YPZGE5gixFj8qD3le5r9v6KnbziDO/9I3M4ZtLQBbVa7Ie9/lZuwYtvXBnPvMZH3uIj7keA9IRIexOkKPDUjU= 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 1761578317776101.12295256220557; Mon, 27 Oct 2025 08:18:37 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vDOvY-0004Hi-N3; Mon, 27 Oct 2025 11:14:33 -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 1vDOv4-0003dm-PT for qemu-devel@nongnu.org; Mon, 27 Oct 2025 11:14:04 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vDOuo-0003yG-JE for qemu-devel@nongnu.org; Mon, 27 Oct 2025 11:14:00 -0400 Received: from mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-204-IRhvZ2tHPaKL3HhJTyZBdA-1; Mon, 27 Oct 2025 11:13:33 -0400 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 5E96919560B5; Mon, 27 Oct 2025 15:13:30 +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 A2BAF19540EB; Mon, 27 Oct 2025 15:13:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761578016; 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=gOiGaNU1LEt6neU8d+Ay12Sjg5sFJrZ5dv6v4rlkU7s=; b=OvgDgTjoRqYaK9aZMKfAVJawWNVGu1tp+s8E7UCsgIyg4nCmUUTh5tbQ0Tni52guRCVnHz 5YzeaWL30wgghrKmYBRz5LQfP0XDKY4pqwv/AoT4dE4UV7FWLYfILxrY+myVvnF59uYH3P FtCvjAJMW8KqxCBFV1WbAY7ghRF2ZqA= X-MC-Unique: IRhvZ2tHPaKL3HhJTyZBdA-1 X-Mimecast-MFC-AGG-ID: IRhvZ2tHPaKL3HhJTyZBdA_1761578010 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Alexandre Ratchov , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Jan Kiszka , "Michael S. Tsirkin" , Marcel Apfelbaum , Yanan Wang , Thomas Huth , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Gerd Hoffmann , Peter Maydell , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Eduardo Habkost , Manos Pitsidianakis , qemu-ppc@nongnu.org, Jiaxun Yang , Akihiko Odaki , =?UTF-8?q?Herv=C3=A9=20Poussineau?= , qemu-arm@nongnu.org, Alistair Francis , Zhao Liu , =?UTF-8?q?Volker=20R=C3=BCmelin?= , Christian Schoenebeck , Paolo Bonzini , "Edgar E. Iglesias" , BALATON Zoltan , Laurent Vivier Subject: [PATCH v3 24/35] audio/replay: fix type punning Date: Mon, 27 Oct 2025 19:10:31 +0400 Message-ID: <20251027151045.2863176-25-marcandre.lureau@redhat.com> In-Reply-To: <20251027151045.2863176-1-marcandre.lureau@redhat.com> References: <20251027151045.2863176-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1761578319158154100 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.0 From nobody Thu Oct 30 15:35:56 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=1761578541; cv=none; d=zohomail.com; s=zohoarc; b=LRdLW8if6QOph3nB4cKZ3I1FbSUGFUOzcoYjjXJxf6sBM91JojrrP6bAYYyYOGRx6wdGgILM6A5SqFUXGeOcKtPMRhf8cAqE+1aO29CwYvgl8bs6YaKI4Y0o1+iv1AdIIwMzyLP5e46c7Dj/XmXYKKdEzfdV5/jWZcRARfhCXrs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761578541; 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=SjdZwH9zgieCYcFtuqyVlNQ4c4s0sJqI/ew69G8MOdY=; b=KHdX7opX5ZW/gmXrCF5oSqiBysR4K9xAW9BHry2pULf9xoaym6ATF2icSnWXWwHwrdMU1u/yHyVQTuDcOXaAuCNnz8WJwPdEYVUrIEF2x+SwQE1hxCehc2FeHtn3L/v70G5di50irbwbQVbfKb/qvHQfBxnjjYXOvQjP2Fs/X/A= 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 1761578541495865.393318764596; Mon, 27 Oct 2025 08:22:21 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vDOve-0004fh-7v; Mon, 27 Oct 2025 11:14: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 1vDOvQ-0004HU-OJ for qemu-devel@nongnu.org; Mon, 27 Oct 2025 11:14:27 -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 1vDOv5-0003z5-Lz for qemu-devel@nongnu.org; Mon, 27 Oct 2025 11:14:20 -0400 Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-57-UujwCvy4MYeqdp3j8szHmA-1; Mon, 27 Oct 2025 11:13:44 -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 6EFCC1834512; Mon, 27 Oct 2025 15:13:36 +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 D0DEA180057E; Mon, 27 Oct 2025 15:13:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761578027; 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=SjdZwH9zgieCYcFtuqyVlNQ4c4s0sJqI/ew69G8MOdY=; b=FMxCS4hGA6wKzU1N8CWr9gbq36APKz3SJVL8sbnWtA+KUcysFCiWruoq+0QLTUZY/uzpNn xIcUP9I6ed0kmFna6GHzXEPRZnEZzs3iezbzjW8/HDnyFsqY2fzgJvARYtlC/hkOHoNnyY MwxGp5UPuBVWQTi2Qv85hVOJu+y9U1g= X-MC-Unique: UujwCvy4MYeqdp3j8szHmA-1 X-Mimecast-MFC-AGG-ID: UujwCvy4MYeqdp3j8szHmA_1761578020 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Alexandre Ratchov , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Jan Kiszka , "Michael S. Tsirkin" , Marcel Apfelbaum , Yanan Wang , Thomas Huth , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Gerd Hoffmann , Peter Maydell , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Eduardo Habkost , Manos Pitsidianakis , qemu-ppc@nongnu.org, Jiaxun Yang , Akihiko Odaki , =?UTF-8?q?Herv=C3=A9=20Poussineau?= , qemu-arm@nongnu.org, Alistair Francis , Zhao Liu , =?UTF-8?q?Volker=20R=C3=BCmelin?= , Christian Schoenebeck , Paolo Bonzini , "Edgar E. Iglesias" , BALATON Zoltan , Laurent Vivier Subject: [PATCH v3 25/35] audio: move internal APIs to audio_int.h Date: Mon, 27 Oct 2025 19:10:32 +0400 Message-ID: <20251027151045.2863176-26-marcandre.lureau@redhat.com> In-Reply-To: <20251027151045.2863176-1-marcandre.lureau@redhat.com> References: <20251027151045.2863176-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=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: 1761578543829154100 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.0 From nobody Thu Oct 30 15:35:56 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=1761578479; cv=none; d=zohomail.com; s=zohoarc; b=ZOnDlEXsFdXVQb+jlDB2ZvlPGCYd8gmFuLjQ7FJ0tJN00+9bYMsr+QA6075n83QufJPPYNMeIegdiI5otfKMZVasmnsgKws137LneJ3FxzIdiEftNrtLuITm0lWZkx2ua9q7kJgWktMTZGP4GHhw7jD0SjieI1k2KQrpspNS6L8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761578479; 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=/psHEgf+aO3hHN5q3jbf/JtBqQzOgFo+DVlniZPsS5I=; b=Oa0sDwsj92ZbpCExbohfdt+Gh+ciToRi27LYTK96UfE+EOBf2I8CetaKmVsSlToFsksA/QWagKggacHMY7tZy61bh2uC6WlHe5QSsfYyDOCQqGUqWma/3R74BGC3N/6E/Uc6d7nHY0d5JKco7U2inHPKGUUemMpIvuanjFoBDjE= 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 1761578479438606.9397548249506; Mon, 27 Oct 2025 08:21:19 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vDOvc-0004Vq-FR; Mon, 27 Oct 2025 11:14:36 -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 1vDOvJ-0004Dm-WA for qemu-devel@nongnu.org; Mon, 27 Oct 2025 11:14:18 -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 1vDOuy-0003zC-9Q for qemu-devel@nongnu.org; Mon, 27 Oct 2025 11:14:17 -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-RPlU5UkYMemC3M7WFj-kfA-1; Mon, 27 Oct 2025 11:13:46 -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 A910018002E4; Mon, 27 Oct 2025 15:13: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 EBB6C19540EB; Mon, 27 Oct 2025 15:13:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761578029; 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=/psHEgf+aO3hHN5q3jbf/JtBqQzOgFo+DVlniZPsS5I=; b=g0pkTAZ5gLqDTlRN0HO1MLAvQ865162R5ADB24CgMoKmYuuG90r19e6z+kEV1xbmALaJ+a U6MbJYWWUcS5EnlXJELPfv8sJL0zVEvCPgC6ZPcOEUBhMMh0IXgPg2XFA8v6/VOIRzusCm qEtB/dt14Bu/cF5sFSYDI3JUztgKPUE= X-MC-Unique: RPlU5UkYMemC3M7WFj-kfA-1 X-Mimecast-MFC-AGG-ID: RPlU5UkYMemC3M7WFj-kfA_1761578022 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Alexandre Ratchov , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Jan Kiszka , "Michael S. Tsirkin" , Marcel Apfelbaum , Yanan Wang , Thomas Huth , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Gerd Hoffmann , Peter Maydell , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Eduardo Habkost , Manos Pitsidianakis , qemu-ppc@nongnu.org, Jiaxun Yang , Akihiko Odaki , =?UTF-8?q?Herv=C3=A9=20Poussineau?= , qemu-arm@nongnu.org, Alistair Francis , Zhao Liu , =?UTF-8?q?Volker=20R=C3=BCmelin?= , Christian Schoenebeck , Paolo Bonzini , "Edgar E. Iglesias" , BALATON Zoltan , Laurent Vivier Subject: [PATCH v3 26/35] audio: rename AudioState -> AudioBackend Date: Mon, 27 Oct 2025 19:10:33 +0400 Message-ID: <20251027151045.2863176-27-marcandre.lureau@redhat.com> In-Reply-To: <20251027151045.2863176-1-marcandre.lureau@redhat.com> References: <20251027151045.2863176-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=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: 1761578481202154100 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 1f810b7ddf..c83a52fc62 100644 --- a/hw/core/qdev-properties-system.c +++ b/hw/core/qdev-properties-system.c @@ -499,16 +499,16 @@ static void set_audiodev(Object *obj, Visitor *v, con= st char* name, { const Property *prop =3D opaque; QEMUSoundCard *card =3D object_field_prop_ptr(obj, prop); - AudioState *state; + AudioBackend *state; g_autofree char *str =3D NULL; =20 if (!visit_type_str(v, name, &str, errp)) { return; } =20 - state =3D audio_state_by_name(str, errp); + state =3D audio_be_by_name(str, errp); if (state) { - card->state =3D state; + card->be =3D state; } } =20 diff --git a/ui/dbus.c b/ui/dbus.c index dd0336702d..84cff47ec7 100644 --- a/ui/dbus.c +++ b/ui/dbus.c @@ -220,16 +220,16 @@ dbus_display_complete(UserCreatable *uc, Error **errp) } =20 if (dd->audiodev && *dd->audiodev) { - AudioState *audio_state =3D audio_state_by_name(dd->audiodev, errp= ); - if (!audio_state) { + AudioBackend *audio_be =3D audio_be_by_name(dd->audiodev, errp); + if (!audio_be) { return; } - if (!g_str_equal(audio_state->drv->name, "dbus")) { + if (!g_str_equal(audio_be->drv->name, "dbus")) { error_setg(errp, "Audiodev '%s' is not compatible with DBus", dd->audiodev); return; } - audio_state->drv->set_dbus_server(audio_state, dd->server, dd->p2p= ); + audio_be->drv->set_dbus_server(audio_be, dd->server, dd->p2p); } =20 consoles =3D g_array_new(FALSE, FALSE, sizeof(guint32)); diff --git a/ui/vnc.c b/ui/vnc.c index 77c823bf2e..0094ec680c 100644 --- a/ui/vnc.c +++ b/ui/vnc.c @@ -1276,7 +1276,7 @@ static void audio_add(VncState *vs) ops.destroy =3D audio_capture_destroy; ops.capture =3D audio_capture; =20 - vs->audio_cap =3D AUD_add_capture(vs->vd->audio_state, &vs->as, &ops, = vs); + vs->audio_cap =3D AUD_add_capture(vs->vd->audio_be, &vs->as, &ops, vs); if (!vs->audio_cap) { error_report("Failed to add audio capture"); } @@ -2193,7 +2193,7 @@ static void set_encodings(VncState *vs, int32_t *enco= dings, size_t n_encodings) send_ext_key_event_ack(vs); break; case VNC_ENCODING_AUDIO: - if (vs->vd->audio_state) { + if (vs->vd->audio_be) { vnc_set_feature(vs, VNC_FEATURE_AUDIO); send_ext_audio_ack(vs); } @@ -4236,12 +4236,12 @@ void vnc_display_open(const char *id, Error **errp) =20 audiodev =3D qemu_opt_get(opts, "audiodev"); if (audiodev) { - vd->audio_state =3D audio_state_by_name(audiodev, errp); - if (!vd->audio_state) { + vd->audio_be =3D audio_be_by_name(audiodev, errp); + if (!vd->audio_be) { goto fail; } } else { - vd->audio_state =3D audio_get_default_audio_state(NULL); + vd->audio_be =3D audio_get_default_audio_be(NULL); } =20 device_id =3D qemu_opt_get(opts, "display"); --=20 2.51.0 From nobody Thu Oct 30 15:35:56 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=1761578417; cv=none; d=zohomail.com; s=zohoarc; b=UqOAQJd1Bq9LDu/N7p3+2+BI4fMxKwxPVkILiU3rgm5mNluRuuGLhQbrnK5sTaih/iBw7qGilDUqjAH6lRzTX8XLJW/y0086kpjBmplzsMlyTzN3iN4Ov4uEvs+lxXfk7hZXSV2b2I9Ens5RcVP7yE57wMS1Wlahf78XB1r3KFw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761578417; 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=RDFhMwRL21R0Bwv/3/FBbWpj5LfRnnxzjgImN711wJ0=; b=LmA53TisVK0QHtYeL0KMbQ2wRHLHxxmQZLDOxzfwzUXTmd+IwMIYe9uOcusuo9ELdBWrzIFervHYfP3LQv7G+SYM2v9b6uWWHJX/dAjQXLxc1OrFQJfOEITfykTU4xnEUxCFKPfp/9ZegMYwFW2kqmpGGMevm7FXnHg/fhv0B5o= 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 1761578417020544.6989773366748; Mon, 27 Oct 2025 08:20:17 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vDOvl-0004uu-P6; Mon, 27 Oct 2025 11:14: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 1vDOvR-0004Hp-RV for qemu-devel@nongnu.org; Mon, 27 Oct 2025 11:14:29 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vDOv4-0003zg-QS for qemu-devel@nongnu.org; Mon, 27 Oct 2025 11:14: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-561-uOOulOvHOh2PkyEew_wwXQ-1; Mon, 27 Oct 2025 11:13:53 -0400 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 3B7201955F07; Mon, 27 Oct 2025 15:13:50 +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 C98B919560AD; Mon, 27 Oct 2025 15:13:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761578037; 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=RDFhMwRL21R0Bwv/3/FBbWpj5LfRnnxzjgImN711wJ0=; b=G/+1P0unjaUBfegFlUjMUrSgQ/pxEq6pfSFE6Jcg5LrIOnEMKrZy5rXTBhZqtbN2okjLxK 0/bWB9o2fm/krYnFeI+F7kesl44VxkCrIEagYcJA5KG9WCz1TVyONW3dt3TI2Z3WR/AmOD k+vVRF/hpoyYlOMv3zug9rgbeDw1xtk= X-MC-Unique: uOOulOvHOh2PkyEew_wwXQ-1 X-Mimecast-MFC-AGG-ID: uOOulOvHOh2PkyEew_wwXQ_1761578030 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Alexandre Ratchov , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Jan Kiszka , "Michael S. Tsirkin" , Marcel Apfelbaum , Yanan Wang , Thomas Huth , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Gerd Hoffmann , Peter Maydell , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Eduardo Habkost , Manos Pitsidianakis , qemu-ppc@nongnu.org, Jiaxun Yang , Akihiko Odaki , =?UTF-8?q?Herv=C3=A9=20Poussineau?= , qemu-arm@nongnu.org, Alistair Francis , Zhao Liu , =?UTF-8?q?Volker=20R=C3=BCmelin?= , Christian Schoenebeck , Paolo Bonzini , "Edgar E. Iglesias" , BALATON Zoltan , Laurent Vivier Subject: [PATCH v3 27/35] audio: remove QEMUSoundCard Date: Mon, 27 Oct 2025 19:10:34 +0400 Message-ID: <20251027151045.2863176-28-marcandre.lureau@redhat.com> In-Reply-To: <20251027151045.2863176-1-marcandre.lureau@redhat.com> References: <20251027151045.2863176-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, 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: 1761578426601158500 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 --- audio/audio.h | 18 ++++++------------ audio/audio_int.h | 3 --- audio/audio_template.h | 22 ++++++++++------------ hw/audio/lm4549.h | 2 +- include/hw/audio/asc.h | 2 +- include/hw/audio/virtio-snd.h | 2 +- include/hw/display/xlnx_dp.h | 2 +- include/hw/isa/vt82c686.h | 2 +- include/hw/qdev-properties-system.h | 2 +- audio/audio.c | 29 ++++++++++------------------- hw/audio/ac97.c | 25 ++++++++++++------------- hw/audio/adlib.c | 9 ++++----- hw/audio/asc.c | 9 +++------ hw/audio/cs4231a.c | 8 ++++---- hw/audio/es1370.c | 23 +++++++++++------------ hw/audio/gus.c | 9 ++++----- hw/audio/hda-codec.c | 15 +++++++-------- hw/audio/lm4549.c | 8 ++++---- hw/audio/pcspk.c | 9 +++++---- hw/audio/pl041.c | 2 +- hw/audio/sb16.c | 16 ++++++++-------- hw/audio/via-ac97.c | 9 ++++----- hw/audio/virtio-snd.c | 13 ++++++------- hw/audio/wm8750.c | 23 +++++++++++------------ hw/core/qdev-properties-system.c | 11 +++++------ hw/display/xlnx_dp.c | 6 +++--- hw/usb/dev-audio.c | 11 +++++------ 27 files changed, 129 insertions(+), 161 deletions(-) diff --git a/audio/audio.h b/audio/audio.h index 1d56f111ea..fdbc33ae0c 100644 --- a/audio/audio.h +++ b/audio/audio.h @@ -69,18 +69,12 @@ struct AudioBackendClass { }; =20 typedef struct AudioBackend AudioBackend; -typedef struct QEMUSoundCard { - char *name; - AudioBackend *be; - QLIST_ENTRY (QEMUSoundCard) entries; -} QEMUSoundCard; =20 typedef struct QEMUAudioTimeStamp { uint64_t old_ts; } QEMUAudioTimeStamp; =20 -bool AUD_register_card (const char *name, QEMUSoundCard *card, Error **err= p); -void AUD_remove_card (QEMUSoundCard *card); +bool AUD_backend_check (AudioBackend **be, Error **errp); CaptureVoiceOut *AUD_add_capture( AudioBackend *s, struct audsettings *as, @@ -90,7 +84,7 @@ CaptureVoiceOut *AUD_add_capture( void AUD_del_capture (CaptureVoiceOut *cap, void *cb_opaque); =20 SWVoiceOut *AUD_open_out ( - QEMUSoundCard *card, + AudioBackend *be, SWVoiceOut *sw, const char *name, void *callback_opaque, @@ -98,7 +92,7 @@ SWVoiceOut *AUD_open_out ( struct audsettings *settings ); =20 -void AUD_close_out (QEMUSoundCard *card, SWVoiceOut *sw); +void AUD_close_out (AudioBackend *be, SWVoiceOut *sw); size_t AUD_write (SWVoiceOut *sw, void *pcm_buf, size_t size); int AUD_get_buffer_size_out (SWVoiceOut *sw); void AUD_set_active_out (SWVoiceOut *sw, int on); @@ -132,7 +126,7 @@ AUD_set_volume_in_lr(SWVoiceIn *sw, bool mut, uint8_t l= vol, uint8_t rvol) { } =20 SWVoiceIn *AUD_open_in ( - QEMUSoundCard *card, + AudioBackend *be, SWVoiceIn *sw, const char *name, void *callback_opaque, @@ -140,7 +134,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 +160,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 9601a11a09..1bd7a7634b 100644 --- a/include/hw/qdev-properties-system.h +++ b/include/hw/qdev-properties-system.h @@ -87,7 +87,7 @@ extern const PropertyInfo qdev_prop_virtio_gpu_output_lis= t; .set_default =3D true) =20 #define DEFINE_PROP_AUDIODEV(_n, _s, _f) \ - DEFINE_PROP(_n, _s, _f, qdev_prop_audiodev, QEMUSoundCard) + DEFINE_PROP(_n, _s, _f, qdev_prop_audiodev, AudioBackend *) =20 #define DEFINE_PROP_UUID_NODEFAULT(_name, _state, _field) \ DEFINE_PROP(_name, _state, _field, qdev_prop_uuid, QemuUUID) diff --git a/audio/audio.c b/audio/audio.c index 8044d55c5c..46282f86d6 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 c83a52fc62..578cbdc015 100644 --- a/hw/core/qdev-properties-system.c +++ b/hw/core/qdev-properties-system.c @@ -487,18 +487,17 @@ static void get_audiodev(Object *obj, Visitor *v, con= st char* name, void *opaque, Error **errp) { const Property *prop =3D opaque; - QEMUSoundCard *card =3D object_field_prop_ptr(obj, prop); - char *p =3D g_strdup(audio_get_id(card)); + AudioBackend **be =3D object_field_prop_ptr(obj, prop); + g_autofree char *id =3D g_strdup(audio_be_get_id(*be)); =20 - visit_type_str(v, name, &p, errp); - g_free(p); + visit_type_str(v, name, (char **)&id, errp); } =20 static void set_audiodev(Object *obj, Visitor *v, const char* name, void *opaque, Error **errp) { const Property *prop =3D opaque; - QEMUSoundCard *card =3D object_field_prop_ptr(obj, prop); + AudioBackend **be =3D object_field_prop_ptr(obj, prop); AudioBackend *state; g_autofree char *str =3D NULL; =20 @@ -508,7 +507,7 @@ static void set_audiodev(Object *obj, Visitor *v, const= char* name, =20 state =3D audio_be_by_name(str, errp); if (state) { - card->be =3D state; + *be =3D state; } } =20 diff --git a/hw/display/xlnx_dp.c b/hw/display/xlnx_dp.c index 882ae3c4b4..96cbb1b3a7 100644 --- a/hw/display/xlnx_dp.c +++ b/hw/display/xlnx_dp.c @@ -1306,7 +1306,7 @@ static void xlnx_dp_realize(DeviceState *dev, Error *= *errp) DisplaySurface *surface; struct audsettings as; =20 - if (!AUD_register_card("xlnx_dp.audio", &s->aud_card, errp)) { + if (!AUD_backend_check(&s->audio_be, errp)) { return; } =20 @@ -1328,7 +1328,7 @@ static void xlnx_dp_realize(DeviceState *dev, Error *= *errp) as.fmt =3D AUDIO_FORMAT_S16; as.endianness =3D 0; =20 - s->amixer_output_stream =3D AUD_open_out(&s->aud_card, + s->amixer_output_stream =3D AUD_open_out(s->audio_be, s->amixer_output_stream, "xlnx_dp.audio.out", s, @@ -1392,7 +1392,7 @@ static void xlnx_dp_reset(DeviceState *dev) } =20 static const Property xlnx_dp_device_properties[] =3D { - DEFINE_AUDIO_PROPERTIES(XlnxDPState, aud_card), + DEFINE_AUDIO_PROPERTIES(XlnxDPState, audio_be), }; =20 static void xlnx_dp_class_init(ObjectClass *oc, const void *data) diff --git a/hw/usb/dev-audio.c b/hw/usb/dev-audio.c index f59e5a53f0..c8e032ab64 100644 --- a/hw/usb/dev-audio.c +++ b/hw/usb/dev-audio.c @@ -635,7 +635,7 @@ static uint8_t *streambuf_get(struct streambuf *buf, si= ze_t *len) struct USBAudioState { /* qemu interfaces */ USBDevice dev; - QEMUSoundCard card; + AudioBackend *audio_be; =20 /* state */ struct { @@ -931,8 +931,7 @@ static void usb_audio_unrealize(USBDevice *dev) } =20 usb_audio_set_output_altset(s, ALTSET_OFF); - AUD_close_out(&s->card, s->out.voice); - AUD_remove_card(&s->card); + AUD_close_out(s->audio_be, s->out.voice); =20 streambuf_fini(&s->out.buf); } @@ -942,7 +941,7 @@ static void usb_audio_realize(USBDevice *dev, Error **e= rrp) USBAudioState *s =3D USB_AUDIO(dev); int i; =20 - if (!AUD_register_card(TYPE_USB_AUDIO, &s->card, errp)) { + if (!AUD_backend_check(&s->audio_be, errp)) { return; } =20 @@ -979,7 +978,7 @@ static void usb_audio_reinit(USBDevice *dev, unsigned c= hannels) s->out.as.endianness =3D 0; streambuf_init(&s->out.buf, s->buffer, s->out.channels); =20 - s->out.voice =3D AUD_open_out(&s->card, s->out.voice, TYPE_USB_AUDIO, + s->out.voice =3D AUD_open_out(s->audio_be, s->out.voice, TYPE_USB_AUDI= O, s, output_callback, &s->out.as); AUD_set_volume_out(s->out.voice, &s->out.vol); AUD_set_active_out(s->out.voice, 0); @@ -991,7 +990,7 @@ static const VMStateDescription vmstate_usb_audio =3D { }; =20 static const Property usb_audio_properties[] =3D { - DEFINE_AUDIO_PROPERTIES(USBAudioState, card), + DEFINE_AUDIO_PROPERTIES(USBAudioState, audio_be), DEFINE_PROP_UINT32("debug", USBAudioState, debug, 0), DEFINE_PROP_UINT32("buffer", USBAudioState, buffer_user, 0), DEFINE_PROP_BOOL("multi", USBAudioState, multi, false), --=20 2.51.0 From nobody Thu Oct 30 15:35:56 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=1761578358; cv=none; d=zohomail.com; s=zohoarc; b=dlQVxYKmlsiNK3+TMstFtIuZ/3FoDaJCRnrW6bag4G/I+yZUFC5nCONMyIR3n9aHmV3RjqwgC2A4eA/G3/urQldyY8IUVNr6E8Z9heXZEkXgQQK1EIGC4iJFUyk3nKwPe72wQMrIpEDu7FM+/8SyxyMIv0NOncKZ9cqVBeHFjkQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761578358; 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=gcZVyykStkrSOetTkHByDccsOg02G0hu0XXIXkqC/ao=; b=lQmqELUmFEowimd33tCLUNYSIIiGDyC1YAN+BszmI6v/zpsHWa457+QBjc6Dvmj9/KU4cHgCdvzrtS1QBQODpY4M64W2xOXt11+xjTvuogyWiqRnlQPtUYd7ym6Al/r9xAgiFsWYLoc4p8J2u5CyqsjHAa3icuwn/UgdCUZ7wF0= 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 1761578358391100.19183771305313; Mon, 27 Oct 2025 08:19:18 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vDOvj-0004s5-2M; Mon, 27 Oct 2025 11:14: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 1vDOvV-0004Ik-Kc for qemu-devel@nongnu.org; Mon, 27 Oct 2025 11:14: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 1vDOvC-00040D-E1 for qemu-devel@nongnu.org; Mon, 27 Oct 2025 11:14: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-480-wUyOgNV_P7ecZi_bKAbkTw-1; Mon, 27 Oct 2025 11:13:59 -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 D195E18002DD; Mon, 27 Oct 2025 15:13:56 +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 C9AA830001A2; Mon, 27 Oct 2025 15:13:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761578043; 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=gcZVyykStkrSOetTkHByDccsOg02G0hu0XXIXkqC/ao=; b=A6k+M5Brr5iGz1skbz1o6ar+xglkyaUnYcLuTEsL9A/7dylVc+q+xI+B2ZjICPZuKOrZH0 vjnTabASzXvWJvdDIg13NVMJLedmsLvx+M2gbgDGVjYwwjThDL/TvlmirlxZIqjmD5lYND 3BrNZyJlAAsE/d4cbRZNPr7N+UvRd9I= X-MC-Unique: wUyOgNV_P7ecZi_bKAbkTw-1 X-Mimecast-MFC-AGG-ID: wUyOgNV_P7ecZi_bKAbkTw_1761578037 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Alexandre Ratchov , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Jan Kiszka , "Michael S. Tsirkin" , Marcel Apfelbaum , Yanan Wang , Thomas Huth , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Gerd Hoffmann , Peter Maydell , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Eduardo Habkost , Manos Pitsidianakis , qemu-ppc@nongnu.org, Jiaxun Yang , Akihiko Odaki , =?UTF-8?q?Herv=C3=A9=20Poussineau?= , qemu-arm@nongnu.org, Alistair Francis , Zhao Liu , =?UTF-8?q?Volker=20R=C3=BCmelin?= , Christian Schoenebeck , Paolo Bonzini , "Edgar E. Iglesias" , BALATON Zoltan , Laurent Vivier Subject: [PATCH v3 28/35] audio/dbus: use a helper function to set the backend dbus server Date: Mon, 27 Oct 2025 19:10:35 +0400 Message-ID: <20251027151045.2863176-29-marcandre.lureau@redhat.com> In-Reply-To: <20251027151045.2863176-1-marcandre.lureau@redhat.com> References: <20251027151045.2863176-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=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: 1761578367613158500 From: Marc-Andr=C3=A9 Lureau Signed-off-by: Marc-Andr=C3=A9 Lureau --- 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 fdbc33ae0c..78c27462ba 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 @@ -161,6 +164,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 46282f86d6..ab33b7f9a7 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.0 From nobody Thu Oct 30 15:35:56 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=1761578185; cv=none; d=zohomail.com; s=zohoarc; b=L69mp8nWpysqOtN11nUVtzf0GNzLVvICcz/HTv9l7M3DvatLaoJaWAxaP+uoEJDd5kHVo7ZjQWuBQAuYU2BGG/WJSmHDVDbxLvslEvf0hpAlr2+OphWP3txiOjNMTqCKw0ksUnvZng2+RpiRK6+WF5Hz8kmFWHw/kyaXzARvgos= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761578185; 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=hJdGU9DzZc1OdjmKNpY5b7B8mNo7SSiOx2uhBAHgmoU=; b=LPF1FkQQHzXarYp01vhE3O5rZfXYCo/i7Mbbod9SeCbqGOypBlh7Du88RydLQmA0G834XYS7JyRmwx660W11J8xG1Lmk17D/RkGpHHJrqyPnUm4jhu58wziW8n9rcWFvE/kjJuU8pxkxhX1F4NxTq88kVrbyBYc5t6Zobr/m4nc= 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 1761578185787464.160049985573; Mon, 27 Oct 2025 08:16:25 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vDOvz-00058R-Oe; Mon, 27 Oct 2025 11:15:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vDOvb-0004VA-BH for qemu-devel@nongnu.org; Mon, 27 Oct 2025 11:14:35 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vDOvE-00040k-MU for qemu-devel@nongnu.org; Mon, 27 Oct 2025 11:14:34 -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-418-IMkDxbJ4M4m2XKwAwJ7OhA-1; Mon, 27 Oct 2025 11:14:06 -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 E0741180121B; Mon, 27 Oct 2025 15:14:03 +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 D9ABA19560AD; Mon, 27 Oct 2025 15:14:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761578048; 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=hJdGU9DzZc1OdjmKNpY5b7B8mNo7SSiOx2uhBAHgmoU=; b=VUlKcow0nqfRs+u7VifuXQvwJHDsdZ68WiPgnP+YLMp7WkohxIVcdsyx4sk5ppvK5OjPFx L5zqZ9vN4+xP03IoHFGi43VOTGC9LlZttMbtqtAIgxZ7eHm2EiPlyi6U4M1F8U3JfLo9Pe w4legbl39+ckH1OhaFWY7NGyqiOxbpQ= X-MC-Unique: IMkDxbJ4M4m2XKwAwJ7OhA-1 X-Mimecast-MFC-AGG-ID: IMkDxbJ4M4m2XKwAwJ7OhA_1761578044 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Alexandre Ratchov , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Jan Kiszka , "Michael S. Tsirkin" , Marcel Apfelbaum , Yanan Wang , Thomas Huth , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Gerd Hoffmann , Peter Maydell , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Eduardo Habkost , Manos Pitsidianakis , qemu-ppc@nongnu.org, Jiaxun Yang , Akihiko Odaki , =?UTF-8?q?Herv=C3=A9=20Poussineau?= , qemu-arm@nongnu.org, Alistair Francis , Zhao Liu , =?UTF-8?q?Volker=20R=C3=BCmelin?= , Christian Schoenebeck , Paolo Bonzini , "Edgar E. Iglesias" , BALATON Zoltan , Laurent Vivier Subject: [PATCH v3 29/35] audio: move audio.h under include/qemu/ Date: Mon, 27 Oct 2025 19:10:36 +0400 Message-ID: <20251027151045.2863176-30-marcandre.lureau@redhat.com> In-Reply-To: <20251027151045.2863176-1-marcandre.lureau@redhat.com> References: <20251027151045.2863176-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_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: 1761578189404158500 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 f33f95ceea..a4f650a88f 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -2975,6 +2975,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 ab33b7f9a7..4bbe6b242f 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 35f8d05ea1..14d38cea8b 100644 --- a/hw/arm/vexpress.c +++ b/hw/arm/vexpress.c @@ -44,7 +44,7 @@ #include "hw/sd/sd.h" #include "qobject/qlist.h" #include "qom/object.h" -#include "audio/audio.h" +#include "qemu/audio.h" #include "target/arm/cpu-qom.h" =20 #define VEXPRESS_BOARD_ID 0x8e0 diff --git a/hw/arm/xlnx-zcu102.c b/hw/arm/xlnx-zcu102.c index 14b6641a71..4ed346a88d 100644 --- a/hw/arm/xlnx-zcu102.c +++ b/hw/arm/xlnx-zcu102.c @@ -25,7 +25,7 @@ #include "system/device_tree.h" #include "qom/object.h" #include "net/can_emu.h" -#include "audio/audio.h" +#include "qemu/audio.h" =20 struct XlnxZCU102 { MachineState parent_obj; diff --git a/hw/audio/ac97.c b/hw/audio/ac97.c index 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 578cbdc015..6560205f9f 100644 --- a/hw/core/qdev-properties-system.c +++ b/hw/core/qdev-properties-system.c @@ -27,7 +27,7 @@ #include "qemu/error-report.h" #include "qdev-prop-internal.h" =20 -#include "audio/audio.h" +#include "qemu/audio.h" #include "chardev/char-fe.h" #include "system/block-backend.h" #include "system/blockdev.h" diff --git a/hw/ppc/prep.c b/hw/ppc/prep.c index c730cb3429..d9c5d14cbd 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.0 From nobody Thu Oct 30 15:35:56 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=1761578210; cv=none; d=zohomail.com; s=zohoarc; b=HuCaXKzEO1N8BRgEbmvh37gyq6lUlbBRB1L0E29ANOaijlnhjlSbq2dPyVZo6+SAPDuOnFmrYynaIDJRKa+gR57id6KbvyzjLbEQ5rL01SmlS7M7zxB9bxH2B7NrTzBssarL535qVJBZTDighR13ZRpug5nPdzEDO3uOEWGwo4M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761578210; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=alKpb0u140eXNITQrcibzH0f3MuJh6yEoE2ncrsRI7Y=; b=TmivFrqVHGZb5tzeMe9xDNZvDzM4kT2dzJ1N98ea/qX70DfxhSy7IPYgXupNavvtyvyTuC1rVwkLt2ylBA7GeB2MqGAJsATxNjS+StQ8eJXryZ/K1WVFfgUBMWAVT9vczUE3vPO5UceVWGY9AOQ8YG0J8/XjWhj3F0YltM+GUw8= 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 1761578210168339.1948789025346; Mon, 27 Oct 2025 08:16:50 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vDOw2-0005Hf-Ax; Mon, 27 Oct 2025 11:15:02 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vDOvh-0004rr-8Q for qemu-devel@nongnu.org; Mon, 27 Oct 2025 11:14: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 1vDOvQ-00041x-UL for qemu-devel@nongnu.org; Mon, 27 Oct 2025 11:14:40 -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-670-PCDKlZIAMYmq6eKX-x4_Fg-1; Mon, 27 Oct 2025 11:14:13 -0400 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 48533180065F; Mon, 27 Oct 2025 15:14:10 +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 9E1551800577; Mon, 27 Oct 2025 15:14:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761578058; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=alKpb0u140eXNITQrcibzH0f3MuJh6yEoE2ncrsRI7Y=; b=A5k38xDbNg+TDsRDeRBrhRsCGymNyHx/kEA3eMQsLSkiHigjGuStg1bMGEFdmEepRI3uRP R9i0gBsgCjN/nA5rZUzNvxKwysVVdOaoTFPa1y6CvFcl+HFmWYwY9hf2jLqMuvj+XacCba /5xsclUQl0cWDiSzN/fVC0qLb3/X4Do= X-MC-Unique: PCDKlZIAMYmq6eKX-x4_Fg-1 X-Mimecast-MFC-AGG-ID: PCDKlZIAMYmq6eKX-x4_Fg_1761578050 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Alexandre Ratchov , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Jan Kiszka , "Michael S. Tsirkin" , Marcel Apfelbaum , Yanan Wang , Thomas Huth , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Gerd Hoffmann , Peter Maydell , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Eduardo Habkost , Manos Pitsidianakis , qemu-ppc@nongnu.org, Jiaxun Yang , Akihiko Odaki , =?UTF-8?q?Herv=C3=A9=20Poussineau?= , qemu-arm@nongnu.org, Alistair Francis , Zhao Liu , =?UTF-8?q?Volker=20R=C3=BCmelin?= , Christian Schoenebeck , Paolo Bonzini , "Edgar E. Iglesias" , BALATON Zoltan , Laurent Vivier Subject: [PATCH v3 30/35] audio: remove dependency on spice header Date: Mon, 27 Oct 2025 19:10:37 +0400 Message-ID: <20251027151045.2863176-31-marcandre.lureau@redhat.com> In-Reply-To: <20251027151045.2863176-1-marcandre.lureau@redhat.com> References: <20251027151045.2863176-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: 1761578211888154100 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.0 From nobody Thu Oct 30 15:35:56 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=1761578685; cv=none; d=zohomail.com; s=zohoarc; b=fn6miKVoeacbgkjQgkBW47mqIShWE65kI+4cwQcVkR9AVQ6nJlHsgHI8JC3MDCW+6r0uyJR5zkrGFQfx7y8+vKNSAqWR7fIPIik5sSL6fXtcystddbOpRtlx8Qv0cEt/YI4RhGXmmrJzLsUM239N7PUhCRhH7oABT7HEcYehvRA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761578685; 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=tOfVtsEaZO+vrKqi4txTmFlgspZc2hje1lURZHHHbjs=; b=KBsgGgMCVo1g05l2huR8/HsmHLKPHVjY7yzmHoQfAeP94TTEFtOnOOtmBLvFVFLIsuGolkDqpThjXS0mm/EcOovWt6kmuYiVr7xHOg+0ewB8Zd61AjM9mM/wOYhA0ODV6u/Uc5P4OTZNE1CUEIUxmrmIQb47dcahY/H1c2CytXA= 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 1761578685133602.4204977068695; Mon, 27 Oct 2025 08:24:45 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vDOw3-0005Hg-Tv; Mon, 27 Oct 2025 11:15: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 1vDOvk-0004vD-It for qemu-devel@nongnu.org; Mon, 27 Oct 2025 11:14:46 -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 1vDOvV-00042J-JO for qemu-devel@nongnu.org; Mon, 27 Oct 2025 11:14:44 -0400 Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-321-SU95BJ5_MdK1Y08esamh1g-1; Mon, 27 Oct 2025 11:14:20 -0400 Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 22FE91808997; Mon, 27 Oct 2025 15:14:16 +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 A144D1800353; Mon, 27 Oct 2025 15:14:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761578063; 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=tOfVtsEaZO+vrKqi4txTmFlgspZc2hje1lURZHHHbjs=; b=aHJkodnJoRxskPu5qtLzbFnPYRW09PmudS7Sb33mc7+SLD2I8VPLvW8Eu7/GnXkGZgW6uB ux2kXNJr7+XvY5+Cq6EJ+Lj5smCx3itEIHxI9wf2NlAEFJxYmkjqMrF+VBmURNVwdT6t2s KR4DGjHo0eMadBfCNMWF0VZ7cPXkQYU= X-MC-Unique: SU95BJ5_MdK1Y08esamh1g-1 X-Mimecast-MFC-AGG-ID: SU95BJ5_MdK1Y08esamh1g_1761578056 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Alexandre Ratchov , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Jan Kiszka , "Michael S. Tsirkin" , Marcel Apfelbaum , Yanan Wang , Thomas Huth , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Gerd Hoffmann , Peter Maydell , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Eduardo Habkost , Manos Pitsidianakis , qemu-ppc@nongnu.org, Jiaxun Yang , Akihiko Odaki , =?UTF-8?q?Herv=C3=A9=20Poussineau?= , qemu-arm@nongnu.org, Alistair Francis , Zhao Liu , =?UTF-8?q?Volker=20R=C3=BCmelin?= , Christian Schoenebeck , Paolo Bonzini , "Edgar E. Iglesias" , BALATON Zoltan , Laurent Vivier Subject: [PATCH v3 31/35] audio: cleanup, use bool for booleans Date: Mon, 27 Oct 2025 19:10:38 +0400 Message-ID: <20251027151045.2863176-32-marcandre.lureau@redhat.com> In-Reply-To: <20251027151045.2863176-1-marcandre.lureau@redhat.com> References: <20251027151045.2863176-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: 1761578687844158500 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 78c27462ba..a857955f51 100644 --- a/include/qemu/audio.h +++ b/include/qemu/audio.h @@ -98,8 +98,8 @@ SWVoiceOut *AUD_open_out ( void AUD_close_out (AudioBackend *be, SWVoiceOut *sw); size_t AUD_write (SWVoiceOut *sw, void *pcm_buf, size_t size); int AUD_get_buffer_size_out (SWVoiceOut *sw); -void AUD_set_active_out (SWVoiceOut *sw, int on); -int AUD_is_active_out (SWVoiceOut *sw); +void AUD_set_active_out(SWVoiceOut *sw, bool on); +bool AUD_is_active_out(SWVoiceOut *sw); =20 void AUD_init_time_stamp_out (SWVoiceOut *sw, QEMUAudioTimeStamp *ts); uint64_t AUD_get_elapsed_usec_out (SWVoiceOut *sw, QEMUAudioTimeStamp *ts); @@ -139,8 +139,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 4bbe6b242f..748dd0da27 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.0 From nobody Thu Oct 30 15:35:56 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=1761578623; cv=none; d=zohomail.com; s=zohoarc; b=jYvLJt18hhubIQLThPg0/+jQd+ZO7By/U5afkfKc7p8ztVSW/zb3ZZl7sGGySy8Jph/oCGO2Jre1APaiMlyg5dXKo4Jp7VQQATliIF7ff6ecq+OHiBAwspkrljX7t9autp/EQum3OWsdZx7bRNmt77TqkplxeApsV5leGC4cT/4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761578623; 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=rEEwWgvOu65dENT6bp88csqVY6xRkGlfxpSMElzIXjk=; b=UIHBGOJmrmzxO2/KMMHxh3BCtINrmgkV0U15qHWJqe2IxnO/U/T9YfTMaFnzYCqJrR9jYitomfx1oXawPCaeu0+KJtf76lnnp6X42gOL2G4lbM9hKytwz06V0+g/V5u+TCUi456fQFzf5DY4ilKyYKDt85tEEPRSAIYEIdAALg8= 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 1761578623345351.3888829569595; Mon, 27 Oct 2025 08:23:43 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vDOwX-0005gv-R1; Mon, 27 Oct 2025 11:15:36 -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 1vDOvo-0004wu-RO for qemu-devel@nongnu.org; Mon, 27 Oct 2025 11:14:49 -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 1vDOva-00043O-HS for qemu-devel@nongnu.org; Mon, 27 Oct 2025 11:14:48 -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-10-pz2ra32mNMiFOzKSyPKEzA-1; Mon, 27 Oct 2025 11:14:27 -0400 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 84B4719540E4; Mon, 27 Oct 2025 15:14:22 +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 99FA4195398C; Mon, 27 Oct 2025 15:14:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761578071; 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=rEEwWgvOu65dENT6bp88csqVY6xRkGlfxpSMElzIXjk=; b=OSXs/8fYbVvbsj6Y0yEmF1+NrEZ+dRSByt7DuGm6sv8w6CFoivplzdB3Lh0LrB4EsNKtlz IQ4Yv5fjO9XuAqGdw+Yj+iUaLbBZlQjiuc2ggLvNXqjaKwgLSmEHl1a0TFurHcq7/yUQLD cBEkDN1Yp5P/2E2r4qtD4V7XmzPJeoA= X-MC-Unique: pz2ra32mNMiFOzKSyPKEzA-1 X-Mimecast-MFC-AGG-ID: pz2ra32mNMiFOzKSyPKEzA_1761578062 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Alexandre Ratchov , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Jan Kiszka , "Michael S. Tsirkin" , Marcel Apfelbaum , Yanan Wang , Thomas Huth , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Gerd Hoffmann , Peter Maydell , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Eduardo Habkost , Manos Pitsidianakis , qemu-ppc@nongnu.org, Jiaxun Yang , Akihiko Odaki , =?UTF-8?q?Herv=C3=A9=20Poussineau?= , qemu-arm@nongnu.org, Alistair Francis , Zhao Liu , =?UTF-8?q?Volker=20R=C3=BCmelin?= , Christian Schoenebeck , Paolo Bonzini , "Edgar E. Iglesias" , BALATON Zoltan , Laurent Vivier Subject: [PATCH v3 32/35] audio: move capture API to own header Date: Mon, 27 Oct 2025 19:10:39 +0400 Message-ID: <20251027151045.2863176-33-marcandre.lureau@redhat.com> In-Reply-To: <20251027151045.2863176-1-marcandre.lureau@redhat.com> References: <20251027151045.2863176-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: 1761578625194158500 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 --- MAINTAINERS | 2 +- audio/audio_int.h | 1 + include/qemu/audio-capture.h | 43 ++++++++++++++++++++++++++++++++++++ include/qemu/audio.h | 30 ------------------------- ui/vnc.h | 2 +- 5 files changed, 46 insertions(+), 32 deletions(-) create mode 100644 include/qemu/audio-capture.h diff --git a/MAINTAINERS b/MAINTAINERS index a4f650a88f..355302cac4 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -2975,7 +2975,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 a857955f51..0ed606c9fb 100644 --- a/include/qemu/audio.h +++ b/include/qemu/audio.h @@ -41,30 +41,7 @@ typedef struct audsettings { int endianness; } audsettings; =20 -typedef enum { - AUD_CNOTIFY_ENABLE, - AUD_CNOTIFY_DISABLE -} audcnotification_e; - -struct audio_capture_ops { - void (*notify) (void *opaque, audcnotification_e cmd); - void (*capture) (void *opaque, const void *buf, int size); - void (*destroy) (void *opaque); -}; - -struct capture_ops { - void (*info) (void *opaque); - void (*destroy) (void *opaque); -}; - -typedef struct CaptureState { - void *opaque; - struct capture_ops ops; - QLIST_ENTRY (CaptureState) entries; -} CaptureState; - typedef struct SWVoiceOut SWVoiceOut; -typedef struct CaptureVoiceOut CaptureVoiceOut; typedef struct SWVoiceIn SWVoiceIn; =20 struct AudioBackendClass { @@ -78,13 +55,6 @@ typedef struct QEMUAudioTimeStamp { } QEMUAudioTimeStamp; =20 bool AUD_backend_check (AudioBackend **be, Error **errp); -CaptureVoiceOut *AUD_add_capture( - AudioBackend *s, - struct audsettings *as, - struct audio_capture_ops *ops, - void *opaque - ); -void AUD_del_capture (CaptureVoiceOut *cap, void *cb_opaque); =20 SWVoiceOut *AUD_open_out ( AudioBackend *be, diff --git a/ui/vnc.h b/ui/vnc.h index 4d8363ebf3..ec8d0c91b5 100644 --- a/ui/vnc.h +++ b/ui/vnc.h @@ -31,7 +31,7 @@ #include "qemu/thread.h" #include "ui/clipboard.h" #include "ui/console.h" -#include "qemu/audio.h" +#include "qemu/audio-capture.h" #include "qemu/bitmap.h" #include "crypto/tlssession.h" #include "qemu/buffer.h" --=20 2.51.0 From nobody Thu Oct 30 15:35:56 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=1761578458; cv=none; d=zohomail.com; s=zohoarc; b=lzF6896490h7cSx5DQUbVEcZyEhU7JIp+S3NQbAPPp/irr42KDiyys2rRSME5oO9NcbsfEt/y+jrZZONLS9yR4QXsTp9Y4irJOYgF7ZSAwSIZ8earDyuuqbMkU0pbLdUcGK8NtKss3Tde2g0sqCh4Z3xDyY0FIfQsKBRLWKvNho= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761578458; 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=itTW4OZJBs2Jn2daZRP3HrWXr1gvhXp3TAvDF6gmSP0=; b=AtyUFJhOZ2fi8t4U6ruzFPFiAF3BfK6Exn7w+Lio+id3dc3Ta5Wj4ueYpqYOVVcKi2B471Dg5OPLHvJ1L8WW0X58cCIC2Rl0UuowO0mxztz2p7bbtO7Jb0h52Ge0ZSPs1nWIYUPXnPI32ttaRxzeG+lvsPcjZnyRuEmKdK6QO0k= 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 1761578458855935.3558099014892; Mon, 27 Oct 2025 08:20:58 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vDOwK-0005We-SW; Mon, 27 Oct 2025 11:15:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vDOvq-00052B-3j for qemu-devel@nongnu.org; Mon, 27 Oct 2025 11:14: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 1vDOvf-00044H-Vi for qemu-devel@nongnu.org; Mon, 27 Oct 2025 11:14:49 -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-280-pZdztnwVOmK87Wou5nO_xw-1; Mon, 27 Oct 2025 11:14:32 -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 8DD94180121B; Mon, 27 Oct 2025 15:14:28 +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 13CD81800353; Mon, 27 Oct 2025 15:14:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761578075; 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=itTW4OZJBs2Jn2daZRP3HrWXr1gvhXp3TAvDF6gmSP0=; b=GMveqAldpTsPGpxiY1HcvT6l4U4Rq8SOjezDhgfW1jUsGO4KbYRsGMUNjNO0yZcDcjxRqv 8v8NFQ1GM3BMD3fl29am2Xm+FZksTrMdE/8x5M5QkGJxsrSrar2eCllZhU1UAA44odjvX1 eHue6X03wgfbodcdAbzgQcBzs1lgMyo= X-MC-Unique: pZdztnwVOmK87Wou5nO_xw-1 X-Mimecast-MFC-AGG-ID: pZdztnwVOmK87Wou5nO_xw_1761578068 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Alexandre Ratchov , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Jan Kiszka , "Michael S. Tsirkin" , Marcel Apfelbaum , Yanan Wang , Thomas Huth , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Gerd Hoffmann , Peter Maydell , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Eduardo Habkost , Manos Pitsidianakis , qemu-ppc@nongnu.org, Jiaxun Yang , Akihiko Odaki , =?UTF-8?q?Herv=C3=A9=20Poussineau?= , qemu-arm@nongnu.org, Alistair Francis , Zhao Liu , =?UTF-8?q?Volker=20R=C3=BCmelin?= , Christian Schoenebeck , Paolo Bonzini , "Edgar E. Iglesias" , BALATON Zoltan , Laurent Vivier Subject: [PATCH v3 33/35] audio: drop needless audio_driver "descr" field Date: Mon, 27 Oct 2025 19:10:40 +0400 Message-ID: <20251027151045.2863176-34-marcandre.lureau@redhat.com> In-Reply-To: <20251027151045.2863176-1-marcandre.lureau@redhat.com> References: <20251027151045.2863176-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: 1761578460774154100 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.0 From nobody Thu Oct 30 15:35:56 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=1761578462; cv=none; d=zohomail.com; s=zohoarc; b=IxVC0uNmi+z4c1Kan6f0v69Zmr4GtFBPvqFDcbt6Qp+tzfUh9XT+45ehCa/6Orlm3pJjPTM3QpoD11xVCrhXgvzgg+O99nTRWDxDp/utpWi8CTkj5HML6YHehx6am1bMy5f6/TgpT9hZUvuwsJM0qdNC/U9paQfC8TF2aYT21bY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761578462; 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=wMmaChcf8jf2PWmovaXlzLXhyNCOVQEwDOiew6Lu3e4=; b=Orm4BeNWSZzr10v6buBXD3AgYdbnRhFNg1r0zr9gOWjHLy8lzxSfe1lz/Syd5BJxdAHp098Yo9ffdSuPYfEGXS0+3uudrHmPb17OWG8ToxSL/uK+gkMgmhxUiQUynXgKuESgV8wezMyO1HS7mTREy8/CwEA3mK+lSv96czNsK64= 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 1761578462103248.18315192706712; Mon, 27 Oct 2025 08:21:02 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vDOww-0005xQ-5C; Mon, 27 Oct 2025 11:15: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 1vDOvx-00058q-La for qemu-devel@nongnu.org; Mon, 27 Oct 2025 11:14:59 -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 1vDOvk-00045P-Oj for qemu-devel@nongnu.org; Mon, 27 Oct 2025 11:14:56 -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-372-gHUPTVk1MFSKlxT8F1Xb0Q-1; Mon, 27 Oct 2025 11:14:37 -0400 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id B7E891801231; Mon, 27 Oct 2025 15:14:34 +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 28EB2180057C; Mon, 27 Oct 2025 15:14:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761578081; 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=wMmaChcf8jf2PWmovaXlzLXhyNCOVQEwDOiew6Lu3e4=; b=DX4FWdKLbiVo3hoaOFYGXq20K6s7G9+xWxl6RGlLGqyJQ7GG7Mq5jJ4tmt8PWHZz+5InIL MIR/5O/Rd7cKoyMdoiXTn8heWI5PEfwxTm6G8LQtUgUshXj5hXTn5gv1ie1ApufzMW8JVW 3aFuVXhubMgQzhZa0Bhl5MkEWViPMd0= X-MC-Unique: gHUPTVk1MFSKlxT8F1Xb0Q-1 X-Mimecast-MFC-AGG-ID: gHUPTVk1MFSKlxT8F1Xb0Q_1761578074 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Alexandre Ratchov , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Jan Kiszka , "Michael S. Tsirkin" , Marcel Apfelbaum , Yanan Wang , Thomas Huth , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Gerd Hoffmann , Peter Maydell , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Eduardo Habkost , Manos Pitsidianakis , qemu-ppc@nongnu.org, Jiaxun Yang , Akihiko Odaki , =?UTF-8?q?Herv=C3=A9=20Poussineau?= , qemu-arm@nongnu.org, Alistair Francis , Zhao Liu , =?UTF-8?q?Volker=20R=C3=BCmelin?= , Christian Schoenebeck , Paolo Bonzini , "Edgar E. Iglesias" , BALATON Zoltan , Laurent Vivier Subject: [PATCH v3 34/35] audio: Remove pointless local variables Date: Mon, 27 Oct 2025 19:10:41 +0400 Message-ID: <20251027151045.2863176-35-marcandre.lureau@redhat.com> In-Reply-To: <20251027151045.2863176-1-marcandre.lureau@redhat.com> References: <20251027151045.2863176-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1761578464888154100 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.0 From nobody Thu Oct 30 15:35:56 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=1761578690; cv=none; d=zohomail.com; s=zohoarc; b=X3y/rs0BUPxgi+S3CZh+m6+BvigVTz9bwXJI44TEqG+Xtqv2SoFZ7y5ViXA7U5QmUne19zgiO597JPJZmCR29zET1eAOJfPMnmHhsEOoQO9cOcXza5j0TYDQEQ9bQMkbs0FUeXhtAURQRkswwHg1lUcHbXFO0SKQ+ZQBihtA4/w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761578690; 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=5uEAD8IufxGlfbgcYTAd6K5nN0aUVsvDwES5X6ku/Aw=; b=QWPm5tNEvok0d0emObGV4L2umX8s+kHPUABk7KhvJwsjHuTkj0X1JJ/PotgIBTBTXP9YW1fuo6RCvpFP2oWkhE8xIebyy33d+ZxyT5NMi+xIc3TrND/LQCx+weQcOs0RjPoQLDDP7BtGyhj6FgneVMKV5zd8D1djS4ec5PpyYik= 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 1761578689803941.3952505495959; Mon, 27 Oct 2025 08:24:49 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vDOxQ-0006WM-LI; Mon, 27 Oct 2025 11:16: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 1vDOw8-0005Qx-2E for qemu-devel@nongnu.org; Mon, 27 Oct 2025 11:15: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 1vDOvr-000476-R1 for qemu-devel@nongnu.org; Mon, 27 Oct 2025 11:15: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-684-LlJD0ToGOFSD_dkmd2rLiQ-1; Mon, 27 Oct 2025 11:14:43 -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 D4BAB180136C; Mon, 27 Oct 2025 15:14:40 +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 2862030001A2; Mon, 27 Oct 2025 15:14:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761578088; 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=5uEAD8IufxGlfbgcYTAd6K5nN0aUVsvDwES5X6ku/Aw=; b=emun6P46NH3UsX/xzllWSlYz5BTiSZZkTj6uB6BCMeSsiRdmmqOvVx9fAf0VzqJs/1e7mN VjaBoKypVVDE4UOYd2ug+hHQb12TrtfB7jqavWUun8AySy4EIB0jAf4vLSN0EqAE4iSP4S ATmgubyf98X7E0khHefXJShxeUGy1m4= X-MC-Unique: LlJD0ToGOFSD_dkmd2rLiQ-1 X-Mimecast-MFC-AGG-ID: LlJD0ToGOFSD_dkmd2rLiQ_1761578081 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Alexandre Ratchov , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Jan Kiszka , "Michael S. Tsirkin" , Marcel Apfelbaum , Yanan Wang , Thomas Huth , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Gerd Hoffmann , Peter Maydell , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Eduardo Habkost , Manos Pitsidianakis , qemu-ppc@nongnu.org, Jiaxun Yang , Akihiko Odaki , =?UTF-8?q?Herv=C3=A9=20Poussineau?= , qemu-arm@nongnu.org, Alistair Francis , Zhao Liu , =?UTF-8?q?Volker=20R=C3=BCmelin?= , Christian Schoenebeck , Paolo Bonzini , "Edgar E. Iglesias" , BALATON Zoltan , Laurent Vivier Subject: [PATCH v3 35/35] audio: Rename @endianness argument as @big_endian for clarity Date: Mon, 27 Oct 2025 19:10:42 +0400 Message-ID: <20251027151045.2863176-36-marcandre.lureau@redhat.com> In-Reply-To: <20251027151045.2863176-1-marcandre.lureau@redhat.com> References: <20251027151045.2863176-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_VALIDITY_RPBL_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: 1761578695903158500 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.0