kernel-hacking-2024-linux-s.../drivers/mailbox
Jason-JH.Lin a8bd68e432 mailbox: mtk-cmdq: Move devm_mbox_controller_register() after devm_pm_runtime_enable()
When mtk-cmdq unbinds, a WARN_ON message with condition
pm_runtime_get_sync() < 0 occurs.

According to the call tracei below:
  cmdq_mbox_shutdown
  mbox_free_channel
  mbox_controller_unregister
  __devm_mbox_controller_unregister
  ...

The root cause can be deduced to be calling pm_runtime_get_sync() after
calling pm_runtime_disable() as observed below:
1. CMDQ driver uses devm_mbox_controller_register() in cmdq_probe()
   to bind the cmdq device to the mbox_controller, so
   devm_mbox_controller_unregister() will automatically unregister
   the device bound to the mailbox controller when the device-managed
   resource is removed. That means devm_mbox_controller_unregister()
   and cmdq_mbox_shoutdown() will be called after cmdq_remove().
2. CMDQ driver also uses devm_pm_runtime_enable() in cmdq_probe() after
   devm_mbox_controller_register(), so that devm_pm_runtime_disable()
   will be called after cmdq_remove(), but before
   devm_mbox_controller_unregister().

To fix this problem, cmdq_probe() needs to move
devm_mbox_controller_register() after devm_pm_runtime_enable() to make
devm_pm_runtime_disable() be called after
devm_mbox_controller_unregister().

Fixes: 623a6143a8 ("mailbox: mediatek: Add Mediatek CMDQ driver")
Signed-off-by: Jason-JH.Lin <jason-jh.lin@mediatek.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Signed-off-by: Jassi Brar <jassisinghbrar@gmail.com>
2024-07-19 21:25:23 -05:00
..
arm_mhu.c
arm_mhu_db.c
arm_mhuv2.c
arm_mhuv3.c mailbox: arm_mhuv3: Add driver 2024-05-19 22:30:09 -05:00
armada-37xx-rwtm-mailbox.c
bcm-flexrm-mailbox.c irqchip: Convert all platform MSI users to the new API 2024-02-15 17:55:40 +01:00
bcm-pdc-mailbox.c mailbox: bcm-pdc: remove unused struct 'pdc_dma_map' 2024-07-10 13:24:55 -05:00
bcm2835-mailbox.c
hi3660-mailbox.c
hi6220-mailbox.c
imx-mailbox.c mailbox: imx: fix TXDB_V2 channel race condition 2024-07-10 13:24:55 -05:00
Kconfig mailbox: qcom-cpucp: fix 64BIT dependency 2024-07-19 21:21:06 -05:00
mailbox-altera.c
mailbox-mpfs.c
mailbox-sti.c
mailbox-test.c mailbox: mailbox-test: Convert to platform remove callback returning void 2024-01-13 23:08:51 -06:00
mailbox-xgene-slimpro.c
mailbox.c
mailbox.h
Makefile mailbox: Add support for QTI CPUCP mailbox controller 2024-07-10 13:24:55 -05:00
mtk-adsp-mailbox.c
mtk-cmdq-mailbox.c mailbox: mtk-cmdq: Move devm_mbox_controller_register() after devm_pm_runtime_enable() 2024-07-19 21:25:23 -05:00
omap-mailbox.c mailbox: omap: Fix mailbox interrupt sharing 2024-07-10 13:24:55 -05:00
pcc.c
pl320-ipc.c
platform_mhu.c
qcom-apcs-ipc-mailbox.c mailbox: qcom-apcs-ipc: Convert to platform remove callback returning void 2024-01-13 23:08:51 -06:00
qcom-cpucp-mbox.c mailbox: Add support for QTI CPUCP mailbox controller 2024-07-10 13:24:55 -05:00
qcom-ipcc.c mailbox: qcom-ipcc: Convert to platform remove callback returning void 2024-01-13 23:08:51 -06:00
rockchip-mailbox.c
sprd-mailbox.c
stm32-ipcc.c mailbox: stm32-ipcc: Convert to platform remove callback returning void 2024-01-13 23:08:51 -06:00
sun6i-msgbox.c mailbox: sun6i-msgbox: Convert to platform remove callback returning void 2024-01-13 23:08:51 -06:00
tegra-hsp.c mailbox: tegra-hsp: Convert to platform remove callback returning void 2024-01-13 23:08:51 -06:00
ti-msgmgr.c
zynqmp-ipi-mailbox.c mailbox: zynqmp-ipi: Make polling period configurable 2024-07-19 21:23:16 -05:00