hso.c (fa251f89903d73989e2f63e13d0eaed1e07ce0da) | hso.c (0bca1b913affbd7e2fdaffee62a499659a466eb5) |
---|---|
1/****************************************************************************** 2 * 3 * Driver for Option High Speed Mobile Devices. 4 * 5 * Copyright (C) 2008 Option International 6 * Filip Aben <f.aben@option.com> 7 * Denis Joseph Barrow <d.barow@option.com> 8 * Jan Dumon <j.dumon@option.com> --- 1631 unchanged lines hidden (view full) --- 1640} 1641 1642/* 1643 * Get counter of input serial line interrupts (DCD,RI,DSR,CTS) 1644 * Return: write counters to the user passed counter struct 1645 * NB: both 1->0 and 0->1 transitions are counted except for 1646 * RI where only 0->1 is counted. 1647 */ | 1/****************************************************************************** 2 * 3 * Driver for Option High Speed Mobile Devices. 4 * 5 * Copyright (C) 2008 Option International 6 * Filip Aben <f.aben@option.com> 7 * Denis Joseph Barrow <d.barow@option.com> 8 * Jan Dumon <j.dumon@option.com> --- 1631 unchanged lines hidden (view full) --- 1640} 1641 1642/* 1643 * Get counter of input serial line interrupts (DCD,RI,DSR,CTS) 1644 * Return: write counters to the user passed counter struct 1645 * NB: both 1->0 and 0->1 transitions are counted except for 1646 * RI where only 0->1 is counted. 1647 */ |
1648static int hso_get_count(struct hso_serial *serial, 1649 struct serial_icounter_struct __user *icnt) | 1648static int hso_get_count(struct tty_struct *tty, 1649 struct serial_icounter_struct *icount) |
1650{ | 1650{ |
1651 struct serial_icounter_struct icount; | |
1652 struct uart_icount cnow; | 1651 struct uart_icount cnow; |
1652 struct hso_serial *serial = get_serial_by_tty(tty); |
|
1653 struct hso_tiocmget *tiocmget = serial->tiocmget; 1654 1655 memset(&icount, 0, sizeof(struct serial_icounter_struct)); 1656 1657 if (!tiocmget) 1658 return -ENOENT; 1659 spin_lock_irq(&serial->serial_lock); 1660 memcpy(&cnow, &tiocmget->icount, sizeof(struct uart_icount)); 1661 spin_unlock_irq(&serial->serial_lock); 1662 | 1653 struct hso_tiocmget *tiocmget = serial->tiocmget; 1654 1655 memset(&icount, 0, sizeof(struct serial_icounter_struct)); 1656 1657 if (!tiocmget) 1658 return -ENOENT; 1659 spin_lock_irq(&serial->serial_lock); 1660 memcpy(&cnow, &tiocmget->icount, sizeof(struct uart_icount)); 1661 spin_unlock_irq(&serial->serial_lock); 1662 |
1663 icount.cts = cnow.cts; 1664 icount.dsr = cnow.dsr; 1665 icount.rng = cnow.rng; 1666 icount.dcd = cnow.dcd; 1667 icount.rx = cnow.rx; 1668 icount.tx = cnow.tx; 1669 icount.frame = cnow.frame; 1670 icount.overrun = cnow.overrun; 1671 icount.parity = cnow.parity; 1672 icount.brk = cnow.brk; 1673 icount.buf_overrun = cnow.buf_overrun; | 1663 icount->cts = cnow.cts; 1664 icount->dsr = cnow.dsr; 1665 icount->rng = cnow.rng; 1666 icount->dcd = cnow.dcd; 1667 icount->rx = cnow.rx; 1668 icount->tx = cnow.tx; 1669 icount->frame = cnow.frame; 1670 icount->overrun = cnow.overrun; 1671 icount->parity = cnow.parity; 1672 icount->brk = cnow.brk; 1673 icount->buf_overrun = cnow.buf_overrun; |
1674 | 1674 |
1675 return copy_to_user(icnt, &icount, sizeof(icount)) ? -EFAULT : 0; | 1675 return 0; |
1676} 1677 1678 1679static int hso_serial_tiocmget(struct tty_struct *tty, struct file *file) 1680{ 1681 int retval; 1682 struct hso_serial *serial = get_serial_by_tty(tty); 1683 struct hso_tiocmget *tiocmget; --- 75 unchanged lines hidden (view full) --- 1759 D4("IOCTL cmd: %d, arg: %ld", cmd, arg); 1760 1761 if (!serial) 1762 return -ENODEV; 1763 switch (cmd) { 1764 case TIOCMIWAIT: 1765 ret = hso_wait_modem_status(serial, arg); 1766 break; | 1676} 1677 1678 1679static int hso_serial_tiocmget(struct tty_struct *tty, struct file *file) 1680{ 1681 int retval; 1682 struct hso_serial *serial = get_serial_by_tty(tty); 1683 struct hso_tiocmget *tiocmget; --- 75 unchanged lines hidden (view full) --- 1759 D4("IOCTL cmd: %d, arg: %ld", cmd, arg); 1760 1761 if (!serial) 1762 return -ENODEV; 1763 switch (cmd) { 1764 case TIOCMIWAIT: 1765 ret = hso_wait_modem_status(serial, arg); 1766 break; |
1767 1768 case TIOCGICOUNT: 1769 ret = hso_get_count(serial, uarg); 1770 break; | |
1771 default: 1772 ret = -ENOIOCTLCMD; 1773 break; 1774 } 1775 return ret; 1776} 1777 1778 --- 1516 unchanged lines hidden (view full) --- 3295 .close = hso_serial_close, 3296 .write = hso_serial_write, 3297 .write_room = hso_serial_write_room, 3298 .ioctl = hso_serial_ioctl, 3299 .set_termios = hso_serial_set_termios, 3300 .chars_in_buffer = hso_serial_chars_in_buffer, 3301 .tiocmget = hso_serial_tiocmget, 3302 .tiocmset = hso_serial_tiocmset, | 1767 default: 1768 ret = -ENOIOCTLCMD; 1769 break; 1770 } 1771 return ret; 1772} 1773 1774 --- 1516 unchanged lines hidden (view full) --- 3291 .close = hso_serial_close, 3292 .write = hso_serial_write, 3293 .write_room = hso_serial_write_room, 3294 .ioctl = hso_serial_ioctl, 3295 .set_termios = hso_serial_set_termios, 3296 .chars_in_buffer = hso_serial_chars_in_buffer, 3297 .tiocmget = hso_serial_tiocmget, 3298 .tiocmset = hso_serial_tiocmset, |
3299 .get_icount = hso_get_count, |
|
3303 .unthrottle = hso_unthrottle 3304}; 3305 3306static struct usb_driver hso_driver = { 3307 .name = driver_name, 3308 .probe = hso_probe, 3309 .disconnect = hso_disconnect, 3310 .id_table = hso_ids, --- 93 unchanged lines hidden --- | 3300 .unthrottle = hso_unthrottle 3301}; 3302 3303static struct usb_driver hso_driver = { 3304 .name = driver_name, 3305 .probe = hso_probe, 3306 .disconnect = hso_disconnect, 3307 .id_table = hso_ids, --- 93 unchanged lines hidden --- |