Module Name:    src
Committed By:   riastradh
Date:           Wed Oct 26 23:45:43 UTC 2022

Modified Files:
        src/sys/dev/ir: irframe_tty.c

Log Message:
irframetty(4): Convert to ttylock/ttyunlock.


To generate a diff of this commit:
cvs rdiff -u -r1.66 -r1.67 src/sys/dev/ir/irframe_tty.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/ir/irframe_tty.c
diff -u src/sys/dev/ir/irframe_tty.c:1.66 src/sys/dev/ir/irframe_tty.c:1.67
--- src/sys/dev/ir/irframe_tty.c:1.66	Tue May 24 20:50:19 2022
+++ src/sys/dev/ir/irframe_tty.c	Wed Oct 26 23:45:43 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: irframe_tty.c,v 1.66 2022/05/24 20:50:19 andvar Exp $	*/
+/*	$NetBSD: irframe_tty.c,v 1.67 2022/10/26 23:45:43 riastradh Exp $	*/
 
 /*
  * TODO
@@ -41,7 +41,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: irframe_tty.c,v 1.66 2022/05/24 20:50:19 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: irframe_tty.c,v 1.67 2022/10/26 23:45:43 riastradh Exp $");
 
 #include <sys/param.h>
 #include <sys/proc.h>
@@ -313,9 +313,9 @@ irframetopen(dev_t dev, struct tty *tp)
 
 	DPRINTF(("%s: set sc=%p\n", __func__, sc));
 
-	mutex_spin_enter(&tty_lock);
+	ttylock(tp);
 	ttyflush(tp, FREAD | FWRITE);
-	mutex_spin_exit(&tty_lock);
+	ttyunlock(tp);
 
 	sc->sc_dongle = DONGLE_NONE;
 	sc->sc_dongle_private = 0;
@@ -341,9 +341,9 @@ irframetclose(struct tty *tp, int flag)
 	DPRINTF(("%s: tp=%p\n", __func__, tp));
 
 	s = spltty();
-	mutex_spin_enter(&tty_lock);
+	ttylock(tp);
 	ttyflush(tp, FREAD | FWRITE);
-	mutex_spin_exit(&tty_lock);	 /* XXX */
+	ttyunlock(tp);	 /* XXX */
 	ttyldisc_release(tp->t_linesw);
 	tp->t_linesw = ttyldisc_default(); if (sc != NULL) {
 		irt_buffer(sc, 0);
@@ -684,17 +684,17 @@ irt_putc(struct tty *tp, int c)
 #endif
 	if (tp->t_outq.c_cc > tp->t_hiwat) {
 		irframetstart(tp);
-		mutex_spin_enter(&tty_lock);
+		ttylock(tp);
 		/*
 		 * This can only occur if FLUSHO is set in t_lflag,
 		 * or if ttstart/oproc is synchronous (or very fast).
 		 */
 		if (tp->t_outq.c_cc <= tp->t_hiwat) {
-			mutex_spin_exit(&tty_lock);
+			ttyunlock(tp);
 			goto go;
 		}
 		error = ttysleep(tp, &tp->t_outcv, true, 0);
-		mutex_spin_exit(&tty_lock);
+		ttyunlock(tp);
 		if (error)
 			return (error);
 	}

Reply via email to