ChangeSet 1.1638, 2004/05/14 10:54:51-07:00, greg@kroah.com

USB: remove serial_paranoia_check() function

If this is hiding real problems, we need to find them.


 drivers/usb/serial/belkin_sa.c       |    6 ------
 drivers/usb/serial/cyberjack.c       |    5 -----
 drivers/usb/serial/digi_acceleport.c |    5 -----
 drivers/usb/serial/io_edgeport.c     |    8 --------
 drivers/usb/serial/io_ti.c           |    4 ----
 drivers/usb/serial/keyspan_pda.c     |   16 +---------------
 drivers/usb/serial/omninet.c         |    6 ------
 drivers/usb/serial/pl2303.c          |    3 ---
 drivers/usb/serial/usb-serial.c      |    3 ---
 drivers/usb/serial/usb-serial.h      |   18 +-----------------
 10 files changed, 2 insertions(+), 72 deletions(-)


diff -Nru a/drivers/usb/serial/belkin_sa.c b/drivers/usb/serial/belkin_sa.c
--- a/drivers/usb/serial/belkin_sa.c	Fri May 14 15:27:24 2004
+++ b/drivers/usb/serial/belkin_sa.c	Fri May 14 15:27:24 2004
@@ -265,7 +265,6 @@
 {
 	struct usb_serial_port *port = (struct usb_serial_port *)urb->context;
 	struct belkin_sa_private *priv;
-	struct usb_serial *serial;
 	unsigned char *data = urb->transfer_buffer;
 	int retval;
 	unsigned long flags;
@@ -285,11 +284,6 @@
 		goto exit;
 	}
 
-	serial = port->serial;
-
-	if (serial_paranoia_check (serial, __FUNCTION__))
-		return;
-	
 	usb_serial_debug_data (__FILE__, __FUNCTION__, urb->actual_length, data);
 
 	/* Handle known interrupt data */
diff -Nru a/drivers/usb/serial/cyberjack.c b/drivers/usb/serial/cyberjack.c
--- a/drivers/usb/serial/cyberjack.c	Fri May 14 15:27:24 2004
+++ b/drivers/usb/serial/cyberjack.c	Fri May 14 15:27:24 2004
@@ -318,7 +318,6 @@
 {
 	struct usb_serial_port *port = (struct usb_serial_port *)urb->context;
 	struct cyberjack_private *priv = usb_get_serial_port_data(port);
-	struct usb_serial *serial;
 	unsigned char *data = urb->transfer_buffer;
 	int result;
 
@@ -326,10 +325,6 @@
 
 	/* the urb might have been killed. */
 	if (urb->status)
-		return;
-
-	serial = port->serial;
-	if (serial_paranoia_check (serial, __FUNCTION__))
 		return;
 
 	usb_serial_debug_data (__FILE__, __FUNCTION__, urb->actual_length, data);
diff -Nru a/drivers/usb/serial/digi_acceleport.c b/drivers/usb/serial/digi_acceleport.c
--- a/drivers/usb/serial/digi_acceleport.c	Fri May 14 15:27:24 2004
+++ b/drivers/usb/serial/digi_acceleport.c	Fri May 14 15:27:24 2004
@@ -1396,10 +1396,6 @@
 		return;
 	}
 
-	/* further sanity checks */
-	if (serial_paranoia_check(serial, __FUNCTION__))
-		return;
-
 	/* try to send any buffered data on this port, if it is open */
 	spin_lock( &priv->dp_port_lock );
 	priv->dp_write_urb_in_use = 0;
