Since you were sending a fix, possibly I shouldn't comment on this. If so 
please disregard my
suggestion for a trivial cleanup.

Roel

Maciej W. Rozycki wrote:
> +void tty_termios_encode_baud_rate(struct ktermios *termios,
> +                               speed_t ibaud, speed_t obaud)
>  {
>       int i = 0;
>       int ifound = -1, ofound = -1;
> @@ -251,12 +252,15 @@ void tty_termios_encode_baud_rate(struct
>       termios->c_cflag &= ~CBAUD;
>  
>       do {
> -             if (obaud - oclose >= baud_table[i] && obaud + oclose <= 
> baud_table[i]) {
> +             if (obaud - oclose <= baud_table[i] &&
> +                 obaud + oclose >= baud_table[i]) {

if(a - b <= c && a + b >= c)
if(a <= c + b && a + b >= c)
if(c + b >= a && a + b >= c)
if(b >= a - c && b >= c - a)
true, if:
b >= |a - c|
so
                if (oclose >= abs(obaud - baud_table[i])) {

should work as well

>                       termios->c_cflag |= baud_bits[i];
>                       ofound = i;
>               }
> -             if (ibaud - iclose >= baud_table[i] && ibaud + iclose <= 
> baud_table[i]) {
> -                     /* For the case input == output don't set IBAUD bits if 
> the user didn't do so */
> +             if (ibaud - iclose <= baud_table[i] &&
> +                 ibaud + iclose >= baud_table[i]) {

similarly,
                if (iclose >= abs(ibaud - baud_table[i])) {

> +                     /* For the case input == output don't set IBAUD bits
> +                        if the user didn't do so */
>                       if (ofound != i || ibinput)
>                               termios->c_cflag |= (baud_bits[i] << IBSHIFT);
>                       ifound = i;
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to