qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Gerd Hoffmann <kraxel@redhat.com>
To: qemu-devel@nongnu.org
Cc: Gerd Hoffmann <kraxel@redhat.com>
Subject: [Qemu-devel] [PATCH 2/7] audio: add module loading support
Date: Tue,  6 Mar 2018 08:40:48 +0100	[thread overview]
Message-ID: <20180306074053.22856-3-kraxel@redhat.com> (raw)
In-Reply-To: <20180306074053.22856-1-kraxel@redhat.com>

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 <kraxel@redhat.com>
---
 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 {
 
 #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)
 
 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) == 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) {
-- 
2.9.3

  parent reply	other threads:[~2018-03-06  7:41 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-06  7:40 [Qemu-devel] [PATCH 0/7] audio: modularize Gerd Hoffmann
2018-03-06  7:40 ` [Qemu-devel] [PATCH 1/7] audio: add driver registry Gerd Hoffmann
2018-03-06 10:58   ` Marc-André Lureau
2018-03-06  7:40 ` Gerd Hoffmann [this message]
2018-03-06 10:59   ` [Qemu-devel] [PATCH 2/7] audio: add module loading support Marc-André Lureau
2018-03-06  7:40 ` [Qemu-devel] [PATCH 3/7] build: enable audio modules Gerd Hoffmann
2018-03-06  7:40 ` [Qemu-devel] [PATCH 4/7] audio/alsa: build as module Gerd Hoffmann
2018-03-06  7:40 ` [Qemu-devel] [PATCH 5/7] audio/oss: " Gerd Hoffmann
2018-03-06  7:40 ` [Qemu-devel] [PATCH 6/7] audio/pulseaudio: " Gerd Hoffmann
2018-03-06  7:40 ` [Qemu-devel] [PATCH 7/7] audio/sdl: " Gerd Hoffmann
2018-03-06 11:22 ` [Qemu-devel] [PATCH 0/7] audio: modularize Marc-André Lureau
2018-03-06 11:42   ` Gerd Hoffmann
2018-03-06 12:43     ` Marc-André Lureau
2018-03-06 13:27       ` Gerd Hoffmann
2018-03-06 15:28         ` Marc-André Lureau

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180306074053.22856-3-kraxel@redhat.com \
    --to=kraxel@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).