From: Jiri Slaby <jslaby@suse.cz>
To: gregkh@suse.de
Cc: jirislaby@gmail.com, linux-kernel@vger.kernel.org,
linux-serial@vger.kernel.org, Jiri Slaby <jslaby@suse.cz>,
Alan Cox <alan@linux.intel.com>
Subject: [PATCH 2/7] Char: nozomi, remove port.count checks
Date: Wed, 20 Apr 2011 10:43:13 +0200 [thread overview]
Message-ID: <1303288998-31718-2-git-send-email-jslaby@suse.cz> (raw)
In-Reply-To: <1303288998-31718-1-git-send-email-jslaby@suse.cz>
Before 33dd474a, 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>
Cc: Greg Kroah-Hartman <gregkh@suse.de>
---
drivers/tty/nozomi.c | 13 +------------
1 files changed, 1 insertions(+), 12 deletions(-)
diff --git a/drivers/tty/nozomi.c b/drivers/tty/nozomi.c
index acaecc1..c34d622 100644
--- a/drivers/tty/nozomi.c
+++ b/drivers/tty/nozomi.c
@@ -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 */
@@ -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;
@@ -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:
--
1.7.4.2
next prev parent reply other threads:[~2011-04-20 8:43 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-04-20 8:43 [PATCH 1/7] Char: nozomi, use GFP_KERNEL for kfifo allocation Jiri Slaby
2011-04-20 8:43 ` Jiri Slaby [this message]
2011-04-20 8:43 ` [PATCH 3/7] Char: nozomi, remove useless tty_sem Jiri Slaby
2011-04-20 9:55 ` Jack Stone
2011-04-20 8:43 ` [PATCH 4/7] Char: moxa, fix locking in moxa_write Jiri Slaby
2011-04-20 8:43 ` [PATCH 5/7] TTY: serial_core, remove invalid test Jiri Slaby
2011-04-20 8:43 ` [PATCH 6/7] TTY: serial_core, remove superfluous set_task_state Jiri Slaby
2011-04-20 8:43 ` [PATCH 7/7] TTY: tty_io, annotate locking functions Jiri Slaby
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1303288998-31718-2-git-send-email-jslaby@suse.cz \
--to=jslaby@suse.cz \
--cc=alan@linux.intel.com \
--cc=gregkh@suse.de \
--cc=jirislaby@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®