tty/serial: lay the foundations for the next set of reworks
[linux-2.6-block.git] / drivers / char / serial167.c
index df8cd0ca97ebcc5d8728ab36ffcdeabcd899c4f3..62d6f2e0fd1881c960fd322ca12f4d75ff1cc22d 100644 (file)
@@ -1539,6 +1539,8 @@ cy_ioctl(struct tty_struct *tty, struct file *file,
        printk("cy_ioctl %s, cmd = %x arg = %lx\n", tty->name, cmd, arg);       /* */
 #endif
 
+       lock_kernel();
+
        switch (cmd) {
        case CYGETMON:
                ret_val = get_mon_info(info, argp);
@@ -1584,18 +1586,6 @@ cy_ioctl(struct tty_struct *tty, struct file *file,
                break;
 
 /* The following commands are incompletely implemented!!! */
-       case TIOCGSOFTCAR:
-               ret_val =
-                   put_user(C_CLOCAL(tty) ? 1 : 0,
-                            (unsigned long __user *)argp);
-               break;
-       case TIOCSSOFTCAR:
-               ret_val = get_user(val, (unsigned long __user *)argp);
-               if (ret_val)
-                       break;
-               tty->termios->c_cflag =
-                   ((tty->termios->c_cflag & ~CLOCAL) | (val ? CLOCAL : 0));
-               break;
        case TIOCGSERIAL:
                ret_val = get_serial_info(info, argp);
                break;
@@ -1605,6 +1595,7 @@ cy_ioctl(struct tty_struct *tty, struct file *file,
        default:
                ret_val = -ENOIOCTLCMD;
        }
+       unlock_kernel();
 
 #ifdef SERIAL_DEBUG_OTHER
        printk("cy_ioctl done\n");
@@ -1683,8 +1674,7 @@ static void cy_close(struct tty_struct *tty, struct file *filp)
        if (info->flags & ASYNC_INITIALIZED)
                tty_wait_until_sent(tty, 3000); /* 30 seconds timeout */
        shutdown(info);
-       if (tty->driver->flush_buffer)
-               tty->driver->flush_buffer(tty);
+       cy_flush_buffer(tty);
        tty_ldisc_flush(tty);
        info->tty = NULL;
        if (info->blocked_open) {