summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJiri Slaby <jslaby@suse.cz>2012-03-05 14:52:37 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-03-08 21:48:27 +0100
commit9aead90a7f5772fc74f733242d953688748b0ce4 (patch)
treea724bf41cbd92be7b04122c262f75f257814b1e1
parentTTY: simserial, properly refcount tty_port->tty (diff)
downloadlinux-9aead90a7f5772fc74f733242d953688748b0ce4.tar.xz
linux-9aead90a7f5772fc74f733242d953688748b0ce4.zip
TTY: simserial, use tty_port_open
So now we convert startup to be ->activate of tty_port. This means we no longer care about INITIALIZED and TTY_IO_ERROR flags. After we have ->activate much of the code may go as it duplicates what tty_port_open does. In this case tty_port_open adds block_til_ready to the path. But we do not define carrier hooks, so it is a noop. 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>
-rw-r--r--arch/ia64/hp/sim/simserial.c64
1 files changed, 5 insertions, 59 deletions
diff --git a/arch/ia64/hp/sim/simserial.c b/arch/ia64/hp/sim/simserial.c
index b3ec91c9fc71..e9c5fb7b923d 100644
--- a/arch/ia64/hp/sim/simserial.c
+++ b/arch/ia64/hp/sim/simserial.c
@@ -473,9 +473,10 @@ static void rs_hangup(struct tty_struct *tty)
}
-static int startup(struct tty_struct *tty, struct serial_state *state)
+static int activate(struct tty_port *port, struct tty_struct *tty)
{
- struct tty_port *port = &state->port;
+ struct serial_state *state = container_of(port, struct serial_state,
+ port);
unsigned long flags;
int retval=0;
unsigned long page;
@@ -486,20 +487,11 @@ static int startup(struct tty_struct *tty, struct serial_state *state)
local_irq_save(flags);
- if (port->flags & ASYNC_INITIALIZED) {
- free_page(page);
- goto errout;
- }
-
if (state->xmit.buf)
free_page(page);
else
state->xmit.buf = (unsigned char *) page;
-#ifdef SIMSERIAL_DEBUG
- printk("startup: ttys%d (irq %d)...", state->line, state->irq);
-#endif
-
/*
* Allocate the IRQ if necessary
*/
@@ -510,18 +502,8 @@ static int startup(struct tty_struct *tty, struct serial_state *state)
goto errout;
}
- clear_bit(TTY_IO_ERROR, &tty->flags);
-
state->xmit.head = state->xmit.tail = 0;
-#if 0
- /*
- * Set up serial timers...
- */
- timer_table[RS_TIMER].expires = jiffies + 2*HZ/100;
- timer_active |= 1 << RS_TIMER;
-#endif
-
/*
* Set up the tty->alt_speed kludge
*/
@@ -534,10 +516,6 @@ static int startup(struct tty_struct *tty, struct serial_state *state)
if ((port->flags & ASYNC_SPD_MASK) == ASYNC_SPD_WARP)
tty->alt_speed = 460800;
- port->flags |= ASYNC_INITIALIZED;
- local_irq_restore(flags);
- return 0;
-
errout:
local_irq_restore(flags);
return retval;
@@ -554,41 +532,11 @@ static int rs_open(struct tty_struct *tty, struct file * filp)
{
struct serial_state *info = rs_table + tty->index;
struct tty_port *port = &info->port;
- int retval;
- port->count++;
- tty_port_tty_set(port, tty);
tty->driver_data = info;
- tty->port = port;
-
-#ifdef SIMSERIAL_DEBUG
- printk("rs_open %s, count = %d\n", tty->name, port->count);
-#endif
tty->low_latency = (port->flags & ASYNC_LOW_LATENCY) ? 1 : 0;
/*
- * If the port is the middle of closing, bail out now
- */
- if (tty_hung_up_p(filp) || (port->flags & ASYNC_CLOSING)) {
- if (port->flags & ASYNC_CLOSING)
- interruptible_sleep_on(&port->close_wait);
-#ifdef SERIAL_DO_RESTART
- return ((port->flags & ASYNC_HUP_NOTIFY) ?
- -EAGAIN : -ERESTARTSYS);
-#else
- return -EAGAIN;
-#endif
- }
-
- /*
- * Start up serial port
- */
- retval = startup(tty, info);
- if (retval) {
- return retval;
- }
-
- /*
* figure out which console to use (should be one already)
*/
console = console_drivers;
@@ -597,10 +545,7 @@ static int rs_open(struct tty_struct *tty, struct file * filp)
console = console->next;
}
-#ifdef SIMSERIAL_DEBUG
- printk("rs_open ttys%d successful\n", info->line);
-#endif
- return 0;
+ return tty_port_open(port, tty, filp);
}
/*
@@ -669,6 +614,7 @@ static const struct tty_operations hp_ops = {
};
static const struct tty_port_operations hp_port_ops = {
+ .activate = activate,
};
/*