aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/serial/keyspan_pda.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/serial/keyspan_pda.c')
-rw-r--r--drivers/usb/serial/keyspan_pda.c66
1 files changed, 5 insertions, 61 deletions
diff --git a/drivers/usb/serial/keyspan_pda.c b/drivers/usb/serial/keyspan_pda.c
index d5c0c6ab4966..a40615674a68 100644
--- a/drivers/usb/serial/keyspan_pda.c
+++ b/drivers/usb/serial/keyspan_pda.c
@@ -12,59 +12,6 @@
12 * 12 *
13 * See Documentation/usb/usb-serial.txt for more information on using this 13 * See Documentation/usb/usb-serial.txt for more information on using this
14 * driver 14 * driver
15 *
16 * (09/07/2001) gkh
17 * cleaned up the Xircom support. Added ids for Entregra device which is
18 * the same as the Xircom device. Enabled the code to be compiled for
19 * either Xircom or Keyspan devices.
20 *
21 * (08/11/2001) Cristian M. Craciunescu
22 * support for Xircom PGSDB9
23 *
24 * (05/31/2001) gkh
25 * switched from using spinlock to a semaphore, which fixes lots of
26 * problems.
27 *
28 * (04/08/2001) gb
29 * Identify version on module load.
30 *
31 * (11/01/2000) Adam J. Richter
32 * usb_device_id table support
33 *
34 * (10/05/2000) gkh
35 * Fixed bug with urb->dev not being set properly, now that the usb
36 * core needs it.
37 *
38 * (08/28/2000) gkh
39 * Added locks for SMP safeness.
40 * Fixed MOD_INC and MOD_DEC logic and the ability to open a port more
41 * than once.
42 *
43 * (07/20/2000) borchers
44 * - keyspan_pda_write no longer sleeps if it is called on interrupt time;
45 * PPP and the line discipline with stty echo on can call write on
46 * interrupt time and this would cause an oops if write slept
47 * - if keyspan_pda_write is in an interrupt, it will not call
48 * usb_control_msg (which sleeps) to query the room in the device
49 * buffer, it simply uses the current room value it has
50 * - if the urb is busy or if it is throttled keyspan_pda_write just
51 * returns 0, rather than sleeping to wait for this to change; the
52 * write_chan code in n_tty.c will sleep if needed before calling
53 * keyspan_pda_write again
54 * - if the device needs to be unthrottled, write now queues up the
55 * call to usb_control_msg (which sleeps) to unthrottle the device
56 * - the wakeups from keyspan_pda_write_bulk_callback are queued rather
57 * than done directly from the callback to avoid the race in write_chan
58 * - keyspan_pda_chars_in_buffer also indicates its buffer is full if the
59 * urb status is -EINPROGRESS, meaning it cannot write at the moment
60 *
61 * (07/19/2000) gkh
62 * Added module_init and module_exit functions to handle the fact that this
63 * driver is a loadable module now.
64 *
65 * (03/26/2000) gkh
66 * Split driver up into device specific pieces.
67 *
68 */ 15 */
69 16
70 17
@@ -290,7 +237,6 @@ static void keyspan_pda_rx_unthrottle(struct tty_struct *tty)
290 struct usb_serial_port *port = tty->driver_data; 237 struct usb_serial_port *port = tty->driver_data;
291 /* just restart the receive interrupt URB */ 238 /* just restart the receive interrupt URB */
292 dbg("keyspan_pda_rx_unthrottle port %d", port->number); 239 dbg("keyspan_pda_rx_unthrottle port %d", port->number);
293 port->interrupt_in_urb->dev = port->serial->dev;
294 if (usb_submit_urb(port->interrupt_in_urb, GFP_KERNEL)) 240 if (usb_submit_urb(port->interrupt_in_urb, GFP_KERNEL))
295 dbg(" usb_submit_urb(read urb) failed"); 241 dbg(" usb_submit_urb(read urb) failed");
296} 242}
@@ -532,11 +478,11 @@ static int keyspan_pda_write(struct tty_struct *tty,
532 the device is full (wait until it says there is room) 478 the device is full (wait until it says there is room)
533 */ 479 */
534 spin_lock_bh(&port->lock); 480 spin_lock_bh(&port->lock);
535 if (port->write_urb_busy || priv->tx_throttled) { 481 if (!test_bit(0, &port->write_urbs_free) || priv->tx_throttled) {
536 spin_unlock_bh(&port->lock); 482 spin_unlock_bh(&port->lock);
537 return 0; 483 return 0;
538 } 484 }
539 port->write_urb_busy = 1; 485 clear_bit(0, &port->write_urbs_free);
540 spin_unlock_bh(&port->lock); 486 spin_unlock_bh(&port->lock);
541 487
542 /* At this point the URB is in our control, nobody else can submit it 488 /* At this point the URB is in our control, nobody else can submit it
@@ -598,7 +544,6 @@ static int keyspan_pda_write(struct tty_struct *tty,
598 544
599 priv->tx_room -= count; 545 priv->tx_room -= count;
600 546
601 port->write_urb->dev = port->serial->dev;
602 rc = usb_submit_urb(port->write_urb, GFP_ATOMIC); 547 rc = usb_submit_urb(port->write_urb, GFP_ATOMIC);
603 if (rc) { 548 if (rc) {
604 dbg(" usb_submit_urb(write bulk) failed"); 549 dbg(" usb_submit_urb(write bulk) failed");
@@ -618,7 +563,7 @@ static int keyspan_pda_write(struct tty_struct *tty,
618 rc = count; 563 rc = count;
619exit: 564exit:
620 if (rc < 0) 565 if (rc < 0)
621 port->write_urb_busy = 0; 566 set_bit(0, &port->write_urbs_free);
622 return rc; 567 return rc;
623} 568}
624 569
@@ -628,7 +573,7 @@ static void keyspan_pda_write_bulk_callback(struct urb *urb)
628 struct usb_serial_port *port = urb->context; 573 struct usb_serial_port *port = urb->context;
629 struct keyspan_pda_private *priv; 574 struct keyspan_pda_private *priv;
630 575
631 port->write_urb_busy = 0; 576 set_bit(0, &port->write_urbs_free);
632 priv = usb_get_serial_port_data(port); 577 priv = usb_get_serial_port_data(port);
633 578
634 /* queue up a wakeup at scheduler time */ 579 /* queue up a wakeup at scheduler time */
@@ -661,7 +606,7 @@ static int keyspan_pda_chars_in_buffer(struct tty_struct *tty)
661 n_tty.c:normal_poll() ) that we're not writeable. */ 606 n_tty.c:normal_poll() ) that we're not writeable. */
662 607
663 spin_lock_irqsave(&port->lock, flags); 608 spin_lock_irqsave(&port->lock, flags);
664 if (port->write_urb_busy || priv->tx_throttled) 609 if (!test_bit(0, &port->write_urbs_free) || priv->tx_throttled)
665 ret = 256; 610 ret = 256;
666 spin_unlock_irqrestore(&port->lock, flags); 611 spin_unlock_irqrestore(&port->lock, flags);
667 return ret; 612 return ret;
@@ -717,7 +662,6 @@ static int keyspan_pda_open(struct tty_struct *tty,
717 priv->tx_throttled = *room ? 0 : 1; 662 priv->tx_throttled = *room ? 0 : 1;
718 663
719 /*Start reading from the device*/ 664 /*Start reading from the device*/
720 port->interrupt_in_urb->dev = serial->dev;
721 rc = usb_submit_urb(port->interrupt_in_urb, GFP_KERNEL); 665 rc = usb_submit_urb(port->interrupt_in_urb, GFP_KERNEL);
722 if (rc) { 666 if (rc) {
723 dbg("%s - usb_submit_urb(read int) failed", __func__); 667 dbg("%s - usb_submit_urb(read int) failed", __func__);