Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753414AbcCAUXo (ORCPT ); Tue, 1 Mar 2016 15:23:44 -0500 Received: from mail-yw0-f169.google.com ([209.85.161.169]:36643 "EHLO mail-yw0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753250AbcCAUXl (ORCPT ); Tue, 1 Mar 2016 15:23:41 -0500 MIME-Version: 1.0 In-Reply-To: <1456862903-12392-1-git-send-email-ynvich@gmail.com> References: <1456862078-11795-1-git-send-email-ynvich@gmail.com> <1456862903-12392-1-git-send-email-ynvich@gmail.com> Date: Tue, 1 Mar 2016 22:23:40 +0200 Message-ID: Subject: Re: [PATCH v9] serial: support for 16550A serial ports on LP-8x4x From: Andy Shevchenko To: Sergei Ianovich Cc: "linux-kernel@vger.kernel.org" , Alan Cox , Andy Shevchenko , Arnd Bergmann , Rob Herring , Pawel Moll , Mark Rutland , Ian Campbell , Kumar Gala , Greg Kroah-Hartman , Jiri Slaby , Heikki Krogerus , Masahiro Yamada , Joachim Eastwood , Paul Burton , Mans Rullgard , Scott Wood , Paul Gortmaker , Peter Ujfalusi , Peter Hurley , "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , "open list:SERIAL DRIVERS" Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2656 Lines: 85 On Tue, Mar 1, 2016 at 10:08 PM, Sergei Ianovich wrote: > The patch adds support for 3 additional LP-8x4x built-in serial > ports. > > The device can also host up to 8 extension cards with 4 serial ports > on each card for a total of 35 ports. However, I don't have > the hardware to test extension cards, so they are not supported, yet. > > Signed-off-by: Sergei Ianovich > Reviewed-by: Heikki Krogerus Sorry, but still few nitpicks and then Reviewed-by: Andy Shevchenko > +#define LP8841_DATA_LEN_MASK 0x3 > +#define LP8841_DATA_LEN_SHIFT_OFFSET 3 No need to have _OFFSET suffix. > + > +static void lp8841_serial_set_termios(struct uart_port *port, > + struct ktermios *termios, struct ktermios *old) > +{ > + unsigned int baud; > + u8 value; > + unsigned int old_csize = old ? old->c_cflag & CSIZE : CS8; > + struct lp8841_serial_data *data = port->private_data; I would rearrange to have assignments first in the definition block. Code duplication (no idea if it worth to fix): + case 2400: + value |= 1; + break; + default: + value |= 1; + tty_termios_encode_baud_rate(termios, 2400, 2400); + break; > +static int lp8841_serial_probe(struct platform_device *pdev) > +{ > + struct uart_8250_port uart = {}; No need {} since memset(). > + struct lp8841_serial_data *data; > + struct resource *mmres, *mires; > + int ret; > + > + memset(&uart, 0, sizeof(uart)); Move this closer to the first assignment of a field. > + > + mmres = platform_get_resource(pdev, IORESOURCE_MEM, 0); > + if (!mmres) > + return -ENODEV; > + > + data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL); > + if (!data) > + return -ENOMEM; > + > + mires = platform_get_resource(pdev, IORESOURCE_MEM, 1); > + data->ios_mem = devm_ioremap_resource(&pdev->dev, mires); > + if (IS_ERR(data->ios_mem)) > + return PTR_ERR(data->ios_mem); > + + memset(&uart, 0, sizeof(uart)); > + uart.port.iotype = UPIO_MEM; > + uart.port.mapbase = mmres->start; > + uart.port.regshift = 1; > + uart.port.irq = platform_get_irq(pdev, 0); > + uart.port.flags = UPF_IOREMAP; > + uart.port.dev = &pdev->dev; > + uart.port.uartclk = 14745600; > + uart.port.set_termios = lp8841_serial_set_termios; > + uart.port.private_data = data; -- With Best Regards, Andy Shevchenko