All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] driver: net: can: disable clock when it is in enable status
@ 2021-10-19  9:14 Meng Li
  2021-10-19  9:23 ` Marc Kleine-Budde
  0 siblings, 1 reply; 3+ messages in thread
From: Meng Li @ 2021-10-19  9:14 UTC (permalink / raw)
  To: wg, mkl, davem, kuba, mailhol.vincent, socketcan,
	ramesh.shanmugasundaram
  Cc: linux-can, netdev, linux-kernel, meng.li

If disable a clock when it is already in disable status, there
will be a warning trace generated. So, it is need to confirm
whether what status the clock is in before disable it.

Fixes: a23b97e6255b ("can: rcar_can: Move Renesas CAN driver to rcar dir")
Cc: stable@vger.kernel.org
Signed-off-by: Meng Li <Meng.Li@windriver.com>
---
 drivers/net/can/rcar/rcar_can.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/net/can/rcar/rcar_can.c b/drivers/net/can/rcar/rcar_can.c
index 48575900adb7..e340e32cd145 100644
--- a/drivers/net/can/rcar/rcar_can.c
+++ b/drivers/net/can/rcar/rcar_can.c
@@ -15,6 +15,7 @@
 #include <linux/can/led.h>
 #include <linux/can/dev.h>
 #include <linux/clk.h>
+#include <linux/clk-provider.h>
 #include <linux/of.h>
 
 #define RCAR_CAN_DRV_NAME	"rcar_can"
@@ -857,7 +858,9 @@ static int __maybe_unused rcar_can_suspend(struct device *dev)
 	writew(ctlr, &priv->regs->ctlr);
 	priv->can.state = CAN_STATE_SLEEPING;
 
-	clk_disable(priv->clk);
+	if(__clk_is_enabled(priv->clk))
+		clk_disable(priv->clk);
+
 	return 0;
 }
 
-- 
2.17.1


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

* Re: [PATCH] driver: net: can: disable clock when it is in enable status
  2021-10-19  9:14 [PATCH] driver: net: can: disable clock when it is in enable status Meng Li
@ 2021-10-19  9:23 ` Marc Kleine-Budde
  2021-10-19  9:33   ` Li, Meng
  0 siblings, 1 reply; 3+ messages in thread
From: Marc Kleine-Budde @ 2021-10-19  9:23 UTC (permalink / raw)
  To: Meng Li
  Cc: wg, davem, kuba, mailhol.vincent, socketcan,
	ramesh.shanmugasundaram, linux-can, netdev, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 867 bytes --]

On 19.10.2021 17:14:16, Meng Li wrote:
> If disable a clock when it is already in disable status, there
> will be a warning trace generated. So, it is need to confirm
> whether what status the clock is in before disable it.
> 
> Fixes: a23b97e6255b ("can: rcar_can: Move Renesas CAN driver to rcar dir")
> Cc: stable@vger.kernel.org
> Signed-off-by: Meng Li <Meng.Li@windriver.com>

Thanks for your patch. This problem should have been resolved with:

https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net.git/commit/?id=f7c05c3987dcfde9a4e8c2d533db013fabebca0d

regards
Marc

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

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

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

* RE: [PATCH] driver: net: can: disable clock when it is in enable status
  2021-10-19  9:23 ` Marc Kleine-Budde
@ 2021-10-19  9:33   ` Li, Meng
  0 siblings, 0 replies; 3+ messages in thread
From: Li, Meng @ 2021-10-19  9:33 UTC (permalink / raw)
  To: Marc Kleine-Budde
  Cc: wg, davem, kuba, mailhol.vincent, socketcan,
	ramesh.shanmugasundaram, linux-can, netdev, linux-kernel



> -----Original Message-----
> From: Marc Kleine-Budde <mkl@pengutronix.de>
> Sent: Tuesday, October 19, 2021 5:23 PM
> To: Li, Meng <Meng.Li@windriver.com>
> Cc: wg@grandegger.com; davem@davemloft.net; kuba@kernel.org;
> mailhol.vincent@wanadoo.fr; socketcan@hartkopp.net;
> ramesh.shanmugasundaram@bp.renesas.com; linux-can@vger.kernel.org;
> netdev@vger.kernel.org; linux-kernel@vger.kernel.org
> Subject: Re: [PATCH] driver: net: can: disable clock when it is in enable status
> 
> On 19.10.2021 17:14:16, Meng Li wrote:
> > If disable a clock when it is already in disable status, there will be
> > a warning trace generated. So, it is need to confirm whether what
> > status the clock is in before disable it.
> >
> > Fixes: a23b97e6255b ("can: rcar_can: Move Renesas CAN driver to rcar
> > dir")
> > Cc: stable@vger.kernel.org
> > Signed-off-by: Meng Li <Meng.Li@windriver.com>
> 
> Thanks for your patch. This problem should have been resolved with:
> 
> https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net.git/commit/?id
> =f7c05c3987dcfde9a4e8c2d533db013fabebca0d
> 

Ok!
Thanks for reminding me.

Regards,
Limeng

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

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

end of thread, other threads:[~2021-10-19  9:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-19  9:14 [PATCH] driver: net: can: disable clock when it is in enable status Meng Li
2021-10-19  9:23 ` Marc Kleine-Budde
2021-10-19  9:33   ` Li, Meng

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.