Skip to contentSkip to conversation

delay always evaluates to 0

BUG ? Nicholas Mc Guire 2 participants 3 messages Jun 12, 2015 – Jun 15, 2015

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

Hi !

commit 2c86c275015c ("Add ipw2100 wireless driver.") introduced

drivers/net/wireless/ipw2100.c - line-numbers are from next-20150511 1410 static int ipw2100_hw_phy_off(struct ipw2100_priv *priv) 1411 {
1412
1413 #define HW_PHY_OFF_LOOP_DELAY (HZ / 5000)
1414
...
1437
1438 schedule_timeout_uninterruptible(HW_PHY_OFF_LOOP_DELAY);
1439 }

but (HZ / 5000) will evaluate to 0 for all configurable HZ values - typo ? and this schedule_timeout_uninterruptible() is probably not doing what is intended.

thx!
hofrat

#1 lore raw

Hi Nicholas,

Quoted 15 lines · Nicholas Mc Guire

Hi !

commit 2c86c275015c ("Add ipw2100 wireless driver.") introduced

drivers/net/wireless/ipw2100.c - line-numbers are from next-20150511 1410 static int ipw2100_hw_phy_off(struct ipw2100_priv *priv) 1411 {
1412
1413 #define HW_PHY_OFF_LOOP_DELAY (HZ / 5000)
1414
...
1437
1438 schedule_timeout_uninterruptible(HW_PHY_OFF_LOOP_DELAY);
1439 }

Quoted 3 lines

but (HZ / 5000) will evaluate to 0 for all configurable HZ values - typo ? and this schedule_timeout_uninterruptible() is probably not doing what is intended.

Yes, you are right. This is a bug. I think it should be:

-#define HW_PHY_OFF_LOOP_DELAY (HZ / 5000) +#define HW_PHY_OFF_LOOP_DELAY (msecs_to_jiffies(50))

Will you send us a patch?

Stanislav.

Quoted 3 lines

thx!
hofrat

#2 lore raw
Quoted 27 lines · Stanislav Yakovlev

Hi Nicholas,

Quoted 15 lines · Nicholas Mc Guire

Hi !

commit 2c86c275015c ("Add ipw2100 wireless driver.") introduced

drivers/net/wireless/ipw2100.c - line-numbers are from next-20150511 1410 static int ipw2100_hw_phy_off(struct ipw2100_priv *priv) 1411 {
1412
1413 #define HW_PHY_OFF_LOOP_DELAY (HZ / 5000)
1414
...
1437
1438 schedule_timeout_uninterruptible(HW_PHY_OFF_LOOP_DELAY);
1439 }

Quoted 3 lines

but (HZ / 5000) will evaluate to 0 for all configurable HZ values - typo ? and this schedule_timeout_uninterruptible() is probably not doing what is intended.

Yes, you are right. This is a bug. I think it should be:

(quoted diff) +1 -1
-#define HW_PHY_OFF_LOOP_DELAY (HZ / 5000)
+#define HW_PHY_OFF_LOOP_DELAY (msecs_to_jiffies(50))
Quoted 2 lines

Will you send us a patch?

just sent it out - thanks!

hofrat