From: Andy P. <at...@us...> - 2002-04-11 14:36:07
|
Update of /cvsroot/linux-vax/kernel-2.4/drivers/char/rio In directory usw-pr-cvs1:/tmp/cvs-serv17293/char/rio Modified Files: linux_compat.h rio.h rio_linux.c rio_linux.h rioboot.c riocmd.c rioctrl.c riodrvr.h rioinit.c riointr.c rioroute.c riotable.c riotty.c Log Message: synch 2.4.15 commit 55 Index: linux_compat.h =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/drivers/char/rio/linux_compat.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- linux_compat.h 14 Jan 2001 18:01:02 -0000 1.1.1.1 +++ linux_compat.h 11 Apr 2002 13:31:05 -0000 1.2 @@ -16,11 +16,13 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +#include <asm/hardirq.h> + #define disable(oldspl) save_flags (oldspl) #define restore(oldspl) restore_flags (oldspl) -#define sysbrk(x) kmalloc ((x), GFP_KERNEL) +#define sysbrk(x) kmalloc ((x),in_interrupt()? GFP_ATOMIC : GFP_KERNEL) #define sysfree(p,size) kfree ((p)) #define WBYTE(p,v) writeb(v, &p) Index: rio.h =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/drivers/char/rio/rio.h,v retrieving revision 1.1.1.2 retrieving revision 1.2 diff -u -r1.1.1.2 -r1.2 --- rio.h 25 Feb 2001 23:15:04 -0000 1.1.1.2 +++ rio.h 11 Apr 2002 13:31:05 -0000 1.2 @@ -210,16 +210,6 @@ #define RIO_PORT(DEV,FIRST_MAJ) ( (major(DEV) - FIRST_MAJ) * PORTS_PER_HOST) \ + minor(DEV) -/* -** Min and Max -*/ -#ifndef min -#define min(A,B) ((A)<(B)?(A):(B)) -#endif -#ifndef max -#define max(A,B) ((A)>(B)?(A):(B)) -#endif - #define splrio spltty #define RIO_IPL 5 Index: rio_linux.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/drivers/char/rio/rio_linux.c,v retrieving revision 1.1.1.2 retrieving revision 1.2 diff -u -r1.1.1.2 -r1.2 --- rio_linux.c 25 Feb 2001 23:15:04 -0000 1.1.1.2 +++ rio_linux.c 11 Apr 2002 13:31:05 -0000 1.2 @@ -27,8 +27,8 @@ * * Revision history: * $Log$ - * Revision 1.1.1.2 2001/02/25 23:15:04 kenn - * Import official 2.4.2 Linus tree + * Revision 1.2 2002/04/11 13:31:05 atp + * synch 2.4.15 commit 55 * * Revision 1.1 1999/07/11 10:13:54 wolff * Initial revision @@ -61,10 +61,14 @@ #include <linux/pci.h> #include <linux/slab.h> #include <linux/miscdevice.h> +#include <linux/init.h> #include <linux/compatmac.h> #include <linux/generic_serial.h> +#if BITS_PER_LONG != 32 +# error FIXME: this driver only works on 32-bit platforms +#endif #include "linux_compat.h" #include "typdef.h" @@ -168,7 +172,7 @@ /* startuptime */ HZ*2, /* how long to wait for card to run */ /* slowcook */ 0, /* TRUE -> always use line disc. */ /* intrpolltime */ 1, /* The frequency of OUR polls */ - /* breakinterval */ 25, /* x10 mS */ + /* breakinterval */ 25, /* x10 mS XXX: units seem to be 1ms not 10! -- REW*/ /* timer */ 10, /* mS */ /* RtaLoadBase */ 0x7000, /* HostLoadBase */ 0x7C00, @@ -206,11 +210,8 @@ unsigned int cmd, unsigned long arg); static int rio_init_drivers(void); - void my_hd (void *addr, int len); - - static struct tty_driver rio_driver, rio_callout_driver; static struct tty_driver rio_driver2, rio_callout_driver2; @@ -251,14 +252,13 @@ long rio_irqmask = -1; #ifndef TWO_ZERO -#ifdef MODULE MODULE_AUTHOR("Rogier Wolff <R.E...@bi...>, Patrick van de Lageweg <pa...@bi...>"); MODULE_DESCRIPTION("RIO driver"); +MODULE_LICENSE("GPL"); MODULE_PARM(rio_poll, "i"); MODULE_PARM(rio_debug, "i"); MODULE_PARM(rio_irqmask, "i"); #endif -#endif static struct real_driver rio_real_driver = { rio_disable_tx_interrupts, @@ -386,8 +386,8 @@ int rio_ismodem (kdev_t device) { - return (MAJOR (device) != RIO_NORMAL_MAJOR0) && - (MAJOR (device) != RIO_NORMAL_MAJOR1); + return (MAJOR (device) == RIO_NORMAL_MAJOR0) || + (MAJOR (device) == RIO_NORMAL_MAJOR1); } @@ -458,7 +458,6 @@ func_enter (); HostP = (struct Host*)ptr; /* &p->RIOHosts[(long)ptr]; */ - rio_dprintk (RIO_DEBUG_IFLOW, "rio: enter rio_interrupt (%d/%d)\n", irq, HostP->Ivec); @@ -627,8 +626,12 @@ /* Nothing special here... */ static void rio_shutdown_port (void * ptr) { + struct Port *PortP; + func_enter(); + PortP = (struct Port *)ptr; + PortP->gs.tty = NULL; #if 0 port->gs.flags &= ~ GS_ACTIVE; if (!port->gs.tty) { @@ -657,8 +660,14 @@ exit minicom. I expect an "oops". -- REW */ static void rio_hungup (void *ptr) { - func_enter (); + struct Port *PortP; + + func_enter(); + + PortP = (struct Port *)ptr; + PortP->gs.tty = NULL; rio_dec_mod_count (); + func_exit (); } @@ -682,9 +691,8 @@ PortP->gs.count = 0; } - + PortP->gs.tty = NULL; rio_dec_mod_count (); - func_exit (); } @@ -703,24 +711,28 @@ return rc; } +extern int RIOShortCommand(struct rio_info *p, struct Port *PortP, + int command, int len, int arg); static int rio_ioctl (struct tty_struct * tty, struct file * filp, unsigned int cmd, unsigned long arg) { -#if 0 int rc; - struct rio_port *port = tty->driver_data; + struct Port *PortP; int ival; - /* func_enter2(); */ + func_enter(); + PortP = (struct Port *)tty->driver_data; rc = 0; switch (cmd) { +#if 0 case TIOCGSOFTCAR: rc = Put_user(((tty->termios->c_cflag & CLOCAL) ? 1 : 0), (unsigned int *) arg); break; +#endif case TIOCSSOFTCAR: if ((rc = verify_area(VERIFY_READ, (void *) arg, sizeof(int))) == 0) { @@ -733,13 +745,39 @@ case TIOCGSERIAL: if ((rc = verify_area(VERIFY_WRITE, (void *) arg, sizeof(struct serial_struct))) == 0) - gs_getserial(&port->gs, (struct serial_struct *) arg); + gs_getserial(&PortP->gs, (struct serial_struct *) arg); + break; + case TCSBRK: + if ( PortP->State & RIO_DELETED ) { + rio_dprintk (RIO_DEBUG_TTY, "BREAK on deleted RTA\n"); + rc = -EIO; + } else { + if (RIOShortCommand(p, PortP, SBREAK, 2, 250) == RIO_FAIL) { + rio_dprintk (RIO_DEBUG_INTR, "SBREAK RIOShortCommand failed\n"); + rc = -EIO; + } + } + break; + case TCSBRKP: + if ( PortP->State & RIO_DELETED ) { + rio_dprintk (RIO_DEBUG_TTY, "BREAK on deleted RTA\n"); + rc = -EIO; + } else { + int l; + l = arg?arg*100:250; + if (l > 255) l = 255; + if (RIOShortCommand(p, PortP, SBREAK, 2, arg?arg*100:250) == RIO_FAIL) { + rio_dprintk (RIO_DEBUG_INTR, "SBREAK RIOShortCommand failed\n"); + rc = -EIO; + } + } break; case TIOCSSERIAL: if ((rc = verify_area(VERIFY_READ, (void *) arg, sizeof(struct serial_struct))) == 0) - rc = gs_setserial(&port->gs, (struct serial_struct *) arg); + rc = gs_setserial(&PortP->gs, (struct serial_struct *) arg); break; +#if 0 case TIOCMGET: if ((rc = verify_area(VERIFY_WRITE, (void *) arg, sizeof(unsigned int))) == 0) { @@ -771,17 +809,13 @@ ((ival & TIOCM_RTS) ? 1 : 0)); } break; - +#endif default: rc = -ENOIOCTLCMD; break; } - /* func_exit(); */ + func_exit(); return rc; -#else - return -ENOIOCTLCMD; -#endif - } @@ -1032,15 +1066,15 @@ free4:kfree (rio_termios); free3:kfree (p->RIOPortp); free2:kfree (p->RIOHosts); - free1:kfree (p); - free0: + free1: rio_dprintk (RIO_DEBUG_INIT, "Not enough memory! %p %p %p %p %p\n", - p, p->RIOHosts, p->RIOPortp, rio_termios, rio_termios); + p, p->RIOHosts, p->RIOPortp, rio_termios, rio_termios); + kfree(p); + free0: return -ENOMEM; } -#ifdef MODULE -static void rio_release_drivers(void) +static void __exit rio_release_drivers(void) { func_enter(); tty_unregister_driver (&rio_callout_driver2); @@ -1049,7 +1083,6 @@ tty_unregister_driver (&rio_driver); func_exit(); } -#endif #ifdef TWO_ZERO #define PDEV unsigned char pci_bus, unsigned pci_fun @@ -1102,11 +1135,7 @@ #endif -#ifdef MODULE -#define rio_init init_module -#endif - -int rio_init(void) +static int __init rio_init(void) { int found = 0; int i; @@ -1256,6 +1285,7 @@ hp->Type = RIO_PCI; hp->Copy = rio_pcicopy; hp->Mode = RIO_PCI_BOOT_FROM_RAM; + hp->HostLock = SPIN_LOCK_UNLOCKED; rio_dprintk (RIO_DEBUG_PROBE, "Ivec: %x\n", hp->Ivec); rio_dprintk (RIO_DEBUG_PROBE, "Mode: %x\n", hp->Mode); @@ -1311,6 +1341,7 @@ * Moreover, the ISA card will work with the * special PCI copy anyway. -- REW */ hp->Mode = 0; + hp->HostLock = SPIN_LOCK_UNLOCKED; vpdp = get_VPD_PROM (hp); rio_dprintk (RIO_DEBUG_PROBE, "Got VPD ROM\n"); @@ -1389,8 +1420,7 @@ } -#ifdef MODULE -void cleanup_module(void) +static void __exit rio_exit (void) { int i; struct Host *hp; @@ -1425,9 +1455,9 @@ func_exit(); } -#endif - +module_init(rio_init); +module_exit(rio_exit); /* * Anybody who knows why this doesn't work for me, please tell me -- REW. Index: rio_linux.h =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/drivers/char/rio/rio_linux.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- rio_linux.h 14 Jan 2001 18:01:18 -0000 1.1.1.1 +++ rio_linux.h 11 Apr 2002 13:31:05 -0000 1.2 @@ -95,28 +95,27 @@ #if 1 #define rio_spin_lock_irqsave(sem, flags) do { \ rio_dprintk (RIO_DEBUG_SPINLOCK, "spinlockirqsave: %p %s:%d\n", \ - sem, __FILE__, __LINE__);\ - spin_lock_irqsave(sem, flags);\ - } while (0) + sem, __FILE__, __LINE__);\ + spin_lock_irqsave(sem, flags);\ + } while (0) #define rio_spin_unlock_irqrestore(sem, flags) do { \ rio_dprintk (RIO_DEBUG_SPINLOCK, "spinunlockirqrestore: %p %s:%d\n",\ - sem, __FILE__, __LINE__);\ - spin_unlock_irqrestore(sem, flags);\ - } while (0) - + sem, __FILE__, __LINE__);\ + spin_unlock_irqrestore(sem, flags);\ + } while (0) #define rio_spin_lock(sem) do { \ rio_dprintk (RIO_DEBUG_SPINLOCK, "spinlock: %p %s:%d\n",\ - sem, __FILE__, __LINE__);\ - spin_lock(sem);\ - } while (0) + sem, __FILE__, __LINE__);\ + spin_lock(sem);\ + } while (0) #define rio_spin_unlock(sem) do { \ rio_dprintk (RIO_DEBUG_SPINLOCK, "spinunlock: %p %s:%d\n",\ - sem, __FILE__, __LINE__);\ - spin_unlock(sem);\ - } while (0) + sem, __FILE__, __LINE__);\ + spin_unlock(sem);\ + } while (0) #else #define rio_spin_lock_irqsave(sem, flags) \ spin_lock_irqsave(sem, flags) @@ -165,7 +164,7 @@ #define rio_memcpy_fromio memcpy_fromio #endif -#define DEBUG +#define DEBUG 1 /* Index: rioboot.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/drivers/char/rio/rioboot.c,v retrieving revision 1.1.1.2 retrieving revision 1.2 diff -u -r1.1.1.2 -r1.2 --- rioboot.c 25 Feb 2001 23:15:04 -0000 1.1.1.2 +++ rioboot.c 11 Apr 2002 13:31:05 -0000 1.2 @@ -38,6 +38,7 @@ #include <linux/module.h> #include <linux/slab.h> #include <linux/errno.h> +#include <linux/interrupt.h> #include <asm/io.h> #include <asm/system.h> #include <asm/string.h> Index: riocmd.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/drivers/char/rio/riocmd.c,v retrieving revision 1.1.1.2 retrieving revision 1.2 diff -u -r1.1.1.2 -r1.2 --- riocmd.c 25 Feb 2001 23:15:04 -0000 1.1.1.2 +++ riocmd.c 11 Apr 2002 13:31:05 -0000 1.2 @@ -474,17 +474,18 @@ rio_spin_lock_irqsave(&PortP->portSem, flags); switch( RBYTE(PktCmdP->Command) ) { case BREAK_RECEIVED: - rio_dprintk (RIO_DEBUG_CMD, "Received a break!\n"); + rio_dprintk (RIO_DEBUG_CMD, "Received a break!\n"); /* If the current line disc. is not multi-threading and the current processor is not the default, reset rup_intr and return FALSE to ensure that the command packet is not freed. */ /* Call tmgr HANGUP HERE */ /* Fix this later when every thing works !!!! RAMRAJ */ + gs_got_break (&PortP->gs); break; case COMPLETE: - rio_dprintk (RIO_DEBUG_CMD, "Command complete on phb %d host %d\n", + rio_dprintk (RIO_DEBUG_CMD, "Command complete on phb %d host %d\n", RBYTE(PktCmdP->PhbNum), HostP-p->RIOHosts); subCommand = 1; switch (RBYTE(PktCmdP->SubCommand)) { @@ -549,6 +550,8 @@ */ if (PortP->gs.tty == NULL) break; + if (PortP->gs.tty->termios == NULL) + break; if (!(PortP->gs.tty->termios->c_cflag & CLOCAL) && ((PortP->State & (RIO_MOPEN|RIO_WOPEN)))) { @@ -623,7 +626,8 @@ struct CmdBlk *CmdBlkP; CmdBlkP = (struct CmdBlk *)sysbrk(sizeof(struct CmdBlk)); - bzero(CmdBlkP, sizeof(struct CmdBlk)); + if (CmdBlkP) + bzero(CmdBlkP, sizeof(struct CmdBlk)); return CmdBlkP; } Index: rioctrl.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/drivers/char/rio/rioctrl.c,v retrieving revision 1.1.1.2 retrieving revision 1.2 diff -u -r1.1.1.2 -r1.2 --- rioctrl.c 25 Feb 2001 23:15:04 -0000 1.1.1.2 +++ rioctrl.c 11 Apr 2002 13:31:05 -0000 1.2 @@ -764,7 +764,7 @@ PortP->Config &= ~RIO_WAITDRAIN; } /* - ** Store setings if locking or unlocking port or if the + ** Store settings if locking or unlocking port or if the ** port is not locked, when setting the store option. */ if (PortP->Mapped && Index: riodrvr.h =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/drivers/char/rio/riodrvr.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- riodrvr.h 14 Jan 2001 18:01:38 -0000 1.1.1.1 +++ riodrvr.h 11 Apr 2002 13:31:05 -0000 1.2 @@ -33,12 +33,13 @@ #ifndef __riodrvr_h #define __riodrvr_h +#include <asm/param.h> /* for HZ */ + #ifdef SCCS_LABELS static char *_riodrvr_h_sccs_ = "@(#)riodrvr.h 1.3"; #endif #define MEMDUMP_SIZE 32 -#define HZ 100 #define MOD_DISABLE (RIO_NOREAD|RIO_NOWRITE|RIO_NOXPRINT) Index: rioinit.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/drivers/char/rio/rioinit.c,v retrieving revision 1.1.1.2 retrieving revision 1.2 diff -u -r1.1.1.2 -r1.2 --- rioinit.c 25 Feb 2001 23:15:04 -0000 1.1.1.2 +++ rioinit.c 11 Apr 2002 13:31:05 -0000 1.2 @@ -1446,7 +1446,7 @@ } RIODefaultName(p, HostP, rup); } - HostP->UnixRups[rup].RupLock = -1; + HostP->UnixRups[rup].RupLock = SPIN_LOCK_UNLOCKED; } } } Index: riointr.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/drivers/char/rio/riointr.c,v retrieving revision 1.1.1.2 retrieving revision 1.2 diff -u -r1.1.1.2 -r1.2 --- riointr.c 25 Feb 2001 23:15:04 -0000 1.1.1.2 +++ riointr.c 11 Apr 2002 13:31:05 -0000 1.2 @@ -819,7 +819,7 @@ ** and available space. */ - transCount = min(PacketP->len & PKT_LEN_MASK, + transCount = min_t(unsigned int, PacketP->len & PKT_LEN_MASK, TTY_FLIPBUF_SIZE - TtyP->flip.count); rio_dprintk (RIO_DEBUG_REC, "port %d: Copy %d bytes\n", PortP->PortNum, transCount); Index: rioroute.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/drivers/char/rio/rioroute.c,v retrieving revision 1.1.1.2 retrieving revision 1.2 diff -u -r1.1.1.2 -r1.2 --- rioroute.c 25 Feb 2001 23:15:04 -0000 1.1.1.2 +++ rioroute.c 11 Apr 2002 13:31:05 -0000 1.2 @@ -657,6 +657,7 @@ */ if (PortP->TxStart == 0) { rio_dprintk (RIO_DEBUG_ROUTE, "Tx pkts not set up yet\n"); + rio_spin_unlock_irqrestore(&PortP->portSem, flags); break; } Index: riotable.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/drivers/char/rio/riotable.c,v retrieving revision 1.1.1.2 retrieving revision 1.2 diff -u -r1.1.1.2 -r1.2 --- riotable.c 25 Feb 2001 23:15:04 -0000 1.1.1.2 +++ riotable.c 11 Apr 2002 13:31:05 -0000 1.2 @@ -37,6 +37,8 @@ #include <linux/module.h> #include <linux/slab.h> #include <linux/errno.h> +#include <linux/interrupt.h> + #include <asm/io.h> #include <asm/system.h> #include <asm/string.h> @@ -443,7 +445,7 @@ int Next = 0; struct Map *MapP; struct Host *HostP; - int oldspl; + long oldspl; disable(oldspl); /* strange but true! */ @@ -499,7 +501,7 @@ struct Map *HostMapP; struct Port *PortP; int work_done = 0; - unsigned long flags; + unsigned long lock_flags, sem_flags; rio_dprintk (RIO_DEBUG_TABLE, "Delete entry on host %x, rta %x\n", MapP->HostUniqueNum, MapP->RtaUniqueNum); @@ -507,10 +509,10 @@ for ( host=0; host < p->RIONumHosts; host++ ) { HostP = &p->RIOHosts[host]; - rio_spin_lock_irqsave( &HostP->HostLock, flags ); + rio_spin_lock_irqsave( &HostP->HostLock, lock_flags ); if ( (HostP->Flags & RUN_STATE) != RC_RUNNING ) { - rio_spin_unlock_irqrestore(&HostP->HostLock, flags); + rio_spin_unlock_irqrestore(&HostP->HostLock, lock_flags); continue; } @@ -527,7 +529,7 @@ if ( HostMapP->Topology[link].Unit != ROUTE_DISCONNECT ) { rio_dprintk (RIO_DEBUG_TABLE, "Entry is in use and cannot be deleted!\n"); p->RIOError.Error = UNIT_IS_IN_USE; - rio_spin_unlock_irqrestore( &HostP->HostLock, flags); + rio_spin_unlock_irqrestore( &HostP->HostLock, lock_flags); return EBUSY; } } @@ -542,7 +544,7 @@ PortP = p->RIOPortp[port]; rio_dprintk (RIO_DEBUG_TABLE, "Unmap port\n"); - rio_spin_lock_irqsave( &PortP->portSem, flags ); + rio_spin_lock_irqsave( &PortP->portSem, sem_flags ); PortP->Mapped = 0; @@ -600,7 +602,7 @@ WWORD(PortP->PhbP->destination, dest_unit + (dest_port << 8)); } - rio_spin_unlock_irqrestore(&PortP->portSem, flags); + rio_spin_unlock_irqrestore(&PortP->portSem, sem_flags); } } rio_dprintk (RIO_DEBUG_TABLE, "Entry nulled.\n"); @@ -608,7 +610,7 @@ work_done++; } } - rio_spin_unlock_irqrestore(&HostP->HostLock, flags); + rio_spin_unlock_irqrestore(&HostP->HostLock, lock_flags); } /* XXXXX lock me up */ Index: riotty.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/drivers/char/rio/riotty.c,v retrieving revision 1.1.1.2 retrieving revision 1.2 diff -u -r1.1.1.2 -r1.2 --- riotty.c 25 Feb 2001 23:15:04 -0000 1.1.1.2 +++ riotty.c 11 Apr 2002 13:31:05 -0000 1.2 @@ -96,7 +96,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); @@ -452,8 +452,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 @@ -471,7 +474,6 @@ func_exit (); return -EINTR; } -#endif } PortP->State &= ~RIO_WOPEN; } @@ -527,8 +529,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; @@ -541,6 +545,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, @@ -573,7 +583,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 @@ -605,7 +616,6 @@ */ rio_dprintk (RIO_DEBUG_TTY, "Timeout 1 starts\n"); -#if 0 if (!deleted) while ( (PortP->InUse != NOT_INUSE) && !p->RIOHalted && (PortP->TxBufferIn != PortP->TxBufferOut) ) { @@ -626,7 +636,7 @@ } rio_spin_lock_irqsave(&PortP->portSem, flags); } -#endif + PortP->TxBufferIn = PortP->TxBufferOut = 0; repeat_this = 0xff; @@ -662,7 +672,7 @@ if (!deleted) while (try && (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; @@ -674,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 ); @@ -779,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; |