Commit 2adddc0a authored by Yegor Yefremov's avatar Yegor Yefremov Committed by Willy Tarreau

can: ti_hecc: add missing prepare and unprepare of the clock

commit befa6011 upstream.

In order to make the driver work with the common clock framework, this
patch converts the clk_enable()/clk_disable() to
clk_prepare_enable()/clk_disable_unprepare().

Also add error checking for clk_prepare_enable().
Signed-off-by: default avatarYegor Yefremov <yegorslists@googlemail.com>
Signed-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: default avatarWilly Tarreau <w@1wt.eu>
parent 165cc033
...@@ -962,7 +962,12 @@ static int ti_hecc_probe(struct platform_device *pdev) ...@@ -962,7 +962,12 @@ static int ti_hecc_probe(struct platform_device *pdev)
netif_napi_add(ndev, &priv->napi, ti_hecc_rx_poll, netif_napi_add(ndev, &priv->napi, ti_hecc_rx_poll,
HECC_DEF_NAPI_WEIGHT); HECC_DEF_NAPI_WEIGHT);
clk_enable(priv->clk); err = clk_prepare_enable(priv->clk);
if (err) {
dev_err(&pdev->dev, "clk_prepare_enable() failed\n");
goto probe_exit_clk;
}
err = register_candev(ndev); err = register_candev(ndev);
if (err) { if (err) {
dev_err(&pdev->dev, "register_candev() failed\n"); dev_err(&pdev->dev, "register_candev() failed\n");
...@@ -995,7 +1000,7 @@ static int ti_hecc_remove(struct platform_device *pdev) ...@@ -995,7 +1000,7 @@ static int ti_hecc_remove(struct platform_device *pdev)
struct ti_hecc_priv *priv = netdev_priv(ndev); struct ti_hecc_priv *priv = netdev_priv(ndev);
unregister_candev(ndev); unregister_candev(ndev);
clk_disable(priv->clk); clk_disable_unprepare(priv->clk);
clk_put(priv->clk); clk_put(priv->clk);
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
iounmap(priv->base); iounmap(priv->base);
...@@ -1021,7 +1026,7 @@ static int ti_hecc_suspend(struct platform_device *pdev, pm_message_t state) ...@@ -1021,7 +1026,7 @@ static int ti_hecc_suspend(struct platform_device *pdev, pm_message_t state)
hecc_set_bit(priv, HECC_CANMC, HECC_CANMC_PDR); hecc_set_bit(priv, HECC_CANMC, HECC_CANMC_PDR);
priv->can.state = CAN_STATE_SLEEPING; priv->can.state = CAN_STATE_SLEEPING;
clk_disable(priv->clk); clk_disable_unprepare(priv->clk);
return 0; return 0;
} }
...@@ -1030,8 +1035,11 @@ static int ti_hecc_resume(struct platform_device *pdev) ...@@ -1030,8 +1035,11 @@ static int ti_hecc_resume(struct platform_device *pdev)
{ {
struct net_device *dev = platform_get_drvdata(pdev); struct net_device *dev = platform_get_drvdata(pdev);
struct ti_hecc_priv *priv = netdev_priv(dev); struct ti_hecc_priv *priv = netdev_priv(dev);
int err;
clk_enable(priv->clk); err = clk_prepare_enable(priv->clk);
if (err)
return err;
hecc_clear_bit(priv, HECC_CANMC, HECC_CANMC_PDR); hecc_clear_bit(priv, HECC_CANMC, HECC_CANMC_PDR);
priv->can.state = CAN_STATE_ERROR_ACTIVE; priv->can.state = CAN_STATE_ERROR_ACTIVE;
......
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