patch-2.4.0-test10 linux/drivers/usb/serial/omninet.c

Next file: linux/drivers/usb/serial/usb-serial.h
Previous file: linux/drivers/usb/serial/keyspan_pda.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.4.0-test9/linux/drivers/usb/serial/omninet.c linux/drivers/usb/serial/omninet.c
@@ -10,6 +10,10 @@
  *
  * Please report both successes and troubles to the author at omninet@kroah.com
  *
+ * (10/05/2000) gkh
+ *	Fixed bug with urb->dev not being set properly, now that the usb
+ *	core needs it.
+ * 
  * (08/28/2000) gkh
  *	Added locks for SMP safeness.
  *	Fixed MOD_INC and MOD_DEC logic and the ability to open a port more 
@@ -129,6 +133,7 @@
 	struct usb_serial_port	*wport;
 	struct omninet_data	*od;
 	unsigned long		flags;
+	int			result;
 
 	if (port_paranoia_check (port, __FUNCTION__))
 		return -ENODEV;
@@ -162,8 +167,13 @@
 		wport->tty = port->tty;
 
 		/* Start reading from the device */
-		if (usb_submit_urb(port->read_urb))
-			dbg(__FUNCTION__" - read bulk (%p) failed", port->read_urb);
+		FILL_BULK_URB(port->read_urb, serial->dev, 
+			      usb_rcvbulkpipe(serial->dev, port->bulk_in_endpointAddress),
+			      port->read_urb->transfer_buffer, port->read_urb->transfer_buffer_length,
+			      omninet_read_bulk_callback, port);
+		result = usb_submit_urb(port->read_urb);
+		if (result)
+			err(__FUNCTION__ " - failed submitting read urb, error %d", result);
 	}
 
 	spin_unlock_irqrestore (&port->port_lock, flags);
@@ -222,6 +232,7 @@
 	struct omninet_header 	*header = (struct omninet_header *) &data[0];
 
 	int i;
+	int result;
 
 //	dbg("omninet_read_bulk_callback");
 
@@ -255,8 +266,13 @@
 	}
 
 	/* Continue trying to always read  */
-	if (usb_submit_urb(urb))
-		dbg(__FUNCTION__" - failed resubmitting read urb");
+	FILL_BULK_URB(urb, serial->dev, 
+		      usb_rcvbulkpipe(serial->dev, port->bulk_in_endpointAddress),
+		      urb->transfer_buffer, urb->transfer_buffer_length,
+		      omninet_read_bulk_callback, port);
+	result = usb_submit_urb(urb);
+	if (result)
+		err(__FUNCTION__ " - failed resubmitting read urb, error %d", result);
 
 	return;
 }
@@ -270,11 +286,7 @@
 	struct omninet_header	*header = (struct omninet_header *) wport->write_urb->transfer_buffer;
 
 	unsigned long		flags;
-/*
-#ifdef DEBUG
-	int i;
-#endif
-*/
+	int			result;
 
 //	dbg("omninet_write port %d", port->number);
 
@@ -282,23 +294,13 @@
 		dbg(__FUNCTION__" - write request of 0 bytes");
 		return (0);
 	}
-/*
-#ifdef DEBUG
-	printk (KERN_DEBUG __FILE__ ": omninet_write %d: ", count);
-		for (i = 0; i < count; i++) {
-			if( isalpha(buf[i]) )
-				printk ("%c ", buf[i]);
-			else
-				printk ("%.2x ", buf[i]);
-		}
-		printk ("\n");
-#endif
-*/
 	if (wport->write_urb->status == -EINPROGRESS) {
 		dbg (__FUNCTION__" - already writing");
 		return (0);
 	}
 
+	usb_serial_debug_data (__FILE__, __FUNCTION__, count, buf);
+	
 	spin_lock_irqsave (&port->port_lock, flags);
 	
 	count = (count > OMNINET_BULKOUTSIZE) ? OMNINET_BULKOUTSIZE : count;
@@ -319,8 +321,10 @@
 	/* send the data out the bulk port, always 64 bytes */
 	wport->write_urb->transfer_buffer_length = 64;
 
-	if (usb_submit_urb(wport->write_urb)) {
-		dbg(__FUNCTION__" - usb_submit_urb(write bulk) failed");
+	wport->write_urb->dev = serial->dev;
+	result = usb_submit_urb(wport->write_urb);
+	if (result) {
+		err(__FUNCTION__ " - failed submitting write urb, error %d", result);
 		spin_unlock_irqrestore (&port->port_lock, flags);
 		return 0;
 	}

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