aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>2017-06-11 10:52:20 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-06-13 10:03:22 -0400
commitcbbdc6082917a92da0fc07cee255111de16ed64a (patch)
tree328f4046a299002f3ac5cb98747c0653ea9a4677
parentc845736dbcd26619acc136b588bcd2f48b1fda45 (diff)
misc: apds990x: Use sysfs_match_string() helper
Use sysfs_match_string() helper instead of open coded variant. Cc: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/misc/apds990x.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/drivers/misc/apds990x.c b/drivers/misc/apds990x.c
index c341164edaad..84e5b949399e 100644
--- a/drivers/misc/apds990x.c
+++ b/drivers/misc/apds990x.c
@@ -841,7 +841,7 @@ static ssize_t apds990x_prox_enable_store(struct device *dev,
841static DEVICE_ATTR(prox0_raw_en, S_IRUGO | S_IWUSR, apds990x_prox_enable_show, 841static DEVICE_ATTR(prox0_raw_en, S_IRUGO | S_IWUSR, apds990x_prox_enable_show,
842 apds990x_prox_enable_store); 842 apds990x_prox_enable_store);
843 843
844static const char reporting_modes[][9] = {"trigger", "periodic"}; 844static const char *reporting_modes[] = {"trigger", "periodic"};
845 845
846static ssize_t apds990x_prox_reporting_mode_show(struct device *dev, 846static ssize_t apds990x_prox_reporting_mode_show(struct device *dev,
847 struct device_attribute *attr, char *buf) 847 struct device_attribute *attr, char *buf)
@@ -856,13 +856,13 @@ static ssize_t apds990x_prox_reporting_mode_store(struct device *dev,
856 const char *buf, size_t len) 856 const char *buf, size_t len)
857{ 857{
858 struct apds990x_chip *chip = dev_get_drvdata(dev); 858 struct apds990x_chip *chip = dev_get_drvdata(dev);
859 int ret;
859 860
860 if (sysfs_streq(buf, reporting_modes[0])) 861 ret = sysfs_match_string(reporting_modes, buf);
861 chip->prox_continuous_mode = 0; 862 if (ret < 0)
862 else if (sysfs_streq(buf, reporting_modes[1])) 863 return ret;
863 chip->prox_continuous_mode = 1; 864
864 else 865 chip->prox_continuous_mode = ret;
865 return -EINVAL;
866 return len; 866 return len;
867} 867}
868 868