Re: [PATCH v3 04/10] serial: mps2-uart: add MPS2 UART driver

One Thousand Gnomes
2016-02-16T11:02:17Z

> +static void mps2_uart_set_termios(struct uart_port *port,
> + struct ktermios *new, struct ktermios *old)

Not that I care much but you might not want to call it "new". People get
upset when their syntax aware editors get confused by C++ keywords 8)

> +{
> + unsigned long flags;
> + unsigned int baud, bauddiv;
> +
> + new->c_cflag &= ~(CRTSCTS | CMSPAR);
> + new->c_cflag &= ~CSIZE;
> + new->c_cflag |= CS8;
> + new->c_cflag &= ~PARENB;
> + new->c_cflag &= ~CSTOPB;
> +
> + baud = uart_get_baud_rate(port, new, old,
> + DIV_ROUND_CLOSEST(port->uartclk, UARTn_BAUDDIV_MASK),
> + DIV_ROUND_CLOSEST(port->uartclk, 16));
> +
> + bauddiv = DIV_ROUND_CLOSEST(port->uartclk, baud);
> +
> + spin_lock_irqsave(&port->lock, flags);
> +
> + uart_update_timeout(port, new->c_cflag, baud);
> + mps2_uart_write32(port, bauddiv, UARTn_BAUDDIV);

This should also set the baud bits back in the termios struct
accordingly.

if (tty_termios_baud_rate(new))
tty_termios_encode_baud_rate(new, baud, baud);

Not a big deal and could certainly be a follow up patch after it's merged.

Alan