All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] can: ti_hecc: add missing prepare and unprepare of the clock
@ 2017-01-18  9:43 yegorslists
  2017-01-18 10:01 ` Marc Kleine-Budde
  0 siblings, 1 reply; 3+ messages in thread
From: yegorslists @ 2017-01-18  9:43 UTC (permalink / raw)
  To: linux-can; +Cc: netdev, mkl, wg, Yegor Yefremov

From: Yegor Yefremov <yegorslists@googlemail.com>

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().

Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
---
 drivers/net/can/ti_hecc.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/net/can/ti_hecc.c b/drivers/net/can/ti_hecc.c
index 680d1ff..0448cb5 100644
--- a/drivers/net/can/ti_hecc.c
+++ b/drivers/net/can/ti_hecc.c
@@ -948,7 +948,8 @@ static int ti_hecc_probe(struct platform_device *pdev)
 	netif_napi_add(ndev, &priv->napi, ti_hecc_rx_poll,
 		HECC_DEF_NAPI_WEIGHT);
 
-	clk_enable(priv->clk);
+	clk_prepare_enable(priv->clk);
+
 	err = register_candev(ndev);
 	if (err) {
 		dev_err(&pdev->dev, "register_candev() failed\n");
@@ -981,7 +982,7 @@ static int ti_hecc_remove(struct platform_device *pdev)
 	struct ti_hecc_priv *priv = netdev_priv(ndev);
 
 	unregister_candev(ndev);
-	clk_disable(priv->clk);
+	clk_disable_unprepare(priv->clk);
 	clk_put(priv->clk);
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	iounmap(priv->base);
@@ -1006,7 +1007,7 @@ static int ti_hecc_suspend(struct platform_device *pdev, pm_message_t state)
 	hecc_set_bit(priv, HECC_CANMC, HECC_CANMC_PDR);
 	priv->can.state = CAN_STATE_SLEEPING;
 
-	clk_disable(priv->clk);
+	clk_disable_unprepare(priv->clk);
 
 	return 0;
 }
@@ -1016,7 +1017,7 @@ static int ti_hecc_resume(struct platform_device *pdev)
 	struct net_device *dev = platform_get_drvdata(pdev);
 	struct ti_hecc_priv *priv = netdev_priv(dev);
 
-	clk_enable(priv->clk);
+	clk_prepare_enable(priv->clk);
 
 	hecc_clear_bit(priv, HECC_CANMC, HECC_CANMC_PDR);
 	priv->can.state = CAN_STATE_ERROR_ACTIVE;
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] can: ti_hecc: add missing prepare and unprepare of the clock
  2017-01-18  9:43 [PATCH] can: ti_hecc: add missing prepare and unprepare of the clock yegorslists
@ 2017-01-18 10:01 ` Marc Kleine-Budde
  2017-01-18 10:05   ` Yegor Yefremov
  0 siblings, 1 reply; 3+ messages in thread
From: Marc Kleine-Budde @ 2017-01-18 10:01 UTC (permalink / raw)
  To: yegorslists, linux-can; +Cc: netdev, wg


[-- Attachment #1.1: Type: text/plain, Size: 2352 bytes --]

On 01/18/2017 10:43 AM, yegorslists@googlemail.com wrote:
> From: Yegor Yefremov <yegorslists@googlemail.com>
> 
> 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().
> 

Can you add the missing error checking for the prepare_enable call?

Marc

> Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
> ---
>  drivers/net/can/ti_hecc.c | 9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/net/can/ti_hecc.c b/drivers/net/can/ti_hecc.c
> index 680d1ff..0448cb5 100644
> --- a/drivers/net/can/ti_hecc.c
> +++ b/drivers/net/can/ti_hecc.c
> @@ -948,7 +948,8 @@ static int ti_hecc_probe(struct platform_device *pdev)
>  	netif_napi_add(ndev, &priv->napi, ti_hecc_rx_poll,
>  		HECC_DEF_NAPI_WEIGHT);
>  
> -	clk_enable(priv->clk);
> +	clk_prepare_enable(priv->clk);
> +
>  	err = register_candev(ndev);
>  	if (err) {
>  		dev_err(&pdev->dev, "register_candev() failed\n");
> @@ -981,7 +982,7 @@ static int ti_hecc_remove(struct platform_device *pdev)
>  	struct ti_hecc_priv *priv = netdev_priv(ndev);
>  
>  	unregister_candev(ndev);
> -	clk_disable(priv->clk);
> +	clk_disable_unprepare(priv->clk);
>  	clk_put(priv->clk);
>  	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>  	iounmap(priv->base);
> @@ -1006,7 +1007,7 @@ static int ti_hecc_suspend(struct platform_device *pdev, pm_message_t state)
>  	hecc_set_bit(priv, HECC_CANMC, HECC_CANMC_PDR);
>  	priv->can.state = CAN_STATE_SLEEPING;
>  
> -	clk_disable(priv->clk);
> +	clk_disable_unprepare(priv->clk);
>  
>  	return 0;
>  }
> @@ -1016,7 +1017,7 @@ static int ti_hecc_resume(struct platform_device *pdev)
>  	struct net_device *dev = platform_get_drvdata(pdev);
>  	struct ti_hecc_priv *priv = netdev_priv(dev);
>  
> -	clk_enable(priv->clk);
> +	clk_prepare_enable(priv->clk);
>  
>  	hecc_clear_bit(priv, HECC_CANMC, HECC_CANMC_PDR);
>  	priv->can.state = CAN_STATE_ERROR_ACTIVE;
> 


-- 
Pengutronix e.K.                  | Marc Kleine-Budde           |
Industrial Linux Solutions        | Phone: +49-231-2826-924     |
Vertretung West/Dortmund          | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] can: ti_hecc: add missing prepare and unprepare of the clock
  2017-01-18 10:01 ` Marc Kleine-Budde
