]> bbs.cooldavid.org Git - net-next-2.6.git/blobdiff - drivers/char/amiserial.c
8139cp: fix checksum broken
[net-next-2.6.git] / drivers / char / amiserial.c
index a11c8c9ca3d4b858029205f9a265b6ee96b04fdb..c0bd6f472c523a377f4d6efef8d90f8f6fbfe373 100644 (file)
@@ -1263,13 +1263,42 @@ static int rs_break(struct tty_struct *tty, int break_state)
        return 0;
 }
 
+/*
+ * Get counter of input serial line interrupts (DCD,RI,DSR,CTS)
+ * Return: write counters to the user passed counter struct
+ * NB: both 1->0 and 0->1 transitions are counted except for
+ *     RI where only 0->1 is counted.
+ */
+static int rs_get_icount(struct tty_struct *tty,
+                               struct serial_icounter_struct *icount)
+{
+       struct async_struct *info = tty->driver_data;
+       struct async_icount cnow;
+       unsigned long flags;
+
+       local_irq_save(flags);
+       cnow = info->state->icount;
+       local_irq_restore(flags);
+       icount->cts = cnow.cts;
+       icount->dsr = cnow.dsr;
+       icount->rng = cnow.rng;
+       icount->dcd = cnow.dcd;
+       icount->rx = cnow.rx;
+       icount->tx = cnow.tx;
+       icount->frame = cnow.frame;
+       icount->overrun = cnow.overrun;
+       icount->parity = cnow.parity;
+       icount->brk = cnow.brk;
+       icount->buf_overrun = cnow.buf_overrun;
+
+       return 0;
+}
 
 static int rs_ioctl(struct tty_struct *tty, struct file * file,
                    unsigned int cmd, unsigned long arg)
 {
        struct async_struct * info = tty->driver_data;
        struct async_icount cprev, cnow;        /* kernel counter temps */
-       struct serial_icounter_struct icount;
        void __user *argp = (void __user *)arg;
        unsigned long flags;
 
@@ -1332,31 +1361,6 @@ static int rs_ioctl(struct tty_struct *tty, struct file * file,
                        }
                        /* NOTREACHED */
 
-               /* 
-                * Get counter of input serial line interrupts (DCD,RI,DSR,CTS)
-                * Return: write counters to the user passed counter struct
-                * NB: both 1->0 and 0->1 transitions are counted except for
-                *     RI where only 0->1 is counted.
-                */
-               case TIOCGICOUNT:
-                       local_irq_save(flags);
-                       cnow = info->state->icount;
-                       local_irq_restore(flags);
-                       icount.cts = cnow.cts;
-                       icount.dsr = cnow.dsr;
-                       icount.rng = cnow.rng;
-                       icount.dcd = cnow.dcd;
-                       icount.rx = cnow.rx;
-                       icount.tx = cnow.tx;
-                       icount.frame = cnow.frame;
-                       icount.overrun = cnow.overrun;
-                       icount.parity = cnow.parity;
-                       icount.brk = cnow.brk;
-                       icount.buf_overrun = cnow.buf_overrun;
-
-                       if (copy_to_user(argp, &icount, sizeof(icount)))
-                               return -EFAULT;
-                       return 0;
                case TIOCSERGWILD:
                case TIOCSERSWILD:
                        /* "setserial -W" is called in Debian boot */
@@ -1958,6 +1962,7 @@ static const struct tty_operations serial_ops = {
        .wait_until_sent = rs_wait_until_sent,
        .tiocmget = rs_tiocmget,
        .tiocmset = rs_tiocmset,
+       .get_icount = rs_get_icount,
        .proc_fops = &rs_proc_fops,
 };