From: Andy Shevchenko Date: Fri, 9 Jun 2017 12:08:10 +0000 (+0300) Subject: iio: adc: ad7791: Use sysfs_match_string() helper X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=405570b4a5c9402f66843be832e44c2ffd70aa01;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git iio: adc: ad7791: Use sysfs_match_string() helper Use sysfs_match_string() helper instead of open coded variant. Cc: Lars-Peter Clausen Cc: Michael Hennerich Cc: Jonathan Cameron Signed-off-by: Andy Shevchenko Signed-off-by: Jonathan Cameron --- 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)