Re: [PATCH] serial: tegra: add serial driver

From: Alan Cox
Date: Mon Dec 17 2012 - 13:19:15 EST




> +
> +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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/