Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

can: flexcan: avoid unbalanced pm_runtime_enable warning

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>
Link: https://lore.kernel.org/all/20221213094351.3023858-1-haibo.chen@nxp.com
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>

authored by

Haibo Chen and committed by
Marc Kleine-Budde
3bc2afcb 115dd546

+9 -3
+9 -3
drivers/net/can/flexcan/flexcan-core.c
··· 2349 2349 if (netif_running(dev)) { 2350 2350 int err; 2351 2351 2352 - err = pm_runtime_force_resume(device); 2353 - if (err) 2354 - return err; 2352 + /* For the wakeup in auto stop mode, no need to gate on the 2353 + * clock here, hardware will do this automatically. 2354 + */ 2355 + if (!(device_may_wakeup(device) && 2356 + priv->devtype_data.quirks & FLEXCAN_QUIRK_AUTO_STOP_MODE)) { 2357 + err = pm_runtime_force_resume(device); 2358 + if (err) 2359 + return err; 2360 + } 2355 2361 2356 2362 if (device_may_wakeup(device)) 2357 2363 flexcan_enable_wakeup_irq(priv, false);