Skip to content

Commit 7eb6b35

Browse files
commodojic23
authored andcommitted
iio: adc: ad7791: remove sample freq sysfs attributes
In the current state, these attributes are broken, because they are registered already, and the kernel throws a warning. The first registration happens via the `IIO_CHAN_INFO_SAMP_FREQ` flag from the `ad_sigma_delta` driver. In this commit these attrs are removed, and in the following the IIO_CHAN_INFO_SAMP_FREQ behavior will be implemented, which replaces these hooks. This is done to make things a bit easier to review as there is a bit of overlap in the patch if it's done all at once. Fixes: a13e831 ("staging: iio: ad7192: implement IIO_CHAN_INFO_SAMP_FREQ") Signed-off-by: Alexandru Ardelean <[email protected]> Cc: <[email protected]> Signed-off-by: Jonathan Cameron <[email protected]>
1 parent 5a0b8cb commit 7eb6b35

File tree

1 file changed

+0
-49
lines changed

1 file changed

+0
-49
lines changed

drivers/iio/adc/ad7791.c

Lines changed: 0 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -244,58 +244,9 @@ static int ad7791_read_raw(struct iio_dev *indio_dev,
244244
return -EINVAL;
245245
}
246246

247-
static const char * const ad7791_sample_freq_avail[] = {
248-
[AD7791_FILTER_RATE_120] = "120",
249-
[AD7791_FILTER_RATE_100] = "100",
250-
[AD7791_FILTER_RATE_33_3] = "33.3",
251-
[AD7791_FILTER_RATE_20] = "20",
252-
[AD7791_FILTER_RATE_16_6] = "16.6",
253-
[AD7791_FILTER_RATE_16_7] = "16.7",
254-
[AD7791_FILTER_RATE_13_3] = "13.3",
255-
[AD7791_FILTER_RATE_9_5] = "9.5",
256-
};
257-
258-
static ssize_t ad7791_read_frequency(struct device *dev,
259-
struct device_attribute *attr, char *buf)
260-
{
261-
struct iio_dev *indio_dev = dev_to_iio_dev(dev);
262-
struct ad7791_state *st = iio_priv(indio_dev);
263-
unsigned int rate = st->filter & AD7791_FILTER_RATE_MASK;
264-
265-
return sprintf(buf, "%s\n", ad7791_sample_freq_avail[rate]);
266-
}
267-
268-
static ssize_t ad7791_write_frequency(struct device *dev,
269-
struct device_attribute *attr, const char *buf, size_t len)
270-
{
271-
struct iio_dev *indio_dev = dev_to_iio_dev(dev);
272-
struct ad7791_state *st = iio_priv(indio_dev);
273-
int i, ret;
274-
275-
i = sysfs_match_string(ad7791_sample_freq_avail, buf);
276-
if (i < 0)
277-
return i;
278-
279-
ret = iio_device_claim_direct_mode(indio_dev);
280-
if (ret)
281-
return ret;
282-
st->filter &= ~AD7791_FILTER_RATE_MASK;
283-
st->filter |= i;
284-
ad_sd_write_reg(&st->sd, AD7791_REG_FILTER, sizeof(st->filter),
285-
st->filter);
286-
iio_device_release_direct_mode(indio_dev);
287-
288-
return len;
289-
}
290-
291-
static IIO_DEV_ATTR_SAMP_FREQ(S_IWUSR | S_IRUGO,
292-
ad7791_read_frequency,
293-
ad7791_write_frequency);
294-
295247
static IIO_CONST_ATTR_SAMP_FREQ_AVAIL("120 100 33.3 20 16.7 16.6 13.3 9.5");
296248

297249
static struct attribute *ad7791_attributes[] = {
298-
&iio_dev_attr_sampling_frequency.dev_attr.attr,
299250
&iio_const_attr_sampling_frequency_available.dev_attr.attr,
300251
NULL
301252
};

0 commit comments

Comments
 (0)