};
 
 /*
- * This routine is called whenever a 3270 tty is opened.
+ * This routine is called whenever a 3270 tty is opened first time.
  */
-static int
-tty3270_open(struct tty_struct *tty, struct file * filp)
+static int tty3270_install(struct tty_driver *driver, struct tty_struct *tty)
 {
        struct raw3270_view *view;
        struct tty3270 *tp;
        int i, rc;
 
-       if (tty->count > 1)
-               return 0;
        /* Check if the tty3270 is already there. */
        view = raw3270_find_view(&tty3270_fn,
                                  tty->index + RAW3270_FIRSTMINOR);
                /* why to reassign? */
                tty_port_tty_set(&tp->port, tty);
                tp->inattr = TF_INPUT;
-               return 0;
+               return tty_port_install(&tp->port, driver, tty);
        }
        if (tty3270_max_index < tty->index + 1)
                tty3270_max_index = tty->index + 1;
 
        tty_port_tty_set(&tp->port, tty);
        tty->low_latency = 0;
-       tty->driver_data = tp;
        tty->winsize.ws_row = tp->view.rows - 2;
        tty->winsize.ws_col = tp->view.cols;
 
        kbd_ascebc(tp->kbd, tp->view.ascebc);
 
        raw3270_activate_view(&tp->view);
+
+       rc = tty_port_install(&tp->port, driver, tty);
+       if (rc) {
+               raw3270_put_view(&tp->view);
+               return rc;
+       }
+
+       tty->driver_data = tp;
+
        return 0;
 }
 
        if (tp) {
                tty->driver_data = NULL;
                tty_port_tty_set(&tp->port, NULL);
-               raw3270_put_view(&tp->view);
        }
 }
 
+static void tty3270_cleanup(struct tty_struct *tty)
+{
+       struct tty3270 *tp = tty->driver_data;
+
+       if (tp)
+               raw3270_put_view(&tp->view);
+}
+
 /*
  * We always have room.
  */
 #endif
 
 static const struct tty_operations tty3270_ops = {
-       .open = tty3270_open,
+       .install = tty3270_install,
+       .cleanup = tty3270_cleanup,
        .close = tty3270_close,
        .write = tty3270_write,
        .put_char = tty3270_put_char,