commit: http://blackfin.uclinux.org/git/?p=linux-kernel;a=commitdiff;h=b1216abd7db77182747a37a5de1c23d737ff376b
branch: http://blackfin.uclinux.org/git/?p=linux-kernel;a=shortlog;h=refs/heads/trunk

stmmac driver for blackfin platform didn't support clk api.

Before kernel update to 3.7, stammc driver use function
stmmac_clk_enable/disable which will check IS_ERR(priv->stmmac_clk).

But now stammc driver use clk api directly which can't work on blackfin
platform.

This patch work around this issue by adding IS_ERR() check back.

Signed-off-by: Bob Liu <[email protected]>
---
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c |   25 ++++++++++++++------
 1 files changed, 17 insertions(+), 8 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 40cb360..61c34ae 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -1435,7 +1435,8 @@ static int stmmac_open(struct net_device *dev)
 	} else
 		priv->tm->enable = 1;
 #endif
-	clk_prepare_enable(priv->stmmac_clk);
+	if (!IS_ERR(priv->stmmac_clk))
+		clk_prepare_enable(priv->stmmac_clk);
 
 	stmmac_check_ether_addr(priv);
 
@@ -1556,7 +1557,8 @@ open_error:
 	if (priv->phydev)
 		phy_disconnect(priv->phydev);
 
-	clk_disable_unprepare(priv->stmmac_clk);
+	if (!IS_ERR(priv->stmmac_clk))
+		clk_disable_unprepare(priv->stmmac_clk);
 
 	return ret;
 }
@@ -1613,7 +1615,8 @@ static int stmmac_release(struct net_device *dev)
 #ifdef CONFIG_STMMAC_DEBUG_FS
 	stmmac_exit_fs();
 #endif
-	clk_disable_unprepare(priv->stmmac_clk);
+	if (!IS_ERR(priv->stmmac_clk))
+		clk_disable_unprepare(priv->stmmac_clk);
 
 	return 0;
 }
@@ -2458,9 +2461,11 @@ struct stmmac_priv *stmmac_dvr_probe(struct device *device,
 	priv->stmmac_clk = clk_get(priv->device, STMMAC_RESOURCE_NAME);
 	if (IS_ERR(priv->stmmac_clk)) {
 		pr_warning("%s: warning: cannot get CSR clock\n", __func__);
+#ifdef CONFIG_BF60x
+	}
+#else
 		goto error_clk_get;
 	}
-
 	/* If a specific clk_csr value is passed from the platform
 	 * this means that the CSR Clock Range selection cannot be
 	 * changed at run-time and it is fixed. Viceversa the driver'll try to
@@ -2471,6 +2476,7 @@ struct stmmac_priv *stmmac_dvr_probe(struct device *device,
 		stmmac_clk_csr_set(priv);
 	else
 		priv->clk_csr = priv->plat->clk_csr;
+#endif
 
 	/* MDIO bus Registration */
 	ret = stmmac_mdio_register(ndev);
@@ -2556,7 +2562,8 @@ int stmmac_suspend(struct net_device *ndev)
 	else {
 		stmmac_set_mac(priv->ioaddr, false);
 		/* Disable clock in case of PWM is off */
-		clk_disable_unprepare(priv->stmmac_clk);
+		if (!IS_ERR(priv->stmmac_clk))
+			clk_disable_unprepare(priv->stmmac_clk);
 	}
 	spin_unlock_irqrestore(&priv->lock, flags);
 	return 0;
@@ -2579,9 +2586,11 @@ int stmmac_resume(struct net_device *ndev)
 	 * from another devices (e.g. serial console). */
 	if (device_may_wakeup(priv->device))
 		priv->hw->mac->pmt(priv->ioaddr, 0);
-	else
-		/* enable the clk prevously disabled */
-		clk_prepare_enable(priv->stmmac_clk);
+	else {
+		if (!IS_ERR(priv->stmmac_clk))
+			/* enable the clk prevously disabled */
+			clk_prepare_enable(priv->stmmac_clk);
+	}
 
 	netif_device_attach(ndev);
 	priv->dirty_tx = 0;
_______________________________________________
Linux-kernel-commits mailing list
[email protected]
https://blackfin.uclinux.org/mailman/listinfo/linux-kernel-commits

Reply via email to