iio: adc: ad7791: Use sysfs_match_string() helper
Subsystems (2)
PATCH 1/1 iio: adc: ad7791: Use sysfs_match_string() helper
Use sysfs_match_string() helper instead of open coded variant.
Cc Lars-Peter Clausen <[email protected]>
Cc Michael Hennerich <[email protected]>
Cc Jonathan Cameron <[email protected]>
Signed-off-by Andy Shevchenko <[email protected]>
--- drivers/iio/adc/ad7791.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/iio/adc/ad7791.c +3 -5
@@ -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)
Signature · 1 line
2.11.0
Jonathan Cameron
maintainerQuoted 6 lines · On Fri, 9 Jun 2017 15:08:10 +0300 Andy Shevchenko…
Use
sysfs_match_string()helper instead of open coded variant.Cc Lars-Peter Clausen <[email protected]>Cc Michael Hennerich <[email protected]>Cc Jonathan Cameron <[email protected]>Signed-off-by Andy Shevchenko <[email protected]>
Looks obvious enough that I'm happy to apply without waiting for Lars or Michael to have a moment. It'll be in my testing branch for at least a little while though if either of you want to comment or add an Ack.
Thanks,
Jonathan
Quoted 23 lines
--- drivers/iio/adc/ad7791.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)drivers/iio/adc/ad7791.c +3
-5@@ -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)