Commit 02e9a0ff authored by Andy Shevchenko's avatar Andy Shevchenko Committed by Jonathan Cameron

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: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: default avatarJonathan Cameron <jic23@kernel.org>
parent c306dbd8
...@@ -478,21 +478,16 @@ ssize_t iio_enum_write(struct iio_dev *indio_dev, ...@@ -478,21 +478,16 @@ ssize_t iio_enum_write(struct iio_dev *indio_dev,
size_t len) size_t len)
{ {
const struct iio_enum *e = (const struct iio_enum *)priv; const struct iio_enum *e = (const struct iio_enum *)priv;
unsigned int i;
int ret; int ret;
if (!e->set) if (!e->set)
return -EINVAL; return -EINVAL;
for (i = 0; i < e->num_items; i++) { ret = __sysfs_match_string(e->items, e->num_items, buf);
if (sysfs_streq(buf, e->items[i])) if (ret < 0)
break; return ret;
}
if (i == e->num_items)
return -EINVAL;
ret = e->set(indio_dev, chan, i); ret = e->set(indio_dev, chan, ret);
return ret ? ret : len; return ret ? ret : len;
} }
EXPORT_SYMBOL_GPL(iio_enum_write); EXPORT_SYMBOL_GPL(iio_enum_write);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment