Skip to contentSkip to conversation

irda/act200l-sir: replace schedule_timeout() with msleep()

PATCH In review [email protected] 3 participants 6 messages Sep 1, 2004

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/8 irda/act200l-sir: replace schedule_timeout() with msleep()

I would appreciate any comments from the janitor@sternweltens list.

Description: Replace schedule_timeout() with msleep() to guarantee the task delays for the desired time.

---

 linux-2.6.9-rc1-bk7-max/drivers/net/irda/act200l-sir.c |    3 +--
 1 files changed, 1 insertion(+), 2 deletions(-)
drivers/net/irda/act200l-sir.c renamed from drivers/net/irda/act200l-sir.c~msleep-drivers_net_irda_act200l-sir +1 -2
diff -puN drivers/net/irda/act200l-sir.c~msleep-drivers_net_irda_act200l-sir drivers/net/irda/act200l-sir.c
@@ -177,8 +177,7 @@ static int act200l_change_speed(struct s
 
 	/* Write control bytes */
 	sirdev_raw_write(dev, control, 3);
-	set_current_state(TASK_UNINTERRUPTIBLE);
-	schedule_timeout(msecs_to_jiffies(5));
+	msleep(5);
 
 	/* Go back to normal mode */
 	sirdev_set_dtr_rts(dev, TRUE, TRUE);

_

#1 lore raw
Quoted 7 lines · On Wed, Sep 01, 2004 at 11:05:23PM +0200, [email protected] wrote:

I would appreciate any comments from the janitor@sternweltens list.

I already commented that I don't like the confusing msleep()
API and I prefer the more explicit schedule_timeout().
But that's only me...

Jean

#2 lore raw
Quoted 2 lines · Jean Tourrilhes
Quoted 1 line · On Wed, Sep 01, 2004 at 11:05:23PM +0200, [email protected] wrote:

I would appreciate any comments from the janitor@sternweltens list.

uups mangled some text there sorry for this silly email.

Quoted 6 lines

I already commented that I don't like the confusing msleep()
API and I prefer the more explicit schedule_timeout().
But that's only me...

Jean

hmm we have still archs were HZ < 100.
i find msleep use msecs units a lot more readable than

	schedule_timeout((HZ + 99) / 100);

the schedule_timeout(HZ/100) gets safely converted with msleep.

--
maks
kernel janitor http://janitor.kernelnewbies.org/

_______________________________________________
Kernel-janitors mailing list
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors

#3 lore raw
Quoted 10 lines · maximilian attems
Quoted 2 lines · Jean Tourrilhes
Quoted 1 line · On Wed, Sep 01, 2004 at 11:05:23PM +0200, [email protected] wrote:

I would appreciate any comments from the janitor@sternweltens list.

uups mangled some text there sorry for this silly email.

Quoted 5 lines

I already commented that I don't like the confusing msleep()
API and I prefer the more explicit schedule_timeout().
But that's only me...

Quoted 7 lines
Quoted 1 line

Jean

hmm we have still archs were HZ < 100.
i find msleep use msecs units a lot more readable than

	schedule_timeout((HZ + 99) / 100);

the schedule_timeout(HZ/100) gets safely converted with msleep.

I don't have complain about converting the (HZ + 99) / 100
expressions to something saner. My beef is the fact that msleep hide the fact that a schedule might happen. This is important in the IrDA code.

Quoted 1 line

maks

Jean

_______________________________________________
Kernel-janitors mailing list
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors

#4 lore raw
Quoted 17 lines · Jean Tourrilhes
Quoted 16 lines · maximilian attems
Quoted 2 lines · Jean Tourrilhes
Quoted 1 line · On Wed, Sep 01, 2004 at 11:05:23PM +0200, [email protected] wrote:

I would appreciate any comments from the janitor@sternweltens list.

uups mangled some text there sorry for this silly email.

Quoted 6 lines

I already commented that I don't like the confusing msleep()
API and I prefer the more explicit schedule_timeout().
But that's only me...

Jean

hmm we have still archs were HZ < 100.
i find msleep use msecs units a lot more readable than

	schedule_timeout((HZ + 99) / 100);
Quoted 6 lines
Quoted 1 line

the schedule_timeout(HZ/100) gets safely converted with msleep.

I don't have complain about converting the (HZ + 99) / 100
expressions to something saner. My beef is the fact that msleep hide the fact that a schedule might happen. This is important in the IrDA code.

It *is* important for developers to realize that invoking msleep() may involve giving up the CPU (ie. eventually calling schedule()); however, I think my previous point, that the name itself (the "sleep" part, I mean) is a fair and clear indication of this behavior, is valid. In those cases where a busy-wait is desired, then mdelay() should be used, as indicated by "delay". I think with this in mind & with a quick glance at the source, if need be, the naming is quite safe.

-Nish

_______________________________________________
Kernel-janitors mailing list
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors

#5 lore raw
In reply to Jean Tourrilhes
Quoted 2 lines · Jean Tourrilhes
Quoted 1 line · maximilian attems

On Wed, 01 Sep 2004, Jean Tourrilhes wrote:

..

Quoted 11 lines
Quoted 6 lines

hmm we have still archs were HZ < 100.
i find msleep use msecs units a lot more readable than

	schedule_timeout((HZ + 99) / 100);

the schedule_timeout(HZ/100) gets safely converted with msleep.

I don't have complain about converting the (HZ + 99) / 100
expressions to something saner. My beef is the fact that msleep hide the fact that a schedule might happen. This is important in the IrDA code.

sorry my woding was confusing:
(HZ + 99) / 100 is correct!
as msleep(10)

--
maks
kernel janitor http://janitor.kernelnewbies.org/

_______________________________________________
Kernel-janitors mailing list
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors