Skip to contentSkip to conversation

driver: net: can: disable clock when it is in enable status

PATCH In review Meng Li 2 participants 3 messages Oct 19, 2021

Subsystems (4)
lore
Share & tools
lore

Meng Li

author
#0 lore raw

PATCH 1/1 driver: net: can: disable clock when it is in enable status

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")
---
 drivers/net/can/rcar/rcar_can.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/can/rcar/rcar_can.c +4 -1
index 48575900adb7..e340e32cd145 100644
@@ -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;
 }
 
Signature · 1 line
2.17.1
#1 lore raw
Quoted 7 lines · 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")

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

Signature · 4 lines
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 |
author
#2 lore raw
Quoted 22 lines

-----Original Message-----
From: Marc Kleine-Budde <[email protected]>
Sent: Tuesday, October 19, 2021 5:23 PM
To: Li, Meng <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH] driver: net: can: disable clock when it is in enable status

Quoted 8 lines · 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")

Quoted 5 lines

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

Quoted 8 lines

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 |