Skip to content

Commit

Permalink
Char: nozomi, remove port.count checks
Browse files Browse the repository at this point in the history
Before 33dd474, these were some kind of protection against race with
HUP. They were protected with port->tty_sem at the same time.

By that commit, the counting was switched to tty_port's one, but the
locking remained the old one. So the count was not protected by
any lock anymore.

The driver should not test whether it raced with HUP or not anyways.
With the new refcounted tty model, it just should proceed as nothing
happened because all needed info is still there. In respect to this,
let's drop the useless and unprotected tests (tty_port->count is
protected by tty_port->lock).

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Tested-by: Gerald Pfeifer <gerald@pfeifer.com>
Cc: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
Jiri Slaby authored and Greg Kroah-Hartman committed Apr 25, 2011
1 parent c29bd8d commit 6d742f6
Showing 1 changed file with 1 addition and 12 deletions.
13 changes: 1 addition & 12 deletions drivers/tty/nozomi.c
Original file line number Diff line number Diff line change
Expand Up @@ -1690,11 +1690,6 @@ static int ntty_write(struct tty_struct *tty, const unsigned char *buffer,

mutex_lock(&port->tty_sem);

if (unlikely(!port->port.count)) {
DBG1(" ");
goto exit;
}

rval = kfifo_in(&port->fifo_ul, (unsigned char *)buffer, count);

/* notify card */
Expand Down Expand Up @@ -1740,8 +1735,7 @@ static int ntty_write_room(struct tty_struct *tty)

if (dc) {
mutex_lock(&port->tty_sem);
if (port->port.count)
room = kfifo_avail(&port->fifo_ul);
room = kfifo_avail(&port->fifo_ul);
mutex_unlock(&port->tty_sem);
}
return room;
Expand Down Expand Up @@ -1889,11 +1883,6 @@ static s32 ntty_chars_in_buffer(struct tty_struct *tty)
goto exit_in_buffer;
}

if (unlikely(!port->port.count)) {
dev_err(&dc->pdev->dev, "No tty open?\n");
goto exit_in_buffer;
}

rval = kfifo_len(&port->fifo_ul);

exit_in_buffer:
Expand Down

0 comments on commit 6d742f6

Please sign in to comment.