get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/2196857/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 2196857,
    "url": "http://patchwork.ozlabs.org/api/patches/2196857/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20260216-audio-v1-54-e676662e4514@redhat.com/",
    "project": {
        "id": 14,
        "url": "http://patchwork.ozlabs.org/api/projects/14/?format=api",
        "name": "QEMU Development",
        "link_name": "qemu-devel",
        "list_id": "qemu-devel.nongnu.org",
        "list_email": "qemu-devel@nongnu.org",
        "web_url": "",
        "scm_url": "",
        "webscm_url": "",
        "list_archive_url": "",
        "list_archive_url_format": "",
        "commit_url_format": ""
    },
    "msgid": "<20260216-audio-v1-54-e676662e4514@redhat.com>",
    "list_archive_url": null,
    "date": "2026-02-16T11:15:43",
    "name": "[54/85] audio/dsound: convert to QOM lifecycle methods",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "cbe26f3c5b086add6b5275fed91c096c6909d9d4",
    "submitter": {
        "id": 66774,
        "url": "http://patchwork.ozlabs.org/api/people/66774/?format=api",
        "name": "Marc-André Lureau",
        "email": "marcandre.lureau@redhat.com"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20260216-audio-v1-54-e676662e4514@redhat.com/mbox/",
    "series": [
        {
            "id": 492294,
            "url": "http://patchwork.ozlabs.org/api/series/492294/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/list/?series=492294",
            "date": "2026-02-16T11:14:52",
            "name": "audio: cleanups & add a manual test",
            "version": 1,
            "mbox": "http://patchwork.ozlabs.org/series/492294/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/2196857/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/2196857/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>",
        "X-Original-To": "incoming@patchwork.ozlabs.org",
        "Delivered-To": "patchwork-incoming@legolas.ozlabs.org",
        "Authentication-Results": [
            "legolas.ozlabs.org;\n\tdkim=pass (1024-bit key;\n unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256\n header.s=mimecast20190719 header.b=e51bSX0X;\n\tdkim-atps=neutral",
            "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org\n (client-ip=209.51.188.17; helo=lists.gnu.org;\n envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n receiver=patchwork.ozlabs.org)"
        ],
        "Received": [
            "from lists.gnu.org (lists.gnu.org [209.51.188.17])\n\t(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fF0pv4VQMz1xxy\n\tfor <incoming@patchwork.ozlabs.org>; Mon, 16 Feb 2026 22:26:47 +1100 (AEDT)",
            "from localhost ([::1] helo=lists1p.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.90_1)\n\t(envelope-from <qemu-devel-bounces@nongnu.org>)\n\tid 1vrwfd-0000Az-8Z; Mon, 16 Feb 2026 06:21:41 -0500",
            "from eggs.gnu.org ([2001:470:142:3::10])\n by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <marcandre.lureau@redhat.com>)\n id 1vrwcM-0006iA-07\n for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:18:21 -0500",
            "from us-smtp-delivery-124.mimecast.com ([170.10.133.124])\n by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <marcandre.lureau@redhat.com>)\n id 1vrwcJ-0008DA-2m\n for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:18:17 -0500",
            "from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com\n (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by\n relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3,\n cipher=TLS_AES_256_GCM_SHA384) id us-mta-576-zgK7_PJxM1C-l1zrxRviUg-1; Mon,\n 16 Feb 2026 06:18:11 -0500",
            "from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com\n (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4])\n (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest\n SHA256)\n (No client certificate requested)\n by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS\n id 400FB1800465; Mon, 16 Feb 2026 11:18:09 +0000 (UTC)",
            "from localhost (unknown [10.45.242.26])\n by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP\n id 9A6B130001A5; Mon, 16 Feb 2026 11:18:08 +0000 (UTC)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n s=mimecast20190719; t=1771240694;\n h=from:from:reply-to:subject:subject:date:date:message-id:message-id:\n to:to:cc:cc:mime-version:mime-version:content-type:content-type:\n content-transfer-encoding:content-transfer-encoding:\n in-reply-to:in-reply-to:references:references;\n bh=8Im4lnpoE1TK3toHuThq/L1NhoACCesgAi+QPC2+8cY=;\n b=e51bSX0X1CzIoITiUxqI5zS6FqF8una78nQJXd31424vHvs5GLNalVgkLoCKUeRNr5qgfO\n vLRFVNLis1pef4Q7Zv57OqSxkjefmES9XOmUaW2TOewa/1IL3Jct2rYo8ghJCffk+FUs33\n h+y1k+NAd2pdmpVlotD1dPhHI1W8fvw=",
        "X-MC-Unique": "zgK7_PJxM1C-l1zrxRviUg-1",
        "X-Mimecast-MFC-AGG-ID": "zgK7_PJxM1C-l1zrxRviUg_1771240689",
        "From": "=?utf-8?q?Marc-Andr=C3=A9_Lureau?= <marcandre.lureau@redhat.com>",
        "Date": "Mon, 16 Feb 2026 12:15:43 +0100",
        "Subject": "[PATCH 54/85] audio/dsound: convert to QOM lifecycle methods",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=\"utf-8\"",
        "Content-Transfer-Encoding": "8bit",
        "Message-Id": "<20260216-audio-v1-54-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 <kraxel@redhat.com>,  Eduardo Habkost <eduardo@habkost.net>,\n Paolo Bonzini <pbonzini@redhat.com>,\n =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= <berrange@redhat.com>, =?utf-8?q?Phil?=\n\t=?utf-8?q?ippe_Mathieu-Daud=C3=A9?= <philmd@linaro.org>,\n  John Snow <jsnow@redhat.com>, Cleber Rosa <crosa@redhat.com>,\n  Christian Schoenebeck <qemu_oss@crudebyte.com>,\n  Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>,\n  Thomas Huth <huth@tuxfamily.org>, Alexandre Ratchov <alex@caoua.org>,\n\t=?utf-8?q?Alex_Benn=C3=A9e?= <alex.bennee@linaro.org>,\n  Laurent Vivier <laurent@vivier.eu>, \"Michael S. Tsirkin\" <mst@redhat.com>,\n  Manos Pitsidianakis <manos.pitsidianakis@linaro.org>,\n  Alistair Francis <alistair@alistair23.me>,\n  \"Edgar E. Iglesias\" <edgar.iglesias@gmail.com>,\n  Peter Maydell <peter.maydell@linaro.org>, qemu-arm@nongnu.org, =?utf-8?q?M?=\n\t=?utf-8?q?arc-Andr=C3=A9_Lureau?= <marcandre.lureau@redhat.com>,\n  Mark Cave-Ayland <mark.caveayland@nutanix.com>",
        "X-Developer-Signature": "v=1; a=openpgp-sha256; l=10062;\n i=marcandre.lureau@redhat.com; h=from:subject:message-id;\n bh=zosDSUMZvgT7AxQdHHQTxQcAqrjNJXmlF9JjWNb4w0A=;\n b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBpkvxQ50UdJWvf78vYCPsgMOXHp2+/NgRW89lse\n nNjA3PL7omJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaZL8UAAKCRDa6OEJdZac\n 5YMzD/wIHUx2MVT1354xNxdM0amM8faKAoGJxapM6/YG2Co5WSaFpKEGdJ09XATxm7LcsUq20wH\n jq6zKSD1KVlYFhRpeDwHRKAU8ngFO9GTBLrNvf3WlcXbodTOUH6uGrHFC38r1Te9vxTRQfG/wUX\n YmATdka1uZE8o/XnzEV44pogKSvJAazdDOk/O04PeoJSEq4BPgFYv0cFNAlus96GUaynCAu9BWt\n jOvZxWussEatxU5NwZ9PXWWBzH29B8JW+u2U9ur2qYjY0aiSDYY5uAG4tnxBAz8OVGbpMh6lJg3\n mL8t31h/e1z+GzcainC0RRdJ3KjQ45JxLR4FrMSulWHussrvJfx/I0x5TaGpE0zBwRdZEh7FTlf\n cKrdrk/1K8/VHeaMdjjQ2IbZVFLXQQvKHlFclMjuUMJrZ/vRxEJooFrrRsIuCCtGCZot/ZWypic\n a7VI7zjYJ3R+PYAXFX8XFaY3yIPs2FLE2GcWC2R5bmVOlRurDRyDC+KgYJ6/MO6XX4HlKpUzzKY\n 6LdVnRWYM5zeNxRH8eJPl/3Jnijvu06vbXljEGKWIBxsUrJ+o2YvpJr60cwkW7FOqNxg37MP3i/\n HbVA3vhRcwjfa6MoRNcM2Ra214sxEoC8aETmBW+v8ECGlkTG00Cr5Tj79SXpnn78WpMKzT/khof\n K7BQL9bodOLnpmQ==",
        "X-Developer-Key": "i=marcandre.lureau@redhat.com; a=openpgp;\n fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5",
        "X-Scanned-By": "MIMEDefang 3.4.1 on 10.30.177.4",
        "Received-SPF": "pass client-ip=170.10.133.124;\n envelope-from=marcandre.lureau@redhat.com;\n 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,\n DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,\n RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001,\n RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001,\n 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 <qemu-devel.nongnu.org>",
        "List-Unsubscribe": "<https://lists.nongnu.org/mailman/options/qemu-devel>,\n <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>",
        "List-Archive": "<https://lists.nongnu.org/archive/html/qemu-devel>",
        "List-Post": "<mailto:qemu-devel@nongnu.org>",
        "List-Help": "<mailto:qemu-devel-request@nongnu.org?subject=help>",
        "List-Subscribe": "<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n <mailto:qemu-devel-request@nongnu.org?subject=subscribe>",
        "Errors-To": "qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org",
        "Sender": "qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org"
    },
    "content": "Migrate the DirectSound audio backend from the legacy driver init/fini\ncallbacks to proper QOM realize and finalize methods.\n\nThe dsound struct fields are now embedded directly in the AudioDsound\nQOM object instead of being allocated separately as drv_opaque. This\nallows accessing the backend state through proper QOM type casting\nwith AUDIO_DSOUND() rather than casting drv_opaque pointers.\n\nThe DirectSound and DirectSoundCapture COM objects are now managed\nthrough the QOM lifecycle, with initialization in realize and cleanup\nin finalize.\n\nSigned-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>\nReviewed-by: Mark Cave-Ayland <mark.caveayland@nutanix.com>\n---\n audio/dsound_template.h |  9 +++--\n audio/dsoundaudio.c     | 87 +++++++++++++++++++++++--------------------------\n 2 files changed, 45 insertions(+), 51 deletions(-)",
    "diff": "diff --git a/audio/dsound_template.h b/audio/dsound_template.h\nindex 0678f2de38b..7979773eb86 100644\n--- a/audio/dsound_template.h\n+++ b/audio/dsound_template.h\n@@ -72,7 +72,7 @@ static int glue (dsound_lock_, TYPE) (\n     DWORD *blen1p,\n     DWORD *blen2p,\n     int entire,\n-    dsound *s\n+    AudioDsound *s\n     )\n {\n     HRESULT hr;\n@@ -166,7 +166,7 @@ static int dsound_init_out(HWVoiceOut *hw, struct audsettings *as,\n {\n     int err;\n     HRESULT hr;\n-    dsound *s = drv_opaque;\n+    AudioDsound *s = AUDIO_DSOUND(hw->s);\n     WAVEFORMATEX wfx;\n     struct audsettings obt_as;\n #ifdef DSBTYPE_IN\n@@ -174,13 +174,13 @@ static int dsound_init_out(HWVoiceOut *hw, struct audsettings *as,\n     DSoundVoiceIn *ds = (DSoundVoiceIn *) hw;\n     DSCBUFFERDESC bd;\n     DSCBCAPS bc;\n-    AudiodevPerDirectionOptions *pdo = s->dev->u.dsound.in;\n+    AudiodevPerDirectionOptions *pdo = hw->s->dev->u.dsound.in;\n #else\n     const char *typ = \"DAC\";\n     DSoundVoiceOut *ds = (DSoundVoiceOut *) hw;\n     DSBUFFERDESC bd;\n     DSBCAPS bc;\n-    AudiodevPerDirectionOptions *pdo = s->dev->u.dsound.out;\n+    AudiodevPerDirectionOptions *pdo = hw->s->dev->u.dsound.out;\n #endif\n \n     if (!s->FIELD2) {\n@@ -256,7 +256,6 @@ static int dsound_init_out(HWVoiceOut *hw, struct audsettings *as,\n     }\n     hw->size_emul = bc.dwBufferBytes;\n     hw->samples = bc.dwBufferBytes / hw->info.bytes_per_frame;\n-    ds->s = s;\n \n #ifdef DEBUG_DSOUND\n     dolog (\"caps %ld, desc %ld\\n\",\ndiff --git a/audio/dsoundaudio.c b/audio/dsoundaudio.c\nindex 462d09e02af..a90c348230b 100644\n--- a/audio/dsoundaudio.c\n+++ b/audio/dsoundaudio.c\n@@ -45,40 +45,30 @@\n #define TYPE_AUDIO_DSOUND \"audio-dsound\"\n OBJECT_DECLARE_SIMPLE_TYPE(AudioDsound, AUDIO_DSOUND)\n \n+static AudioBackendClass *audio_dsound_parent_class;\n+\n struct AudioDsound {\n     AudioMixengBackend parent_obj;\n+\n+    LPDIRECTSOUND dsound;\n+    LPDIRECTSOUNDCAPTURE dsound_capture;\n+    struct audsettings settings;\n };\n \n static struct audio_driver dsound_audio_driver;\n \n-static void audio_dsound_class_init(ObjectClass *klass, const void *data)\n-{\n-    AudioMixengBackendClass *k = AUDIO_MIXENG_BACKEND_CLASS(klass);\n-\n-    k->driver = &dsound_audio_driver;\n-}\n-\n /* #define DEBUG_DSOUND */\n \n-typedef struct {\n-    LPDIRECTSOUND dsound;\n-    LPDIRECTSOUNDCAPTURE dsound_capture;\n-    struct audsettings settings;\n-    Audiodev *dev;\n-} dsound;\n-\n typedef struct {\n     HWVoiceOut hw;\n     LPDIRECTSOUNDBUFFER dsound_buffer;\n     bool first_time;\n-    dsound *s;\n } DSoundVoiceOut;\n \n typedef struct {\n     HWVoiceIn hw;\n     LPDIRECTSOUNDCAPTUREBUFFER dsound_capture_buffer;\n     bool first_time;\n-    dsound *s;\n } DSoundVoiceIn;\n \n static const char *dserror(HRESULT hr)\n@@ -276,7 +266,7 @@ static void print_wave_format (WAVEFORMATEX *wfx)\n }\n #endif\n \n-static int dsound_restore_out (LPDIRECTSOUNDBUFFER dsb, dsound *s)\n+static int dsound_restore_out (LPDIRECTSOUNDBUFFER dsb, AudioDsound *s)\n {\n     HRESULT hr;\n \n@@ -295,7 +285,7 @@ static int dsound_restore_out (LPDIRECTSOUNDBUFFER dsb, dsound *s)\n #undef DSBTYPE_IN\n \n static int dsound_get_status_out (LPDIRECTSOUNDBUFFER dsb, DWORD *statusp,\n-                                  dsound *s)\n+                                  AudioDsound *s)\n {\n     HRESULT hr;\n \n@@ -328,7 +318,7 @@ static int dsound_get_status_in (LPDIRECTSOUNDCAPTUREBUFFER dscb,\n }\n \n static void dsound_clear_sample (HWVoiceOut *hw, LPDIRECTSOUNDBUFFER dsb,\n-                                 dsound *s)\n+                                 AudioDsound *s)\n {\n     int err;\n     LPVOID p1, p2;\n@@ -372,9 +362,9 @@ static void dsound_enable_out(HWVoiceOut *hw, bool enable)\n {\n     HRESULT hr;\n     DWORD status;\n+    AudioDsound *s = AUDIO_DSOUND(hw->s);\n     DSoundVoiceOut *ds = (DSoundVoiceOut *) hw;\n     LPDIRECTSOUNDBUFFER dsb = ds->dsound_buffer;\n-    dsound *s = ds->s;\n \n     if (!dsb) {\n         dolog (\"Attempt to control voice without a buffer\\n\");\n@@ -450,7 +440,7 @@ static void *dsound_get_buffer_out(HWVoiceOut *hw, size_t *size)\n     assert(req_size > 0);\n \n     err = dsound_lock_out(dsb, &hw->info, hw->pos_emul, req_size, &ret, NULL,\n-                          &act_size, NULL, false, ds->s);\n+                          &act_size, NULL, false, AUDIO_DSOUND(hw->s));\n     if (err) {\n         dolog(\"Failed to lock buffer\\n\");\n         *size = 0;\n@@ -553,7 +543,7 @@ static void *dsound_get_buffer_in(HWVoiceIn *hw, size_t *size)\n     }\n \n     err = dsound_lock_in(dscb, &hw->info, hw->pos_emul, req_size, &ret, NULL,\n-                         &act_size, NULL, false, ds->s);\n+                         &act_size, NULL, false, AUDIO_DSOUND(hw->s));\n     if (err) {\n         dolog(\"Failed to lock buffer\\n\");\n         *size = 0;\n@@ -577,13 +567,12 @@ static void dsound_put_buffer_in(HWVoiceIn *hw, void *buf, size_t len)\n     hw->pos_emul = (hw->pos_emul + len) % hw->size_emul;\n }\n \n-static void dsound_audio_fini (void *opaque)\n+static void audio_dsound_finalize(Object *obj)\n {\n+    AudioDsound *s = AUDIO_DSOUND(obj);\n     HRESULT hr;\n-    dsound *s = opaque;\n \n     if (!s->dsound) {\n-        g_free(s);\n         return;\n     }\n \n@@ -594,7 +583,6 @@ static void dsound_audio_fini (void *opaque)\n     s->dsound = NULL;\n \n     if (!s->dsound_capture) {\n-        g_free(s);\n         return;\n     }\n \n@@ -603,18 +591,21 @@ static void dsound_audio_fini (void *opaque)\n         dsound_logerr (hr, \"Could not release DirectSoundCapture\\n\");\n     }\n     s->dsound_capture = NULL;\n-\n-    g_free(s);\n }\n \n-static void *dsound_audio_init(Audiodev *dev, Error **errp)\n+static bool\n+audio_dsound_realize(AudioBackend *abe, Audiodev *dev, Error **errp)\n {\n+    AudioDsound *s = AUDIO_DSOUND(abe);\n     HRESULT hr;\n-    dsound *s = g_new0(dsound, 1);\n     AudiodevDsoundOptions *dso;\n \n     assert(dev->driver == AUDIODEV_DRIVER_DSOUND);\n-    s->dev = dev;\n+\n+    if (!audio_dsound_parent_class->realize(abe, dev, errp)) {\n+        return false;\n+    }\n+\n     dso = &dev->u.dsound;\n \n     if (!dso->has_latency) {\n@@ -625,8 +616,7 @@ static void *dsound_audio_init(Audiodev *dev, Error **errp)\n     hr = CoInitialize (NULL);\n     if (FAILED (hr)) {\n         dserror_set(errp, hr, \"Could not initialize COM\");\n-        dsound_audio_fini(s);\n-        return NULL;\n+        return false;\n     }\n \n     hr = CoCreateInstance (\n@@ -638,15 +628,13 @@ static void *dsound_audio_init(Audiodev *dev, Error **errp)\n         );\n     if (FAILED (hr)) {\n         dserror_set(errp, hr, \"Could not create DirectSound instance\");\n-        dsound_audio_fini(s);\n-        return NULL;\n+        return false;\n     }\n \n     hr = IDirectSound_Initialize (s->dsound, NULL);\n     if (FAILED (hr)) {\n         dserror_set(errp, hr, \"Could not initialize DirectSound\");\n-        dsound_audio_fini(s);\n-        return NULL;\n+        return false;\n     }\n \n     hr = CoCreateInstance (\n@@ -658,15 +646,13 @@ static void *dsound_audio_init(Audiodev *dev, Error **errp)\n         );\n     if (FAILED (hr)) {\n         dserror_set(errp, hr, \"Could not create DirectSoundCapture instance\");\n-        dsound_audio_fini(s);\n-        return NULL;\n+        return false;\n     }\n \n     hr = IDirectSoundCapture_Initialize (s->dsound_capture, NULL);\n     if (FAILED(hr)) {\n         dserror_set(errp, hr, \"Could not initialize DirectSoundCapture\");\n-        dsound_audio_fini(s);\n-        return NULL;\n+        return false;\n     }\n \n     hr = IDirectSound_SetCooperativeLevel (\n@@ -676,11 +662,10 @@ static void *dsound_audio_init(Audiodev *dev, Error **errp)\n     );\n     if (FAILED(hr)) {\n         dserror_set(errp, hr, \"Could not set cooperative level\");\n-        dsound_audio_fini(s);\n-        return NULL;\n+        return false;\n     }\n \n-    return s;\n+    return true;\n }\n \n static struct audio_pcm_ops dsound_pcm_ops = {\n@@ -702,8 +687,6 @@ static struct audio_pcm_ops dsound_pcm_ops = {\n \n static struct audio_driver dsound_audio_driver = {\n     .name           = \"dsound\",\n-    .init           = dsound_audio_init,\n-    .fini           = dsound_audio_fini,\n     .pcm_ops        = &dsound_pcm_ops,\n     .max_voices_out = INT_MAX,\n     .max_voices_in  = 1,\n@@ -711,12 +694,24 @@ static struct audio_driver dsound_audio_driver = {\n     .voice_size_in  = sizeof (DSoundVoiceIn)\n };\n \n+static void audio_dsound_class_init(ObjectClass *klass, const void *data)\n+{\n+    AudioBackendClass *b = AUDIO_BACKEND_CLASS(klass);\n+    AudioMixengBackendClass *k = AUDIO_MIXENG_BACKEND_CLASS(klass);\n+\n+    audio_dsound_parent_class = AUDIO_BACKEND_CLASS(object_class_get_parent(klass));\n+\n+    b->realize = audio_dsound_realize;\n+    k->driver = &dsound_audio_driver;\n+}\n+\n static const TypeInfo audio_types[] = {\n     {\n         .name = TYPE_AUDIO_DSOUND,\n         .parent = TYPE_AUDIO_MIXENG_BACKEND,\n         .instance_size = sizeof(AudioDsound),\n         .class_init = audio_dsound_class_init,\n+        .instance_finalize = audio_dsound_finalize,\n     },\n };\n \n",
    "prefixes": [
        "54/85"
    ]
}