From nobody Fri Nov 14 18:23:12 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1761893540; cv=none; d=zohomail.com; s=zohoarc; b=ecGsOcNE6Lb1Nyrp90ioZvMILYiQc1GxGidVdrPKLRivh/VNT5n25sEvaYeHqs2boGZXo8c37QzGbhL6isFTntzBxQRhTCRO/qax/9/ISIBkDNn11CpFaBb3PljhiKKm5NBG9vxUpDjz0dUAUVrE7+6R+XuPmCAmMzWkjbK8fJk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761893540; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=3vcN7c2q7ApEIuezAycDq9xRQa4lV6TBvMpmZRZ04JE=; b=kWHmdHQiSbvFi+Hkuud7i1RgxtODGX6EwVdMfyTlMNVsdM/qRGfDp9bY4GFRRyXqsMA/mq41HbiwUG1AZO2Ku9GmuRV41PhD/JIMELeaKgmxHkdGj5jf1WbaLlTPR6QB7eP5m43bHAk5hVdym3z+SzL22TNL4PYT4qE1Iu+bsvM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1761893540041163.59823487071571; Thu, 30 Oct 2025 23:52:20 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vEixK-0002QJ-Bf; Fri, 31 Oct 2025 02:49:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vEixJ-0002PZ-LJ for qemu-devel@nongnu.org; Fri, 31 Oct 2025 02:49:49 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vEixD-00044K-8H for qemu-devel@nongnu.org; Fri, 31 Oct 2025 02:49:49 -0400 Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-633-VOH_7-ToMoW4PieoOAdPAg-1; Fri, 31 Oct 2025 02:49:39 -0400 Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 8EB881955DB5; Fri, 31 Oct 2025 06:49:38 +0000 (UTC) Received: from localhost (unknown [10.45.242.5]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 2BC60180035A; Fri, 31 Oct 2025 06:49:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761893382; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=3vcN7c2q7ApEIuezAycDq9xRQa4lV6TBvMpmZRZ04JE=; b=CACT38tYHCKEBOfmK79AHs86kQziizb5B5GvdGgC1Jy+1Ef8kyhV0vfz7QtFM7uq72GOTN dVisaVO/inIET6LKavfV/npzLXVmOaM4+LDEfTT6Jwjt/9WOaQCApGfASsIKa/6zUlBYDo Ei1kq5fya8L0N/WbRsT1/AkVILKnlLA= X-MC-Unique: VOH_7-ToMoW4PieoOAdPAg-1 X-Mimecast-MFC-AGG-ID: VOH_7-ToMoW4PieoOAdPAg_1761893378 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: richard.henderson@linaro.org, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Gerd Hoffmann Subject: [PULL 28/36] audio/dbus: use a helper function to set the backend dbus server Date: Fri, 31 Oct 2025 10:46:21 +0400 Message-ID: <20251031064631.134651-29-marcandre.lureau@redhat.com> In-Reply-To: <20251031064631.134651-1-marcandre.lureau@redhat.com> References: <20251031064631.134651-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1761893547412158500 From: Marc-Andr=C3=A9 Lureau Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- audio/audio.h | 9 +++++++++ audio/audio_int.h | 5 ++++- audio/audio.c | 17 +++++++++++++++++ audio/dbusaudio.c | 9 +++++++-- ui/dbus.c | 8 +------- 5 files changed, 38 insertions(+), 10 deletions(-) diff --git a/audio/audio.h b/audio/audio.h index 0a016bdabc..08753f621a 100644 --- a/audio/audio.h +++ b/audio/audio.h @@ -28,6 +28,9 @@ #include "qemu/queue.h" #include "qapi/qapi-types-audio.h" #include "hw/qdev-properties-system.h" +#ifdef CONFIG_GIO +#include "gio/gio.h" +#endif =20 typedef void (*audio_callback_fn) (void *opaque, int avail); =20 @@ -162,6 +165,12 @@ void audio_help(void); AudioBackend *audio_be_by_name(const char *name, Error **errp); AudioBackend *audio_get_default_audio_be(Error **errp); const char *audio_be_get_id(AudioBackend *be); +#ifdef CONFIG_GIO +bool audio_be_set_dbus_server(AudioBackend *be, + GDBusObjectManagerServer *server, + bool p2p, + Error **errp); +#endif =20 #define DEFINE_AUDIO_PROPERTIES(_s, _f) \ DEFINE_PROP_AUDIODEV("audiodev", _s, _f) diff --git a/audio/audio_int.h b/audio/audio_int.h index c4453b3a29..d66f7aac32 100644 --- a/audio/audio_int.h +++ b/audio/audio_int.h @@ -148,7 +148,10 @@ struct audio_driver { void *(*init) (Audiodev *, Error **); void (*fini) (void *); #ifdef CONFIG_GIO - void (*set_dbus_server)(AudioBackend *s, GDBusObjectManagerServer *man= ager, bool p2p); + bool (*set_dbus_server)(AudioBackend *be, + GDBusObjectManagerServer *manager, + bool p2p, + Error **errp); #endif struct audio_pcm_ops *pcm_ops; int max_voices_out; diff --git a/audio/audio.c b/audio/audio.c index d9a5695eb8..3229829bef 100644 --- a/audio/audio.c +++ b/audio/audio.c @@ -2223,6 +2223,23 @@ AudioBackend *audio_be_by_name(const char *name, Err= or **errp) } } =20 +#ifdef CONFIG_GIO +bool audio_be_set_dbus_server(AudioBackend *be, + GDBusObjectManagerServer *server, + bool p2p, + Error **errp) +{ + assert(be !=3D NULL); + + if (!be->drv->set_dbus_server) { + error_setg(errp, "Audiodev '%s' is not compatible with DBus", be->= dev->id); + return false; + } + + return be->drv->set_dbus_server(be, server, p2p, errp); +} +#endif + const char *audio_be_get_id(AudioBackend *be) { if (be) { diff --git a/audio/dbusaudio.c b/audio/dbusaudio.c index 49cef38e3e..c97c34b486 100644 --- a/audio/dbusaudio.c +++ b/audio/dbusaudio.c @@ -645,8 +645,11 @@ dbus_audio_register_in_listener(AudioBackend *s, arg_listener, false); } =20 -static void -dbus_audio_set_server(AudioBackend *s, GDBusObjectManagerServer *server, b= ool p2p) +static bool +dbus_audio_set_server(AudioBackend *s, + GDBusObjectManagerServer *server, + bool p2p, + Error **errp) { DBusAudio *da =3D s->drv_opaque; =20 @@ -669,6 +672,8 @@ dbus_audio_set_server(AudioBackend *s, GDBusObjectManag= erServer *server, bool p2 g_dbus_object_skeleton_add_interface(G_DBUS_OBJECT_SKELETON(da->audio), G_DBUS_INTERFACE_SKELETON(da->ifa= ce)); g_dbus_object_manager_server_export(da->server, da->audio); + + return true; } =20 static struct audio_pcm_ops dbus_pcm_ops =3D { diff --git a/ui/dbus.c b/ui/dbus.c index 84cff47ec7..fbe108af1e 100644 --- a/ui/dbus.c +++ b/ui/dbus.c @@ -221,15 +221,9 @@ dbus_display_complete(UserCreatable *uc, Error **errp) =20 if (dd->audiodev && *dd->audiodev) { AudioBackend *audio_be =3D audio_be_by_name(dd->audiodev, errp); - if (!audio_be) { + if (!audio_be || !audio_be_set_dbus_server(audio_be, dd->server, d= d->p2p, errp)) { return; } - if (!g_str_equal(audio_be->drv->name, "dbus")) { - error_setg(errp, "Audiodev '%s' is not compatible with DBus", - dd->audiodev); - return; - } - audio_be->drv->set_dbus_server(audio_be, dd->server, dd->p2p); } =20 consoles =3D g_array_new(FALSE, FALSE, sizeof(guint32)); --=20 2.51.1