Re: [PATCH v1] iio: adc: ad7791: Use sysfs_match_string() helper

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri,  9 Jun 2017 15:08:10 +0300
Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx> wrote:

> Use sysfs_match_string() helper instead of open coded variant.
> 
> Cc: Lars-Peter Clausen <lars@xxxxxxxxxx>
> Cc: Michael Hennerich <Michael.Hennerich@xxxxxxxxxx>
> Cc: Jonathan Cameron <jic23@xxxxxxxxxx>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>
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
> ---
>  drivers/iio/adc/ad7791.c | 8 +++-----
>  1 file 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)

--
To unsubscribe from this list: send the line "unsubscribe linux-iio" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux