mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: David Woodhouse <dwmw2@infradead.org>
To: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: akpm@osdl.org, linux-kernel@vger.kernel.org, paulus@samba.org
Subject: [SERIAL] Don't optimise away baud rate changes when BOTHER is used (v2)
Date: Fri, 08 Jun 2007 12:14:49 +0100	[thread overview]
Message-ID: <1181301289.2801.26.camel@pmac.infradead.org> (raw)
In-Reply-To: <1181133010.4096.26.camel@pmac.infradead.org>

The uart_set_termios() function will bail out early without bothering to
touch the hardware, if it decides that nothing "relevant" has changed.
Unfortunately, its idea of "relevant" doesn't include c_[io]speed. So if
the baud rate bits are BOTHER and you just change the speed, the change
gets optimised away.

This patch makes it ignore the old Bfoo bits in c_cflag and just check
whether c_ispeed and c_ospeed have changed. Those integers are always
set appropriately for us by set_termios().

This version of the patch lacks the debugging printk which I
accidentally left in the previous one.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>

diff --git a/drivers/serial/serial_core.c b/drivers/serial/serial_core.c
index e8be3b5..4480990 100644
--- a/drivers/serial/serial_core.c
+++ b/drivers/serial/serial_core.c
@@ -1146,11 +1146,19 @@ static void uart_set_termios(struct tty_struct *tty, struct ktermios *old_termio
 
 	/*
 	 * These are the bits that are used to setup various
-	 * flags in the low level driver.
+	 * flags in the low level driver. We can ignore the Bfoo
+	 * bits in c_cflag; c_[io]speed will always be set
+	 * appropriately by set_termios() in tty_ioctl.c
 	 */
+#ifdef CIBAUD
+#define RELEVANT_CFLAG(cflag)	((cflag) & ~(CIBAUD|CBAUD)
+#else
+#define RELEVANT_CFLAG(cflag)	((cflag) & ~(CIBAUD|CBAUD)
+#endif
 #define RELEVANT_IFLAG(iflag)	((iflag) & (IGNBRK|BRKINT|IGNPAR|PARMRK|INPCK))
-
 	if ((cflag ^ old_termios->c_cflag) == 0 &&
+	    tty->termios->c_ospeed == old_termios->c_ospeed &&
+	    tty->termios->c_ispeed == old_termios->c_ispeed &&
 	    RELEVANT_IFLAG(tty->termios->c_iflag ^ old_termios->c_iflag) == 0)
 		return;
 

-- 
dwmw2


  parent reply	other threads:[~2007-06-08 11:15 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-23 16:27 [PATCH] ARM/ARM26: Enable arbitary speed tty ioctls and split input/output speed Alan Cox
2007-05-23 16:27 ` Russell King
2007-05-24 13:08 ` [PATCH] $ARCH: " David Woodhouse
2007-05-24 13:41   ` Alan Cox
2007-05-24 13:45     ` David Woodhouse
2007-05-24 15:05       ` Alan Cox
2007-05-24 15:18         ` David Woodhouse
2007-05-28  4:47         ` Paul Mackerras
2007-06-06 12:33           ` David Woodhouse
2007-06-08 11:18             ` [PATCH] PowerPC: " David Woodhouse
2007-06-06 12:30         ` [SERIAL] Don't optimise away baud rate changes when BOTHER is used David Woodhouse
2007-06-06 15:03           ` Alan Cox
2007-06-06 17:29             ` David Woodhouse
2007-06-07 15:38               ` Alan Cox
2007-06-07 15:50                 ` David Woodhouse
2007-06-07 21:55                   ` Alan Cox
2007-06-07 22:04                     ` David Woodhouse
2007-06-07 22:15                     ` David Woodhouse
2007-06-07 22:54                       ` Alan Cox
2007-06-08 11:01                         ` David Woodhouse
2007-06-08 11:48                           ` Alan Cox
2007-06-08 11:48                             ` David Woodhouse
2007-06-08 11:13           ` David Woodhouse
2007-06-08 11:14           ` David Woodhouse [this message]
2007-06-08 11:42             ` [SERIAL] Don't optimise away baud rate changes when BOTHER is used (v2) Alan Cox
2007-06-06 12:34         ` [PATCH] Minor cleanups in tty_ioctl.c David Woodhouse
2007-06-06 13:09           ` Jiri Slaby
2007-05-28 19:36 ` [PATCH] ARM/ARM26: Enable arbitary speed tty ioctls and split input/output speed Russell King
2007-05-28 21:56   ` Andrew Morton
2007-05-28 22:00     ` Russell King
2007-05-29  8:31     ` 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=1181301289.2801.26.camel@pmac.infradead.org \
    --to=dwmw2@infradead.org \
    --cc=akpm@osdl.org \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=paulus@samba.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®