[PATCH] serial: tegra: add serial driver

Alan Cox alan at lxorguk.ukuu.org.uk
Tue Dec 18 05:23:43 EST 2012



> +
> +static void tegra_uart_copy_rx_to_tty(struct tegra_uart_port *tup, int count)
> +{
> +	int copied;
> +
> +	tup->uport.icount.rx += count;
> +	dma_sync_single_for_cpu(tup->uport.dev, tup->rx_dma_buf_phys,
> +				TEGRA_UART_RX_DMA_BUFFER_SIZE, DMA_FROM_DEVICE);
> +	copied = tty_insert_flip_string(tup->uport.state->port.tty,

Reference needed and port.tty can go to NULL
(good rule of thumb - any use of port.tty directly is probably wrong)

‎
> +	tty_flip_buffer_push(u->state->port.tty);

Ditto (and elsewhere)

> +	if ((c_cflag & PARENB) == PARENB) {
> +		symb_bit++;
> +		if ((c_cflag & CMSPAR) == CMSPAR) {
> +			dev_err(tup->uport.dev, "Space parity not supported\n");
> +			return;

No - this is out of spec and lets user tasks spam the log. Just clear the
flag if not supported.


> +	/* Baud rate. */
> +	baud = uart_get_baud_rate(u, termios, oldtermios, 200, 4000000);
> +	spin_unlock_irqrestore(&u->lock, flags);
> +	tegra_set_baudrate(tup, baud);
> +	spin_lock_irqsave(&u->lock, flags);

I think you need to use the helpers to put the actual baud it got into the
termios if not B0 - see 8250.c ?

Alan


More information about the devicetree-discuss mailing list