TTY: amiserial/simserial, use tty_port

Add tty_port to serial_state and start using common tty port members
from tty_port in amiserial and simserial. The rest will follow one by
one.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Tony Luck <tony.luck@intel.com>
Cc: Fenghua Yu <fenghua.yu@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Jiri Slaby
2012-03-05 14:52:24 +01:00
committed by Greg Kroah-Hartman
parent 5e99d54587
commit 87758791c9
3 changed files with 45 additions and 49 deletions

View File

@@ -165,7 +165,7 @@ static irqreturn_t rs_interrupt_single(int irq, void *dev_id)
{
struct serial_state *info = dev_id;
if (!info->tty) {
if (!info->tport.tty) {
printk(KERN_INFO "simrs_interrupt_single: info|tty=0 info=%p problem\n", info);
return IRQ_NONE;
}
@@ -173,7 +173,7 @@ static irqreturn_t rs_interrupt_single(int irq, void *dev_id)
* pretty simple in our case, because we only get interrupts
* on inbound traffic
*/
receive_chars(info->tty);
receive_chars(info->tport.tty);
return IRQ_HANDLED;
}
@@ -533,14 +533,14 @@ static void rs_close(struct tty_struct *tty, struct file * filp)
shutdown(tty, info);
rs_flush_buffer(tty);
tty_ldisc_flush(tty);
info->tty = NULL;
if (info->blocked_open) {
info->tport.tty = NULL;
if (info->tport.blocked_open) {
if (info->close_delay)
schedule_timeout_interruptible(info->close_delay);
wake_up_interruptible(&info->open_wait);
wake_up_interruptible(&info->tport.open_wait);
}
info->flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CLOSING);
wake_up_interruptible(&info->close_wait);
wake_up_interruptible(&info->tport.close_wait);
}
/*
@@ -569,8 +569,8 @@ static void rs_hangup(struct tty_struct *tty)
info->count = 0;
info->flags &= ~ASYNC_NORMAL_ACTIVE;
info->tty = NULL;
wake_up_interruptible(&info->open_wait);
info->tport.tty = NULL;
wake_up_interruptible(&info->tport.open_wait);
}
@@ -662,8 +662,9 @@ static int rs_open(struct tty_struct *tty, struct file * filp)
unsigned long page;
info->count++;
info->tty = tty;
info->tport.tty = tty;
tty->driver_data = info;
tty->port = &info->tport;
#ifdef SIMSERIAL_DEBUG
printk("rs_open %s, count = %d\n", tty->name, info->count);
@@ -685,7 +686,7 @@ static int rs_open(struct tty_struct *tty, struct file * filp)
*/
if (tty_hung_up_p(filp) || (info->flags & ASYNC_CLOSING)) {
if (info->flags & ASYNC_CLOSING)
interruptible_sleep_on(&info->close_wait);
interruptible_sleep_on(&info->tport.close_wait);
#ifdef SERIAL_DO_RESTART
return ((info->flags & ASYNC_HUP_NOTIFY) ?
-EAGAIN : -ERESTARTSYS);
@@ -827,8 +828,7 @@ simrs_init (void)
* Let's have a little bit of fun !
*/
for (i = 0, state = rs_table; i < NR_PORTS; i++,state++) {
init_waitqueue_head(&state->open_wait);
init_waitqueue_head(&state->close_wait);
tty_port_init(&state->tport);
if (state->type == PORT_UNKNOWN) continue;