msm: subsystem_restart: Ignore SSR requests during system reboot/shutdown
When a system reboot or shutdown is already underway, ignore
SSR errors so that the reboot/shutdown process is uninterrupted.
However, log the SSR request so that we know that the subsystem
behaved unexpectedly.
(cherry picked from commit 3d58c2f7db89ab01f76e7733922408c5a398d465)
Change-Id: I60387a63dcb728e271cf4a512c6546b3d4bce0c3
CRs-Fixed: 416175
Signed-off-by: Vikram Mulukutla <markivx@codeaurora.org>
diff --git a/arch/arm/mach-msm/subsystem_restart.c b/arch/arm/mach-msm/subsystem_restart.c
index 14c666b..d1681f5 100644
--- a/arch/arm/mach-msm/subsystem_restart.c
+++ b/arch/arm/mach-msm/subsystem_restart.c
@@ -433,6 +433,18 @@
int subsystem_restart_dev(struct subsys_device *dev)
{
const char *name = dev->desc->name;
+
+ /*
+ * If a system reboot/shutdown is underway, ignore subsystem errors.
+ * However, print a message so that we know that a subsystem behaved
+ * unexpectedly here.
+ */
+ if (system_state == SYSTEM_RESTART
+ || system_state == SYSTEM_POWER_OFF) {
+ pr_err("%s crashed during a system poweroff/shutdown.\n", name);
+ return -EBUSY;
+ }
+
pr_info("Restart sequence requested for %s, restart_level = %d.\n",
name, restart_level);