Re: [Nios2-dev] [PATCH 2/2] serial: Add driver for the Altera UART

From: Ian Abbott
Date: Thu May 06 2010 - 07:09:20 EST


On 06/05/10 11:44, Ian Abbott wrote:
> On Wed, 2010-05-05 at 09:35 +0100, Tobias Klauser wrote:
>> Add an UART driver for the UART component available as a SOPC (System on
>> Programmable Chip) component for Altera FPGAs.
> [...]
>
>> +static void altera_uart_start_tx(struct uart_port *port)
>> +{
>> + struct altera_uart *pp = container_of(port, struct altera_uart, port);
>> + unsigned long flags;
>> +
>> + spin_lock_irqsave(&port->lock, flags);
>> + pp->imr |= ALTERA_UART_CONTROL_TRDY_MSK;
>> + writel(pp->imr, port->membase + ALTERA_UART_CONTROL_REG);
>> + spin_unlock_irqrestore(&port->lock, flags);
>> +}
>> +
>> +static void altera_uart_stop_tx(struct uart_port *port)
>> +{
>> + struct altera_uart *pp = container_of(port, struct altera_uart, port);
>> + unsigned long flags;
>> +
>> + spin_lock_irqsave(&port->lock, flags);
>> + pp->imr &= ~ALTERA_UART_CONTROL_TRDY_MSK;
>> + writel(pp->imr, port->membase + ALTERA_UART_CONTROL_REG);
>> + spin_unlock_irqrestore(&port->lock, flags);
>> +}
>> +
>> +static void altera_uart_stop_rx(struct uart_port *port)
>> +{
>> + struct altera_uart *pp = container_of(port, struct altera_uart, port);
>> + unsigned long flags;
>> +
>> + spin_lock_irqsave(&port->lock, flags);
>> + pp->imr &= ~ALTERA_UART_CONTROL_RRDY_MSK;
>> + writel(pp->imr, port->membase + ALTERA_UART_CONTROL_REG);
>> + spin_unlock_irqrestore(&port->lock, flags);
>> +}
>
> Those four functions shouldn't grab port->lock because the caller in
> serial_core.c grabs it before calling them.

Oh, and that also applies to altera_uart_set_mctrl() - the caller grabs
port->lock before calling it.

--
-=( Ian Abbott @ MEV Ltd. E-mail: <abbotti@xxxxxxxxx> )=-
-=( Tel: +44 (0)161 477 1898 FAX: +44 (0)161 718 3587 )=-
--
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/