]> git.karo-electronics.de Git - mv-sheeva.git/blobdiff - drivers/char/cyclades.c
Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/kyle/parisc-2.6
[mv-sheeva.git] / drivers / char / cyclades.c
index 27aad94223321718f4d86f5847f0554dad4011cc..4f152c28f40e810746093e93beba8658954fec49 100644 (file)
@@ -2790,29 +2790,6 @@ cy_ioctl(struct tty_struct *tty, struct file *file,
                 * NB: both 1->0 and 0->1 transitions are counted except for
                 *     RI where only 0->1 is counted.
                 */
-       case TIOCGICOUNT: {
-               struct serial_icounter_struct sic = { };
-
-               spin_lock_irqsave(&info->card->card_lock, flags);
-               cnow = info->icount;
-               spin_unlock_irqrestore(&info->card->card_lock, flags);
-
-               sic.cts = cnow.cts;
-               sic.dsr = cnow.dsr;
-               sic.rng = cnow.rng;
-               sic.dcd = cnow.dcd;
-               sic.rx = cnow.rx;
-               sic.tx = cnow.tx;
-               sic.frame = cnow.frame;
-               sic.overrun = cnow.overrun;
-               sic.parity = cnow.parity;
-               sic.brk = cnow.brk;
-               sic.buf_overrun = cnow.buf_overrun;
-
-               if (copy_to_user(argp, &sic, sizeof(sic)))
-                       ret_val = -EFAULT;
-               break;
-       }
        default:
                ret_val = -ENOIOCTLCMD;
        }
@@ -2823,6 +2800,31 @@ cy_ioctl(struct tty_struct *tty, struct file *file,
        return ret_val;
 }                              /* cy_ioctl */
 
+static int cy_get_icount(struct tty_struct *tty,
+                               struct serial_icounter_struct *sic)
+{
+       struct cyclades_port *info = tty->driver_data;
+       struct cyclades_icount cnow;    /* Used to snapshot */
+       unsigned long flags;
+
+       spin_lock_irqsave(&info->card->card_lock, flags);
+       cnow = info->icount;
+       spin_unlock_irqrestore(&info->card->card_lock, flags);
+
+       sic->cts = cnow.cts;
+       sic->dsr = cnow.dsr;
+       sic->rng = cnow.rng;
+       sic->dcd = cnow.dcd;
+       sic->rx = cnow.rx;
+       sic->tx = cnow.tx;
+       sic->frame = cnow.frame;
+       sic->overrun = cnow.overrun;
+       sic->parity = cnow.parity;
+       sic->brk = cnow.brk;
+       sic->buf_overrun = cnow.buf_overrun;
+       return 0;
+}
+
 /*
  * This routine allows the tty driver to be notified when
  * device's termios settings have changed.  Note that a
@@ -4084,6 +4086,7 @@ static const struct tty_operations cy_ops = {
        .wait_until_sent = cy_wait_until_sent,
        .tiocmget = cy_tiocmget,
        .tiocmset = cy_tiocmset,
+       .get_icount = cy_get_icount,
        .proc_fops = &cyclades_proc_fops,
 };