Skip to content

Commit

Permalink
sh_eth: simplify sh_eth_check_reset()
Browse files Browse the repository at this point in the history
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: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Sergei Shtylyov authored and David S. Miller committed Feb 19, 2018
1 parent c088165 commit 607ea03
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions drivers/net/ethernet/renesas/sh_eth.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
int ret = 0;
int cnt = 100;
int cnt;

while (cnt > 0) {
for (cnt = 100; cnt > 0; cnt--) {
if (!(sh_eth_read(ndev, EDMR) & EDMR_SRST_GETHER))
break;
return 0;
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)
Expand Down

0 comments on commit 607ea03

Please sign in to comment.