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

TTY: 68328serial, use tty from tty_port

And refcount that properly.
Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: linux-m68k@lists.linux-m68k.org
Acked-by: default avatarGreg Ungerer <gerg@uclinux.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 467712c9
...@@ -114,7 +114,6 @@ struct m68k_serial { ...@@ -114,7 +114,6 @@ struct m68k_serial {
int port; int port;
int irq; int irq;
int type; /* UART type */ int type; /* UART type */
struct tty_struct *tty;
int custom_divisor; int custom_divisor;
int x_char; /* xon/xoff character */ int x_char; /* xon/xoff character */
int line; int line;
...@@ -356,7 +355,7 @@ static void transmit_chars(struct m68k_serial *info, struct tty_struct *tty) ...@@ -356,7 +355,7 @@ static void transmit_chars(struct m68k_serial *info, struct tty_struct *tty)
irqreturn_t rs_interrupt(int irq, void *dev_id) irqreturn_t rs_interrupt(int irq, void *dev_id)
{ {
struct m68k_serial *info = dev_id; struct m68k_serial *info = dev_id;
struct tty_struct *tty = info->tty; struct tty_struct *tty = tty_port_tty_get(&info->tport);
m68328_uart *uart; m68328_uart *uart;
unsigned short rx; unsigned short rx;
unsigned short tx; unsigned short tx;
...@@ -374,6 +373,8 @@ irqreturn_t rs_interrupt(int irq, void *dev_id) ...@@ -374,6 +373,8 @@ irqreturn_t rs_interrupt(int irq, void *dev_id)
#else #else
receive_chars(info, tty, rx); receive_chars(info, tty, rx);
#endif #endif
tty_kref_put(tty);
return IRQ_HANDLED; return IRQ_HANDLED;
} }
...@@ -1062,7 +1063,7 @@ static void rs_close(struct tty_struct *tty, struct file * filp) ...@@ -1062,7 +1063,7 @@ static void rs_close(struct tty_struct *tty, struct file * filp)
tty_ldisc_flush(tty); tty_ldisc_flush(tty);
tty->closing = 0; tty->closing = 0;
info->tty = NULL; tty_port_tty_set(&info->tport, NULL);
#warning "This is not and has never been valid so fix it" #warning "This is not and has never been valid so fix it"
#if 0 #if 0
if (tty->ldisc.num != ldiscs[N_TTY].num) { if (tty->ldisc.num != ldiscs[N_TTY].num) {
...@@ -1098,7 +1099,7 @@ void rs_hangup(struct tty_struct *tty) ...@@ -1098,7 +1099,7 @@ void rs_hangup(struct tty_struct *tty)
shutdown(info, tty); shutdown(info, tty);
info->tport.count = 0; info->tport.count = 0;
info->tport.flags &= ~ASYNC_NORMAL_ACTIVE; info->tport.flags &= ~ASYNC_NORMAL_ACTIVE;
info->tty = NULL; tty_port_tty_set(&info->tport, NULL);
wake_up_interruptible(&info->tport.open_wait); wake_up_interruptible(&info->tport.open_wait);
} }
...@@ -1210,7 +1211,7 @@ int rs_open(struct tty_struct *tty, struct file * filp) ...@@ -1210,7 +1211,7 @@ int rs_open(struct tty_struct *tty, struct file * filp)
info->tport.count++; info->tport.count++;
tty->driver_data = info; tty->driver_data = info;
info->tty = tty; tty_port_tty_set(&info->tport, tty);
/* /*
* Start up serial port * Start up serial port
...@@ -1289,7 +1290,6 @@ rs68328_init(void) ...@@ -1289,7 +1290,6 @@ rs68328_init(void)
tty_port_init(&info->tport); tty_port_init(&info->tport);
info->magic = SERIAL_MAGIC; info->magic = SERIAL_MAGIC;
info->port = (int) &uart_addr[i]; info->port = (int) &uart_addr[i];
info->tty = NULL;
info->irq = uart_irqs[i]; info->irq = uart_irqs[i];
info->custom_divisor = 16; info->custom_divisor = 16;
info->x_char = 0; info->x_char = 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