Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 185201
b: refs/heads/master
c: e8c65d1
h: refs/heads/master
i:
  185199: 84b4c9e
v: v3
  • Loading branch information
Alan Cox authored and Greg Kroah-Hartman committed Mar 2, 2010
1 parent 429451f commit 86f1d0a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 23 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: 266794eb71cfee65b38371954b9db2f6dbda207c
refs/heads/master: e8c65d143a9903cb553c0d80c819428c5b839a02
34 changes: 12 additions & 22 deletions trunk/drivers/char/nozomi.c
Original file line number Diff line number Diff line change
Expand Up @@ -1693,15 +1693,7 @@ static int ntty_write(struct tty_struct *tty, const unsigned char *buffer,
if (!dc || !port)
return -ENODEV;

if (unlikely(!mutex_trylock(&port->tty_sem))) {
/*
* must test lock as tty layer wraps calls
* to this function with BKL
*/
dev_err(&dc->pdev->dev, "Would have deadlocked - "
"return EAGAIN\n");
return -EAGAIN;
}
mutex_lock(&port->tty_sem);

if (unlikely(!port->port.count)) {
DBG1(" ");
Expand Down Expand Up @@ -1741,25 +1733,23 @@ static int ntty_write(struct tty_struct *tty, const unsigned char *buffer,
* This method is called by the upper tty layer.
* #according to sources N_TTY.c it expects a value >= 0 and
* does not check for negative values.
*
* If the port is unplugged report lots of room and let the bits
* dribble away so we don't block anything.
*/
static int ntty_write_room(struct tty_struct *tty)
{
struct port *port = tty->driver_data;
int room = 0;
int room = 4096;
const struct nozomi *dc = get_dc_by_tty(tty);

if (!dc || !port)
return 0;
if (!mutex_trylock(&port->tty_sem))
return 0;

if (!port->port.count)
goto exit;

room = port->fifo_ul.size - kfifo_len(&port->fifo_ul);

exit:
mutex_unlock(&port->tty_sem);
if (dc) {
mutex_lock(&port->tty_sem);
if (port->port.count)
room = port->fifo_ul.size -
kfifo_len(&port->fifo_ul);
mutex_unlock(&port->tty_sem);
}
return room;
}

Expand Down

0 comments on commit 86f1d0a

Please sign in to comment.