patch-2.2.18 linux/drivers/char/rio/riotty.c
Next file: linux/drivers/char/rtc.c
Previous file: linux/drivers/char/rio/riotable.c
Back to the patch index
Back to the overall index
- Lines: 117
- Date:
Thu Dec 7 14:45:41 2000
- Orig file:
v2.2.17/drivers/char/rio/riotty.c
- Orig date:
Sat Sep 9 18:42:36 2000
diff -u --new-file --recursive --exclude-from /usr/src/exclude v2.2.17/drivers/char/rio/riotty.c linux/drivers/char/rio/riotty.c
@@ -95,7 +95,7 @@
#endif
static void RIOClearUp(struct Port *PortP);
-static int RIOShortCommand(struct rio_info *p, struct Port *PortP,
+int RIOShortCommand(struct rio_info *p, struct Port *PortP,
int command, int len, int arg);
@@ -451,8 +451,11 @@
PortP->gs.tty->termios->c_state |= WOPEN;
*/
PortP->State |= RIO_WOPEN;
+ rio_spin_unlock_irqrestore(&PortP->portSem, flags);
+ if (RIODelay (PortP, HUNDRED_MS) == RIO_FAIL)
#if 0
if ( sleep((caddr_t)&tp->tm.c_canqo, TTIPRI|PCATCH))
+#endif
{
/*
** ACTION: verify that this is a good thing
@@ -470,7 +473,6 @@
func_exit ();
return -EINTR;
}
-#endif
}
PortP->State &= ~RIO_WOPEN;
}
@@ -526,8 +528,10 @@
#endif
struct Port *PortP =ptr; /* pointer to the port structure */
int deleted = 0;
- int try = 25;
- int repeat_this = 0xff;
+ int try = -1; /* Disable the timeouts by setting them to -1 */
+ int repeat_this = -1; /* Congrats to those having 15 years of
+ uptime! (You get to break the driver.) */
+ long end_time;
struct tty_struct * tty;
unsigned long flags;
int Modem;
@@ -540,6 +544,12 @@
/* tp = PortP->TtyP;*/ /* Get tty */
tty = PortP->gs.tty;
rio_dprintk (RIO_DEBUG_TTY, "TTY is at address 0x%x\n",(int)tty);
+
+ if (PortP->gs.closing_wait)
+ end_time = jiffies + PortP->gs.closing_wait;
+ else
+ end_time = jiffies + MAX_SCHEDULE_TIMEOUT;
+
Modem = rio_ismodem(tty->device);
#if 0
/* What F.CKING cache? Even then, a higly idle multiprocessor,
@@ -572,7 +582,8 @@
** clear the open bits for this device
*/
PortP->State &= (Modem ? ~RIO_MOPEN : ~RIO_LOPEN);
-
+ PortP->State &= ~RIO_CARR_ON;
+ PortP->ModemState &= ~MSVR1_CD;
/*
** If the device was open as both a Modem and a tty line
** then we need to wimp out here, as the port has not really
@@ -604,7 +615,7 @@
*/
rio_dprintk (RIO_DEBUG_TTY, "Timeout 1 starts\n");
-#if 0
+
if (!deleted)
while ( (PortP->InUse != NOT_INUSE) && !p->RIOHalted &&
(PortP->TxBufferIn != PortP->TxBufferOut) ) {
@@ -625,7 +636,7 @@
}
rio_spin_lock_irqsave(&PortP->portSem, flags);
}
-#endif
+
PortP->TxBufferIn = PortP->TxBufferOut = 0;
repeat_this = 0xff;
@@ -659,9 +670,9 @@
}
if (!deleted)
- while (try && (PortP->PortState & PORT_ISOPEN)) {
+ while (PortP->PortState & PORT_ISOPEN) {
try--;
- if (try == 0) {
+ if (time_after (jiffies, end_time)) {
rio_dprintk (RIO_DEBUG_TTY, "Run out of tries - force the bugger shut!\n" );
RIOPreemptiveCmd(p, PortP,FCLOSE);
break;
@@ -673,7 +684,11 @@
RIOClearUp( PortP );
goto close_end;
}
- RIODelay_ni(PortP, HUNDRED_MS);
+ if (RIODelay(PortP, HUNDRED_MS) == RIO_FAIL) {
+ rio_dprintk (RIO_DEBUG_TTY, "RTA EINTR in delay \n");
+ RIOPreemptiveCmd(p, PortP,FCLOSE);
+ break;
+ }
}
rio_spin_lock_irqsave(&PortP->portSem, flags);
rio_dprintk (RIO_DEBUG_TTY, "Close: try was %d on completion\n", try );
@@ -778,7 +793,7 @@
** Other values of len aren't allowed, and will cause
** a panic.
*/
-static int RIOShortCommand(struct rio_info *p, struct Port *PortP,
+int RIOShortCommand(struct rio_info *p, struct Port *PortP,
int command, int len, int arg)
{
PKT *PacketP;
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)