Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/ic - use microtime instead of getmicrotime, suggeste...



details:   https://anonhg.NetBSD.org/src/rev/6e6e052e9107
branches:  trunk
changeset: 989490:6e6e052e9107
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Thu Oct 14 09:56:12 2021 +0000

description:
- use microtime instead of getmicrotime, suggested by thorpej
- use ttclos for wchan even though we are sleeping in comopen now

diffstat:

 sys/dev/ic/com.c |  17 +++++++----------
 1 files changed, 7 insertions(+), 10 deletions(-)

diffs (49 lines):

diff -r b3fcbeac002a -r 6e6e052e9107 sys/dev/ic/com.c
--- a/sys/dev/ic/com.c  Thu Oct 14 09:52:40 2021 +0000
+++ b/sys/dev/ic/com.c  Thu Oct 14 09:56:12 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: com.c,v 1.368 2021/10/12 08:09:50 kre Exp $ */
+/* $NetBSD: com.c,v 1.369 2021/10/14 09:56:12 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 1998, 1999, 2004, 2008 The NetBSD Foundation, Inc.
@@ -66,7 +66,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: com.c,v 1.368 2021/10/12 08:09:50 kre Exp $");
+__KERNEL_RCSID(0, "$NetBSD: com.c,v 1.369 2021/10/14 09:56:12 jmcneill Exp $");
 
 #include "opt_com.h"
 #include "opt_ddb.h"
@@ -891,7 +891,7 @@
         */
        if (ISSET(tp->t_cflag, HUPCL)) {
                com_modem(sc, 0);
-               getmicrotime(&sc->sc_hup_pending);
+               microtime(&sc->sc_hup_pending);
                sc->sc_hup_pending.tv_sec++;
        }
 
@@ -984,17 +984,14 @@
                }
 
                if (timerisset(&sc->sc_hup_pending)) {
-                       getmicrotime(&now);
+                       microtime(&now);
                        while (timercmp(&now, &sc->sc_hup_pending, <)) {
-                               int ms;
-
-
                                timersub(&sc->sc_hup_pending, &now, &diff);
-                               ms = diff.tv_sec * 1000 +
+                               const int ms = diff.tv_sec * 1000 +
                                    uimax(diff.tv_usec / 1000, 1);
-                               kpause("comopen", false, mstohz(ms),
+                               kpause(ttclos, false, mstohz(ms),
                                    &sc->sc_lock);
-                               getmicrotime(&now);
+                               microtime(&now);
                        }
                        timerclear(&sc->sc_hup_pending);
                }



Home | Main Index | Thread Index | Old Index