@@ -1797,7 +1793,6 @@
 		return;
 	}
 	if( port->serial == NULL
-	|| serial_paranoia_check( port->serial, __FUNCTION__ )
 	|| (serial_priv=usb_get_serial_data(port->serial)) == NULL ) {
 		err("%s: serial is bad or serial->private is NULL, status=%d", __FUNCTION__, urb->status );
 		return;
diff -Nru a/drivers/usb/serial/io_edgeport.c b/drivers/usb/serial/io_edgeport.c
--- a/drivers/usb/serial/io_edgeport.c	Fri May 14 15:27:24 2004
+++ b/drivers/usb/serial/io_edgeport.c	Fri May 14 15:27:24 2004
@@ -776,10 +776,6 @@
 
 	dbg("%s", __FUNCTION__);
 
-	if (serial_paranoia_check (edge_serial->serial, __FUNCTION__)) {
-		return;
-	}
-
 	switch (urb->status) {
 	case 0:
 		/* success */
@@ -864,10 +860,6 @@
 	__u16			raw_data_length;
 
 	dbg("%s", __FUNCTION__);
-
-	if (serial_paranoia_check (edge_serial->serial, __FUNCTION__)) {
-		return;
-	}
 
 	if (urb->status) {
 		dbg("%s - nonzero read bulk status received: %d", __FUNCTION__, urb->status);
diff -Nru a/drivers/usb/serial/io_ti.c b/drivers/usb/serial/io_ti.c
--- a/drivers/usb/serial/io_ti.c	Fri May 14 15:27:24 2004
+++ b/drivers/usb/serial/io_ti.c	Fri May 14 15:27:24 2004
@@ -1649,10 +1649,6 @@
 
 	dbg("%s", __FUNCTION__);
 
-	if (serial_paranoia_check (edge_serial->serial, __FUNCTION__)) {
-		return;
-	}
-
 	switch (urb->status) {
 	case 0:
 		/* success */
diff -Nru a/drivers/usb/serial/keyspan_pda.c b/drivers/usb/serial/keyspan_pda.c
--- a/drivers/usb/serial/keyspan_pda.c	Fri May 14 15:27:24 2004
+++ b/drivers/usb/serial/keyspan_pda.c	Fri May 14 15:27:24 2004
@@ -226,8 +226,7 @@
 static void keyspan_pda_rx_interrupt (struct urb *urb, struct pt_regs *regs)
 {
 	struct usb_serial_port *port = (struct usb_serial_port *)urb->context;
-	struct usb_serial *serial;
-       	struct tty_struct *tty;
+       	struct tty_struct *tty = port->tty;
 	unsigned char *data = urb->transfer_buffer;
 	int i;
 	int status;
@@ -249,17 +248,11 @@
 		goto exit;
 	}
 
-	serial = port->serial;
-	if (serial_paranoia_check (serial, "keyspan_pda_rx_interrupt")) {
-		return;
-	}
-	
  	/* see if the message is data or a status interrupt */
 	switch (data[0]) {
 	case 0:
 		/* rest of message is rx data */
 		if (urb->actual_length) {
-			tty = serial->port[0]->tty;
 			for (i = 1; i < urb->actual_length ; ++i) {
 				tty_insert_flip_char(tty, data[i], 0);
 			}
@@ -273,7 +266,6 @@
 		case 1: /* modemline change */
 			break;
 		case 2: /* tx unthrottle interrupt */
-			tty = serial->port[0]->tty;
 			priv->tx_throttled = 0;
 			/* queue up a wakeup at scheduler time */
 			schedule_work(&priv->wakeup_work);
@@ -628,16 +620,10 @@
 static void keyspan_pda_write_bulk_callback (struct urb *urb, struct pt_regs *regs)
 {
 	struct usb_serial_port *port = (struct usb_serial_port *)urb->context;
-	struct usb_serial *serial;
 	struct keyspan_pda_private *priv;
 
 	priv = usb_get_serial_port_data(port);
 
-	serial = port->serial;
-	if (serial_paranoia_check (serial, "keyspan_pda_rx_interrupt")) {
-		return;
-	}
-	
 	/* queue up a wakeup at scheduler time */
 	schedule_work(&priv->wakeup_work);
 }
diff -Nru a/drivers/usb/serial/omninet.c b/drivers/usb/serial/omninet.c
--- a/drivers/usb/serial/omninet.c	Fri May 14 15:27:24 2004
+++ b/drivers/usb/serial/omninet.c	Fri May 14 15:27:24 2004
@@ -338,14 +338,8 @@
 {
 /*	struct omninet_header	*header = (struct omninet_header  *) urb->transfer_buffer; */
 	struct usb_serial_port 	*port   = (struct usb_serial_port *) urb->context;
-	struct usb_serial 	*serial;
 
 //	dbg("omninet_write_bulk_callback, port %0x\n", port);
-
-	serial = port->serial;
-	if (serial_paranoia_check (serial, __FUNCTION__)) {
-		return;
-	}
 
 	if (urb->status) {
 		dbg("%s - nonzero write bulk status received: %d", __FUNCTION__, urb->status);
diff -Nru a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c
--- a/drivers/usb/serial/pl2303.c	Fri May 14 15:27:24 2004
+++ b/drivers/usb/serial/pl2303.c	Fri May 14 15:27:24 2004
@@ -803,9 +803,6 @@
 	
 	if (urb->status) {
 		/* error in the urb, so we have to resubmit it */
-		if (serial_paranoia_check (port->serial, __FUNCTION__)) {
-			return;
-		}
 		dbg("%s - Overflow in write", __FUNCTION__);
 		dbg("%s - nonzero write bulk status received: %d", __FUNCTION__, urb->status);
 		port->write_urb->transfer_buffer_length = 1;
diff -Nru a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c
--- a/drivers/usb/serial/usb-serial.c	Fri May 14 15:27:24 2004
+++ b/drivers/usb/serial/usb-serial.c	Fri May 14 15:27:24 2004
@@ -460,9 +460,6 @@
 	/* get the serial object associated with this tty pointer */
 	serial = usb_serial_get_by_index(tty->index);
 
-	if (serial_paranoia_check (serial, __FUNCTION__))
-		return -ENODEV;
-
 	/* set up our port structure making the tty driver remember our port object, and us it */
 	portNumber = tty->index - serial->minor;
 	port = serial->port[portNumber];
diff -Nru a/drivers/usb/serial/usb-serial.h b/drivers/usb/serial/usb-serial.h
--- a/drivers/usb/serial/usb-serial.h	Fri May 14 15:27:24 2004
+++ b/drivers/usb/serial/usb-serial.h	Fri May 14 15:27:24 2004
@@ -294,26 +294,10 @@
 extern struct bus_type usb_serial_bus_type;
 extern struct tty_driver *usb_serial_tty_driver;
 
-/* Inline functions to check the sanity of a pointer that is passed to us */
-static inline int serial_paranoia_check (struct usb_serial *serial, const char *function)
-{
-	if (!serial) {
-		dbg("%s - serial == NULL", function);
-		return -1;
-	}
-	if (!serial->type) {
-		dbg("%s - serial->type == NULL!", function);
-		return -1;
-	}
-
-	return 0;
-}
-
 static inline struct usb_serial* get_usb_serial (struct usb_serial_port *port, const char *function) 
 { 
 	/* if no port was specified, or it fails a paranoia check */
-	if (!port || 
-		serial_paranoia_check (port->serial, function)) {
+	if (!port) {
 		/* then say that we don't have a valid usb_serial thing, which will
 		 * end up genrating -ENODEV return values */ 
 		return NULL;
