From 65ba86966146ad074da0a18d209d1a52f2befd5a Mon Sep 17 00:00:00 2001 From: Gerd Hoffmann Date: Tue, 6 Mar 2018 08:40:48 +0100 Subject: audio: add module loading support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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é Lureau Message-id: 20180306074053.22856-3-kraxel@redhat.com --- audio/audio.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'audio') 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) == 0) { + return d; + } + } + return NULL; } +static void audio_module_load_all(void) +{ + int i; + + for (i = 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; + /* 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) { -- cgit v1.2.1