Source-Changes-HG archive

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

[src/trunk]: src/sys/dev midi(4): No need to take lock just for callout_halt.



details:   https://anonhg.NetBSD.org/src/rev/5dcd6bf3fa0a
branches:  trunk
changeset: 371984:5dcd6bf3fa0a
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Sun Oct 23 23:03:30 2022 +0000

description:
midi(4): No need to take lock just for callout_halt.

Lock is relevant only if we're doing something _else_ under the lock
that must be serialized with the callout's own action.

diffstat:

 sys/dev/midi.c |  10 ++++------
 1 files changed, 4 insertions(+), 6 deletions(-)

diffs (31 lines):

diff -r 6ce82f3e0d49 -r 5dcd6bf3fa0a sys/dev/midi.c
--- a/sys/dev/midi.c    Sun Oct 23 23:03:13 2022 +0000
+++ b/sys/dev/midi.c    Sun Oct 23 23:03:30 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: midi.c,v 1.100 2022/10/23 23:03:13 riastradh Exp $     */
+/*     $NetBSD: midi.c,v 1.101 2022/10/23 23:03:30 riastradh Exp $     */
 
 /*
  * Copyright (c) 1998, 2008 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: midi.c,v 1.100 2022/10/23 23:03:13 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: midi.c,v 1.101 2022/10/23 23:03:30 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "midi.h"
@@ -246,10 +246,8 @@
                sc->sih = NULL;
        }
 
-       mutex_enter(sc->lock);
-       callout_halt(&sc->xmt_asense_co, sc->lock);
-       callout_halt(&sc->rcv_asense_co, sc->lock);
-       mutex_exit(sc->lock);
+       callout_halt(&sc->xmt_asense_co, NULL);
+       callout_halt(&sc->rcv_asense_co, NULL);
 
        callout_destroy(&sc->xmt_asense_co);
        callout_destroy(&sc->rcv_asense_co);



Home | Main Index | Thread Index | Old Index