can: m_can: move runtime PM enable/disable to m_can_platform
This is a preparatory patch for upcoming PCI based M_CAN devices. The current PM implementation would cause PCI based drivers to enable PM twice, once when the PCI device is added and a second time in m_can_class_register(). This will cause 'Unbalanced pm_runtime_enable!' to be logged, and is a situation that should be avoided. Therefore, in anticipation of PCI devices, move PM enabling out from M_CAN class registration to its only user, the m_can_platform driver. Signed-off-by: Patrik Flykt <patrik.flykt@linux.intel.com> Link: https://lore.kernel.org/r/20201023115800.46538-2-patrik.flykt@linux.intel.com [mkl: m_can_plat_probe(): fix error handling m_can_class_register(): simplify error handling] Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
This commit is contained in:
parent
c9f4cad6cd
commit
227619c3ff
|
@ -1826,10 +1826,9 @@ int m_can_class_register(struct m_can_classdev *m_can_dev)
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (m_can_dev->pm_clock_support) {
|
if (m_can_dev->pm_clock_support) {
|
||||||
pm_runtime_enable(m_can_dev->dev);
|
|
||||||
ret = m_can_clk_start(m_can_dev);
|
ret = m_can_clk_start(m_can_dev);
|
||||||
if (ret)
|
if (ret)
|
||||||
goto pm_runtime_fail;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = m_can_dev_setup(m_can_dev);
|
ret = m_can_dev_setup(m_can_dev);
|
||||||
|
@ -1855,11 +1854,6 @@ int m_can_class_register(struct m_can_classdev *m_can_dev)
|
||||||
*/
|
*/
|
||||||
clk_disable:
|
clk_disable:
|
||||||
m_can_clk_stop(m_can_dev);
|
m_can_clk_stop(m_can_dev);
|
||||||
pm_runtime_fail:
|
|
||||||
if (ret) {
|
|
||||||
if (m_can_dev->pm_clock_support)
|
|
||||||
pm_runtime_disable(m_can_dev->dev);
|
|
||||||
}
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -115,8 +115,15 @@ static int m_can_plat_probe(struct platform_device *pdev)
|
||||||
|
|
||||||
m_can_init_ram(mcan_class);
|
m_can_init_ram(mcan_class);
|
||||||
|
|
||||||
return m_can_class_register(mcan_class);
|
pm_runtime_enable(mcan_class->dev);
|
||||||
|
ret = m_can_class_register(mcan_class);
|
||||||
|
if (ret)
|
||||||
|
goto out_runtime_disable;
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
|
||||||
|
out_runtime_disable:
|
||||||
|
pm_runtime_disable(mcan_class->dev);
|
||||||
probe_fail:
|
probe_fail:
|
||||||
m_can_class_free_dev(mcan_class->net);
|
m_can_class_free_dev(mcan_class->net);
|
||||||
return ret;
|
return ret;
|
||||||
|
|
Loading…
Reference in New Issue