Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1760558AbcCEKWT (ORCPT ); Sat, 5 Mar 2016 05:22:19 -0500 Received: from mail-pf0-f193.google.com ([209.85.192.193]:34748 "EHLO mail-pf0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755535AbcCEKWE (ORCPT ); Sat, 5 Mar 2016 05:22:04 -0500 Subject: Re: [PATCH v2] serial: core: remove baud_rates when serial console setup To: Jeffy Chen , gregkh@linuxfoundation.org References: <1451894086-20435-1-git-send-email-jeffy.chen@rock-chips.com> Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, jslaby@suse.com, linux-rockchip@lists.infradead.org, Doug Anderson , Caesar Wang , Heiko Stuebner From: Caesar Wang Message-ID: <56DAB33F.50802@gmail.com> Date: Sat, 5 Mar 2016 18:21:51 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.1 MIME-Version: 1.0 In-Reply-To: <1451894086-20435-1-git-send-email-jeffy.chen@rock-chips.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2348 Lines: 83 Hi, I don't see this patch in mainline.:-( Sorry for noise if this patch has applied by Greg. 在 2016年01月04日 15:54, Jeffy Chen 写道: > Currently, when tring to set up a serial console with a higher > baud rate, it would fallback to 921600. > > Tested-by: Jianqun Xu > Signed-off-by: Jeffy Chen Verified on RK3228/RK3229 SoCs. Tested-by: Caesar Wang > > --- > > Changes in v2: > remove baud_rates as Alan's suggestion. > > drivers/tty/serial/serial_core.c | 33 ++------------------------------- > 1 file changed, 2 insertions(+), 31 deletions(-) > > diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c > index def5199..150547c 100644 > --- a/drivers/tty/serial/serial_core.c > +++ b/drivers/tty/serial/serial_core.c > @@ -1892,26 +1892,6 @@ uart_parse_options(char *options, int *baud, int *parity, int *bits, int *flow) > } > EXPORT_SYMBOL_GPL(uart_parse_options); > > -struct baud_rates { > - unsigned int rate; > - unsigned int cflag; > -}; > - > -static const struct baud_rates baud_rates[] = { > - { 921600, B921600 }, > - { 460800, B460800 }, > - { 230400, B230400 }, > - { 115200, B115200 }, > - { 57600, B57600 }, > - { 38400, B38400 }, > - { 19200, B19200 }, > - { 9600, B9600 }, > - { 4800, B4800 }, > - { 2400, B2400 }, > - { 1200, B1200 }, > - { 0, B38400 } > -}; > - > /** > * uart_set_options - setup the serial console parameters > * @port: pointer to the serial ports uart_port structure > @@ -1927,7 +1907,6 @@ uart_set_options(struct uart_port *port, struct console *co, > { > struct ktermios termios; > static struct ktermios dummy; > - int i; > > /* > * Ensure that the serial console lock is initialised > @@ -1942,16 +1921,8 @@ uart_set_options(struct uart_port *port, struct console *co, > > memset(&termios, 0, sizeof(struct ktermios)); > > - termios.c_cflag = CREAD | HUPCL | CLOCAL; > - > - /* > - * Construct a cflag setting. > - */ > - for (i = 0; baud_rates[i].rate; i++) > - if (baud_rates[i].rate <= baud) > - break; > - > - termios.c_cflag |= baud_rates[i].cflag; > + termios.c_cflag |= CREAD | HUPCL | CLOCAL; > + tty_termios_encode_baud_rate(&termios, baud, baud); > > if (bits == 7) > termios.c_cflag |= CS7;