* [PATCH] can: flexcan: avoid unbalanced pm_runtime_enable warning
@ 2022-12-13 9:43 haibo.chen
2022-12-13 13:38 ` Marc Kleine-Budde
0 siblings, 1 reply; 2+ messages in thread
From: haibo.chen @ 2022-12-13 9:43 UTC (permalink / raw)
To: wg, mkl
Cc: davem, edumazet, kuba, pabeni, linux-can, netdev, linux-imx, haibo.chen
From: Haibo Chen <haibo.chen@nxp.com>
When do suspend/resume, meet the following warning message:
[ 30.028336] flexcan 425b0000.can: Unbalanced pm_runtime_enable!
Balance the pm_runtime_force_suspend() and pm_runtime_force_resume().
Fixes: 8cb53b485f18 ("can: flexcan: add auto stop mode for IMX93 to support wakeup")
Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
---
drivers/net/can/flexcan/flexcan-core.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/drivers/net/can/flexcan/flexcan-core.c b/drivers/net/can/flexcan/flexcan-core.c
index 0aeff34e5ae1..6d638c93977b 100644
--- a/drivers/net/can/flexcan/flexcan-core.c
+++ b/drivers/net/can/flexcan/flexcan-core.c
@@ -2349,9 +2349,15 @@ static int __maybe_unused flexcan_noirq_resume(struct device *device)
if (netif_running(dev)) {
int err;
- err = pm_runtime_force_resume(device);
- if (err)
- return err;
+ /* For the wakeup in auto stop mode, no need to gate on the
+ * clock here, hardware will do this automatically.
+ */
+ if (!(device_may_wakeup(device) &&
+ priv->devtype_data.quirks & FLEXCAN_QUIRK_AUTO_STOP_MODE)) {
+ err = pm_runtime_force_resume(device);
+ if (err)
+ return err;
+ }
if (device_may_wakeup(device))
flexcan_enable_wakeup_irq(priv, false);
--
2.34.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] can: flexcan: avoid unbalanced pm_runtime_enable warning
2022-12-13 9:43 [PATCH] can: flexcan: avoid unbalanced pm_runtime_enable warning haibo.chen
@ 2022-12-13 13:38 ` Marc Kleine-Budde
0 siblings, 0 replies; 2+ messages in thread
From: Marc Kleine-Budde @ 2022-12-13 13:38 UTC (permalink / raw)
To: haibo.chen
Cc: wg, davem, edumazet, kuba, pabeni, linux-can, netdev, linux-imx
[-- Attachment #1: Type: text/plain, Size: 769 bytes --]
On 13.12.2022 17:43:51, haibo.chen@nxp.com wrote:
> From: Haibo Chen <haibo.chen@nxp.com>
>
> When do suspend/resume, meet the following warning message:
> [ 30.028336] flexcan 425b0000.can: Unbalanced pm_runtime_enable!
>
> Balance the pm_runtime_force_suspend() and pm_runtime_force_resume().
>
> Fixes: 8cb53b485f18 ("can: flexcan: add auto stop mode for IMX93 to support wakeup")
> Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
Looks good. Applied to linux-can-next.
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] 2+ messages in thread
end of thread, other threads:[~2022-12-13 13:39 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-13 9:43 [PATCH] can: flexcan: avoid unbalanced pm_runtime_enable warning haibo.chen
2022-12-13 13:38 ` Marc Kleine-Budde
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).