From 65d9792727fbef6a4e7d2ba2154204d7824bf78c Mon Sep 17 00:00:00 2001 From: Seshendra Gadagottu Date: Mon, 20 Feb 2012 12:45:10 +0530 Subject: 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 Reviewed-on: http://git-master/r/84751 (cherry picked from commit 14ac86297c4faa6a9cbf95877b782c997698347c) Reviewed-on: http://git-master/r/87506 Reviewed-by: Seshendra Gadagottu Tested-by: Seshendra Gadagottu Reviewed-by: Steve Lin --- arch/arm/mach-tegra/baseband-xmm-power.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'arch/arm') 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; } -- cgit v1.2.3