diff options
author | Jiri Slaby <jslaby@suse.cz> | 2012-03-05 08:52:36 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-03-08 15:48:27 -0500 |
commit | 3a5c24232463b4978acf8d8668becbf515d30a36 (patch) | |
tree | 8f10b80f70b1ab34b8ed114a64314fbd21fe3b6c /arch/ia64/hp | |
parent | 78e74d778a9b3ed80bb73b65ab16f842f48aa287 (diff) |
TTY: simserial, properly refcount tty_port->tty
So that we will not be surprised in the ISR anymore.
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Tony Luck <tony.luck@intel.com>
Cc: Fenghua Yu <fenghua.yu@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'arch/ia64/hp')
-rw-r--r-- | arch/ia64/hp/sim/simserial.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/arch/ia64/hp/sim/simserial.c b/arch/ia64/hp/sim/simserial.c index 2cd6d23dfdee..b3ec91c9fc71 100644 --- a/arch/ia64/hp/sim/simserial.c +++ b/arch/ia64/hp/sim/simserial.c | |||
@@ -107,7 +107,7 @@ static void receive_chars(struct tty_struct *tty) | |||
107 | static irqreturn_t rs_interrupt_single(int irq, void *dev_id) | 107 | static irqreturn_t rs_interrupt_single(int irq, void *dev_id) |
108 | { | 108 | { |
109 | struct serial_state *info = dev_id; | 109 | struct serial_state *info = dev_id; |
110 | struct tty_struct *tty = info->port.tty; | 110 | struct tty_struct *tty = tty_port_tty_get(&info->port); |
111 | 111 | ||
112 | if (!tty) { | 112 | if (!tty) { |
113 | printk(KERN_INFO "simrs_interrupt_single: info|tty=0 info=%p problem\n", info); | 113 | 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 | * on inbound traffic | 118 | * on inbound traffic |
119 | */ | 119 | */ |
120 | receive_chars(tty); | 120 | receive_chars(tty); |
121 | tty_kref_put(tty); | ||
121 | return IRQ_HANDLED; | 122 | return IRQ_HANDLED; |
122 | } | 123 | } |
123 | 124 | ||
@@ -443,9 +444,9 @@ static void rs_close(struct tty_struct *tty, struct file * filp) | |||
443 | */ | 444 | */ |
444 | shutdown(tty, info); | 445 | shutdown(tty, info); |
445 | rs_flush_buffer(tty); | 446 | rs_flush_buffer(tty); |
446 | port->tty = NULL; | ||
447 | 447 | ||
448 | tty_port_close_end(port, tty); | 448 | tty_port_close_end(port, tty); |
449 | tty_port_tty_set(port, NULL); | ||
449 | } | 450 | } |
450 | 451 | ||
451 | /* | 452 | /* |
@@ -467,7 +468,7 @@ static void rs_hangup(struct tty_struct *tty) | |||
467 | 468 | ||
468 | port->count = 0; | 469 | port->count = 0; |
469 | port->flags &= ~ASYNC_NORMAL_ACTIVE; | 470 | port->flags &= ~ASYNC_NORMAL_ACTIVE; |
470 | port->tty = NULL; | 471 | tty_port_tty_set(port, NULL); |
471 | wake_up_interruptible(&port->open_wait); | 472 | wake_up_interruptible(&port->open_wait); |
472 | } | 473 | } |
473 | 474 | ||
@@ -556,7 +557,7 @@ static int rs_open(struct tty_struct *tty, struct file * filp) | |||
556 | int retval; | 557 | int retval; |
557 | 558 | ||
558 | port->count++; | 559 | port->count++; |
559 | port->tty = tty; | 560 | tty_port_tty_set(port, tty); |
560 | tty->driver_data = info; | 561 | tty->driver_data = info; |
561 | tty->port = port; | 562 | tty->port = port; |
562 | 563 | ||