diff options
author | Seongho Joo <sjoo@nvidia.com> | 2012-02-24 19:03:11 +0900 |
---|---|---|
committer | Simone Willett <swillett@nvidia.com> | 2012-03-07 21:20:09 -0800 |
commit | be971c964a63493e4c7f42015d6681a44b7d54b1 (patch) | |
tree | a0a4d5dd72d2459b091edff0c8dbe701a486007c /arch/arm/mach-tegra/baseband-xmm-power.c | |
parent | 35e6c7a8aacf3e24bf911abb264de27d9b69de90 (diff) |
arm: tegra: xmm: ignore same xmm_onoff value
sysfs xmm_onoff is called from userspace.
If it is called twice with same value it could cause a problem.
if it happens, this change will ignore the case.
Bug 943018
Signed-off-by: Seongho Joo <sjoo@nvidia.com>
Reviewed-on: http://git-master/r/85721
(cherry picked from commit e722f73d1eed055682dbfeeedfa9c73173a7b3b6)
Change-Id: Ief96b667242a9af3df078cf62c9e9a9531b80f45
Reviewed-on: http://git-master/r/87639
Reviewed-by: Simone Willett <swillett@nvidia.com>
Tested-by: Simone Willett <swillett@nvidia.com>
Diffstat (limited to 'arch/arm/mach-tegra/baseband-xmm-power.c')
-rw-r--r-- | arch/arm/mach-tegra/baseband-xmm-power.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/arch/arm/mach-tegra/baseband-xmm-power.c b/arch/arm/mach-tegra/baseband-xmm-power.c index 074a3c3291d2..13a904dcf40d 100644 --- a/arch/arm/mach-tegra/baseband-xmm-power.c +++ b/arch/arm/mach-tegra/baseband-xmm-power.c @@ -251,6 +251,7 @@ static ssize_t baseband_xmm_onoff(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { + int pwr; int size; struct platform_device *device = to_platform_device(dev); @@ -267,12 +268,20 @@ static ssize_t baseband_xmm_onoff(struct device *dev, pr_debug("%s: count=%d\n", __func__, count); /* parse input */ - size = sscanf(buf, "%d", &power_onoff); + size = sscanf(buf, "%d", &pwr); if (size != 1) { pr_err("%s: size=%d -EINVAL\n", __func__, size); mutex_unlock(&xmm_onoff_mutex); return -EINVAL; } + + if (power_onoff == pwr) { + pr_err("%s: Ignored, due to same CP power state(%d)\n", + __func__, power_onoff); + mutex_unlock(&xmm_onoff_mutex); + return -EINVAL; + } + power_onoff = pwr; pr_debug("%s power_onoff=%d\n", __func__, power_onoff); if (power_onoff == 0) |