Skip to contentSkip to conversation

can: flexcan: avoid unbalanced pm_runtime_enable warning

PATCH In review [email protected] 2 participants 2 messages Dec 13, 2022

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 can: flexcan: avoid unbalanced pm_runtime_enable warning

From: Haibo Chen <[email protected]>

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")
---
 drivers/net/can/flexcan/flexcan-core.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)
drivers/net/can/flexcan/flexcan-core.c +9 -3
index 0aeff34e5ae1..6d638c93977b 100644
@@ -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);
Signature · 1 line
2.34.1
#1 lore raw
Quoted 9 lines · On 13.12.2022 17:43:51, [email protected] wrote:

From: Haibo Chen <[email protected]>

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")

Looks good. Applied to linux-can-next.

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 |