summaryrefslogtreecommitdiffstats
path: root/drivers/iio
diff options
context:
space:
mode:
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>2017-06-09 15:08:10 +0300
committerJonathan Cameron <jic23@kernel.org>2017-06-11 15:07:35 +0100
commit405570b4a5c9402f66843be832e44c2ffd70aa01 (patch)
tree4f0e14a8237cd1f808f4b5d0aba16e6c5d2ed122 /drivers/iio
parent02e9a0ff0d7a3c9eadbff698b7146c9eaac86708 (diff)
downloadlinux-405570b4a5c9402f66843be832e44c2ffd70aa01.tar.gz
linux-405570b4a5c9402f66843be832e44c2ffd70aa01.tar.bz2
linux-405570b4a5c9402f66843be832e44c2ffd70aa01.zip
iio: adc: ad7791: Use sysfs_match_string() helper
Use sysfs_match_string() helper instead of open coded variant. Cc: Lars-Peter Clausen <lars@metafoo.de> Cc: Michael Hennerich <Michael.Hennerich@analog.com> Cc: Jonathan Cameron <jic23@kernel.org> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Diffstat (limited to 'drivers/iio')
-rw-r--r--drivers/iio/adc/ad7791.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/drivers/iio/adc/ad7791.c b/drivers/iio/adc/ad7791.c
index 1817ebf5ad84..34e353c43ac8 100644
--- a/drivers/iio/adc/ad7791.c
+++ b/drivers/iio/adc/ad7791.c
@@ -272,11 +272,9 @@ static ssize_t ad7791_write_frequency(struct device *dev,
struct ad7791_state *st = iio_priv(indio_dev);
int i, ret;
- for (i = 0; i < ARRAY_SIZE(ad7791_sample_freq_avail); i++)
- if (sysfs_streq(ad7791_sample_freq_avail[i], buf))
- break;
- if (i == ARRAY_SIZE(ad7791_sample_freq_avail))
- return -EINVAL;
+ i = sysfs_match_string(ad7791_sample_freq_avail, buf);
+ if (i < 0)
+ return i;
ret = iio_device_claim_direct_mode(indio_dev);
if (ret)