summaryrefslogtreecommitdiff
path: root/drivers/misc/apds990x.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/misc/apds990x.c')
-rw-r--r--drivers/misc/apds990x.c37
1 files changed, 24 insertions, 13 deletions
diff --git a/drivers/misc/apds990x.c b/drivers/misc/apds990x.c
index 98f9bb26492a..868a30a1b417 100644
--- a/drivers/misc/apds990x.c
+++ b/drivers/misc/apds990x.c
@@ -696,9 +696,11 @@ static ssize_t apds990x_lux_calib_store(struct device *dev,
{
struct apds990x_chip *chip = dev_get_drvdata(dev);
unsigned long value;
+ int ret;
- if (strict_strtoul(buf, 0, &value))
- return -EINVAL;
+ ret = kstrtoul(buf, 0, &value);
+ if (ret)
+ return ret;
chip->lux_calib = value;
@@ -759,8 +761,9 @@ static ssize_t apds990x_rate_store(struct device *dev,
unsigned long value;
int ret;
- if (strict_strtoul(buf, 0, &value))
- return -EINVAL;
+ ret = kstrtoul(buf, 0, &value);
+ if (ret)
+ return ret;
mutex_lock(&chip->mutex);
ret = apds990x_set_arate(chip, value);
@@ -813,9 +816,11 @@ static ssize_t apds990x_prox_enable_store(struct device *dev,
{
struct apds990x_chip *chip = dev_get_drvdata(dev);
unsigned long value;
+ int ret;
- if (strict_strtoul(buf, 0, &value))
- return -EINVAL;
+ ret = kstrtoul(buf, 0, &value);
+ if (ret)
+ return ret;
mutex_lock(&chip->mutex);
@@ -892,11 +897,12 @@ static ssize_t apds990x_lux_thresh_below_show(struct device *dev,
static ssize_t apds990x_set_lux_thresh(struct apds990x_chip *chip, u32 *target,
const char *buf)
{
- int ret = 0;
unsigned long thresh;
+ int ret;
- if (strict_strtoul(buf, 0, &thresh))
- return -EINVAL;
+ ret = kstrtoul(buf, 0, &thresh);
+ if (ret)
+ return ret;
if (thresh > APDS_RANGE)
return -EINVAL;
@@ -957,9 +963,11 @@ static ssize_t apds990x_prox_threshold_store(struct device *dev,
{
struct apds990x_chip *chip = dev_get_drvdata(dev);
unsigned long value;
+ int ret;
- if (strict_strtoul(buf, 0, &value))
- return -EINVAL;
+ ret = kstrtoul(buf, 0, &value);
+ if (ret)
+ return ret;
if ((value > APDS_RANGE) || (value == 0) ||
(value < APDS_PROX_HYSTERESIS))
@@ -990,9 +998,12 @@ static ssize_t apds990x_power_state_store(struct device *dev,
{
struct apds990x_chip *chip = dev_get_drvdata(dev);
unsigned long value;
+ int ret;
+
+ ret = kstrtoul(buf, 0, &value);
+ if (ret)
+ return ret;
- if (strict_strtoul(buf, 0, &value))
- return -EINVAL;
if (value) {
pm_runtime_get_sync(dev);
mutex_lock(&chip->mutex);