lkml.org 
[lkml]   [2016]   [Feb]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v3 04/10] serial: mps2-uart: add MPS2 UART driver

> +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

\
 
 \ /
  Last update: 2016-02-16 12:41    [W:0.159 / U:0.068 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site