patch-2.4.0-test3 linux/drivers/usb/serial/usbserial.c
Next file: linux/drivers/usb/serial/visor.c
Previous file: linux/drivers/usb/serial/usb-serial.h
Back to the patch index
Back to the overall index
- Lines: 185
- Date:
Mon Jul 10 14:33:04 2000
- Orig file:
v2.4.0-test2/linux/drivers/usb/serial/usbserial.c
- Orig date:
Fri Jun 23 21:55:10 2000
diff -u --recursive --new-file v2.4.0-test2/linux/drivers/usb/serial/usbserial.c linux/drivers/usb/serial/usbserial.c
@@ -14,6 +14,13 @@
*
* See Documentation/usb/usb-serial.txt for more information on using this driver
*
+ * (07/03/2000) gkh
+ * Added more debugging to serial_ioctl call
+ *
+ * (06/25/2000) gkh
+ * Changed generic_write_bulk_callback to not call wake_up_interruptible
+ * directly, but to have port_softint do it at a safer time.
+ *
* (06/23/2000) gkh
* Cleaned up debugging statements in a quest to find UHCI timeout bug.
*
@@ -222,6 +229,8 @@
#include <linux/tty.h>
#include <linux/module.h>
#include <linux/spinlock.h>
+#include <linux/list.h>
+#include <linux/smp_lock.h>
#ifdef CONFIG_USB_SERIAL_DEBUG
#define DEBUG
@@ -302,6 +311,18 @@
#ifdef CONFIG_USB_SERIAL_DIGI_ACCELEPORT
&digi_acceleport_device,
#endif
+#ifdef CONFIG_USB_SERIAL_KEYSPAN
+ &keyspan_usa18x_pre_device,
+ &keyspan_usa19_pre_device,
+ &keyspan_usa19w_pre_device,
+ &keyspan_usa28_pre_device,
+ &keyspan_usa28x_pre_device,
+ &keyspan_usa18x_device,
+ &keyspan_usa19_device,
+ &keyspan_usa19w_device,
+ &keyspan_usa28_device,
+ &keyspan_usa28x_device,
+#endif
NULL
};
@@ -638,7 +659,7 @@
return -ENODEV;
}
- dbg(__FUNCTION__ " - port %d", port->number);
+ dbg(__FUNCTION__ " - port %d, cmd 0x%.4x", port->number, cmd);
if (!port->active) {
dbg (__FUNCTION__ " - port not open");
@@ -803,36 +824,32 @@
static int generic_write_room (struct usb_serial_port *port)
{
struct usb_serial *serial = port->serial;
- int room;
+ int room = 0;
dbg(__FUNCTION__ " - port %d", port->number);
- if (serial->num_bulk_out) {
- if (port->write_urb->status == -EINPROGRESS)
- room = 0;
- else
+ if (serial->num_bulk_out)
+ if (port->write_urb->status != -EINPROGRESS)
room = port->bulk_out_size;
- dbg(__FUNCTION__ " returns %d", room);
- return (room);
- }
- return (0);
+ dbg(__FUNCTION__ " - returns %d", room);
+ return (room);
}
static int generic_chars_in_buffer (struct usb_serial_port *port)
{
struct usb_serial *serial = port->serial;
+ int chars = 0;
dbg(__FUNCTION__ " - port %d", port->number);
- if (serial->num_bulk_out) {
- if (port->write_urb->status == -EINPROGRESS) {
- return (port->bulk_out_size);
- }
- }
+ if (serial->num_bulk_out)
+ if (port->write_urb->status == -EINPROGRESS)
+ chars = port->write_urb->transfer_buffer_length;
- return (0);
+ dbg (__FUNCTION__ " - returns %d", chars);
+ return (chars);
}
@@ -844,9 +861,10 @@
unsigned char *data = urb->transfer_buffer;
int i;
- dbg (__FUNCTION__ " - enter");
+ dbg(__FUNCTION__ " - port %d", port->number);
if (!serial) {
+ dbg(__FUNCTION__ " - bad serial pointer, exiting");
return;
}
@@ -877,8 +895,6 @@
if (usb_submit_urb(urb))
dbg(__FUNCTION__ " - failed resubmitting read urb");
- dbg (__FUNCTION__ " - exit");
-
return;
}
@@ -887,11 +903,11 @@
{
struct usb_serial_port *port = (struct usb_serial_port *)urb->context;
struct usb_serial *serial = get_usb_serial (port, __FUNCTION__);
- struct tty_struct *tty;
- dbg (__FUNCTION__ " - enter");
+ dbg(__FUNCTION__ " - port %d", port->number);
if (!serial) {
+ dbg(__FUNCTION__ " - bad serial pointer, exiting");
return;
}
@@ -900,18 +916,36 @@
return;
}
+ queue_task(&port->tqueue, &tq_immediate);
+ mark_bh(IMMEDIATE_BH);
+
+ return;
+}
+
+
+static void port_softint(void *private)
+{
+ struct usb_serial_port *port = (struct usb_serial_port *)private;
+ struct usb_serial *serial = get_usb_serial (port, __FUNCTION__);
+ struct tty_struct *tty;
+
+ dbg(__FUNCTION__ " - port %d", port->number);
+
+ if (!serial) {
+ return;
+ }
+
tty = port->tty;
- if ((tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) && tty->ldisc.write_wakeup)
+ if ((tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) && tty->ldisc.write_wakeup) {
+ dbg(__FUNCTION__ " - write wakeup call.");
(tty->ldisc.write_wakeup)(tty);
+ }
wake_up_interruptible(&tty->write_wait);
-
- dbg (__FUNCTION__ " - exit");
-
- return;
}
+
static void * usb_serial_probe(struct usb_device *dev, unsigned int ifnum)
{
struct usb_serial *serial = NULL;
@@ -1117,6 +1151,8 @@
port->number = i + serial->minor;
port->serial = serial;
port->magic = USB_SERIAL_PORT_MAGIC;
+ port->tqueue.routine = port_softint;
+ port->tqueue.data = port;
}
/* initialize the devfs nodes for this device and let the user know what ports we are bound to */
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)