[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1330955575-26641-51-git-send-email-jslaby@suse.cz>
Date: Mon, 5 Mar 2012 14:52:37 +0100
From: Jiri Slaby <jslaby@...e.cz>
To: gregkh@...uxfoundation.org
Cc: alan@...ux.intel.com, linux-serial@...r.kernel.org,
linux-kernel@...r.kernel.org, jirislaby@...il.com,
Tony Luck <tony.luck@...el.com>,
Fenghua Yu <fenghua.yu@...el.com>
Subject: [PATCH 50/68] 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@...e.cz>
Cc: Tony Luck <tony.luck@...el.com>
Cc: Fenghua Yu <fenghua.yu@...el.com>
---
arch/ia64/hp/sim/simserial.c | 64 ++++--------------------------------------
1 file changed, 5 insertions(+), 59 deletions(-)
diff --git a/arch/ia64/hp/sim/simserial.c b/arch/ia64/hp/sim/simserial.c
index b3ec91c..e9c5fb7 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,
};
/*
--
1.7.9.2
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists