diff options
| author | Jiri Slaby <jslaby@suse.cz> | 2012-04-02 07:54:06 -0400 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-04-09 14:18:36 -0400 |
| commit | 30409420d2e181215745fdc7052446b439e0221f (patch) | |
| tree | 76054f8c17d06434162e9a3614f31a8791cbd846 /drivers/net/usb | |
| parent | 5ce76e77e0fde4a46bd230d0678099bd648b50d4 (diff) | |
TTY: hso, remove tty NULL checks fro tty->ops
tty is never NULL in tty->ops->* while the device is open. (And they
are not called otherwise.) So remove pointless checks and use
tty->driver_data directly.
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Jan Dumon <j.dumon@option.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/net/usb')
| -rw-r--r-- | drivers/net/usb/hso.c | 27 |
1 files changed, 10 insertions, 17 deletions
diff --git a/drivers/net/usb/hso.c b/drivers/net/usb/hso.c index 0b26d7532ba..ec782c7eabd 100644 --- a/drivers/net/usb/hso.c +++ b/drivers/net/usb/hso.c | |||
| @@ -106,13 +106,6 @@ | |||
| 106 | 106 | ||
| 107 | #define MAX_RX_URBS 2 | 107 | #define MAX_RX_URBS 2 |
| 108 | 108 | ||
| 109 | static inline struct hso_serial *get_serial_by_tty(struct tty_struct *tty) | ||
| 110 | { | ||
| 111 | if (tty) | ||
| 112 | return tty->driver_data; | ||
| 113 | return NULL; | ||
| 114 | } | ||
| 115 | |||
| 116 | /*****************************************************************************/ | 109 | /*****************************************************************************/ |
| 117 | /* Debugging functions */ | 110 | /* Debugging functions */ |
| 118 | /*****************************************************************************/ | 111 | /*****************************************************************************/ |
| @@ -1114,7 +1107,7 @@ static void hso_init_termios(struct ktermios *termios) | |||
| 1114 | static void _hso_serial_set_termios(struct tty_struct *tty, | 1107 | static void _hso_serial_set_termios(struct tty_struct *tty, |
| 1115 | struct ktermios *old) | 1108 | struct ktermios *old) |
| 1116 | { | 1109 | { |
| 1117 | struct hso_serial *serial = get_serial_by_tty(tty); | 1110 | struct hso_serial *serial = tty->driver_data; |
| 1118 | struct ktermios *termios; | 1111 | struct ktermios *termios; |
| 1119 | 1112 | ||
| 1120 | if (!serial) { | 1113 | if (!serial) { |
| @@ -1268,7 +1261,7 @@ static void hso_unthrottle_tasklet(struct hso_serial *serial) | |||
| 1268 | 1261 | ||
| 1269 | static void hso_unthrottle(struct tty_struct *tty) | 1262 | static void hso_unthrottle(struct tty_struct *tty) |
| 1270 | { | 1263 | { |
| 1271 | struct hso_serial *serial = get_serial_by_tty(tty); | 1264 | struct hso_serial *serial = tty->driver_data; |
| 1272 | 1265 | ||
| 1273 | tasklet_hi_schedule(&serial->unthrottle_tasklet); | 1266 | tasklet_hi_schedule(&serial->unthrottle_tasklet); |
| 1274 | } | 1267 | } |
| @@ -1390,7 +1383,7 @@ static void hso_serial_close(struct tty_struct *tty, struct file *filp) | |||
| 1390 | static int hso_serial_write(struct tty_struct *tty, const unsigned char *buf, | 1383 | static int hso_serial_write(struct tty_struct *tty, const unsigned char *buf, |
| 1391 | int count) | 1384 | int count) |
| 1392 | { | 1385 | { |
| 1393 | struct hso_serial *serial = get_serial_by_tty(tty); | 1386 | struct hso_serial *serial = tty->driver_data; |
| 1394 | int space, tx_bytes; | 1387 | int space, tx_bytes; |
| 1395 | unsigned long flags; | 1388 | unsigned long flags; |
| 1396 | 1389 | ||
| @@ -1422,7 +1415,7 @@ out: | |||
| 1422 | /* how much room is there for writing */ | 1415 | /* how much room is there for writing */ |
| 1423 | static int hso_serial_write_room(struct tty_struct *tty) | 1416 | static int hso_serial_write_room(struct tty_struct *tty) |
| 1424 | { | 1417 | { |
| 1425 | struct hso_serial *serial = get_serial_by_tty(tty); | 1418 | struct hso_serial *serial = tty->driver_data; |
| 1426 | int room; | 1419 | int room; |
| 1427 | unsigned long flags; | 1420 | unsigned long flags; |
| 1428 | 1421 | ||
| @@ -1437,7 +1430,7 @@ static int hso_serial_write_room(struct tty_struct *tty) | |||
| 1437 | /* setup the term */ | 1430 | /* setup the term */ |
| 1438 | static void hso_serial_set_termios(struct tty_struct *tty, struct ktermios *old) | 1431 | static void hso_serial_set_termios(struct tty_struct *tty, struct ktermios *old) |
| 1439 | { | 1432 | { |
| 1440 | struct hso_serial *serial = get_serial_by_tty(tty); | 1433 | struct hso_serial *serial = tty->driver_data; |
| 1441 | unsigned long flags; | 1434 | unsigned long flags; |
| 1442 | 1435 | ||
| 1443 | if (old) | 1436 | if (old) |
| @@ -1458,7 +1451,7 @@ static void hso_serial_set_termios(struct tty_struct *tty, struct ktermios *old) | |||
| 1458 | /* how many characters in the buffer */ | 1451 | /* how many characters in the buffer */ |
| 1459 | static int hso_serial_chars_in_buffer(struct tty_struct *tty) | 1452 | static int hso_serial_chars_in_buffer(struct tty_struct *tty) |
| 1460 | { | 1453 | { |
| 1461 | struct hso_serial *serial = get_serial_by_tty(tty); | 1454 | struct hso_serial *serial = tty->driver_data; |
| 1462 | int chars; | 1455 | int chars; |
| 1463 | unsigned long flags; | 1456 | unsigned long flags; |
| 1464 | 1457 | ||
| @@ -1629,7 +1622,7 @@ static int hso_get_count(struct tty_struct *tty, | |||
| 1629 | struct serial_icounter_struct *icount) | 1622 | struct serial_icounter_struct *icount) |
| 1630 | { | 1623 | { |
| 1631 | struct uart_icount cnow; | 1624 | struct uart_icount cnow; |
| 1632 | struct hso_serial *serial = get_serial_by_tty(tty); | 1625 | struct hso_serial *serial = tty->driver_data; |
| 1633 | struct hso_tiocmget *tiocmget = serial->tiocmget; | 1626 | struct hso_tiocmget *tiocmget = serial->tiocmget; |
| 1634 | 1627 | ||
| 1635 | memset(icount, 0, sizeof(struct serial_icounter_struct)); | 1628 | memset(icount, 0, sizeof(struct serial_icounter_struct)); |
| @@ -1659,7 +1652,7 @@ static int hso_get_count(struct tty_struct *tty, | |||
| 1659 | static int hso_serial_tiocmget(struct tty_struct *tty) | 1652 | static int hso_serial_tiocmget(struct tty_struct *tty) |
| 1660 | { | 1653 | { |
| 1661 | int retval; | 1654 | int retval; |
| 1662 | struct hso_serial *serial = get_serial_by_tty(tty); | 1655 | struct hso_serial *serial = tty->driver_data; |
| 1663 | struct hso_tiocmget *tiocmget; | 1656 | struct hso_tiocmget *tiocmget; |
| 1664 | u16 UART_state_bitmap; | 1657 | u16 UART_state_bitmap; |
| 1665 | 1658 | ||
| @@ -1693,7 +1686,7 @@ static int hso_serial_tiocmset(struct tty_struct *tty, | |||
| 1693 | int val = 0; | 1686 | int val = 0; |
| 1694 | unsigned long flags; | 1687 | unsigned long flags; |
| 1695 | int if_num; | 1688 | int if_num; |
| 1696 | struct hso_serial *serial = get_serial_by_tty(tty); | 1689 | struct hso_serial *serial = tty->driver_data; |
| 1697 | 1690 | ||
| 1698 | /* sanity check */ | 1691 | /* sanity check */ |
| 1699 | if (!serial) { | 1692 | if (!serial) { |
| @@ -1733,7 +1726,7 @@ static int hso_serial_tiocmset(struct tty_struct *tty, | |||
| 1733 | static int hso_serial_ioctl(struct tty_struct *tty, | 1726 | static int hso_serial_ioctl(struct tty_struct *tty, |
| 1734 | unsigned int cmd, unsigned long arg) | 1727 | unsigned int cmd, unsigned long arg) |
| 1735 | { | 1728 | { |
| 1736 | struct hso_serial *serial = get_serial_by_tty(tty); | 1729 | struct hso_serial *serial = tty->driver_data; |
| 1737 | int ret = 0; | 1730 | int ret = 0; |
| 1738 | D4("IOCTL cmd: %d, arg: %ld", cmd, arg); | 1731 | D4("IOCTL cmd: %d, arg: %ld", cmd, arg); |
| 1739 | 1732 | ||