@ 2017-01-18 10:05   ` Yegor Yefremov
  0 siblings, 0 replies; 3+ messages in thread
From: Yegor Yefremov @ 2017-01-18 10:05 UTC (permalink / raw)
  To: Marc Kleine-Budde; +Cc: linux-can, netdev, Wolfgang Grandegger

On Wed, Jan 18, 2017 at 11:01 AM, Marc Kleine-Budde <mkl@pengutronix.de> wrote:
> On 01/18/2017 10:43 AM, yegorslists@googlemail.com wrote:
>> From: Yegor Yefremov <yegorslists@googlemail.com>
>>
>> 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().
>>
>
> Can you add the missing error checking for the prepare_enable call?

Will do.

Yegor

>> Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
>> ---
>>  drivers/net/can/ti_hecc.c | 9 +++++----
>>  1 file changed, 5 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/net/can/ti_hecc.c b/drivers/net/can/ti_hecc.c
>> index 680d1ff..0448cb5 100644
>> --- a/drivers/net/can/ti_hecc.c
>> +++ b/drivers/net/can/ti_hecc.c
>> @@ -948,7 +948,8 @@ static int ti_hecc_probe(struct platform_device *pdev)
>>       netif_napi_add(ndev, &priv->napi, ti_hecc_rx_poll,
>>               HECC_DEF_NAPI_WEIGHT);
>>
>> -     clk_enable(priv->clk);
>> +     clk_prepare_enable(priv->clk);
>> +
>>       err = register_candev(ndev);
>>       if (err) {
>>               dev_err(&pdev->dev, "register_candev() failed\n");
>> @@ -981,7 +982,7 @@ static int ti_hecc_remove(struct platform_device *pdev)
>>       struct ti_hecc_priv *priv = netdev_priv(ndev);
>>
>>       unregister_candev(ndev);
>> -     clk_disable(priv->clk);
>> +     clk_disable_unprepare(priv->clk);
>>       clk_put(priv->clk);
>>       res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>>       iounmap(priv->base);
>> @@ -1006,7 +1007,7 @@ static int ti_hecc_suspend(struct platform_device *pdev, pm_message_t state)
>>       hecc_set_bit(priv, HECC_CANMC, HECC_CANMC_PDR);
>>       priv->can.state = CAN_STATE_SLEEPING;
>>
>> -     clk_disable(priv->clk);
>> +     clk_disable_unprepare(priv->clk);
>>
>>       return 0;
>>  }
>> @@ -1016,7 +1017,7 @@ static int ti_hecc_resume(struct platform_device *pdev)
>>       struct net_device *dev = platform_get_drvdata(pdev);
>>       struct ti_hecc_priv *priv = netdev_priv(dev);
>>
>> -     clk_enable(priv->clk);
>> +     clk_prepare_enable(priv->clk);
>>
>>       hecc_clear_bit(priv, HECC_CANMC, HECC_CANMC_PDR);
>>       priv->can.state = CAN_STATE_ERROR_ACTIVE;
>>
>
>
> --
> Pengutronix e.K.                  | Marc Kleine-Budde           |
> Industrial Linux Solutions        | Phone: +49-231-2826-924     |
> Vertretung West/Dortmund          | Fax:   +49-5121-206917-5555 |
> Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-01-18 10:05 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-18  9:43 [PATCH] can: ti_hecc: add missing prepare and unprepare of the clock yegorslists
2017-01-18 10:01 ` Marc Kleine-Budde
2017-01-18 10:05   ` Yegor Yefremov

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.