linux-serial.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alan Cox <alan@linux.intel.com>
To: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org,
	arnd@arndb.de
Subject: [PATCH 13/20] tty: serial - fix tty referencing in set_ldisc
Date: Wed, 05 May 2010 11:02:53 +0100	[thread overview]
Message-ID: <20100505100253.3595.6394.stgit@localhost.localdomain> (raw)
In-Reply-To: <20100505100144.3595.65633.stgit@localhost.localdomain>

Pass down the ldisc number so that the drivers don't have to peek into the
tty object themselves. This lets us get rid of another case of back referencing
port to tty which we don't want (because of races versus hangup/close).

Signed-off-by: Alan Cox <alan@linux.intel.com>
---

 drivers/serial/bfin_5xx.c    |    7 ++-----
 drivers/serial/serial_core.c |    2 +-
 include/linux/serial_core.h  |    2 +-
 3 files changed, 4 insertions(+), 7 deletions(-)


diff --git a/drivers/serial/bfin_5xx.c b/drivers/serial/bfin_5xx.c
index 96f7e74..e0d25ca 100644
--- a/drivers/serial/bfin_5xx.c
+++ b/drivers/serial/bfin_5xx.c
@@ -952,15 +952,12 @@ bfin_serial_verify_port(struct uart_port *port, struct serial_struct *ser)
  * Enable the IrDA function if tty->ldisc.num is N_IRDA.
  * In other cases, disable IrDA function.
  */
-static void bfin_serial_set_ldisc(struct uart_port *port)
+static void bfin_serial_set_ldisc(struct uart_port *port, int ld)
 {
 	int line = port->line;
 	unsigned short val;
 
-	if (line >= port->state->port.tty->driver->num)
-		return;
-
-	switch (port->state->port.tty->termios->c_line) {
+	switch (ld) {
 	case N_IRDA:
 		val = UART_GET_GCTL(&bfin_serial_ports[line]);
 		val |= (IREN | RPOLC);
diff --git a/drivers/serial/serial_core.c b/drivers/serial/serial_core.c
index 12ee7e0..570dca2 100644
--- a/drivers/serial/serial_core.c
+++ b/drivers/serial/serial_core.c
@@ -1194,7 +1194,7 @@ static void uart_set_ldisc(struct tty_struct *tty)
 	struct uart_port *uport = state->uart_port;
 
 	if (uport->ops->set_ldisc)
-		uport->ops->set_ldisc(uport);
+		uport->ops->set_ldisc(uport, tty->termios->c_line);
 }
 
 static void uart_set_termios(struct tty_struct *tty,
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
index ad83996..5c4cbe6 100644
--- a/include/linux/serial_core.h
+++ b/include/linux/serial_core.h
@@ -216,7 +216,7 @@ struct uart_ops {
 	void		(*flush_buffer)(struct uart_port *);
 	void		(*set_termios)(struct uart_port *, struct ktermios *new,
 				       struct ktermios *old);
-	void		(*set_ldisc)(struct uart_port *);
+	void		(*set_ldisc)(struct uart_port *, int new);
 	void		(*pm)(struct uart_port *, unsigned int state,
 			      unsigned int oldstate);
 	int		(*set_wake)(struct uart_port *, unsigned int state);

  parent reply	other threads:[~2010-05-05 10:02 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-05 10:01 [PATCH 01/20] stallion: prune lock_kernel calls Alan Cox
2010-05-05 10:01 ` [PATCH 02/20] istallion: use bit ops for the board flags Alan Cox
2010-05-05 10:01 ` [PATCH 03/20] riscom8: kill use of lock_kernel Alan Cox
2010-05-05 10:02 ` [PATCH 04/20] isicom: kill off the BKL Alan Cox
2010-05-05 10:02 ` [PATCH 05/20] rocket: kill BKL Alan Cox
2010-05-05 10:02 ` [PATCH 06/20] synclink: kill the big kernel lock Alan Cox
2010-05-05 10:02 ` [PATCH 07/20] cyclades: Kill off BKL usage Alan Cox
2010-05-05 10:02 ` [PATCH 08/20] epca: Kill the big kernel lock Alan Cox
2010-05-05 10:02 ` [PATCH 09/20] specialix; Kill the BKL Alan Cox
2010-05-05 10:02 ` [PATCH 10/20] synclink: reworking locking a bit Alan Cox
2010-05-05 10:02 ` [PATCH 11/20] tty: serial - fix various misuses/mishandlings of port->tty Alan Cox
2010-05-05 10:02 ` [PATCH 12/20] tty: serial - fix tty back references in termios Alan Cox
2010-05-05 10:02 ` Alan Cox [this message]
2010-05-05 10:02 ` [PATCH 14/20] vc: Locking clean up Alan Cox
2010-05-05 10:03 ` [PATCH 15/20] tty: Make vt's have a tty_port Alan Cox
2010-05-05 10:03 ` [PATCH 16/20] tty: Move the vt_tty field from the vc_data into the standard tty_port Alan Cox
2010-05-05 10:03 ` [PATCH 17/20] serial: Change the wait for carrier locking Alan Cox
2010-05-05 10:03 ` [PATCH 18/20] serial: add port helpers Alan Cox
2010-05-05 10:03 ` [PATCH 19/20] serial: trim locking on the helpers Alan Cox
2010-05-05 10:03 ` [PATCH 20/20] serial: Use block_til_ready helper Alan Cox

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=20100505100253.3595.6394.stgit@localhost.localdomain \
    --to=alan@linux.intel.com \
    --cc=arnd@arndb.de \
    --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;
as well as URLs for NNTP newsgroup(s).