Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/ic zs_shutdown: lower IPL before sleeping. Also not...



details:   https://anonhg.NetBSD.org/src/rev/30ef7ca1424b
branches:  trunk
changeset: 542260:30ef7ca1424b
user:      pk <pk%NetBSD.org@localhost>
date:      Fri Jan 24 20:46:45 2003 +0000

description:
zs_shutdown: lower IPL before sleeping.  Also note the fact that the
effectiveness of that very tsleep() call is dubious at best.

diffstat:

 sys/dev/ic/z8530tty.c |  17 +++++++++++++++--
 1 files changed, 15 insertions(+), 2 deletions(-)

diffs (48 lines):

diff -r 6d63b3d49b8c -r 30ef7ca1424b sys/dev/ic/z8530tty.c
--- a/sys/dev/ic/z8530tty.c     Fri Jan 24 19:48:52 2003 +0000
+++ b/sys/dev/ic/z8530tty.c     Fri Jan 24 20:46:45 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: z8530tty.c,v 1.87 2003/01/06 13:05:13 wiz Exp $        */
+/*     $NetBSD: z8530tty.c,v 1.88 2003/01/24 20:46:45 pk Exp $ */
 
 /*-
  * Copyright (c) 1993, 1994, 1995, 1996, 1997, 1998, 1999
@@ -99,7 +99,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: z8530tty.c,v 1.87 2003/01/06 13:05:13 wiz Exp $");
+__KERNEL_RCSID(0, "$NetBSD: z8530tty.c,v 1.88 2003/01/24 20:46:45 pk Exp $");
 
 #include "opt_kgdb.h"
 
@@ -469,9 +469,21 @@
         */
        if (ISSET(tp->t_cflag, HUPCL)) {
                zs_modem(zst, 0);
+               splx(s);
+               /*
+                * XXX -    another process is not prevented from opening
+                *          the device during our sleep.
+                * XXXSMP - another process isn't prevented from opening
+                *          at even if it was waiting for t_wopen.
+                */
                (void) tsleep(cs, TTIPRI, ttclos, hz);
+               s = splzs();
        }
 
+       /* Re-check state in case we were opened during our sleep */
+       if (ISSET(tp->t_state, TS_ISOPEN) || tp->t_wopen != 0)
+               goto out;
+
        /* Turn off interrupts if not the console. */
        if (!ISSET(zst->zst_hwflags, ZS_HWFLAG_CONSOLE)) {
                CLR(cs->cs_preg[1], ZSWR1_RIE | ZSWR1_SIE);
@@ -488,6 +500,7 @@
                (*cs->disable)(zst->zst_cs);
        }
 
+out:
        splx(s);
 }
 



Home | Main Index | Thread Index | Old Index