Skip to content

Commit

Permalink
net: jme: Replace mdelay() with msleep() and usleep_range() in jme_wa…
Browse files Browse the repository at this point in the history
…it_link()

jme_wait_link() is never called in atomic context.
It calls mdelay() to busily wait, which is not necessary.
mdelay() can be replaced with msleep() and usleep_range().

This is found by a static analysis tool named DCNS written by myself.

Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Jia-Ju Bai authored and David S. Miller committed Jul 27, 2018
1 parent 89036f2 commit d818c59
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/net/ethernet/jme.c
Original file line number Diff line number Diff line change
Expand Up @@ -1911,10 +1911,10 @@ jme_wait_link(struct jme_adapter *jme)
{
u32 phylink, to = JME_WAIT_LINK_TIME;

mdelay(1000);
msleep(1000);
phylink = jme_linkstat_from_phy(jme);
while (!(phylink & PHY_LINK_UP) && (to -= 10) > 0) {
mdelay(10);
usleep_range(10000, 11000);
phylink = jme_linkstat_from_phy(jme);
}
}
Expand Down

0 comments on commit d818c59

Please sign in to comment.