Commit 607ea032 authored by Sergei Shtylyov's avatar Sergei Shtylyov Committed by David S. Miller

sh_eth: simplify sh_eth_check_reset()

The *while* loop in this function  can be turned into a normal *for* loop.
And getting rid  of the  single return point saves us a few more LoCs...
Signed-off-by: default avatarSergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Reviewed-by: default avatarGeert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent c088165d
...@@ -962,20 +962,16 @@ static void sh_eth_set_default_cpu_data(struct sh_eth_cpu_data *cd) ...@@ -962,20 +962,16 @@ static void sh_eth_set_default_cpu_data(struct sh_eth_cpu_data *cd)
static int sh_eth_check_reset(struct net_device *ndev) static int sh_eth_check_reset(struct net_device *ndev)
{ {
int ret = 0; int cnt;
int cnt = 100;
while (cnt > 0) { for (cnt = 100; cnt > 0; cnt--) {
if (!(sh_eth_read(ndev, EDMR) & EDMR_SRST_GETHER)) if (!(sh_eth_read(ndev, EDMR) & EDMR_SRST_GETHER))
break; return 0;
mdelay(1); mdelay(1);
cnt--;
}
if (cnt <= 0) {
netdev_err(ndev, "Device reset failed\n");
ret = -ETIMEDOUT;
} }
return ret;
netdev_err(ndev, "Device reset failed\n");
return -ETIMEDOUT;
} }
static int sh_eth_reset(struct net_device *ndev) static int sh_eth_reset(struct net_device *ndev)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment