mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-12 21:57:43 +00:00
USB: cdc-acm: use get_icount tty operation
Use the tty get_icount operation instead of implementing TIOCGICOUNT directly. Signed-off-by: Johan Hovold <johan@kernel.org> Acked-by: Oliver Neukum <oneukum@suse.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
04cbf3832b
commit
bb2d387c4d
1 changed files with 12 additions and 19 deletions
|
@ -968,25 +968,20 @@ static int wait_serial_change(struct acm *acm, unsigned long arg)
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int get_serial_usage(struct acm *acm,
|
static int acm_tty_get_icount(struct tty_struct *tty,
|
||||||
struct serial_icounter_struct __user *count)
|
struct serial_icounter_struct *icount)
|
||||||
{
|
{
|
||||||
struct serial_icounter_struct icount;
|
struct acm *acm = tty->driver_data;
|
||||||
int rv = 0;
|
|
||||||
|
|
||||||
memset(&icount, 0, sizeof(icount));
|
icount->dsr = acm->iocount.dsr;
|
||||||
icount.dsr = acm->iocount.dsr;
|
icount->rng = acm->iocount.rng;
|
||||||
icount.rng = acm->iocount.rng;
|
icount->dcd = acm->iocount.dcd;
|
||||||
icount.dcd = acm->iocount.dcd;
|
icount->frame = acm->iocount.frame;
|
||||||
icount.frame = acm->iocount.frame;
|
icount->overrun = acm->iocount.overrun;
|
||||||
icount.overrun = acm->iocount.overrun;
|
icount->parity = acm->iocount.parity;
|
||||||
icount.parity = acm->iocount.parity;
|
icount->brk = acm->iocount.brk;
|
||||||
icount.brk = acm->iocount.brk;
|
|
||||||
|
|
||||||
if (copy_to_user(count, &icount, sizeof(icount)) > 0)
|
return 0;
|
||||||
rv = -EFAULT;
|
|
||||||
|
|
||||||
return rv;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int acm_tty_ioctl(struct tty_struct *tty,
|
static int acm_tty_ioctl(struct tty_struct *tty,
|
||||||
|
@ -1011,9 +1006,6 @@ static int acm_tty_ioctl(struct tty_struct *tty,
|
||||||
rv = wait_serial_change(acm, arg);
|
rv = wait_serial_change(acm, arg);
|
||||||
usb_autopm_put_interface(acm->control);
|
usb_autopm_put_interface(acm->control);
|
||||||
break;
|
break;
|
||||||
case TIOCGICOUNT:
|
|
||||||
rv = get_serial_usage(acm, (struct serial_icounter_struct __user *) arg);
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return rv;
|
return rv;
|
||||||
|
@ -1924,6 +1916,7 @@ static const struct tty_operations acm_ops = {
|
||||||
.set_termios = acm_tty_set_termios,
|
.set_termios = acm_tty_set_termios,
|
||||||
.tiocmget = acm_tty_tiocmget,
|
.tiocmget = acm_tty_tiocmget,
|
||||||
.tiocmset = acm_tty_tiocmset,
|
.tiocmset = acm_tty_tiocmset,
|
||||||
|
.get_icount = acm_tty_get_icount,
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in a new issue