Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A123DD778BC for ; Fri, 23 Jan 2026 22:33:51 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vjPiI-0006RL-Rx; Fri, 23 Jan 2026 17:33:11 -0500 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 1vjPiE-0006P3-0M for qemu-devel@nongnu.org; Fri, 23 Jan 2026 17:33:06 -0500 Received: from zero.eik.bme.hu ([2001:738:2001:2001::2001]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vjPiB-0007Y3-NN for qemu-devel@nongnu.org; Fri, 23 Jan 2026 17:33:05 -0500 Received: from localhost (localhost [127.0.0.1]) by zero.eik.bme.hu (Postfix) with ESMTP id A1406596ADB; Fri, 23 Jan 2026 23:32:58 +0100 (CET) X-Virus-Scanned: amavis at eik.bme.hu Received: from zero.eik.bme.hu ([127.0.0.1]) by localhost (zero.eik.bme.hu [127.0.0.1]) (amavis, port 10028) with ESMTP id 9xdzoE4SgACh; Fri, 23 Jan 2026 23:32:56 +0100 (CET) Received: by zero.eik.bme.hu (Postfix, from userid 432) id 8AA6C596ADA; Fri, 23 Jan 2026 23:32:56 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by zero.eik.bme.hu (Postfix) with ESMTP id 888A0596A03; Fri, 23 Jan 2026 23:32:56 +0100 (CET) Date: Fri, 23 Jan 2026 23:32:56 +0100 (CET) From: BALATON Zoltan To: =?ISO-8859-15?Q?Marc-Andr=E9_Lureau?= cc: qemu-devel@nongnu.org, =?ISO-8859-15?Q?Philippe_Mathieu-Daud=E9?= , Gerd Hoffmann , Christian Schoenebeck , Akihiko Odaki , Thomas Huth , Alexandre Ratchov Subject: Re: [PATCH 21/37] audio: add QOM module-objects for each backend In-Reply-To: Message-ID: <883cf392-50bb-b8ee-e5d4-0828afec6d9c@eik.bme.hu> References: <20260123074945.2563196-1-marcandre.lureau@redhat.com> <20260123074945.2563196-22-marcandre.lureau@redhat.com> <3f0d41b1-dbce-80ba-c1e2-a8d73d1c6caf@eik.bme.hu> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="3866299591-1721331925-1769207576=:11662" Received-SPF: pass client-ip=2001:738:2001:2001::2001; envelope-from=balaton@eik.bme.hu; helo=zero.eik.bme.hu X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --3866299591-1721331925-1769207576=:11662 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8BIT On Fri, 23 Jan 2026, Marc-André Lureau wrote: > On Fri, Jan 23, 2026 at 6:24 PM BALATON Zoltan wrote: >> >> On Fri, 23 Jan 2026, marcandre.lureau@redhat.com wrote: >>> From: Marc-André Lureau >>> >>> This will allow to use QOM and the dynamic object module loading. >>> >>> Signed-off-by: Marc-André Lureau >>> --- >>> audio/audio_int.h | 2 ++ >>> audio/alsaaudio.c | 27 +++++++++++++++++++++++++++ >>> audio/dbusaudio.c | 26 ++++++++++++++++++++++++++ >>> audio/dsoundaudio.c | 26 ++++++++++++++++++++++++++ >>> audio/jackaudio.c | 26 ++++++++++++++++++++++++++ >>> audio/noaudio.c | 26 ++++++++++++++++++++++++++ >>> audio/ossaudio.c | 26 ++++++++++++++++++++++++++ >>> audio/paaudio.c | 26 ++++++++++++++++++++++++++ >>> audio/pwaudio.c | 26 ++++++++++++++++++++++++++ >>> audio/sdlaudio.c | 26 ++++++++++++++++++++++++++ >>> audio/sndioaudio.c | 26 ++++++++++++++++++++++++++ >>> audio/spiceaudio.c | 26 ++++++++++++++++++++++++++ >>> audio/wavaudio.c | 26 ++++++++++++++++++++++++++ >>> audio/coreaudio.m | 26 ++++++++++++++++++++++++++ >>> 14 files changed, 341 insertions(+) >>> >>> diff --git a/audio/audio_int.h b/audio/audio_int.h >>> index 06f5160e8df..29f5864be69 100644 >>> --- a/audio/audio_int.h >>> +++ b/audio/audio_int.h >>> @@ -241,6 +241,8 @@ struct SWVoiceCap { >>> >>> struct AudioMixengBackendClass { >>> AudioBackendClass parent_class; >>> + >>> + audio_driver *driver; >>> }; >>> >>> struct AudioMixengBackend { >>> diff --git a/audio/alsaaudio.c b/audio/alsaaudio.c >>> index 814820e2864..881f3d0349d 100644 >>> --- a/audio/alsaaudio.c >>> +++ b/audio/alsaaudio.c >>> @@ -27,6 +27,7 @@ >>> #include "qemu/main-loop.h" >>> #include "qemu/module.h" >>> #include "qemu/audio.h" >>> +#include "qom/object.h" >>> #include "trace.h" >>> >>> #pragma GCC diagnostic ignored "-Waddress" >>> @@ -36,6 +37,22 @@ >>> >>> #define DEBUG_ALSA 0 >>> >>> +#define TYPE_AUDIO_ALSA "audio-alsa" >>> +OBJECT_DECLARE_SIMPLE_TYPE(AudioALSA, AUDIO_ALSA) >>> + >>> +struct AudioALSA { >>> + AudioMixengBackend parent; >>> +}; >> >> If you have nothing to put here only the parent you don't need to declare >> the state struct... >> >>> + >>> +static struct audio_driver alsa_audio_driver; >>> + >>> +static void audio_alsa_class_init(ObjectClass *klass, const void *data) >>> +{ >>> + AudioMixengBackendClass *k = AUDIO_MIXENG_BACKEND_CLASS(klass); >>> + >>> + k->driver = &alsa_audio_driver; >>> +} >>> + >>> struct pollhlp { >>> snd_pcm_t *handle; >>> struct pollfd *pfds; >>> @@ -945,8 +962,18 @@ static struct audio_driver alsa_audio_driver = { >>> .voice_size_in = sizeof (ALSAVoiceIn) >>> }; >>> >>> +static const TypeInfo audio_alsa_info = { >>> + .name = TYPE_AUDIO_ALSA, >>> + .parent = TYPE_AUDIO_MIXENG_BACKEND, >>> + .instance_size = sizeof(AudioALSA), >> >> ...and can set instance_size of the parent so I think you can drop the >> struct above everywhere where no other fields are needed other than the >> parent. (See e.g. via_mc97_info) > > True, although the pending patches to finish the conversion to QOM will > add fields there. This is an intermediary step, but yes, I can drop > the "empty" structs for now. No need to drop it if you will add class specific fields to these structs, just this series didn't add any so I thought the structs aren't needed and could avoid some boiler plate code. If you'd add it back shortly in subsequent patches then it's OK to add them here. Regards, BALATON Zoltan --3866299591-1721331925-1769207576=:11662--