diff options
author | Andy Shevchenko <andriy.shevchenko@linux.intel.com> | 2017-06-09 15:08:16 +0300 |
---|---|---|
committer | Jonathan Cameron <jic23@kernel.org> | 2017-06-11 15:07:34 +0100 |
commit | 02e9a0ff0d7a3c9eadbff698b7146c9eaac86708 (patch) | |
tree | 28fcd135ecb72ab62939c02905d1f8bf72672699 /drivers/iio/industrialio-core.c | |
parent | c306dbd88c3d1a9f41c81d38e8f756d25958d575 (diff) | |
download | linux-next-02e9a0ff0d7a3c9eadbff698b7146c9eaac86708.tar.gz |
iio: core: Use __sysfs_match_string() helper
Use __sysfs_match_string() helper instead of open coded variant.
Cc: Jonathan Cameron <jic23@kernel.org>
Cc: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Diffstat (limited to 'drivers/iio/industrialio-core.c')
-rw-r--r-- | drivers/iio/industrialio-core.c | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/drivers/iio/industrialio-core.c b/drivers/iio/industrialio-core.c index 4a1de59d153a..15c86a8cd704 100644 --- a/drivers/iio/industrialio-core.c +++ b/drivers/iio/industrialio-core.c @@ -478,21 +478,16 @@ ssize_t iio_enum_write(struct iio_dev *indio_dev, size_t len) { const struct iio_enum *e = (const struct iio_enum *)priv; - unsigned int i; int ret; if (!e->set) return -EINVAL; - for (i = 0; i < e->num_items; i++) { - if (sysfs_streq(buf, e->items[i])) - break; - } - - if (i == e->num_items) - return -EINVAL; + ret = __sysfs_match_string(e->items, e->num_items, buf); + if (ret < 0) + return ret; - ret = e->set(indio_dev, chan, i); + ret = e->set(indio_dev, chan, ret); return ret ? ret : len; } EXPORT_SYMBOL_GPL(iio_enum_write); |