vserver 1.9.5.x5
[linux-2.6.git] / net / irda / ircomm / ircomm_tty.c
index 6b9ae8c..f75949d 100644 (file)
@@ -52,7 +52,7 @@
 
 static int  ircomm_tty_open(struct tty_struct *tty, struct file *filp);
 static void ircomm_tty_close(struct tty_struct * tty, struct file *filp);
-static int  ircomm_tty_write(struct tty_struct * tty, int from_user,
+static int  ircomm_tty_write(struct tty_struct * tty,
                             const unsigned char *buf, int count);
 static int  ircomm_tty_write_room(struct tty_struct *tty);
 static void ircomm_tty_throttle(struct tty_struct *tty);
@@ -64,6 +64,7 @@ static void ircomm_tty_wait_until_sent(struct tty_struct *tty, int timeout);
 static void ircomm_tty_hangup(struct tty_struct *tty);
 static void ircomm_tty_do_softint(void *private_);
 static void ircomm_tty_shutdown(struct ircomm_tty_cb *self);
+static void ircomm_tty_stop(struct tty_struct *tty);
 
 static int ircomm_tty_data_indication(void *instance, void *sap,
                                      struct sk_buff *skb);
@@ -108,7 +109,7 @@ static struct tty_operations ops = {
  *    Init IrCOMM TTY layer/driver
  *
  */
-int __init ircomm_tty_init(void)
+static int __init ircomm_tty_init(void)
 {
        driver = alloc_tty_driver(IRCOMM_TTY_PORTS);
        if (!driver)
@@ -159,7 +160,7 @@ static void __exit __ircomm_tty_cleanup(struct ircomm_tty_cb *self)
  *    Remove IrCOMM TTY layer/driver
  *
  */
-void __exit ircomm_tty_cleanup(void)
+static void __exit ircomm_tty_cleanup(void)
 {
        int ret;
 
@@ -561,7 +562,7 @@ static void ircomm_tty_close(struct tty_struct *tty, struct file *filp)
                tty->ldisc.flush_buffer(tty);
 
        tty->closing = 0;
-       self->tty = 0;
+       self->tty = NULL;
 
        if (self->blocked_open) {
                if (self->close_delay) {
@@ -662,14 +663,14 @@ static void ircomm_tty_do_softint(void *private_)
 }
 
 /*
- * Function ircomm_tty_write (tty, from_user, buf, count)
+ * Function ircomm_tty_write (tty, buf, count)
  *
  *    This routine is called by the kernel to write a series of characters
  *    to the tty device. The characters may come from user space or kernel
  *    space. This routine will return the number of characters actually
  *    accepted for writing. This routine is mandatory.
  */
-static int ircomm_tty_write(struct tty_struct *tty, int from_user,
+static int ircomm_tty_write(struct tty_struct *tty,
                            const unsigned char *ubuf, int count)
 {
        struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) tty->driver_data;
@@ -713,19 +714,8 @@ static int ircomm_tty_write(struct tty_struct *tty, int from_user,
        if (count < 1)
                return 0;
 
-       /* Additional copy to avoid copy_from_user() under spinlock.
-        * We tradeoff this extra copy to allow to pack more the
-        * IrCOMM frames. This is advantageous because the IrDA link
-        * is the bottleneck. */
-       if (from_user) {
-               kbuf = kmalloc(count, GFP_KERNEL);
-               if (kbuf == NULL)
-                       return -ENOMEM;
-               if (copy_from_user(kbuf, ubuf, count))
-                       return -EFAULT;
-       } else
-               /* The buffer is already in kernel space */
-               kbuf = (unsigned char *) ubuf;
+       /* The buffer is already in kernel space */
+       kbuf = (unsigned char *) ubuf;
 
        /* Protect our manipulation of self->tx_skb and related */
        spin_lock_irqsave(&self->spinlock, flags);
@@ -797,9 +787,6 @@ static int ircomm_tty_write(struct tty_struct *tty, int from_user,
 
        spin_unlock_irqrestore(&self->spinlock, flags);
 
-       if (from_user)
-               kfree(kbuf);
-
        /*     
         * Schedule a new thread which will transmit the frame as soon
         * as possible, but at a safe point in time. We do this so the
@@ -873,7 +860,7 @@ static void ircomm_tty_wait_until_sent(struct tty_struct *tty, int timeout)
        orig_jiffies = jiffies;
 
        /* Set poll time to 200 ms */
-       poll_time = IRDA_MIN(timeout, MSECS_TO_JIFFIES(200));
+       poll_time = IRDA_MIN(timeout, msecs_to_jiffies(200));
 
        spin_lock_irqsave(&self->spinlock, flags);
        while (self->tx_skb && self->tx_skb->len) {
@@ -1041,7 +1028,7 @@ static void ircomm_tty_hangup(struct tty_struct *tty)
        /* I guess we need to lock here - Jean II */
        spin_lock_irqsave(&self->spinlock, flags);
        self->flags &= ~ASYNC_NORMAL_ACTIVE;
-       self->tty = 0;
+       self->tty = NULL;
        self->open_count = 0;
        spin_unlock_irqrestore(&self->spinlock, flags);
 
@@ -1078,7 +1065,7 @@ void ircomm_tty_start(struct tty_struct *tty)
  *     This routine notifies the tty driver that it should stop outputting
  *     characters to the tty device. 
  */
-void ircomm_tty_stop(struct tty_struct *tty) 
+static void ircomm_tty_stop(struct tty_struct *tty) 
 {
        struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) tty->driver_data;