Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev Add rescan for audio children.



details:   https://anonhg.NetBSD.org/src/rev/17c1e4a1e2b5
branches:  trunk
changeset: 349526:17c1e4a1e2b5
user:      christos <christos%NetBSD.org@localhost>
date:      Tue Dec 13 17:12:51 2016 +0000

description:
Add rescan for audio children.

diffstat:

 sys/dev/audio.c |  42 ++++++++++++++++++++++++++++++++++++++----
 1 files changed, 38 insertions(+), 4 deletions(-)

diffs (84 lines):

diff -r e43ea1e940ae -r 17c1e4a1e2b5 sys/dev/audio.c
--- a/sys/dev/audio.c   Tue Dec 13 13:09:00 2016 +0000
+++ b/sys/dev/audio.c   Tue Dec 13 17:12:51 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: audio.c,v 1.277 2016/12/11 10:28:00 martin Exp $       */
+/*     $NetBSD: audio.c,v 1.278 2016/12/13 17:12:51 christos Exp $     */
 
 /*-
  * Copyright (c) 2016 Nathanial Sloss <nathanialsloss%yahoo.com.au@localhost>
@@ -148,7 +148,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.277 2016/12/11 10:28:00 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.278 2016/12/13 17:12:51 christos Exp $");
 
 #include "audio.h"
 #if NAUDIO > 0
@@ -305,6 +305,8 @@
 void   audioattach(device_t, device_t, void *);
 int    audiodetach(device_t, int);
 int    audioactivate(device_t, enum devact);
+void   audiochilddet(device_t, device_t);
+int    audiorescan(device_t, const char *, const int *);
 
 #ifdef AUDIO_PM_IDLE
 static void    audio_idle(void *);
@@ -436,8 +438,8 @@
 };
 
 CFATTACH_DECL3_NEW(audio, sizeof(struct audio_softc),
-    audioprobe, audioattach, audiodetach, audioactivate, NULL, NULL,
-    DVF_DETACH_SHUTDOWN);
+    audioprobe, audioattach, audiodetach, audioactivate, audiorescan,
+    audiochilddet, DVF_DETACH_SHUTDOWN);
 
 extern struct cfdriver audio_cd;
 
@@ -837,6 +839,7 @@
            audio_rec_thread, sc, &sc->sc_recthread, "audiorec");
        kthread_create(PRI_NONE, KTHREAD_MPSAFE | KTHREAD_MUSTJOIN, NULL,
            audio_play_thread, sc, &sc->sc_playthread, "audiomix");
+       audiorescan(self, "audio", NULL);
 }
 
 int
@@ -971,6 +974,37 @@
        return 0;
 }
 
+void
+audiochilddet(device_t self, device_t child)
+{
+
+       /* we hold no child references, so do nothing */
+}
+
+static int
+audiosearch(device_t parent, cfdata_t cf, const int *locs, void *aux)
+{
+
+       if (config_match(parent, cf, aux))
+               config_attach_loc(parent, cf, locs, aux, NULL);
+
+       return 0;
+}
+
+int
+audiorescan(device_t self, const char *ifattr, const int *flags)
+{
+       struct audio_softc *sc = device_private(self);
+
+       if (!ifattr_match(ifattr, "audio"))
+               return 0;
+
+       config_search_loc(audiosearch, sc->dev, "audio", NULL, NULL);
+
+       return 0;
+}
+
+
 int
 au_portof(struct audio_softc *sc, char *name, int class)
 {



Home | Main Index | Thread Index | Old Index