Source-Changes-HG archive

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

[src/trunk]: src/sys/dev audio(4): Fix indirect circular dependency with audi...



details:   https://anonhg.NetBSD.org/src/rev/436286f2c479
branches:  trunk
changeset: 333390:436286f2c479
user:      uebayasi <uebayasi%NetBSD.org@localhost>
date:      Sat Nov 01 05:56:36 2014 +0000

description:
audio(4): Fix indirect circular dependency with audio if drivers

Provide audio_attach_mi(4) as inline so that audio if drivers don't need to
call functions in audio.c.  This way audio if drivers (e.g. auich(4)) can be
linked into kernel without audio.c.

diffstat:

 sys/dev/audio.c    |  25 ++-----------------------
 sys/dev/audio_if.h |  28 +++++++++++++++++++++++++---
 2 files changed, 27 insertions(+), 26 deletions(-)

diffs (90 lines):

diff -r bc60c42e86bf -r 436286f2c479 sys/dev/audio.c
--- a/sys/dev/audio.c   Sat Nov 01 04:34:27 2014 +0000
+++ b/sys/dev/audio.c   Sat Nov 01 05:56:36 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: audio.c,v 1.263 2014/07/25 08:10:35 dholland Exp $     */
+/*     $NetBSD: audio.c,v 1.264 2014/11/01 05:56:36 uebayasi Exp $     */
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -155,7 +155,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.263 2014/07/25 08:10:35 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.264 2014/11/01 05:56:36 uebayasi Exp $");
 
 #include "audio.h"
 #if NAUDIO > 0
@@ -829,27 +829,6 @@
        }
 }
 
-/*
- * Called from hardware driver.  This is where the MI audio driver gets
- * probed/attached to the hardware driver.
- */
-device_t
-audio_attach_mi(const struct audio_hw_if *ahwp, void *hdlp, device_t dev)
-{
-       struct audio_attach_args arg;
-
-#ifdef DIAGNOSTIC
-       if (ahwp == NULL) {
-               aprint_error("audio_attach_mi: NULL\n");
-               return 0;
-       }
-#endif
-       arg.type = AUDIODEV_TYPE_AUDIO;
-       arg.hwif = ahwp;
-       arg.hdl = hdlp;
-       return config_found(dev, &arg, audioprint);
-}
-
 #ifdef AUDIO_DEBUG
 void   audio_printsc(struct audio_softc *);
 void   audio_print_params(const char *, struct audio_params *);
diff -r bc60c42e86bf -r 436286f2c479 sys/dev/audio_if.h
--- a/sys/dev/audio_if.h        Sat Nov 01 04:34:27 2014 +0000
+++ b/sys/dev/audio_if.h        Sat Nov 01 05:56:36 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: audio_if.h,v 1.67 2011/11/23 23:07:31 jmcneill Exp $   */
+/*     $NetBSD: audio_if.h,v 1.68 2014/11/01 05:56:36 uebayasi Exp $   */
 
 /*
  * Copyright (c) 1994 Havard Eidnes.
@@ -254,10 +254,32 @@
 #define AUDIODEV_TYPE_MPU      3
 #define AUDIODEV_TYPE_AUX      4
 
-/* Attach the MI driver(s) to the MD driver. */
-device_t audio_attach_mi(const struct audio_hw_if *, void *, device_t);
 int    audioprint(void *, const char *);
 
+/*
+ * Called from hardware driver.  This is where the MI audio driver gets
+ * probed/attached to the hardware driver.
+ *
+ * This is provided as inline so that hardware drivers don't need to depend
+ * on audio.c.
+ */
+static inline device_t
+audio_attach_mi(const struct audio_hw_if *ahwp, void *hdlp, device_t dev)
+{
+       struct audio_attach_args arg;
+
+#ifdef DIAGNOSTIC
+       if (ahwp == NULL) {
+               aprint_error("audio_attach_mi: NULL\n");
+               return 0;
+       }
+#endif
+       arg.type = AUDIODEV_TYPE_AUDIO;
+       arg.hwif = ahwp;
+       arg.hdl = hdlp;
+       return config_found(dev, &arg, audioprint);
+}
+
 /* Device identity flags */
 #define SOUND_DEVICE           0
 #define AUDIO_DEVICE           0x80



Home | Main Index | Thread Index | Old Index