* [PATCH 1/1] serial/uuc_uart: Set shutdown timeout to CONFIG_HZ independent 2ms
@ 2016-12-05 15:50 Alexander Stein
2016-12-05 16:04 ` Timur Tabi
0 siblings, 1 reply; 4+ messages in thread
From: Alexander Stein @ 2016-12-05 15:50 UTC (permalink / raw)
To: Timur Tabi, Greg Kroah-Hartman, Jiri Slaby
Cc: Alexander Stein, linuxppc-dev, linux-serial
schedule_timeout takes a timeout in jiffies resolution. So pass 2ms
as a converted jiffies value. This makes the timeout independent of
CONFIG_HZ.
Signed-off-by: Alexander Stein <alexander.stein@systec-electronic.com>
---
drivers/tty/serial/ucc_uart.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/tty/serial/ucc_uart.c b/drivers/tty/serial/ucc_uart.c
index 481eb29..c6c01a4 100644
--- a/drivers/tty/serial/ucc_uart.c
+++ b/drivers/tty/serial/ucc_uart.c
@@ -827,7 +827,7 @@ static void qe_uart_shutdown(struct uart_port *port)
break;
}
set_current_state(TASK_UNINTERRUPTIBLE);
- schedule_timeout(2);
+ schedule_timeout(msecs_to_jiffies(2));
}
if (qe_port->wait_closing) {
--
2.7.3
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 1/1] serial/uuc_uart: Set shutdown timeout to CONFIG_HZ independent 2ms
2016-12-05 15:50 [PATCH 1/1] serial/uuc_uart: Set shutdown timeout to CONFIG_HZ independent 2ms Alexander Stein
@ 2016-12-05 16:04 ` Timur Tabi
2016-12-06 7:36 ` Alexander Stein
0 siblings, 1 reply; 4+ messages in thread
From: Timur Tabi @ 2016-12-05 16:04 UTC (permalink / raw)
To: Alexander Stein, Greg Kroah-Hartman, Jiri Slaby
Cc: linuxppc-dev, linux-serial
Alexander Stein wrote:
> - schedule_timeout(2);
> + schedule_timeout(msecs_to_jiffies(2));
NACK.
So I don't remember why I wrote this code, but I don't think I was
expecting it to be 2ms. Instead, I think I just wanted it to be some
delay, but I believed that schedule_timeout(1) was too short or would be
"optimized" out somehow.
Note that right below this, I do:
if (qe_port->wait_closing) {
/* Wait a bit longer */
set_current_state(TASK_UNINTERRUPTIBLE);
schedule_timeout(qe_port->wait_closing);
}
And wait_closing is a number of jiffies, so I knew that
schedule_timeout() took jiffies as a parameter.
So I think I'm going to NACK this patch, since I believe I knew what I
was doing when I wrote it five years ago.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/1] serial/uuc_uart: Set shutdown timeout to CONFIG_HZ independent 2ms
2016-12-05 16:04 ` Timur Tabi
@ 2016-12-06 7:36 ` Alexander Stein
2016-12-06 13:35 ` Timur Tabi
0 siblings, 1 reply; 4+ messages in thread
From: Alexander Stein @ 2016-12-06 7:36 UTC (permalink / raw)
To: Timur Tabi; +Cc: Greg Kroah-Hartman, Jiri Slaby, linuxppc-dev, linux-serial
On Monday 05 December 2016 10:04:27, Timur Tabi wrote:
> Alexander Stein wrote:
> > - schedule_timeout(2);
> > + schedule_timeout(msecs_to_jiffies(2));
>
> NACK.
>
> So I don't remember why I wrote this code, but I don't think I was
> expecting it to be 2ms. Instead, I think I just wanted it to be some
> delay, but I believed that schedule_timeout(1) was too short or would be
> "optimized" out somehow.
>
> Note that right below this, I do:
>
> if (qe_port->wait_closing) {
> /* Wait a bit longer */
> set_current_state(TASK_UNINTERRUPTIBLE);
> schedule_timeout(qe_port->wait_closing);
> }
>
> And wait_closing is a number of jiffies, so I knew that
> schedule_timeout() took jiffies as a parameter.
>
> So I think I'm going to NACK this patch, since I believe I knew what I
> was doing when I wrote it five years ago.
Okay, I was just wondering why the timeout is dependant on the timer tick.
That didn't seem obvious to me.
Rethinking about this, I would rather replace those lines with msleep instead.
Best regards,
Alexander
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/1] serial/uuc_uart: Set shutdown timeout to CONFIG_HZ independent 2ms
2016-12-06 7:36 ` Alexander Stein
@ 2016-12-06 13:35 ` Timur Tabi
0 siblings, 0 replies; 4+ messages in thread
From: Timur Tabi @ 2016-12-06 13:35 UTC (permalink / raw)
To: Alexander Stein
Cc: Greg Kroah-Hartman, Jiri Slaby, linuxppc-dev, linux-serial
Alexander Stein wrote:
> Okay, I was just wondering why the timeout is dependant on the timer tick.
> That didn't seem obvious to me.
> Rethinking about this, I would rather replace those lines with msleep instead.
What's wrong with leaving it as-is? The code is five years old, and
Freescale/NXP barely uses the QE any more. I don't have access to any
hardware to test any changes you would propose.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-12-06 13:35 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-12-05 15:50 [PATCH 1/1] serial/uuc_uart: Set shutdown timeout to CONFIG_HZ independent 2ms Alexander Stein
2016-12-05 16:04 ` Timur Tabi
2016-12-06 7:36 ` Alexander Stein
2016-12-06 13:35 ` Timur Tabi
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).