bug-hurd
[Top][All Lists]
Advanced

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

[PATCH 31/66] i386/i386at/com.c: simplify code


From: Marin Ramesa
Subject: [PATCH 31/66] i386/i386at/com.c: simplify code
Date: Thu, 5 Dec 2013 22:03:25 +0100

Variable comtimer_active is used uninitialized. What's the
chance of this variable getting the value FALSE? I suggest
a removal of the code that deals with this variable.

But, on the other hand, this may not be a good solution.
Maybe the variable should be initialized to FALSE, meaning
that the comtimer() has not been called, and then write at 
the return of comtimer():

comtimer_active = FALSE;

I don't really know what is better.

* i386/i386at/com.c (comtimer_active): Remove variable.
Remove check for !comtimer_active.
(comtimer): Remove function.
* i386/i386at/com.h (comtimer): Remove prototype.

---
 i386/i386at/com.c | 33 ---------------------------------
 i386/i386at/com.h |  2 --
 2 files changed, 35 deletions(-)

diff --git a/i386/i386at/com.c b/i386/i386at/com.c
index 90e1d0b..62aa85c 100644
--- a/i386/i386at/com.c
+++ b/i386/i386at/com.c
@@ -64,7 +64,6 @@ struct tty com_tty[NCOM];
 int commodem[NCOM];
 int comcarrier[NCOM] = {0, 0,};
 boolean_t comfifo[NCOM];
-boolean_t comtimer_active;
 int comtimer_state[NCOM];
 
 #define RCBAUD B9600
@@ -387,11 +386,6 @@ io_return_t comopen(
 
        result = char_open(dev, tp, flag, ior);
 
-       if (!comtimer_active) {
-               comtimer_active = TRUE;
-               comtimer(NULL);
-       }
-
        s = spltty();
        while(!(inb(INTR_ID(addr))&1)) { /* while pending interrupts */
                (void) inb(LINE_STAT (addr)); /* reset overrun error  */
@@ -667,33 +661,6 @@ comst_4++;
 #endif
 }
 
-/* Check for stuck xmitters */
-int comtimer_interval = 5;
-
-void
-comtimer(void * param)
-{
-       spl_t   s = spltty();
-       struct tty *tp = com_tty;
-       int i, nch;
-
-       for (i = 0; i < NCOM; i++, tp++) {
-               if ((tp->t_state & TS_ISOPEN) == 0)
-                       continue;
-               if (!tp->t_outq.c_cc)
-                       continue;
-               if (++comtimer_state[i] < 2)
-                       continue;
-               /* Its stuck */
-printf("Tty %p was stuck\n", tp);
-               nch = getc(&tp->t_outq);
-               outb(TXRX((int)tp->t_addr), nch);
-       }
-
-       splx(s);
-       timeout(comtimer, 0, comtimer_interval*hz);
-}
-
 /*
  * Set receive modem state from modem status register.
  */
diff --git a/i386/i386at/com.h b/i386/i386at/com.h
index 49f23ee..8179b39 100644
--- a/i386/i386at/com.h
+++ b/i386/i386at/com.h
@@ -34,8 +34,6 @@
  */
 extern void fix_modem_state(int unit, int modem_stat);
 
-extern void comtimer(void * param);
-
 /*
  * Modem change (input signals)
  */
-- 
1.8.1.4




reply via email to

[Prev in Thread] Current Thread [Next in Thread]