serial: change the divisor latch only when prescalar actually changed
authorYin Kangkai <kangkai.yin@linux.intel.com>
Wed, 9 Feb 2011 03:35:18 +0000 (11:35 +0800)
committerGreg Kroah-Hartman <gregkh@suse.de>
Wed, 23 Mar 2011 20:03:45 +0000 (13:03 -0700)
commit2ac31a250c7d0cf642cc183bcf55e571ada867f6
tree8350d4f1e63bbcbbf1d28413bb187875e3babcb4
parent102965a0c525751b781021eed046ada76e65475b
serial: change the divisor latch only when prescalar actually changed

commit 0d0389e5414c8950b1613e8bdc74289cde3d6d98 upstream.

In 8250.c original ns16550 autoconfig code, we change the divisor latch when
we goto to high speed mode, we're assuming the previous speed is legacy. This
some times is not true.

For example in a system with both CONFIG_SERIAL_8250 and
CONFIG_SERIAL_8250_PNP set, in this case, the code (autoconfig) will be called
twice, one in serial8250_init/probe() and the other is from
serial_pnp_probe. When serial_pnp_probe calls the autoconfig for NS16550A,
it's already in high speed mode, change the divisor latch (quot << 3) in this
case will make the UART console garbled.

CC: Greg Kroah-Hartman <greg@kroah.com>
CC: David Woodhouse <dwmw2@infradead.org>
CC: linux-kernel@vger.kernel.org
Signed-off-by: Yin Kangkai <kangkai.yin@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/tty/serial/8250.c