Source-Changes-HG archive

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

[src/trunk]: src/sys/dev Make calling get_props() lockless.



details:   https://anonhg.NetBSD.org/src/rev/2a8cc0f920e0
branches:  trunk
changeset: 745052:2a8cc0f920e0
user:      isaki <isaki%NetBSD.org@localhost>
date:      Sat Feb 22 08:15:09 2020 +0000

description:
Make calling get_props() lockless.
get_props() of all MD drivers now can be called without sc_lock.

diffstat:

 sys/dev/audio/audio.c |  8 +++-----
 sys/dev/pad/pad.c     |  9 ++-------
 2 files changed, 5 insertions(+), 12 deletions(-)

diffs (67 lines):

diff -r e04224ab85ab -r 2a8cc0f920e0 sys/dev/audio/audio.c
--- a/sys/dev/audio/audio.c     Sat Feb 22 08:03:19 2020 +0000
+++ b/sys/dev/audio/audio.c     Sat Feb 22 08:15:09 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: audio.c,v 1.51 2020/02/22 08:03:19 isaki Exp $ */
+/*     $NetBSD: audio.c,v 1.52 2020/02/22 08:15:09 isaki Exp $ */
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -121,7 +121,7 @@
  *     allocm                  -       - +     (*1)
  *     freem                   -       - +     (*1)
  *     round_buffersize        -       x
- *     get_props               -       x       Called at attach time
+ *     get_props               -       -       Called at attach time
  *     trigger_output          x       x +
  *     trigger_input           x       x +
  *     dev_ioctl               -       x
@@ -142,7 +142,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.51 2020/02/22 08:03:19 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.52 2020/02/22 08:15:09 isaki Exp $");
 
 #ifdef _KERNEL_OPT
 #include "audio.h"
@@ -886,9 +886,7 @@
        sc->sc_am_used = 0;
        sc->sc_am = NULL;
 
-       mutex_enter(sc->sc_lock);
        sc->sc_props = hw_if->get_props(sc->hw_hdl);
-       mutex_exit(sc->sc_lock);
 
        /* MMAP is now supported by upper layer.  */
        sc->sc_props |= AUDIO_PROP_MMAP;
diff -r e04224ab85ab -r 2a8cc0f920e0 sys/dev/pad/pad.c
--- a/sys/dev/pad/pad.c Sat Feb 22 08:03:19 2020 +0000
+++ b/sys/dev/pad/pad.c Sat Feb 22 08:15:09 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pad.c,v 1.63 2019/06/26 12:21:40 isaki Exp $ */
+/* $NetBSD: pad.c,v 1.64 2020/02/22 08:15:09 isaki Exp $ */
 
 /*-
  * Copyright (c) 2007 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pad.c,v 1.63 2019/06/26 12:21:40 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pad.c,v 1.64 2020/02/22 08:15:09 isaki Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -795,11 +795,6 @@
 static int
 pad_get_props(void *opaque)
 {
-       struct pad_softc *sc __diagused;
-
-       sc = (struct pad_softc *)opaque;
-
-       KASSERT(mutex_owned(&sc->sc_lock));
 
        return AUDIO_PROP_PLAYBACK;
 }



Home | Main Index | Thread Index | Old Index