linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] serial: core: stop passing NULL in uart_resume_port
@ 2018-07-25 10:04 Chen Hu
  2018-07-25 22:01 ` Andy Shevchenko
  0 siblings, 1 reply; 4+ messages in thread
From: Chen Hu @ 2018-07-25 10:04 UTC (permalink / raw)
  Cc: Chen Hu, Greg Kroah-Hartman, Jiri Slaby, linux-serial, linux-kernel

We found the baud rate is changed after S3 on some Intel Broxton
platforms. The baud rate should be restored during resume. However, some
set_termios() callback such as dw8250_set_termios() for DesignWare 8250
will skip setting if old termios is NULL. We address this issue via
passing a dummy.

Signed-off-by: Chen Hu <hu1.chen@intel.com>
---
 drivers/tty/serial/serial_core.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
index f02965936f2e..8b815f1539e8 100644
--- a/drivers/tty/serial/serial_core.c
+++ b/drivers/tty/serial/serial_core.c
@@ -2217,6 +2217,7 @@ int uart_resume_port(struct uart_driver *drv, struct uart_port *uport)
 	struct device *tty_dev;
 	struct uart_match match = {uport, drv};
 	struct ktermios termios;
+	static struct ktermios dummy;
 
 	mutex_lock(&port->mutex);
 
@@ -2277,7 +2278,7 @@ int uart_resume_port(struct uart_driver *drv, struct uart_port *uport)
 			pm_runtime_put_autosuspend(uport->dev);
 			if (ret == 0) {
 				if (tty)
-					uart_change_speed(tty, state, NULL);
+					uart_change_speed(tty, state, &dummy);
 				pm_runtime_get_sync(uport->dev);
 				spin_lock_irq(&uport->lock);
 				ops->set_mctrl(uport, uport->mctrl);
-- 
2.13.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] serial: core: stop passing NULL in uart_resume_port
  2018-07-25 10:04 [PATCH] serial: core: stop passing NULL in uart_resume_port Chen Hu
@ 2018-07-25 22:01 ` Andy Shevchenko
  2018-07-26  9:36   ` Chen Hu
  0 siblings, 1 reply; 4+ messages in thread
From: Andy Shevchenko @ 2018-07-25 22:01 UTC (permalink / raw)
  To: Chen Hu
  Cc: Greg Kroah-Hartman, Jiri Slaby, open list:SERIAL DRIVERS,
	Linux Kernel Mailing List

On Wed, Jul 25, 2018 at 1:04 PM, Chen Hu <hu1.chen@intel.com> wrote:
> We found the baud rate is changed after S3 on some Intel Broxton
> platforms. The baud rate should be restored during resume. However, some
> set_termios() callback such as dw8250_set_termios() for DesignWare 8250
> will skip setting if old termios is NULL. We address this issue via
> passing a dummy.

Why does it need to be "fixed" here then?

>
> Signed-off-by: Chen Hu <hu1.chen@intel.com>
> ---
>  drivers/tty/serial/serial_core.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
> index f02965936f2e..8b815f1539e8 100644
> --- a/drivers/tty/serial/serial_core.c
> +++ b/drivers/tty/serial/serial_core.c
> @@ -2217,6 +2217,7 @@ int uart_resume_port(struct uart_driver *drv, struct uart_port *uport)
>         struct device *tty_dev;
>         struct uart_match match = {uport, drv};
>         struct ktermios termios;
> +       static struct ktermios dummy;
>
>         mutex_lock(&port->mutex);
>
> @@ -2277,7 +2278,7 @@ int uart_resume_port(struct uart_driver *drv, struct uart_port *uport)
>                         pm_runtime_put_autosuspend(uport->dev);
>                         if (ret == 0) {
>                                 if (tty)
> -                                       uart_change_speed(tty, state, NULL);
> +                                       uart_change_speed(tty, state, &dummy);
>                                 pm_runtime_get_sync(uport->dev);
>                                 spin_lock_irq(&uport->lock);
>                                 ops->set_mctrl(uport, uport->mctrl);
> --
> 2.13.0
>



-- 
With Best Regards,
Andy Shevchenko

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] serial: core: stop passing NULL in uart_resume_port
  2018-07-25 22:01 ` Andy Shevchenko
@ 2018-07-26  9:36   ` Chen Hu
  2018-07-26 14:04     ` Andy Shevchenko
  0 siblings, 1 reply; 4+ messages in thread
From: Chen Hu @ 2018-07-26  9:36 UTC (permalink / raw)
  To: andy.shevchenko
  Cc: Chen Hu, Greg Kroah-Hartman, Jiri Slaby, linux-serial, linux-kernel


Hi Andy,
Thanks the feedback.

Is it better to modify the DesignWare 8250 driver directly? Or do you think is this really an issue?

Thanks
Chen Hu

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] serial: core: stop passing NULL in uart_resume_port
  2018-07-26  9:36   ` Chen Hu
@ 2018-07-26 14:04     ` Andy Shevchenko
  0 siblings, 0 replies; 4+ messages in thread
From: Andy Shevchenko @ 2018-07-26 14:04 UTC (permalink / raw)
  To: Chen Hu
  Cc: Greg Kroah-Hartman, Jiri Slaby, open list:SERIAL DRIVERS,
	Linux Kernel Mailing List

On Thu, Jul 26, 2018 at 12:36 PM, Chen Hu <hu1.chen@intel.com> wrote:
> Is it better to modify the DesignWare 8250 driver directly? Or do you think is this really an issue?

I have checked all of the users of do_termios in 8250 and only DW
bails out on old == NULL.

So, send a patch against 8250_dw with detailed explanation why it's
wrong (use case, examples of wrong output, etc) and how you fix it.
Describe any potential side effects (b/c it's a new behaviour).


-- 
With Best Regards,
Andy Shevchenko

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-07-26 14:04 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-25 10:04 [PATCH] serial: core: stop passing NULL in uart_resume_port Chen Hu
2018-07-25 22:01 ` Andy Shevchenko
2018-07-26  9:36   ` Chen Hu
2018-07-26 14:04     ` Andy Shevchenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).