Re: [2.6.19 patch] drivers/char/specialix.c: fix the baud conversion

From: Rolf Eike Beer
Date: Tue Oct 10 2006 - 08:00:41 EST


Adrian Bunk wrote:
> On Mon, Oct 09, 2006 at 08:37:45AM +0200, Rogier Wolff wrote:
> > On Mon, Oct 09, 2006 at 12:18:19AM +0200, Adrian Bunk wrote:
> > > + if (baud == 38400) {
> > > if ((port->flags & ASYNC_SPD_MASK) == ASYNC_SPD_HI)
> > > baud ++;
> > > if ((port->flags & ASYNC_SPD_MASK) == ASYNC_SPD_VHI)
> > > baud += 2;
> > > }
> > >
> > > Increasing the index for baud_table[] by 1 or 2 is quite different from
> > > increasing baud by 1 or 2.
> >
> > In that range,
> > baud <<= 1;
> > and
> > baud <<= 2;
> >
> > should work.
>
> Thanks for the hint.
>
> What about the patch below?

> @@ -1090,9 +1085,9 @@
>
> if (baud == 38400) {
> if ((port->flags & ASYNC_SPD_MASK) == ASYNC_SPD_HI)
> - baud ++;
> + baud <<= 1;
> if ((port->flags & ASYNC_SPD_MASK) == ASYNC_SPD_VHI)
> - baud += 2;
> + baud <<= 2;
> }
>
> if (!baud) {

Neither is 38400 <<= 1 == 57600 nor is 38400 <<= 2 == 115200. You should just
set baud to the value you want instead of doing tricks here.

Eike

Attachment: pgp00000.pgp
Description: PGP signature