From: Meng Li <Meng.Li@windriver.com>
To: wg@grandegger.com, mkl@pengutronix.de, davem@davemloft.net,
kuba@kernel.org, mailhol.vincent@wanadoo.fr,
socketcan@hartkopp.net, ramesh.shanmugasundaram@bp.renesas.com
Cc: linux-can@vger.kernel.org, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org, meng.li@windriver.com
Subject: [PATCH] driver: net: can: disable clock when it is in enable status
Date: Tue, 19 Oct 2021 17:14:16 +0800 [thread overview]
Message-ID: <20211019091416.16923-1-Meng.Li@windriver.com> (raw)
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
next reply other threads:[~2021-10-19 9:15 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-19 9:14 Meng Li [this message]
2021-10-19 9:23 ` [PATCH] driver: net: can: disable clock when it is in enable status Marc Kleine-Budde
2021-10-19 9:33 ` Li, Meng
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20211019091416.16923-1-Meng.Li@windriver.com \
--to=meng.li@windriver.com \
--cc=davem@davemloft.net \
--cc=kuba@kernel.org \
--cc=linux-can@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mailhol.vincent@wanadoo.fr \
--cc=mkl@pengutronix.de \
--cc=netdev@vger.kernel.org \
--cc=ramesh.shanmugasundaram@bp.renesas.com \
--cc=socketcan@hartkopp.net \
--cc=wg@grandegger.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox