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

n_hdlc: remove cached tty

It's not needed, as now it's clear, that it's always the same as the one
passed from the tty layer.
Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
Link: https://lore.kernel.org/r/20200219084118.26491-13-jslaby@suse.czSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 43e784ec
...@@ -124,7 +124,6 @@ struct n_hdlc_buf_list { ...@@ -124,7 +124,6 @@ struct n_hdlc_buf_list {
/** /**
* struct n_hdlc - per device instance data structure * struct n_hdlc - per device instance data structure
* @magic - magic value for structure * @magic - magic value for structure
* @tty - ptr to TTY structure
* @tbusy - reentrancy flag for tx wakeup code * @tbusy - reentrancy flag for tx wakeup code
* @woke_up - FIXME: describe this field * @woke_up - FIXME: describe this field
* @tx_buf_list - list of pending transmit frame buffers * @tx_buf_list - list of pending transmit frame buffers
...@@ -134,7 +133,6 @@ struct n_hdlc_buf_list { ...@@ -134,7 +133,6 @@ struct n_hdlc_buf_list {
*/ */
struct n_hdlc { struct n_hdlc {
int magic; int magic;
struct tty_struct *tty;
int tbusy; int tbusy;
int woke_up; int woke_up;
struct n_hdlc_buf_list tx_buf_list; struct n_hdlc_buf_list tx_buf_list;
...@@ -240,8 +238,6 @@ static void n_hdlc_tty_close(struct tty_struct *tty) ...@@ -240,8 +238,6 @@ static void n_hdlc_tty_close(struct tty_struct *tty)
clear_bit(TTY_NO_WRITE_SPLIT,&tty->flags); clear_bit(TTY_NO_WRITE_SPLIT,&tty->flags);
#endif #endif
tty->disc_data = NULL; tty->disc_data = NULL;
if (tty != n_hdlc->tty)
return;
/* Ensure that the n_hdlcd process is not hanging on select()/poll() */ /* Ensure that the n_hdlcd process is not hanging on select()/poll() */
wake_up_interruptible(&tty->read_wait); wake_up_interruptible(&tty->read_wait);
...@@ -280,7 +276,6 @@ static int n_hdlc_tty_open (struct tty_struct *tty) ...@@ -280,7 +276,6 @@ static int n_hdlc_tty_open (struct tty_struct *tty)
} }
tty->disc_data = n_hdlc; tty->disc_data = n_hdlc;
n_hdlc->tty = tty;
tty->receive_room = 65536; tty->receive_room = 65536;
#if defined(TTY_NO_WRITE_SPLIT) #if defined(TTY_NO_WRITE_SPLIT)
...@@ -391,11 +386,6 @@ static void n_hdlc_tty_wakeup(struct tty_struct *tty) ...@@ -391,11 +386,6 @@ static void n_hdlc_tty_wakeup(struct tty_struct *tty)
if (!n_hdlc) if (!n_hdlc)
return; return;
if (tty != n_hdlc->tty) {
clear_bit(TTY_DO_WRITE_WAKEUP, &tty->flags);
return;
}
n_hdlc_send_frames (n_hdlc, tty); n_hdlc_send_frames (n_hdlc, tty);
} /* end of n_hdlc_tty_wakeup() */ } /* end of n_hdlc_tty_wakeup() */
...@@ -420,7 +410,7 @@ static void n_hdlc_tty_receive(struct tty_struct *tty, const __u8 *data, ...@@ -420,7 +410,7 @@ static void n_hdlc_tty_receive(struct tty_struct *tty, const __u8 *data,
__FILE__, __LINE__, __func__, count); __FILE__, __LINE__, __func__, count);
/* This can happen if stuff comes in on the backup tty */ /* This can happen if stuff comes in on the backup tty */
if (!n_hdlc || tty != n_hdlc->tty) if (!n_hdlc)
return; return;
/* verify line is using HDLC discipline */ /* verify line is using HDLC discipline */
...@@ -461,8 +451,8 @@ static void n_hdlc_tty_receive(struct tty_struct *tty, const __u8 *data, ...@@ -461,8 +451,8 @@ static void n_hdlc_tty_receive(struct tty_struct *tty, const __u8 *data,
/* wake up any blocked reads and perform async signalling */ /* wake up any blocked reads and perform async signalling */
wake_up_interruptible (&tty->read_wait); wake_up_interruptible (&tty->read_wait);
if (n_hdlc->tty->fasync != NULL) if (tty->fasync != NULL)
kill_fasync (&n_hdlc->tty->fasync, SIGIO, POLL_IN); kill_fasync(&tty->fasync, SIGIO, POLL_IN);
} /* end of n_hdlc_tty_receive() */ } /* end of n_hdlc_tty_receive() */
...@@ -598,8 +588,7 @@ static ssize_t n_hdlc_tty_write(struct tty_struct *tty, struct file *file, ...@@ -598,8 +588,7 @@ static ssize_t n_hdlc_tty_write(struct tty_struct *tty, struct file *file,
schedule(); schedule();
n_hdlc = tty->disc_data; n_hdlc = tty->disc_data;
if (!n_hdlc || n_hdlc->magic != HDLC_MAGIC || if (!n_hdlc || n_hdlc->magic != HDLC_MAGIC) {
tty != n_hdlc->tty) {
printk("n_hdlc_tty_write: %p invalid after wait!\n", n_hdlc); printk("n_hdlc_tty_write: %p invalid after wait!\n", n_hdlc);
error = -EIO; error = -EIO;
break; break;
...@@ -712,7 +701,7 @@ static __poll_t n_hdlc_tty_poll(struct tty_struct *tty, struct file *filp, ...@@ -712,7 +701,7 @@ static __poll_t n_hdlc_tty_poll(struct tty_struct *tty, struct file *filp,
struct n_hdlc *n_hdlc = tty->disc_data; struct n_hdlc *n_hdlc = tty->disc_data;
__poll_t mask = 0; __poll_t mask = 0;
if (!n_hdlc || n_hdlc->magic != HDLC_MAGIC || tty != n_hdlc->tty) if (!n_hdlc || n_hdlc->magic != HDLC_MAGIC)
return 0; return 0;
/* /*
......
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