msm: smd_pkt: Rate limit the subsystem_get operation

SMD_PKT Driver open operation triggers modem loading procedure, by invoking
the subsystem_get operation. When the modem image is not flashed in the
target, subsystem_get operation fails which in turn causes the open
operation to fail. Everytime the subsystem_get operation fails, an error
message is logged into the kernel logs by both PIL and SMD_PKT drivers.
Under such error scenario, the user-space modules retry the open operation
in a tight loop. This causes the SMD_PKT driver to invoke subsystem_get
operation frequently. This repeated frequent failures cause frequent
logging by PIL and SMD_PKT drivers into the kernel and eventually a
watchdog bite.

When the subsystem_get operation invoked by SMD_PKT driver fails, SMD_PKT
driver to throttle the subsequent invocation of subsystem_get operation.
This will avoid the potential watchdog bite under error scenarios.

CRs-Fixed: 431153
Change-Id: Ia465856b994e1907ab3c1fb7a7ddcae4fbfb7eb2
Signed-off-by: Karthikeyan Ramasubramanian <kramasub@codeaurora.org>
diff --git a/arch/arm/mach-msm/smd_pkt.c b/arch/arm/mach-msm/smd_pkt.c
index 73ebdf6..8e7a1f5 100644
--- a/arch/arm/mach-msm/smd_pkt.c
+++ b/arch/arm/mach-msm/smd_pkt.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2008-2012, Code Aurora Forum. All rights reserved.
+/* Copyright (c) 2008-2013, The Linux Foundation. All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 and
@@ -855,6 +855,12 @@
 				r = PTR_ERR(smd_pkt_devp->pil);
 				pr_err("%s failed on smd_pkt_dev id:%d - subsystem_get failed for %s\n",
 					__func__, smd_pkt_devp->i, peripheral);
+				/*
+				 * Sleep inorder to reduce the frequency of
+				 * retry by user-space modules and to avoid
+				 * possible watchdog bite.
+				 */
+				msleep((smd_pkt_devp->open_modem_wait * 1000));
 				goto release_pd;
 			}