From nobody Sat Oct 25 08:52:40 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1520322188175125.66612368500034; Mon, 5 Mar 2018 23:43:08 -0800 (PST) Received: from localhost ([::1]:53931 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1et7FU-0003dV-K1 for importer@patchew.org; Tue, 06 Mar 2018 02:43:00 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57476) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1et7Dj-0002jU-3r for qemu-devel@nongnu.org; Tue, 06 Mar 2018 02:41:12 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1et7De-0000BQ-8M for qemu-devel@nongnu.org; Tue, 06 Mar 2018 02:41:11 -0500 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:46640 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1et7De-0000Ab-4D for qemu-devel@nongnu.org; Tue, 06 Mar 2018 02:41:06 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6FE96EAEA0 for ; Tue, 6 Mar 2018 07:41:01 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-116-39.ams2.redhat.com [10.36.116.39]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0DC0B10B0F2E; Tue, 6 Mar 2018 07:40:55 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 7E82F1751E; Tue, 6 Mar 2018 08:40:54 +0100 (CET) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Tue, 6 Mar 2018 08:40:48 +0100 Message-Id: <20180306074053.22856-3-kraxel@redhat.com> In-Reply-To: <20180306074053.22856-1-kraxel@redhat.com> References: <20180306074053.22856-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Tue, 06 Mar 2018 07:41:01 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Tue, 06 Mar 2018 07:41:01 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'kraxel@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PATCH 2/7] audio: add module loading support X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Gerd Hoffmann Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Make audio_driver_lookup() try load the module in case it doesn't find the driver in the registry. Also load all modules for -audio-help, so the help output includes the help text for modular audio drivers. Signed-off-by: Gerd Hoffmann Reviewed-by: Marc-Andr=C3=A9 Lureau --- include/qemu/module.h | 1 + audio/audio.c | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/include/qemu/module.h b/include/qemu/module.h index 9fea75aaeb..54300ab6e5 100644 --- a/include/qemu/module.h +++ b/include/qemu/module.h @@ -54,6 +54,7 @@ typedef enum { =20 #define block_module_load_one(lib) module_load_one("block-", lib) #define ui_module_load_one(lib) module_load_one("ui-", lib) +#define audio_module_load_one(lib) module_load_one("audio-", lib) =20 void register_module_init(void (*fn)(void), module_init_type type); void register_dso_module_init(void (*fn)(void), module_init_type type); diff --git a/audio/audio.c b/audio/audio.c index 2384612b87..6eccdb17ee 100644 --- a/audio/audio.c +++ b/audio/audio.c @@ -68,9 +68,26 @@ audio_driver *audio_driver_lookup(const char *name) return d; } } + + audio_module_load_one(name); + QLIST_FOREACH(d, &audio_drivers, next) { + if (strcmp(name, d->name) =3D=3D 0) { + return d; + } + } + return NULL; } =20 +static void audio_module_load_all(void) +{ + int i; + + for (i =3D 0; i < ARRAY_SIZE(audio_prio_list); i++) { + audio_driver_lookup(audio_prio_list[i]); + } +} + struct fixed_settings { int enabled; int nb_voices; @@ -1675,6 +1692,9 @@ void AUD_help (void) { struct audio_driver *d; =20 + /* make sure we print the help text for modular drivers too */ + audio_module_load_all(); + audio_process_options ("AUDIO", audio_options); QLIST_FOREACH(d, &audio_drivers, next) { if (d->options) { --=20 2.9.3