[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Sat, 12 Dec 2020 20:26:16 +0200
From: Andy Shevchenko <andy.shevchenko@...il.com>
To: Alexandre Belloni <alexandre.belloni@...tlin.com>
Cc: Jonathan Cameron <jic23@...nel.org>,
Lars-Peter Clausen <lars@...afoo.de>,
Peter Meerwald-Stadler <pmeerw@...erw.net>,
linux-iio <linux-iio@...r.kernel.org>,
devicetree <devicetree@...r.kernel.org>,
linux-arm Mailing List <linux-arm-kernel@...ts.infradead.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 3/6] iio:pressure:ms5637: limit available sample frequencies
On Thu, Dec 10, 2020 at 2:03 AM Alexandre Belloni
<alexandre.belloni@...tlin.com> wrote:
>
> Avoid exposing all the sampling frequencies for chip that only support a
> subset.
> +static ssize_t ms5637_show_samp_freq(struct device *dev, struct device_attribute *attr, char *buf)
> +{
> + struct iio_dev *indio_dev = dev_to_iio_dev(dev);
> + struct ms_tp_dev *dev_data = iio_priv(indio_dev);
> + int i, len = 0;
> +
> + for (i = 0; i <= dev_data->hw->max_res_index; i++)
> + len += scnprintf(buf + len, PAGE_SIZE - len, "%u ", ms5637_samp_freq[i]);
Doesn't IIO core have a helper?
Also, it's better to use sysfs_emit().
> + buf[len - 1] = '\n';
> +
> + return len;
> +}
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists