]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/usb/serial/iuu_phoenix.c
tty: usb-serial krefs
[linux-2.6-omap-h63xx.git] / drivers / usb / serial / iuu_phoenix.c
index d654148883491f83fee46fe627cc9d8f14bd8812..53710aa7eadd96d7c6f1e535d513465815a7bceb 100644 (file)
@@ -318,11 +318,10 @@ static int bulk_immediate(struct usb_serial_port *port, u8 *buf, u8 count)
                                         port->bulk_out_endpointAddress), buf,
                         count, &actual, HZ * 1);
 
-       if (status != IUU_OPERATION_OK) {
+       if (status != IUU_OPERATION_OK)
                dbg("%s - error = %2x", __func__, status);
-       } else {
+       else
                dbg("%s - write OK !", __func__);
-       }
        return status;
 }
 
@@ -342,12 +341,10 @@ static int read_immediate(struct usb_serial_port *port, u8 *buf, u8 count)
                                         port->bulk_in_endpointAddress), buf,
                         count, &actual, HZ * 1);
 
-       if (status != IUU_OPERATION_OK) {
+       if (status != IUU_OPERATION_OK)
                dbg("%s - error = %2x", __func__, status);
-       } else {
+       else
                dbg("%s - read OK !", __func__);
-       }
-
        return status;
 }
 
@@ -632,13 +629,14 @@ static void read_buf_callback(struct urb *urb)
        }
 
        dbg("%s - %i chars to write", __func__, urb->actual_length);
-       tty = port->port.tty;
+       tty = tty_port_tty_get(&port->port);
        if (data == NULL)
                dbg("%s - data is NULL !!!", __func__);
        if (tty && urb->actual_length && data) {
                tty_insert_flip_string(tty, data, urb->actual_length);
                tty_flip_buffer_push(tty);
        }
+       tty_kref_put(tty);
        iuu_led_activity_on(urb);
 }
 
@@ -770,14 +768,14 @@ static int iuu_uart_write(struct tty_struct *tty, struct usb_serial_port *port,
        if (priv->writelen > 0) {
                /* buffer already filled but not commited */
                spin_unlock_irqrestore(&priv->lock, flags);
-               return (0);
+               return 0;
        }
        /* fill the buffer */
        memcpy(priv->writebuf, buf, count);
        priv->writelen = count;
        spin_unlock_irqrestore(&priv->lock, flags);
 
-       return (count);
+       return count;
 }
 
 static void read_rxcmd_callback(struct urb *urb)