patch-2.2.18 linux/drivers/char/rio/riocmd.c

Next file: linux/drivers/char/rio/rioinit.c
Previous file: linux/drivers/char/rio/rioboot.c
Back to the patch index
Back to the overall index

diff -u --new-file --recursive --exclude-from /usr/src/exclude v2.2.17/drivers/char/rio/riocmd.c linux/drivers/char/rio/riocmd.c
@@ -38,6 +38,9 @@
 #include <linux/module.h>
 #include <linux/malloc.h>
 #include <linux/errno.h>
+#include <linux/smp.h>
+#include <linux/interrupt.h>
+#include <asm/ptrace.h>
 #include <asm/io.h>
 #include <asm/system.h>
 #include <asm/string.h>
@@ -80,7 +83,6 @@
 #include "control.h"
 #include "cirrus.h"
 
-
 static struct IdentifyRta IdRta;
 static struct KillNeighbour KillUnit;
 
@@ -534,7 +536,7 @@
 				     PortP->ModemState, ReportedModemStatus);
 				PortP->ModemState = ReportedModemStatus;
 #ifdef MODEM_SUPPORT
-				if ( PortP->Mapped ) {
+				if ( PortP->Mapped && (PortP->PortState & PORT_ISOPEN) && !(PortP->PortState & RIO_CLOSING))  {
 				/***********************************************************\
 				*************************************************************
 				***													   ***
@@ -546,12 +548,15 @@
 				** If the device is a modem, then check the modem
 				** carrier.
 				*/
+				
 				if (PortP->gs.tty == NULL)
 					break;
-			  
-				if (!(PortP->gs.tty->termios->c_cflag & CLOCAL) &&
-				((PortP->State & (RIO_MOPEN|RIO_WOPEN)))) {
 
+  				if (PortP->gs.tty->termios == NULL)
+  					break;
+			  
+ 				if (!(PortP->gs.tty->termios->c_cflag & CLOCAL) &&
+ 				    ((PortP->State & (RIO_MOPEN|RIO_WOPEN)))) {
 					rio_dprintk (RIO_DEBUG_CMD, "Is there a Carrier?\n");
 			/*
 			** Is there a carrier?
@@ -577,8 +582,9 @@
 			** Has carrier just dropped?
 			*/
 						if (PortP->State & RIO_CARR_ON) {
-							if (PortP->State & (PORT_ISOPEN|RIO_WOPEN|RIO_MOPEN))
-								tty_hangup (PortP->gs.tty);
+						  if (PortP->State & (PORT_ISOPEN|RIO_WOPEN|RIO_MOPEN)) 
+							  tty_hangup (PortP->gs.tty);
+
 							PortP->State &= ~RIO_CARR_ON;
 							rio_dprintk (RIO_DEBUG_CMD, "Carrirer just went down\n");
 #ifdef STATS
@@ -622,7 +628,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;
 }

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)