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

TTY: simserial, properly refcount tty_port->tty

So that we will not be surprised in the ISR anymore.
Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
Cc: Tony Luck <tony.luck@intel.com>
Cc: Fenghua Yu <fenghua.yu@intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 78e74d77
...@@ -107,7 +107,7 @@ static void receive_chars(struct tty_struct *tty) ...@@ -107,7 +107,7 @@ static void receive_chars(struct tty_struct *tty)
static irqreturn_t rs_interrupt_single(int irq, void *dev_id) static irqreturn_t rs_interrupt_single(int irq, void *dev_id)
{ {
struct serial_state *info = dev_id; struct serial_state *info = dev_id;
struct tty_struct *tty = info->port.tty; struct tty_struct *tty = tty_port_tty_get(&info->port);
if (!tty) { if (!tty) {
printk(KERN_INFO "simrs_interrupt_single: info|tty=0 info=%p problem\n", info); printk(KERN_INFO "simrs_interrupt_single: info|tty=0 info=%p problem\n", info);
...@@ -118,6 +118,7 @@ static irqreturn_t rs_interrupt_single(int irq, void *dev_id) ...@@ -118,6 +118,7 @@ static irqreturn_t rs_interrupt_single(int irq, void *dev_id)
* on inbound traffic * on inbound traffic
*/ */
receive_chars(tty); receive_chars(tty);
tty_kref_put(tty);
return IRQ_HANDLED; return IRQ_HANDLED;
} }
...@@ -443,9 +444,9 @@ static void rs_close(struct tty_struct *tty, struct file * filp) ...@@ -443,9 +444,9 @@ static void rs_close(struct tty_struct *tty, struct file * filp)
*/ */
shutdown(tty, info); shutdown(tty, info);
rs_flush_buffer(tty); rs_flush_buffer(tty);
port->tty = NULL;
tty_port_close_end(port, tty); tty_port_close_end(port, tty);
tty_port_tty_set(port, NULL);
} }
/* /*
...@@ -467,7 +468,7 @@ static void rs_hangup(struct tty_struct *tty) ...@@ -467,7 +468,7 @@ static void rs_hangup(struct tty_struct *tty)
port->count = 0; port->count = 0;
port->flags &= ~ASYNC_NORMAL_ACTIVE; port->flags &= ~ASYNC_NORMAL_ACTIVE;
port->tty = NULL; tty_port_tty_set(port, NULL);
wake_up_interruptible(&port->open_wait); wake_up_interruptible(&port->open_wait);
} }
...@@ -556,7 +557,7 @@ static int rs_open(struct tty_struct *tty, struct file * filp) ...@@ -556,7 +557,7 @@ static int rs_open(struct tty_struct *tty, struct file * filp)
int retval; int retval;
port->count++; port->count++;
port->tty = tty; tty_port_tty_set(port, tty);
tty->driver_data = info; tty->driver_data = info;
tty->port = port; tty->port = port;
......
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