Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 304175
b: refs/heads/master
c: 8e32841
h: refs/heads/master
i:
  304173: 7ef2924
  304171: ef69aa2
  304167: 287fae2
  304159: dcbcfb0
v: v3
  • Loading branch information
Jiri Slaby authored and Greg Kroah-Hartman committed Apr 9, 2012
1 parent ab26875 commit 7e5017f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 92 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: 665569d0269be3dd67b768fb65061e1b54bb2faf
refs/heads/master: 8e32841634958d4927a85b484faf9d2c3c222e4d
96 changes: 5 additions & 91 deletions trunk/drivers/tty/serial/68328serial.c
Original file line number Diff line number Diff line change
Expand Up @@ -1103,96 +1103,6 @@ void rs_hangup(struct tty_struct *tty)
wake_up_interruptible(&info->tport.open_wait);
}

/*
* ------------------------------------------------------------
* rs_open() and friends
* ------------------------------------------------------------
*/
static int block_til_ready(struct tty_struct *tty, struct file * filp,
struct m68k_serial *info)
{
struct tty_port *port = &info->tport;
DECLARE_WAITQUEUE(wait, current);
int retval;
int do_clocal = 0;

/*
* If the device is in the middle of being closed, then block
* until it's done, and then try again.
*/
if (port->flags & ASYNC_CLOSING) {
interruptible_sleep_on(&port->close_wait);
#ifdef SERIAL_DO_RESTART
if (port->flags & ASYNC_HUP_NOTIFY)
return -EAGAIN;
else
return -ERESTARTSYS;
#else
return -EAGAIN;
#endif
}

/*
* If non-blocking mode is set, or the port is not enabled,
* then make the check up front and then exit.
*/
if ((filp->f_flags & O_NONBLOCK) ||
(tty->flags & (1 << TTY_IO_ERROR))) {
port->flags |= ASYNC_NORMAL_ACTIVE;
return 0;
}

if (tty->termios->c_cflag & CLOCAL)
do_clocal = 1;

/*
* Block waiting for the carrier detect and the line to become
* free (i.e., not in use by the callout). While we are in
* this loop, port->count is dropped by one, so that
* rs_close() knows when to free things. We restore it upon
* exit, either normal or abnormal.
*/
retval = 0;
add_wait_queue(&port->open_wait, &wait);

port->count--;
port->blocked_open++;
while (1) {
current->state = TASK_INTERRUPTIBLE;
if (tty_hung_up_p(filp) ||
!(port->flags & ASYNC_INITIALIZED)) {
#ifdef SERIAL_DO_RESTART
if (port->flags & ASYNC_HUP_NOTIFY)
retval = -EAGAIN;
else
retval = -ERESTARTSYS;
#else
retval = -EAGAIN;
#endif
break;
}
if (!(port->flags & ASYNC_CLOSING) && do_clocal)
break;
if (signal_pending(current)) {
retval = -ERESTARTSYS;
break;
}
tty_unlock();
schedule();
tty_lock();
}
current->state = TASK_RUNNING;
remove_wait_queue(&port->open_wait, &wait);
if (!tty_hung_up_p(filp))
port->count++;
port->blocked_open--;

if (retval)
return retval;
port->flags |= ASYNC_NORMAL_ACTIVE;
return 0;
}

/*
* This routine is called whenever a serial port is opened. It
* enables interrupts for a serial port, linking in its S structure into
Expand Down Expand Up @@ -1220,7 +1130,7 @@ int rs_open(struct tty_struct *tty, struct file * filp)
if (retval)
return retval;

return block_til_ready(tty, filp, info);
return tty_port_block_til_ready(&info->tport, tty, filp);
}

/* Finally, routines used to initialize the serial driver. */
Expand Down Expand Up @@ -1248,6 +1158,9 @@ static const struct tty_operations rs_ops = {
.set_ldisc = rs_set_ldisc,
};

static const struct tty_port_operations rs_port_ops = {
};

/* rs_init inits the driver */
static int __init
rs68328_init(void)
Expand Down Expand Up @@ -1288,6 +1201,7 @@ rs68328_init(void)

info = &m68k_soft[i];
tty_port_init(&info->tport);
info->tport.ops = &rs_port_ops;
info->magic = SERIAL_MAGIC;
info->port = (int) &uart_addr[i];
info->irq = uart_irqs[i];
Expand Down

0 comments on commit 7e5017f

Please sign in to comment.