can: m_can_platform: restore necessary m_can_class_resume() call
Subsystems (2)
PATCH 1/1 can: m_can_platform: restore necessary m_can_class_resume() call
Hi there,
After the last refactoring, m_can_runtime_suspend()/resume() would call the corresponding m_can_class_suspend() and m_can_class_resume() functions. That caused a recursion through m_can_clk_start/stop calls, with a deadlock due to spin_lock_irqsave(&dev->power.lock, flags).
The temporary solution, put in place in 0704c57,
was to remove the call to m_can_runtime_resume().
However, this breaks the driver on SoCs that use pinmux to control the CAN controller. The controller would be permanently disconnected from the outside world.
The fix for the recursion is to remove calls to m_can_clk_start/stop() from resume/suspend, since m_can_clk_start/stop() calls are what triggered resume/suspend.
--- drivers/net/can/m_can/m_can.c | 7 ------- drivers/net/can/m_can/m_can_platform.c | 3 +++ 2 files changed, 3 insertions(+), 7 deletions(-)
drivers/net/can/m_can/m_can.c +0 -7
@@ -1866,7 +1866,6 @@ int m_can_class_suspend(struct device *dev)netif_stop_queue (ndev);netif_device_detach (ndev);m_can_stop (ndev); -m_can_clk_stop (cdev); }pinctrl_pm_select_sleep_state (dev);
@@ -1887,12 +1886,6 @@ int m_can_class_resume(struct device *dev) cdev->can.state =CAN_STATE_ERROR_ACTIVE ;if (netif_running (ndev)) { -int ret; - - ret =m_can_clk_start (cdev); -if (ret) -return ret; -m_can_init_ram (cdev);m_can_start (ndev);netif_device_attach (ndev);
drivers/net/can/m_can/m_can_platform.c +3 -0
@@ -166,6 +166,9 @@ static int __maybe_unused m_can_runtime_resume(struct device *dev)if (err)clk_disable_unprepare (mcan_class->hclk); +if (!err) +m_can_class_resume (dev); +return err; }
Signature · 1 line
2.17.1