OSDN Git Service

TTY: serial_core, add ->install
[android-x86/kernel.git] / drivers / tty / serial / serial_core.c
index f0b354b..8dbeb14 100644 (file)
@@ -130,9 +130,6 @@ static void uart_start(struct tty_struct *tty)
        struct uart_port *port;
        unsigned long flags;
 
-       if (!state)
-               return;
-
        port = uart_port_lock(state, flags);
        __uart_start(tty);
        uart_port_unlock(port, flags);
@@ -730,9 +727,6 @@ static void uart_unthrottle(struct tty_struct *tty)
        upstat_t mask = UPSTAT_SYNC_FIFO;
        struct uart_port *port;
 
-       if (!state)
-               return;
-
        port = uart_port_ref(state);
        if (!port)
                return;
@@ -1708,6 +1702,16 @@ static void uart_dtr_rts(struct tty_port *port, int raise)
        uart_port_deref(uport);
 }
 
+static int uart_install(struct tty_driver *driver, struct tty_struct *tty)
+{
+       struct uart_driver *drv = driver->driver_state;
+       struct uart_state *state = drv->state + tty->index;
+
+       tty->driver_data = state;
+
+       return tty_standard_install(driver, tty);
+}
+
 /*
  * Calls to uart_open are serialised by the tty_lock in
  *   drivers/tty/tty_io.c:tty_open()
@@ -1720,11 +1724,8 @@ static void uart_dtr_rts(struct tty_port *port, int raise)
  */
 static int uart_open(struct tty_struct *tty, struct file *filp)
 {
-       struct uart_driver *drv = tty->driver->driver_state;
-       int retval, line = tty->index;
-       struct uart_state *state = drv->state + line;
-
-       tty->driver_data = state;
+       struct uart_state *state = tty->driver_data;
+       int retval;
 
        retval = tty_port_open(&state->port, tty, filp);
        if (retval > 0)
@@ -2409,6 +2410,7 @@ static void uart_poll_put_char(struct tty_driver *driver, int line, char ch)
 #endif
 
 static const struct tty_operations uart_ops = {
+       .install        = uart_install,
        .open           = uart_open,
        .close          = uart_close,
        .write          = uart_write,