Commit 30409420 authored by Jiri Slaby's avatar Jiri Slaby Committed by Greg Kroah-Hartman

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: default avatarJiri Slaby <jslaby@suse.cz>
Cc: Jan Dumon <j.dumon@option.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 5ce76e77
...@@ -106,13 +106,6 @@ ...@@ -106,13 +106,6 @@
#define MAX_RX_URBS 2 #define MAX_RX_URBS 2
static inline struct hso_serial *get_serial_by_tty(struct tty_struct *tty)
{
if (tty)
return tty->driver_data;
return NULL;
}
/*****************************************************************************/ /*****************************************************************************/
/* Debugging functions */ /* Debugging functions */
/*****************************************************************************/ /*****************************************************************************/
...@@ -1114,7 +1107,7 @@ static void hso_init_termios(struct ktermios *termios) ...@@ -1114,7 +1107,7 @@ static void hso_init_termios(struct ktermios *termios)
static void _hso_serial_set_termios(struct tty_struct *tty, static void _hso_serial_set_termios(struct tty_struct *tty,
struct ktermios *old) struct ktermios *old)
{ {
struct hso_serial *serial = get_serial_by_tty(tty); struct hso_serial *serial = tty->driver_data;
struct ktermios *termios; struct ktermios *termios;
if (!serial) { if (!serial) {
...@@ -1268,7 +1261,7 @@ static void hso_unthrottle_tasklet(struct hso_serial *serial) ...@@ -1268,7 +1261,7 @@ static void hso_unthrottle_tasklet(struct hso_serial *serial)
static void hso_unthrottle(struct tty_struct *tty) static void hso_unthrottle(struct tty_struct *tty)
{ {
struct hso_serial *serial = get_serial_by_tty(tty); struct hso_serial *serial = tty->driver_data;
tasklet_hi_schedule(&serial->unthrottle_tasklet); tasklet_hi_schedule(&serial->unthrottle_tasklet);
} }
...@@ -1390,7 +1383,7 @@ static void hso_serial_close(struct tty_struct *tty, struct file *filp) ...@@ -1390,7 +1383,7 @@ static void hso_serial_close(struct tty_struct *tty, struct file *filp)
static int hso_serial_write(struct tty_struct *tty, const unsigned char *buf, static int hso_serial_write(struct tty_struct *tty, const unsigned char *buf,
int count) int count)
{ {
struct hso_serial *serial = get_serial_by_tty(tty); struct hso_serial *serial = tty->driver_data;
int space, tx_bytes; int space, tx_bytes;
unsigned long flags; unsigned long flags;
...@@ -1422,7 +1415,7 @@ static int hso_serial_write(struct tty_struct *tty, const unsigned char *buf, ...@@ -1422,7 +1415,7 @@ static int hso_serial_write(struct tty_struct *tty, const unsigned char *buf,
/* how much room is there for writing */ /* how much room is there for writing */
static int hso_serial_write_room(struct tty_struct *tty) static int hso_serial_write_room(struct tty_struct *tty)
{ {
struct hso_serial *serial = get_serial_by_tty(tty); struct hso_serial *serial = tty->driver_data;
int room; int room;
unsigned long flags; unsigned long flags;
...@@ -1437,7 +1430,7 @@ static int hso_serial_write_room(struct tty_struct *tty) ...@@ -1437,7 +1430,7 @@ static int hso_serial_write_room(struct tty_struct *tty)
/* setup the term */ /* setup the term */
static void hso_serial_set_termios(struct tty_struct *tty, struct ktermios *old) static void hso_serial_set_termios(struct tty_struct *tty, struct ktermios *old)
{ {
struct hso_serial *serial = get_serial_by_tty(tty); struct hso_serial *serial = tty->driver_data;
unsigned long flags; unsigned long flags;
if (old) if (old)
...@@ -1458,7 +1451,7 @@ static void hso_serial_set_termios(struct tty_struct *tty, struct ktermios *old) ...@@ -1458,7 +1451,7 @@ static void hso_serial_set_termios(struct tty_struct *tty, struct ktermios *old)
/* how many characters in the buffer */ /* how many characters in the buffer */
static int hso_serial_chars_in_buffer(struct tty_struct *tty) static int hso_serial_chars_in_buffer(struct tty_struct *tty)
{ {
struct hso_serial *serial = get_serial_by_tty(tty); struct hso_serial *serial = tty->driver_data;
int chars; int chars;
unsigned long flags; unsigned long flags;
...@@ -1629,7 +1622,7 @@ static int hso_get_count(struct tty_struct *tty, ...@@ -1629,7 +1622,7 @@ static int hso_get_count(struct tty_struct *tty,
struct serial_icounter_struct *icount) struct serial_icounter_struct *icount)
{ {
struct uart_icount cnow; struct uart_icount cnow;
struct hso_serial *serial = get_serial_by_tty(tty); struct hso_serial *serial = tty->driver_data;
struct hso_tiocmget *tiocmget = serial->tiocmget; struct hso_tiocmget *tiocmget = serial->tiocmget;
memset(icount, 0, sizeof(struct serial_icounter_struct)); memset(icount, 0, sizeof(struct serial_icounter_struct));
...@@ -1659,7 +1652,7 @@ static int hso_get_count(struct tty_struct *tty, ...@@ -1659,7 +1652,7 @@ static int hso_get_count(struct tty_struct *tty,
static int hso_serial_tiocmget(struct tty_struct *tty) static int hso_serial_tiocmget(struct tty_struct *tty)
{ {
int retval; int retval;
struct hso_serial *serial = get_serial_by_tty(tty); struct hso_serial *serial = tty->driver_data;
struct hso_tiocmget *tiocmget; struct hso_tiocmget *tiocmget;
u16 UART_state_bitmap; u16 UART_state_bitmap;
...@@ -1693,7 +1686,7 @@ static int hso_serial_tiocmset(struct tty_struct *tty, ...@@ -1693,7 +1686,7 @@ static int hso_serial_tiocmset(struct tty_struct *tty,
int val = 0; int val = 0;
unsigned long flags; unsigned long flags;
int if_num; int if_num;
struct hso_serial *serial = get_serial_by_tty(tty); struct hso_serial *serial = tty->driver_data;
/* sanity check */ /* sanity check */
if (!serial) { if (!serial) {
...@@ -1733,7 +1726,7 @@ static int hso_serial_tiocmset(struct tty_struct *tty, ...@@ -1733,7 +1726,7 @@ static int hso_serial_tiocmset(struct tty_struct *tty,
static int hso_serial_ioctl(struct tty_struct *tty, static int hso_serial_ioctl(struct tty_struct *tty,
unsigned int cmd, unsigned long arg) unsigned int cmd, unsigned long arg)
{ {
struct hso_serial *serial = get_serial_by_tty(tty); struct hso_serial *serial = tty->driver_data;
int ret = 0; int ret = 0;
D4("IOCTL cmd: %d, arg: %ld", cmd, arg); D4("IOCTL cmd: %d, arg: %ld", cmd, arg);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment