From 0587102cf9f427c185bfdeb2cef41e13ee0264b1 Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Thu, 16 Sep 2010 18:21:52 +0100 Subject: tty: icount changeover for other main devices Again basically cut and paste Convert the main driver set to use the hooks for GICOUNT Signed-off-by: Alan Cox Signed-off-by: Greg Kroah-Hartman --- drivers/char/nozomi.c | 37 ++++++++++++++++++------------------- 1 file changed, 18 insertions(+), 19 deletions(-) (limited to 'drivers/char/nozomi.c') diff --git a/drivers/char/nozomi.c b/drivers/char/nozomi.c index 817169c..dd3f9b1 100644 --- a/drivers/char/nozomi.c +++ b/drivers/char/nozomi.c @@ -1804,24 +1804,24 @@ static int ntty_cflags_changed(struct port *port, unsigned long flags, return ret; } -static int ntty_ioctl_tiocgicount(struct port *port, void __user *argp) +static int ntty_tiocgicount(struct tty_struct *tty, + struct serial_icounter_struct *icount) { + struct port *port = tty->driver_data; const struct async_icount cnow = port->tty_icount; - struct serial_icounter_struct icount; - - 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 copy_to_user(argp, &icount, sizeof(icount)) ? -EFAULT : 0; + + 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 ntty_ioctl(struct tty_struct *tty, struct file *file, @@ -1840,9 +1840,7 @@ static int ntty_ioctl(struct tty_struct *tty, struct file *file, rval = wait_event_interruptible(port->tty_wait, ntty_cflags_changed(port, arg, &cprev)); break; - } case TIOCGICOUNT: - rval = ntty_ioctl_tiocgicount(port, argp); - break; + } default: DBG1("ERR: 0x%08X, %d", cmd, cmd); break; @@ -1922,6 +1920,7 @@ static const struct tty_operations tty_ops = { .chars_in_buffer = ntty_chars_in_buffer, .tiocmget = ntty_tiocmget, .tiocmset = ntty_tiocmset, + .get_icount = ntty_tiocgicount, .install = ntty_install, .cleanup = ntty_cleanup, }; -- cgit v1.1