Skip to content

Commit bca1a95

Browse files
yegorichgregkh
authored andcommitted
can: ti_hecc: add missing prepare and unprepare of the clock
commit befa60113ce7ea270cb51eada28443ca2756f480 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: Yegor Yefremov <yegorslists@googlemail.com> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 63fe33a commit bca1a95

1 file changed

Lines changed: 12 additions & 4 deletions

File tree

drivers/net/can/ti_hecc.c

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -948,7 +948,12 @@ static int ti_hecc_probe(struct platform_device *pdev)
948948
netif_napi_add(ndev, &priv->napi, ti_hecc_rx_poll,
949949
HECC_DEF_NAPI_WEIGHT);
950950

951-
clk_enable(priv->clk);
951+
err = clk_prepare_enable(priv->clk);
952+
if (err) {
953+
dev_err(&pdev->dev, "clk_prepare_enable() failed\n");
954+
goto probe_exit_clk;
955+
}
956+
952957
err = register_candev(ndev);
953958
if (err) {
954959
dev_err(&pdev->dev, "register_candev() failed\n");
@@ -981,7 +986,7 @@ static int ti_hecc_remove(struct platform_device *pdev)
981986
struct ti_hecc_priv *priv = netdev_priv(ndev);
982987

983988
unregister_candev(ndev);
984-
clk_disable(priv->clk);
989+
clk_disable_unprepare(priv->clk);
985990
clk_put(priv->clk);
986991
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
987992
iounmap(priv->base);
@@ -1006,7 +1011,7 @@ static int ti_hecc_suspend(struct platform_device *pdev, pm_message_t state)
10061011
hecc_set_bit(priv, HECC_CANMC, HECC_CANMC_PDR);
10071012
priv->can.state = CAN_STATE_SLEEPING;
10081013

1009-
clk_disable(priv->clk);
1014+
clk_disable_unprepare(priv->clk);
10101015

10111016
return 0;
10121017
}
@@ -1015,8 +1020,11 @@ static int ti_hecc_resume(struct platform_device *pdev)
10151020
{
10161021
struct net_device *dev = platform_get_drvdata(pdev);
10171022
struct ti_hecc_priv *priv = netdev_priv(dev);
1023+
int err;
10181024

1019-
clk_enable(priv->clk);
1025+
err = clk_prepare_enable(priv->clk);
1026+
if (err)
1027+
return err;
10201028

10211029
hecc_clear_bit(priv, HECC_CANMC, HECC_CANMC_PDR);
10221030
priv->can.state = CAN_STATE_ERROR_ACTIVE;

0 commit comments

Comments
 (0)