2005-03-06 23:49:35

by Domen Puncer

[permalink] [raw]
Subject: [patch 10/14] serial/crisv10: replace schedule_timeout() with msleep()




Use msleep() instead of schedule_timeout() to guarantee the task
delays as expected. The current code uses TASK_INTERRUPTIBLE, but does not care
about signals, so I believe msleep() should be ok.

Signed-off-by: Nishanth Aravamudan <[email protected]>
Signed-off-by: Domen Puncer <[email protected]>
---


kj-domen/drivers/serial/crisv10.c | 6 ++----
1 files changed, 2 insertions(+), 4 deletions(-)

diff -puN drivers/serial/crisv10.c~msleep-drivers_serial_crisv10 drivers/serial/crisv10.c
--- kj/drivers/serial/crisv10.c~msleep-drivers_serial_crisv10 2005-03-05 16:10:52.000000000 +0100
+++ kj-domen/drivers/serial/crisv10.c 2005-03-05 16:10:52.000000000 +0100
@@ -3757,10 +3757,8 @@ rs_write(struct tty_struct * tty, int fr
e100_enable_rx_irq(info);
#endif

- if (info->rs485.delay_rts_before_send > 0) {
- set_current_state(TASK_INTERRUPTIBLE);
- schedule_timeout((info->rs485.delay_rts_before_send * HZ)/1000);
- }
+ if (info->rs485.delay_rts_before_send > 0)
+ msleep(info->rs485.delay_rts_before_send);
}
#endif /* CONFIG_ETRAX_RS485 */

_


2005-03-07 03:36:56

by Andrew Morton

[permalink] [raw]
Subject: Re: [patch 10/14] serial/crisv10: replace schedule_timeout() with msleep()

[email protected] wrote:
>
> Use msleep() instead of schedule_timeout() to guarantee the task
> delays as expected. The current code uses TASK_INTERRUPTIBLE, but does not care
> about signals, so I believe msleep() should be ok.
>
> Signed-off-by: Nishanth Aravamudan <[email protected]>
> Signed-off-by: Domen Puncer <[email protected]>
> ---
>
>
> kj-domen/drivers/serial/crisv10.c | 6 ++----
> 1 files changed, 2 insertions(+), 4 deletions(-)
>
> diff -puN drivers/serial/crisv10.c~msleep-drivers_serial_crisv10 drivers/serial/crisv10.c
> --- kj/drivers/serial/crisv10.c~msleep-drivers_serial_crisv10 2005-03-05 16:10:52.000000000 +0100
> +++ kj-domen/drivers/serial/crisv10.c 2005-03-05 16:10:52.000000000 +0100
> @@ -3757,10 +3757,8 @@ rs_write(struct tty_struct * tty, int fr
> e100_enable_rx_irq(info);
> #endif
>
> - if (info->rs485.delay_rts_before_send > 0) {
> - set_current_state(TASK_INTERRUPTIBLE);
> - schedule_timeout((info->rs485.delay_rts_before_send * HZ)/1000);
> - }
> + if (info->rs485.delay_rts_before_send > 0)
> + msleep(info->rs485.delay_rts_before_send);

Behavioural change: we'll no longer break out of the sleep if a signal is
pending. Which probably means you fixed a bug ;)

Please work it with Mikael.

2005-03-07 08:13:47

by Mikael Starvik

[permalink] [raw]
Subject: RE: [patch 10/14] serial/crisv10: replace schedule_timeout() with msleep()

Yes, that is correct. Please apply.

Acked-by: Mikael Starvik <[email protected]>

-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Andrew Morton
Sent: Monday, March 07, 2005 4:36 AM
To: [email protected]
Cc: [email protected]; [email protected]; [email protected];
Mikael Starvik
Subject: Re: [patch 10/14] serial/crisv10: replace schedule_timeout() with
msleep()


[email protected] wrote:
>
> Use msleep() instead of schedule_timeout() to guarantee the task
> delays as expected. The current code uses TASK_INTERRUPTIBLE, but does
not care
> about signals, so I believe msleep() should be ok.
>
> Signed-off-by: Nishanth Aravamudan <[email protected]>
> Signed-off-by: Domen Puncer <[email protected]>
> ---
>
>
> kj-domen/drivers/serial/crisv10.c | 6 ++----
> 1 files changed, 2 insertions(+), 4 deletions(-)
>
> diff -puN drivers/serial/crisv10.c~msleep-drivers_serial_crisv10
drivers/serial/crisv10.c
> --- kj/drivers/serial/crisv10.c~msleep-drivers_serial_crisv10
2005-03-05 16:10:52.000000000 +0100
> +++ kj-domen/drivers/serial/crisv10.c 2005-03-05
16:10:52.000000000 +0100
> @@ -3757,10 +3757,8 @@ rs_write(struct tty_struct * tty, int fr
> e100_enable_rx_irq(info);
> #endif
>
> - if (info->rs485.delay_rts_before_send > 0) {
> - set_current_state(TASK_INTERRUPTIBLE);
> - schedule_timeout((info->rs485.delay_rts_before_send
* HZ)/1000);
> - }
> + if (info->rs485.delay_rts_before_send > 0)
> + msleep(info->rs485.delay_rts_before_send);

Behavioural change: we'll no longer break out of the sleep if a signal is
pending. Which probably means you fixed a bug ;)

Please work it with Mikael.