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 E80ABE7BD92 for ; Mon, 16 Feb 2026 11:25:58 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vrwfG-0005RD-7Q; Mon, 16 Feb 2026 06:21:18 -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 1vrwbv-0006EE-Ut for qemu-arm@nongnu.org; Mon, 16 Feb 2026 06:17:52 -0500 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 1vrwbp-00086d-4j for qemu-arm@nongnu.org; Mon, 16 Feb 2026 06:17:51 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1771240664; 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=ZAePRO9iX/CdNZl5mbtEzsh4UrYfxMJmJv42slqeaKE=; b=jKQBGvqsKUTAS47ZiwL6VOCvGTpsx9cbJ/7GNeWDdtTrd9s/rLx9V9CvnCBUKYEMFVkoZM 9K7c1i2D36QsQRdAsT+QfW/lbTUzZBq+oMvYVCVDHk8lqfBwH09HuJFqNhwRENVCRiZg1d RJe4S5O9ENrwvn2l2SZFeZKewUO4Jbg= 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-213-jmIuXMb8MmCISZFgiasbOQ-1; Mon, 16 Feb 2026 06:17:41 -0500 X-MC-Unique: jmIuXMb8MmCISZFgiasbOQ-1 X-Mimecast-MFC-AGG-ID: jmIuXMb8MmCISZFgiasbOQ_1771240659 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 43D7119560AA; Mon, 16 Feb 2026 11:17:39 +0000 (UTC) Received: from localhost (unknown [10.45.242.26]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id C96B119560A2; Mon, 16 Feb 2026 11:17:37 +0000 (UTC) From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Mon, 16 Feb 2026 12:15:32 +0100 Subject: [PATCH 43/85] audio/spice: convert to QOM lifecycle methods MIME-Version: 1.0 Message-Id: <20260216-audio-v1-43-e676662e4514@redhat.com> References: <20260216-audio-v1-0-e676662e4514@redhat.com> In-Reply-To: <20260216-audio-v1-0-e676662e4514@redhat.com> To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , Eduardo Habkost , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , John Snow , Cleber Rosa , Christian Schoenebeck , Akihiko Odaki , Thomas Huth , Alexandre Ratchov , =?utf-8?q?Alex_Benn=C3=A9e?= , Laurent Vivier , "Michael S. Tsirkin" , Manos Pitsidianakis , Alistair Francis , "Edgar E. Iglesias" , Peter Maydell , qemu-arm@nongnu.org, =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Mark Cave-Ayland X-Developer-Signature: v=1; a=openpgp-sha256; l=2621; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=Rcs408lO9P4mK3uz8yvMkyVGqD72XWjzygJPEae432E=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBpkvxQAwF6m/TkCaYFng41JyP1I6mFplns1w39M VCyg9F1V7yJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaZL8UAAKCRDa6OEJdZac 5dXTD/4roKmuR4JVDbGSh1B2Tv7YYNc+wLiMg6Vo5Oum72fx4eaGMB/jDzjpWl1tcYyUeHZRydY yF5FSzdhdVz+gvs53HwXhwyKcbEt1jJPAim14RehF7e5Y2ZOp1VSQ1XS9VcdTUPvaw4BtmIMbUU LJCI2SLTzLYyt2/wgKhYmB3NmedVG3n1ljRyPSq7zF1gTjsct6X7d7jAW+qQd/sYDsgfK7ANrDG 7g/oaWYhLP6F7lscbZOrboROm1u4OQY0JaXruNETx6xb+DyJF4khxKvNL9z/rRkeI8v3eKqUXvr RkaTJM6WmWv4GSV0BVRHoo3IPz6hPBQ478s2nihRbNFAtf/7qhVHRV1jXk6SjlGbeRxEj6fmeVF 6iy2cdA48jsyGIFXYEaf/NDKr2nR7L6dSwvMCSv0dRNrcW+ux5BZjBdBvSxPPgMDJn6i5XW3UVw 3wMnVoB1guas3YAioQW4wb/pE7M0GzwktYauLXKk/I0UYvFJZ2yczpes1p3f3U0SOvvPLQ33/CY Z6xZo2JYiGEFGtkZiUPtpb2O++cSBT44eTn6Tu0mu8xMvuphALaC8lY8S67Q6sy3Q8j0aHB2QpC K/izWRigAhPbugB0kfMtLL1uKsxdK93BWkchDYQ0b3MAIuqKen/w8oaA9IftG/D3fXiIyv4t62x TczxZ1PJLLgvXzw== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 X-Mimecast-MFC-PROC-ID: RClFBKrueidn2tGTKEEtwR6YA2HHgAl_ZRkDVjQsf6A_1771240659 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit 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_H4=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-arm@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-arm-bounces+qemu-arm=archiver.kernel.org@nongnu.org Sender: qemu-arm-bounces+qemu-arm=archiver.kernel.org@nongnu.org Migrate the SPICE audio backend from the legacy driver init/fini callbacks to proper QOM realize method. The spice_audio_init() function is replaced with spice_audio_realize(), which validates that SPICE is enabled before delegating to the parent class realize method. The empty spice_audio_fini() is removed as no cleanup is needed. Signed-off-by: Marc-André Lureau Reviewed-by: Mark Cave-Ayland --- audio/spiceaudio.c | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/audio/spiceaudio.c b/audio/spiceaudio.c index ad7cb69673b..953dbf6c308 100644 --- a/audio/spiceaudio.c +++ b/audio/spiceaudio.c @@ -33,16 +33,33 @@ #define TYPE_AUDIO_SPICE "audio-spice" OBJECT_DECLARE_SIMPLE_TYPE(AudioSpice, AUDIO_SPICE) +static AudioBackendClass *audio_spice_parent_class; + struct AudioSpice { AudioMixengBackend parent_obj; }; static struct audio_driver spice_audio_driver; +static bool spice_audio_realize(AudioBackend *abe, Audiodev *dev, Error **errp) +{ + if (!using_spice) { + error_setg(errp, "Cannot use spice audio without -spice"); + qapi_free_Audiodev(dev); + return false; + } + + return audio_spice_parent_class->realize(abe, dev, errp); +} + static void audio_spice_class_init(ObjectClass *klass, const void *data) { + AudioBackendClass *b = AUDIO_BACKEND_CLASS(klass); AudioMixengBackendClass *k = AUDIO_MIXENG_BACKEND_CLASS(klass); + audio_spice_parent_class = AUDIO_BACKEND_CLASS(object_class_get_parent(klass)); + + b->realize = spice_audio_realize; k->driver = &spice_audio_driver; } @@ -89,21 +106,6 @@ static const SpiceRecordInterface record_sif = { .base.minor_version = SPICE_INTERFACE_RECORD_MINOR, }; -static void *spice_audio_init(Audiodev *dev, Error **errp) -{ - if (!using_spice) { - error_setg(errp, "Cannot use spice audio without -spice"); - return NULL; - } - - return &spice_audio_init; -} - -static void spice_audio_fini (void *opaque) -{ - /* nothing */ -} - /* playback */ static int line_out_init(HWVoiceOut *hw, struct audsettings *as, @@ -333,8 +335,6 @@ static struct audio_pcm_ops audio_callbacks = { static struct audio_driver spice_audio_driver = { .name = "spice", - .init = spice_audio_init, - .fini = spice_audio_fini, .pcm_ops = &audio_callbacks, .max_voices_out = 1, .max_voices_in = 1, -- 2.53.0