[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
- Re: [PATCH 21/66] i386/i386/db_interface.c: remove dead assignment, (continued)
- [PATCH 24/66] i386/i386/mp_desc.c: remove unused variable, Marin Ramesa, 2013/12/05
- [PATCH 23/66] i386/i386/ipl.h: remove ifdef and add ifndef, Marin Ramesa, 2013/12/05
- [PATCH 26/66] i386/i386/pic.c: remove unused variables, Marin Ramesa, 2013/12/05
- [PATCH 25/66] i386/i386/mp_desc.c: remove dead assignment, Marin Ramesa, 2013/12/05
- [PATCH 27/66] i386/i386/pit.c: remove unused variables, Marin Ramesa, 2013/12/05
- [PATCH 29/66] i386/i386/trap.c: remove unused variables, Marin Ramesa, 2013/12/05
- [PATCH 28/66] i386/i386/trap.c: remove unused variable, Marin Ramesa, 2013/12/05
- [PATCH 30/66] i386/i386/user_ldt.c: remove unused variable, Marin Ramesa, 2013/12/05
- [PATCH 31/66] i386/i386at/com.c: simplify code,
Marin Ramesa <=
- [PATCH 32/66] i386/i386at/com.c: remove dead assignment, Marin Ramesa, 2013/12/05
- [PATCH 33/66] i386/i386at/immc.c, kd.c: use boolean instead of an int, Marin Ramesa, 2013/12/05
- [PATCH 34/66] i386/i386at/model_dep.c, kd.c: use boolean instead of an int, Marin Ramesa, 2013/12/05
- [PATCH 40/66] i386/i386at/kd.h: remove ifdef, Marin Ramesa, 2013/12/05
- [PATCH 41/66] i386/i386at/kd.h: remove ifdef, Marin Ramesa, 2013/12/05
- [PATCH 43/66] i386/i386at/rtc.c: use boolean instead of an int, Marin Ramesa, 2013/12/05