LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] serial: speed setup failure reporting
@ 2008-01-03 16:55 Alan Cox
  2008-01-10  6:23 ` Andrew Morton
  0 siblings, 1 reply; 3+ messages in thread
From: Alan Cox @ 2008-01-03 16:55 UTC (permalink / raw)
  To: akpm, linux-kernel

Invalid speeds are forced to 9600. Update the code for this to encode new
style baud rates properly.

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

diff -u --new-file --recursive --exclude-from /usr/src/exclude linux.vanilla-2.6.24-rc6-mm1/drivers/serial/serial_core.c linux-2.6.24-rc6-mm1/drivers/serial/serial_core.c
--- linux.vanilla-2.6.24-rc6-mm1/drivers/serial/serial_core.c	2008-01-02 16:04:23.000000000 +0000
+++ linux-2.6.24-rc6-mm1/drivers/serial/serial_core.c	2008-01-02 16:17:50.000000000 +0000
@@ -372,7 +372,8 @@
 		 */
 		termios->c_cflag &= ~CBAUD;
 		if (old) {
-			termios->c_cflag |= old->c_cflag & CBAUD;
+			baud = tty_termios_baud_rate(old);
+			tty_termios_encode_baud_rate(termios, baud, baud);
 			old = NULL;
 			continue;
 		}
@@ -381,7 +382,7 @@
 		 * As a last resort, if the quotient is zero,
 		 * default to 9600 bps
 		 */
-		termios->c_cflag |= B9600;
+		tty_termios_encode_baud_rate(termios, 9600, 9600);
 	}
 
 	return 0;

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] serial: speed setup failure reporting
  2008-01-03 16:55 [PATCH] serial: speed setup failure reporting Alan Cox
@ 2008-01-10  6:23 ` Andrew Morton
  2008-01-10 20:40   ` Alan Cox
  0 siblings, 1 reply; 3+ messages in thread
From: Andrew Morton @ 2008-01-10  6:23 UTC (permalink / raw)
  To: Alan Cox; +Cc: linux-kernel

On Thu, 3 Jan 2008 16:55:07 +0000 Alan Cox <alan@lxorguk.ukuu.org.uk> wrote:

> Invalid speeds are forced to 9600. Update the code for this to encode new
> style baud rates properly.
> 
> Signed-off-by: Alan Cox <alan@redhat.com>
> 
> diff -u --new-file --recursive --exclude-from /usr/src/exclude linux.vanilla-2.6.24-rc6-mm1/drivers/serial/serial_core.c linux-2.6.24-rc6-mm1/drivers/serial/serial_core.c
> --- linux.vanilla-2.6.24-rc6-mm1/drivers/serial/serial_core.c	2008-01-02 16:04:23.000000000 +0000
> +++ linux-2.6.24-rc6-mm1/drivers/serial/serial_core.c	2008-01-02 16:17:50.000000000 +0000
> @@ -372,7 +372,8 @@
>  		 */
>  		termios->c_cflag &= ~CBAUD;
>  		if (old) {
> -			termios->c_cflag |= old->c_cflag & CBAUD;
> +			baud = tty_termios_baud_rate(old);
> +			tty_termios_encode_baud_rate(termios, baud, baud);
>  			old = NULL;
>  			continue;
>  		}
> @@ -381,7 +382,7 @@
>  		 * As a last resort, if the quotient is zero,
>  		 * default to 9600 bps
>  		 */
> -		termios->c_cflag |= B9600;
> +		tty_termios_encode_baud_rate(termios, 9600, 9600);
>  	}
>  
>  	return 0;

Is this a 2.6.24 thing?

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] serial: speed setup failure reporting
  2008-01-10  6:23 ` Andrew Morton
@ 2008-01-10 20:40   ` Alan Cox
  0 siblings, 0 replies; 3+ messages in thread
From: Alan Cox @ 2008-01-10 20:40 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel

It only causes a problem if you set a completely bogus baud rate (out of
range) and that baud rate was not a standard one and you were using the
new tty ioctls - so its fairly low priority 8)

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-01-10 20:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-01-03 16:55 [PATCH] serial: speed setup failure reporting Alan Cox
2008-01-10  6:23 ` Andrew Morton
2008-01-10 20:40   ` Alan Cox

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).