aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorguoyh <guoyh@marvell.com>2012-09-10 10:09:11 +0800
committerLubomir Rintel <lkundrak@v3.sk>2019-07-22 19:39:59 +0200
commit463b3be60106733fd4ddbee313baf4cc96eedf26 (patch)
tree582a84b163d1692c56d17192b087e5e2ebf2a5ff
parentdffd6ee1fb8de378e08a488256d4662e6e03a8ac (diff)
downloadlinux-mmp3-dell-ariel-463b3be60106733fd4ddbee313baf4cc96eedf26.tar.gz
hwmon: isl29043: prevent setting interval when inactive
Prevent setting interval when sensor is inactive, or it will cause i2c timeout isssue. Change-Id: I819e01cf1ea666c724d0dd43c2c1424588d1b31f Signed-off-by: guoyh <guoyh@marvell.com>
-rw-r--r--drivers/hwmon/isl29043.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/hwmon/isl29043.c b/drivers/hwmon/isl29043.c
index 292ad2c6a8a9f7..40395c8fafca82 100644
--- a/drivers/hwmon/isl29043.c
+++ b/drivers/hwmon/isl29043.c
@@ -285,6 +285,11 @@ static int interval_ps_set(struct device *dev, struct device_attribute *attr,
__func__);
return 0;
}
+ if (isl29043_dev.ps_user_count == 0) {
+ dev_warn(dev, "%s: can't set interval when inactive\n",
+ __func__);
+ return 0;
+ }
ret = strict_strtoul(buf, 10, &val);
if (ret < 0)
return ret;
@@ -322,6 +327,11 @@ static int interval_als_set(struct device *dev, struct device_attribute *attr,
__func__);
return 0;
}
+ if (isl29043_dev.als_user_count == 0) {
+ dev_warn(dev, "%s: can't set interval when inactive\n",
+ __func__);
+ return 0;
+ }
ret = strict_strtoul(buf, 10, &val);
if (ret < 0)
return ret;