summaryrefslogtreecommitdiff
path: root/arch/arm/mach-tegra/baseband-xmm-power.c
diff options
context:
space:
mode:
authorSeshendra Gadagottu <sgadagottu@nvidia.com>2012-02-20 12:45:10 +0530
committerDan Willemsen <dwillemsen@nvidia.com>2013-09-14 01:38:01 -0700
commit4bb0482c35c15ba7461baee872395081c886033a (patch)
tree7abe842c3d72ba9dc86b065c9db0ac8f2092b9f2 /arch/arm/mach-tegra/baseband-xmm-power.c
parent01f90c940e23ee8d5b3d9bcf0d1a81c650c6bd1b (diff)
arm: tegra: comms: add mutex for on/off switch
Mutex protection is added on xmm_onoff Bug 938553 Change-Id: I260847861a56f612f06c20cd7429c19c9001ac99 Signed-off-by: Xin Xie <xxie@nvidia.com> Reviewed-on: http://git-master/r/84751 (cherry picked from commit 14ac86297c4faa6a9cbf95877b782c997698347c) Reviewed-on: http://git-master/r/87506 Reviewed-by: Seshendra Gadagottu <sgadagottu@nvidia.com> Tested-by: Seshendra Gadagottu <sgadagottu@nvidia.com> Reviewed-by: Steve Lin <stlin@nvidia.com> Rebase-Id: R2717dd8f5002f721a60b303ecba1a65056f38da1
Diffstat (limited to 'arch/arm/mach-tegra/baseband-xmm-power.c')
-rw-r--r--arch/arm/mach-tegra/baseband-xmm-power.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/arch/arm/mach-tegra/baseband-xmm-power.c b/arch/arm/mach-tegra/baseband-xmm-power.c
index 1bdaf8046390..534ba49939cf 100644
--- a/arch/arm/mach-tegra/baseband-xmm-power.c
+++ b/arch/arm/mach-tegra/baseband-xmm-power.c
@@ -104,6 +104,7 @@ static struct work_struct autopm_resume_work;
static bool wakeup_pending;
static bool modem_sleep_flag;
static spinlock_t xmm_lock;
+static DEFINE_MUTEX(xmm_onoff_mutex);
static void baseband_xmm_power_L2_resume(void);
static int baseband_xmm_power_driver_handle_resume(
@@ -253,11 +254,14 @@ static ssize_t baseband_xmm_onoff(struct device *dev,
int size;
struct platform_device *device = to_platform_device(dev);
+ mutex_lock(&xmm_onoff_mutex);
+
pr_debug("%s\n", __func__);
/* check input */
if (buf == NULL) {
pr_err("%s: buf NULL\n", __func__);
+ mutex_unlock(&xmm_onoff_mutex);
return -EINVAL;
}
pr_debug("%s: count=%d\n", __func__, count);
@@ -266,6 +270,7 @@ static ssize_t baseband_xmm_onoff(struct device *dev,
size = sscanf(buf, "%d", &power_onoff);
if (size != 1) {
pr_err("%s: size=%d -EINVAL\n", __func__, size);
+ mutex_unlock(&xmm_onoff_mutex);
return -EINVAL;
}
pr_debug("%s power_onoff=%d\n", __func__, power_onoff);
@@ -274,6 +279,9 @@ static ssize_t baseband_xmm_onoff(struct device *dev,
baseband_xmm_power_off(device);
else if (power_onoff == 1)
baseband_xmm_power_on(device);
+
+ mutex_unlock(&xmm_onoff_mutex);
+
return count;
}