]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/net/usb/hso.c
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6
[linux-2.6-omap-h63xx.git] / drivers / net / usb / hso.c
index d974d970e5fddcaeda9f358d4536f7e4c00543be..0d0fa91c025130fa96637d70a89b2cc101b89233 100644 (file)
@@ -3,6 +3,8 @@
  * Driver for Option High Speed Mobile Devices.
  *
  *  Copyright (C) 2008 Option International
+ *                     Filip Aben <f.aben@option.com>
+ *                     Denis Joseph Barrow <d.barow@option.com>
  *  Copyright (C) 2007 Andrew Bird (Sphere Systems Ltd)
  *                     <ajb@spheresystems.co.uk>
  *  Copyright (C) 2008 Greg Kroah-Hartman <gregkh@suse.de>
@@ -1295,6 +1297,7 @@ static int hso_serial_open(struct tty_struct *tty, struct file *filp)
        /* setup */
        spin_lock_irq(&serial->serial_lock);
        tty->driver_data = serial;
+       tty_kref_put(serial->tty);
        serial->tty = tty_kref_get(tty);
        spin_unlock_irq(&serial->serial_lock);
 
@@ -1790,8 +1793,8 @@ static int mux_device_request(struct hso_serial *serial, u8 type, u16 port,
 
        /* initialize */
        ctrl_req->wValue = 0;
-       ctrl_req->wIndex = hso_port_to_mux(port);
-       ctrl_req->wLength = size;
+       ctrl_req->wIndex = cpu_to_le16(hso_port_to_mux(port));
+       ctrl_req->wLength = cpu_to_le16(size);
 
        if (type == USB_CDC_GET_ENCAPSULATED_RESPONSE) {
                /* Reading command */
@@ -2041,9 +2044,8 @@ static int put_rxbuf_data(struct urb *urb, struct hso_serial *serial)
                return -2;
        }
 
-       spin_lock(&serial->serial_lock);
+       /* All callers to put_rxbuf_data hold serial_lock */
        tty = tty_kref_get(serial->tty);
-       spin_unlock(&serial->serial_lock);
 
        /* Push data to tty */
        if (tty) {
@@ -2051,8 +2053,10 @@ static int put_rxbuf_data(struct urb *urb, struct hso_serial *serial)
                        serial->curr_rx_urb_offset;
                D1("data to push to tty");
                while (write_length_remaining) {
-                       if (test_bit(TTY_THROTTLED, &tty->flags))
+                       if (test_bit(TTY_THROTTLED, &tty->flags)) {
+                               tty_kref_put(tty);
                                return -1;
+                       }
                        curr_write_len =  tty_insert_flip_string
                                (tty, urb->transfer_buffer +
                                 serial->curr_rx_urb_offset,
@@ -2663,7 +2667,7 @@ static struct hso_device *hso_create_bulk_serial_device(
        serial->parent = hso_dev;
        hso_dev->port_data.dev_serial = serial;
 
-       if (port & HSO_PORT_MODEM) {
+       if ((port & HSO_PORT_MASK) == HSO_PORT_MODEM) {
                num_urbs = 2;
                serial->tiocmget = kzalloc(sizeof(struct hso_tiocmget),
                                           GFP_KERNEL);