Re: [PATCH] tty: serial_core: Add mechanism to identify port closure.

Alan Cox
2012-04-23T10:07:22Z

> diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
> index 9c4c05b..c176ff2 100644
> --- a/drivers/tty/serial/serial_core.c
> +++ b/drivers/tty/serial/serial_core.c
> @@ -1426,6 +1426,9 @@ static void uart_port_shutdown(struct tty_port *port)
> */
> uport->ops->shutdown(uport);
>
> + if (uport->ops->set_wake)
> + uport->ops->set_wake(uport, false);
> +
> /*
> * Ensure that the IRQ handler isn't running on another CPU.
> */
> @@ -1512,6 +1515,9 @@ static int uart_open(struct tty_struct *tty,
> struct file *filp)
> goto err_dec_count;
> }
>
> + if (uport->ops->set_wake)
> + uport->ops->set_wake(uport, true);
> +
> /*
> * Make sure the device is in D0 state.
> */

This is probably the right approach for now. In the ideal world we should
probably use the struct device * and device power management but that is
a big upheaval and would mean fixing lots of other stuff first.

So this looks good to me - providing it doesn't break anything else.

Alan