summaryrefslogtreecommitdiffstats
path: root/drivers/net/usb
diff options
context:
space:
mode:
authorAlan Cox <alan@linux.intel.com>2010-09-16 18:21:40 +0100
committerGreg Kroah-Hartman <gregkh@suse.de>2010-10-22 10:20:04 -0700
commit0bca1b913affbd7e2fdaffee62a499659a466eb5 (patch)
treea7e1c20146790345c0cdcadb31b4ff908d1632c2 /drivers/net/usb
parentd281da7ff6f70efca0553c288bb883e8605b3862 (diff)
downloadop-kernel-dev-0bca1b913affbd7e2fdaffee62a499659a466eb5.zip
op-kernel-dev-0bca1b913affbd7e2fdaffee62a499659a466eb5.tar.gz
tty: Convert the USB drivers to the new icount interface
Simple pasting job using the new ops function. Also fix a couple of devices directly returning the internal struct (which happens at this point to match for the fields that matter but isn't correct or futureproof) Signed-off-by: Alan Cox <alan@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/net/usb')
-rw-r--r--drivers/net/usb/hso.c35
1 files changed, 16 insertions, 19 deletions
diff --git a/drivers/net/usb/hso.c b/drivers/net/usb/hso.c
index 1cd752f..b8e9572 100644
--- a/drivers/net/usb/hso.c
+++ b/drivers/net/usb/hso.c
@@ -1645,11 +1645,11 @@ hso_wait_modem_status(struct hso_serial *serial, unsigned long arg)
* NB: both 1->0 and 0->1 transitions are counted except for
* RI where only 0->1 is counted.
*/
-static int hso_get_count(struct hso_serial *serial,
- struct serial_icounter_struct __user *icnt)
+static int hso_get_count(struct tty_struct *tty,
+ struct serial_icounter_struct *icount)
{
- struct serial_icounter_struct icount;
struct uart_icount cnow;
+ struct hso_serial *serial = get_serial_by_tty(tty);
struct hso_tiocmget *tiocmget = serial->tiocmget;
memset(&icount, 0, sizeof(struct serial_icounter_struct));
@@ -1660,19 +1660,19 @@ static int hso_get_count(struct hso_serial *serial,
memcpy(&cnow, &tiocmget->icount, sizeof(struct uart_icount));
spin_unlock_irq(&serial->serial_lock);
- 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;
+ 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(icnt, &icount, sizeof(icount)) ? -EFAULT : 0;
+ return 0;
}
@@ -1764,10 +1764,6 @@ static int hso_serial_ioctl(struct tty_struct *tty, struct file *file,
case TIOCMIWAIT:
ret = hso_wait_modem_status(serial, arg);
break;
-
- case TIOCGICOUNT:
- ret = hso_get_count(serial, uarg);
- break;
default:
ret = -ENOIOCTLCMD;
break;
@@ -3300,6 +3296,7 @@ static const struct tty_operations hso_serial_ops = {
.chars_in_buffer = hso_serial_chars_in_buffer,
.tiocmget = hso_serial_tiocmget,
.tiocmset = hso_serial_tiocmset,
+ .get_icount = hso_get_count,
.unthrottle = hso_unthrottle
};
OpenPOWER on IntegriCloud