diff options
author | Seshendra Gadagottu <sgadagottu@nvidia.com> | 2012-02-20 12:45:10 +0530 |
---|---|---|
committer | Simone Willett <swillett@nvidia.com> | 2012-03-05 17:41:34 -0800 |
commit | 65d9792727fbef6a4e7d2ba2154204d7824bf78c (patch) | |
tree | 5d05043aef41d78094a6f499f2bff61bb7f2858b /arch/arm/mach-tegra/baseband-xmm-power.c | |
parent | 48a177ef87aeafc913e7e7e1eeb6a74c9636628f (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>
Diffstat (limited to 'arch/arm/mach-tegra/baseband-xmm-power.c')
-rw-r--r-- | arch/arm/mach-tegra/baseband-xmm-power.c | 8 |
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; } |