]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/usb/serial/empeg.c
Merge git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-2.6
[linux-2.6-omap-h63xx.git] / drivers / usb / serial / empeg.c
index 4703c8f853837431616249f846647d07b344546b..a5c8e1e17ea5ff42c0280b7e0b444e42694ac390 100644 (file)
@@ -326,12 +326,14 @@ static int empeg_chars_in_buffer (struct usb_serial_port *port)
 
 static void empeg_write_bulk_callback (struct urb *urb)
 {
-       struct usb_serial_port *port = (struct usb_serial_port *)urb->context;
+       struct usb_serial_port *port = urb->context;
+       int status = urb->status;
 
        dbg("%s - port %d", __FUNCTION__, port->number);
 
-       if (urb->status) {
-               dbg("%s - nonzero write bulk status received: %d", __FUNCTION__, urb->status);
+       if (status) {
+               dbg("%s - nonzero write bulk status received: %d",
+                   __FUNCTION__, status);
                return;
        }
 
@@ -345,11 +347,13 @@ static void empeg_read_bulk_callback (struct urb *urb)
        struct tty_struct *tty;
        unsigned char *data = urb->transfer_buffer;
        int result;
+       int status = urb->status;
 
        dbg("%s - port %d", __FUNCTION__, port->number);
 
-       if (urb->status) {
-               dbg("%s - nonzero read bulk status received: %d", __FUNCTION__, urb->status);
+       if (status) {
+               dbg("%s - nonzero read bulk status received: %d",
+                   __FUNCTION__, status);
                return;
        }
 
@@ -445,14 +449,9 @@ static int empeg_ioctl (struct usb_serial_port *port, struct file * file, unsign
 
 static void empeg_set_termios (struct usb_serial_port *port, struct ktermios *old_termios)
 {
-
+       struct ktermios *termios = port->tty->termios;
        dbg("%s - port %d", __FUNCTION__, port->number);
 
-       if ((!port->tty) || (!port->tty->termios)) {
-               dbg("%s - no tty structures", __FUNCTION__);
-               return;
-       }
-
        /*
          * The empeg-car player wants these particular tty settings.
          * You could, for example, change the baud rate, however the
@@ -462,7 +461,7 @@ static void empeg_set_termios (struct usb_serial_port *port, struct ktermios *ol
          *
          * The default requirements for this device are:
          */
-       port->tty->termios->c_iflag
+       termios->c_iflag
                &= ~(IGNBRK     /* disable ignore break */
                | BRKINT        /* disable break causes interrupt */
                | PARMRK        /* disable mark parity errors */
@@ -472,24 +471,23 @@ static void empeg_set_termios (struct usb_serial_port *port, struct ktermios *ol
                | ICRNL         /* disable translate CR to NL */
                | IXON);        /* disable enable XON/XOFF flow control */
 
-       port->tty->termios->c_oflag
+       termios->c_oflag
                &= ~OPOST;      /* disable postprocess output characters */
 
-       port->tty->termios->c_lflag
+       termios->c_lflag
                &= ~(ECHO       /* disable echo input characters */
                | ECHONL        /* disable echo new line */
                | ICANON        /* disable erase, kill, werase, and rprnt special characters */
                | ISIG          /* disable interrupt, quit, and suspend special characters */
                | IEXTEN);      /* disable non-POSIX special characters */
 
-       port->tty->termios->c_cflag
+       termios->c_cflag
                &= ~(CSIZE      /* no size */
                | PARENB        /* disable parity bit */
                | CBAUD);       /* clear current baud rate */
 
-       port->tty->termios->c_cflag
-               |= (CS8         /* character size 8 bits */
-               | B115200);     /* baud rate 115200 */
+       termios->c_cflag
+               |= CS8;         /* character size 8 bits */
 
        /*
         * Force low_latency on; otherwise the pushes are scheduled;
@@ -497,8 +495,7 @@ static void empeg_set_termios (struct usb_serial_port *port, struct ktermios *ol
         * on the floor.  We don't want to drop bytes on the floor. :)
         */
        port->tty->low_latency = 1;
-
-       return;
+       tty_encode_baud_rate(port->tty, 115200, 115200);
 }