Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 280677
b: refs/heads/master
c: c0d92be
h: refs/heads/master
i:
  280675: 1f2e203
v: v3
  • Loading branch information
Jiri Slaby authored and Greg Kroah-Hartman committed Nov 15, 2011
1 parent 5df73d0 commit c7c15a8
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 16 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: b922e19d03a680d732b61dc8e82d9948f6f8b6c7
refs/heads/master: c0d92be6bc4fbbf6402fde2c0bc08fc4d2b58430
43 changes: 28 additions & 15 deletions trunk/drivers/tty/serial/serial_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -131,24 +131,16 @@ uart_update_mctrl(struct uart_port *port, unsigned int set, unsigned int clear)
* Startup the port. This will be called once per open. All calls
* will be serialised by the per-port mutex.
*/
static int uart_startup(struct tty_struct *tty, struct uart_state *state, int init_hw)
static int uart_port_startup(struct tty_struct *tty, struct uart_state *state,
int init_hw)
{
struct uart_port *uport = state->uart_port;
struct tty_port *port = &state->port;
unsigned long page;
int retval = 0;

if (port->flags & ASYNC_INITIALIZED)
return 0;

/*
* Set the TTY IO error marker - we will only clear this
* once we have successfully opened the port.
*/
set_bit(TTY_IO_ERROR, &tty->flags);

if (uport->type == PORT_UNKNOWN)
return 0;
return 1;

/*
* Initialise and allocate the transmit and temporary
Expand Down Expand Up @@ -190,10 +182,6 @@ static int uart_startup(struct tty_struct *tty, struct uart_state *state, int in
tty->hw_stopped = 1;
spin_unlock_irq(&uport->lock);
}

set_bit(ASYNCB_INITIALIZED, &port->flags);

clear_bit(TTY_IO_ERROR, &tty->flags);
}

/*
Expand All @@ -202,6 +190,31 @@ static int uart_startup(struct tty_struct *tty, struct uart_state *state, int in
* now.
*/
if (retval && capable(CAP_SYS_ADMIN))
return 1;

return retval;
}

static int uart_startup(struct tty_struct *tty, struct uart_state *state,
int init_hw)
{
struct tty_port *port = &state->port;
int retval;

if (port->flags & ASYNC_INITIALIZED)
return 0;

/*
* Set the TTY IO error marker - we will only clear this
* once we have successfully opened the port.
*/
set_bit(TTY_IO_ERROR, &tty->flags);

retval = uart_port_startup(tty, state, init_hw);
if (!retval) {
set_bit(ASYNCB_INITIALIZED, &port->flags);
clear_bit(TTY_IO_ERROR, &tty->flags);
} else if (retval > 0)
retval = 0;

return retval;
Expand Down

0 comments on commit c7c15a8

Please sign in to comment.