msm: bam_dmux: prevent duplicate subsystem restart
If a subsystem restart is triggered while BAM DMUX is waiting for a
power control response, then BAM DMUX will timeout and trigger another
subsystem restart which will cause a kernel panic.
Check if an SSR is already in progress before triggering another
subsystem restart.
CRs-Fixed: 515398
Change-Id: I9e8e5513f6568da9c0090fd97c671a9bc824c43b
Signed-off-by: Eric Holmberg <eholmber@codeaurora.org>
diff --git a/arch/arm/mach-msm/bam_dmux.c b/arch/arm/mach-msm/bam_dmux.c
index 4d26e3c..56922a8 100644
--- a/arch/arm/mach-msm/bam_dmux.c
+++ b/arch/arm/mach-msm/bam_dmux.c
@@ -1582,6 +1582,12 @@
{
int ret = 0;
+ if (in_global_reset) {
+ DMUX_LOG_KERR("%s: modem timeout: already in SSR\n",
+ __func__);
+ return 1;
+ }
+
DMUX_LOG_KERR("%s: modem timeout: BAM DMUX disabled for SSR\n",
__func__);
in_global_reset = 1;
@@ -1754,11 +1760,15 @@
unsigned long flags;
unsigned long time_remaining;
- time_remaining = wait_for_completion_timeout(&shutdown_completion,
- msecs_to_jiffies(SHUTDOWN_TIMEOUT_MS));
- if (time_remaining == 0) {
- pr_err("%s: shutdown completion timed out\n", __func__);
- ssrestart_check();
+ if (!in_global_reset) {
+ time_remaining = wait_for_completion_timeout(
+ &shutdown_completion,
+ msecs_to_jiffies(SHUTDOWN_TIMEOUT_MS));
+ if (time_remaining == 0) {
+ DMUX_LOG_KERR("%s: shutdown completion timed out\n",
+ __func__);
+ ssrestart_check();
+ }
}
bam_connection_is_active = 0;
@@ -2223,6 +2233,11 @@
{
static unsigned int clear_bit; /* 0 = set the bit, else clear bit */
+ if (in_global_reset) {
+ BAM_DMUX_LOG("%s: skipped due to SSR\n", __func__);
+ return;
+ }
+
BAM_DMUX_LOG("%s: apps ack %d->%d\n", __func__,
clear_bit & 0x1, ~clear_bit & 0x1);
smsm_change_state(SMSM_APPS_STATE,