From be971c964a63493e4c7f42015d6681a44b7d54b1 Mon Sep 17 00:00:00 2001 From: Seongho Joo Date: Fri, 24 Feb 2012 19:03:11 +0900 Subject: 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 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 Tested-by: Simone Willett --- arch/arm/mach-tegra/baseband-xmm-power.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'arch/arm/mach-tegra/baseband-xmm-power.c') 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) -- cgit v1.2.3