Skip to content

Commit

Permalink
net: bcmgenet: propagate errors from bcmgenet_power_down
Browse files Browse the repository at this point in the history
If bcmgenet_power_down() fails, we would want to propagate a return
value from bcmgenet_wol_power_down_cfg() to know about this.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Florian Fainelli authored and David S. Miller committed Mar 24, 2015
1 parent cc330b5 commit ca8cf34
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions drivers/net/ethernet/broadcom/genet/bcmgenet.c
Original file line number Diff line number Diff line change
Expand Up @@ -847,9 +847,10 @@ static struct ethtool_ops bcmgenet_ethtool_ops = {
};

/* Power down the unimac, based on mode. */
static void bcmgenet_power_down(struct bcmgenet_priv *priv,
static int bcmgenet_power_down(struct bcmgenet_priv *priv,
enum bcmgenet_power_mode mode)
{
int ret = 0;
u32 reg;

switch (mode) {
Expand All @@ -858,7 +859,7 @@ static void bcmgenet_power_down(struct bcmgenet_priv *priv,
break;

case GENET_POWER_WOL_MAGIC:
bcmgenet_wol_power_down_cfg(priv, mode);
ret = bcmgenet_wol_power_down_cfg(priv, mode);
break;

case GENET_POWER_PASSIVE:
Expand All @@ -873,6 +874,8 @@ static void bcmgenet_power_down(struct bcmgenet_priv *priv,
default:
break;
}

return 0;
}

static void bcmgenet_power_up(struct bcmgenet_priv *priv,
Expand Down Expand Up @@ -2606,12 +2609,12 @@ static int bcmgenet_close(struct net_device *dev)
free_irq(priv->irq1, priv);

if (phy_is_internal(priv->phydev))
bcmgenet_power_down(priv, GENET_POWER_PASSIVE);
ret = bcmgenet_power_down(priv, GENET_POWER_PASSIVE);

if (!IS_ERR(priv->clk))
clk_disable_unprepare(priv->clk);

return 0;
return ret;
}

static void bcmgenet_timeout(struct net_device *dev)
Expand Down Expand Up @@ -3097,14 +3100,14 @@ static int bcmgenet_suspend(struct device *d)

/* Prepare the device for Wake-on-LAN and switch to the slow clock */
if (device_may_wakeup(d) && priv->wolopts) {
bcmgenet_power_down(priv, GENET_POWER_WOL_MAGIC);
ret = bcmgenet_power_down(priv, GENET_POWER_WOL_MAGIC);
clk_prepare_enable(priv->clk_wol);
}

/* Turn off the clocks */
clk_disable_unprepare(priv->clk);

return 0;
return ret;
}

static int bcmgenet_resume(struct device *d)
Expand Down

0 comments on commit ca8cf34

Please sign in to comment.