tty: replace BKL with a new tty_lock
[pandora-kernel.git] / drivers / char / amiserial.c
index 4f8d60c..1b21a7a 100644 (file)
@@ -1072,7 +1072,7 @@ static int get_serial_info(struct async_struct * info,
        if (!retinfo)
                return -EFAULT;
        memset(&tmp, 0, sizeof(tmp));
-       lock_kernel();
+       tty_lock();
        tmp.type = state->type;
        tmp.line = state->line;
        tmp.port = state->port;
@@ -1083,7 +1083,7 @@ static int get_serial_info(struct async_struct * info,
        tmp.close_delay = state->close_delay;
        tmp.closing_wait = state->closing_wait;
        tmp.custom_divisor = state->custom_divisor;
-       unlock_kernel();
+       tty_unlock();
        if (copy_to_user(retinfo,&tmp,sizeof(*retinfo)))
                return -EFAULT;
        return 0;
@@ -1100,14 +1100,14 @@ static int set_serial_info(struct async_struct * info,
        if (copy_from_user(&new_serial,new_info,sizeof(new_serial)))
                return -EFAULT;
 
-       lock_kernel();
+       tty_lock();
        state = info->state;
        old_state = *state;
   
        change_irq = new_serial.irq != state->irq;
        change_port = (new_serial.port != state->port);
        if(change_irq || change_port || (new_serial.xmit_fifo_size != state->xmit_fifo_size)) {
-         unlock_kernel();
+         tty_unlock();
          return -EINVAL;
        }
   
@@ -1127,7 +1127,7 @@ static int set_serial_info(struct async_struct * info,
        }
 
        if (new_serial.baud_base < 9600) {
-               unlock_kernel();
+               tty_unlock();
                return -EINVAL;
        }
 
@@ -1163,7 +1163,7 @@ check_and_exit:
                }
        } else
                retval = startup(info);
-       unlock_kernel();
+       tty_unlock();
        return retval;
 }
 
@@ -1538,7 +1538,7 @@ static void rs_wait_until_sent(struct tty_struct *tty, int timeout)
 
        orig_jiffies = jiffies;
 
-       lock_kernel();
+       tty_lock_nested(); /* tty_wait_until_sent is called from lots of places */
        /*
         * Set the check interval to be 1/5 of the estimated time to
         * send a single character, and make it at least 1.  The check
@@ -1579,7 +1579,7 @@ static void rs_wait_until_sent(struct tty_struct *tty, int timeout)
                        break;
        }
        __set_current_state(TASK_RUNNING);
-       unlock_kernel();
+       tty_unlock();
 #ifdef SERIAL_DEBUG_RS_WAIT_UNTIL_SENT
        printk("lsr = %d (jiff=%lu)...done\n", lsr, jiffies);
 #endif