Re: [PATCH 1/2] tty: serial_core: convert uart_open to use tty_port_open

From: One Thousand Gnomes
Date: Wed Aug 24 2016 - 09:49:49 EST


On Mon, 22 Aug 2016 17:39:09 -0500
Rob Herring <robh@xxxxxxxxxx> wrote:

> tty_port_open handles much of the common parts of tty opening. Convert
> uart_open to use it and move the serial_core specific parts into
> tty_port.activate function. This will be needed to use tty_port functions
> directly from in kernel clients.
>
> The tricky part is uart_port_startup can return positive values to allow
> setserial to configure the port. We now return the positive value to
> tty_port_open so that the tty is not marked as initialized and then set the
> return value in uart_open to 0.
>
> Cc: Alan Cox <alan@xxxxxxxxxxxxxxx>
> Cc: Peter Hurley <peter@xxxxxxxxxxxxxxxxxx>
> Signed-off-by: Rob Herring <robh@xxxxxxxxxx>
> ---
> In looking at using tty_port for uart slaves, this is the first thing I
> hit. serial_core doesn't even use the 2 functions that already exist for
> tty_port and are needed.
>
> I've tested this on QEMU with pl011 and 8250 UARTs using setserial, but
> I'm not sure what are all the tricky cases to handle.
>
> Greg, Don't apply these without comment from Alan and Peter.

Originally I didn't convert them because the lockign was incompatible.
That looks to have been fixed by other changes. This is definitely the
right direction irrespective of the uart slave discussion.

Acked-by: Alan Cox <alan@xxxxxxxxxxxxxxx>