Source-Changes-HG archive

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

[src/trunk]: src/sys/dev Attach this only if the parent device has playback c...



details:   https://anonhg.NetBSD.org/src/rev/f385dec22149
branches:  trunk
changeset: 980762:f385dec22149
user:      isaki <isaki%NetBSD.org@localhost>
date:      Wed Feb 17 12:37:33 2021 +0000

description:
Attach this only if the parent device has playback capability.

diffstat:

 sys/dev/spkr_audio.c |  13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)

diffs (45 lines):

diff -r fd75660cbd18 -r f385dec22149 sys/dev/spkr_audio.c
--- a/sys/dev/spkr_audio.c      Wed Feb 17 08:49:54 2021 +0000
+++ b/sys/dev/spkr_audio.c      Wed Feb 17 12:37:33 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: spkr_audio.c,v 1.8 2019/06/21 09:34:30 isaki Exp $     */
+/*     $NetBSD: spkr_audio.c,v 1.9 2021/02/17 12:37:33 isaki Exp $     */
 
 /*-
  * Copyright (c) 2016 Nathanial Sloss <nathanialsloss%yahoo.com.au@localhost>
@@ -27,10 +27,11 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: spkr_audio.c,v 1.8 2019/06/21 09:34:30 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: spkr_audio.c,v 1.9 2021/02/17 12:37:33 isaki Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
+#include <sys/audioio.h>
 #include <sys/kernel.h>
 #include <sys/errno.h>
 #include <sys/device.h>
@@ -41,7 +42,7 @@
 #include <sys/conf.h>
 #include <sys/sysctl.h>
 
-#include <dev/audio/audio_if.h>
+#include <dev/audio/audiovar.h>
 #include <dev/audio/audiobellvar.h>
 
 #include <dev/spkrvar.h>
@@ -90,8 +91,12 @@
 static int
 spkr_audio_probe(device_t parent, cfdata_t cf, void *aux)
 {
+       struct audio_softc *asc = device_private(parent);
 
-       return 1;
+       if ((asc->sc_props & AUDIO_PROP_PLAYBACK))
+               return 1;
+
+       return 0;
 }
 
 static void



Home | Main Index | Thread Index | Old Index