svcrpc: treat uid's as unsigned
[safe/jmp/linux-2.6] / drivers / input / serio / serport.c
index 79ca384..6d34511 100644 (file)
@@ -15,6 +15,7 @@
 
 #include <asm/uaccess.h>
 #include <linux/kernel.h>
+#include <linux/sched.h>
 #include <linux/slab.h>
 #include <linux/module.h>
 #include <linux/init.h>
@@ -46,7 +47,7 @@ struct serport {
 static int serport_serio_write(struct serio *serio, unsigned char data)
 {
        struct serport *serport = serio->port_data;
-       return -(serport->tty->driver->write(serport->tty, &data, 1) != 1);
+       return -(serport->tty->ops->write(serport->tty, &data, 1) != 1);
 }
 
 static int serport_serio_open(struct serio *serio)
@@ -87,7 +88,7 @@ static int serport_ldisc_open(struct tty_struct *tty)
        if (!capable(CAP_SYS_ADMIN))
                return -EPERM;
 
-       serport = kcalloc(1, sizeof(struct serport), GFP_KERNEL);
+       serport = kzalloc(sizeof(struct serport), GFP_KERNEL);
        if (!serport)
                return -ENOMEM;
 
@@ -96,6 +97,7 @@ static int serport_ldisc_open(struct tty_struct *tty)
        init_waitqueue_head(&serport->wait);
 
        tty->disc_data = serport;
+       tty->receive_room = 256;
        set_bit(TTY_DO_WRITE_WAKEUP, &tty->flags);
 
        return 0;
@@ -116,9 +118,6 @@ static void serport_ldisc_close(struct tty_struct *tty)
  * serport_ldisc_receive() is called by the low level tty driver when characters
  * are ready for us. We forward the characters, one by one to the 'interrupt'
  * routine.
- *
- * FIXME: We should get pt_regs from the tty layer and forward them to
- *       serio_interrupt here.
  */
 
 static void serport_ldisc_receive(struct tty_struct *tty, const unsigned char *cp, char *fp, int count)
@@ -133,24 +132,13 @@ static void serport_ldisc_receive(struct tty_struct *tty, const unsigned char *c
                goto out;
 
        for (i = 0; i < count; i++)
-               serio_interrupt(serport->serio, cp[i], 0, NULL);
+               serio_interrupt(serport->serio, cp[i], 0);
 
 out:
        spin_unlock_irqrestore(&serport->lock, flags);
 }
 
 /*
- * serport_ldisc_room() reports how much room we do have for receiving data.
- * Although we in fact have infinite room, we need to specify some value
- * here, and 256 seems to be reasonable.
- */
-
-static int serport_ldisc_room(struct tty_struct *tty)
-{
-       return 256;
-}
-
-/*
  * serport_ldisc_read() just waits indefinitely if everything goes well.
  * However, when the serio driver closes the serio port, it finishes,
  * returning 0 characters.
@@ -165,7 +153,7 @@ static ssize_t serport_ldisc_read(struct tty_struct * tty, struct file * file, u
        if (test_and_set_bit(SERPORT_BUSY, &serport->flags))
                return -EBUSY;
 
-       serport->serio = serio = kcalloc(1, sizeof(struct serio), GFP_KERNEL);
+       serport->serio = serio = kzalloc(sizeof(struct serio), GFP_KERNEL);
        if (!serio)
                return -ENOMEM;
 
@@ -229,7 +217,7 @@ static void serport_ldisc_write_wakeup(struct tty_struct * tty)
  * The line discipline structure.
  */
 
-static struct tty_ldisc serport_ldisc = {
+static struct tty_ldisc_ops serport_ldisc = {
        .owner =        THIS_MODULE,
        .name =         "input",
        .open =         serport_ldisc_open,
@@ -237,7 +225,6 @@ static struct tty_ldisc serport_ldisc = {
        .read =         serport_ldisc_read,
        .ioctl =        serport_ldisc_ioctl,
        .receive_buf =  serport_ldisc_receive,
-       .receive_room = serport_ldisc_room,
        .write_wakeup = serport_ldisc_write_wakeup
 };