summaryrefslogtreecommitdiff
path: root/arch/arm/mach-imx
diff options
context:
space:
mode:
authorLeonard Crestez <leonard.crestez@nxp.com>2018-08-03 14:52:32 +0300
committerLeonard Crestez <leonard.crestez@nxp.com>2018-08-24 12:41:33 +0300
commite9231deefa5a65e9525c55b903124f6018066245 (patch)
tree2886c480b172374d71aa60b4415ce6e67cb581f9 /arch/arm/mach-imx
parent307b3fa736091bc625303d46eb98357bfa206fba (diff)
MLK-19047-1 ARM: imx: busfreq: Add debug check for double notify
The only user of busfreq notifiers is imx_thermal and if it receives a double LOW_BUSFREQ_ENTER it will incorrectly decrease the reference count on its clk. Since tempmon uses pll3 directly this can cause problems like uart hangs. Guard against this scenario with an explicit check and warn inside busfreq_notify. This is not a high-performance path so it's better to be safe. Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com> Acked-by: Anson Huang <Anson.Huang@nxp.com>
Diffstat (limited to 'arch/arm/mach-imx')
-rw-r--r--arch/arm/mach-imx/busfreq-imx.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/arch/arm/mach-imx/busfreq-imx.c b/arch/arm/mach-imx/busfreq-imx.c
index 353795cec5f4..3e68df65f068 100644
--- a/arch/arm/mach-imx/busfreq-imx.c
+++ b/arch/arm/mach-imx/busfreq-imx.c
@@ -139,10 +139,19 @@ static bool check_m4_sleep(void)
return true;
}
+static bool busfreq_notified_low = false;
+
static int busfreq_notify(enum busfreq_event event)
{
int ret;
+ if (event == LOW_BUSFREQ_ENTER) {
+ WARN_ON(busfreq_notified_low);
+ busfreq_notified_low = true;
+ } else if (event == LOW_BUSFREQ_EXIT) {
+ WARN_ON(!busfreq_notified_low);
+ busfreq_notified_low = false;
+ }
ret = raw_notifier_call_chain(&busfreq_notifier_chain, event, NULL);
return notifier_to_errno(ret);