Skip to content

Commit 5a00961

Browse files
larsclausenehristev
authored andcommitted
iio: at91-sama5d2: Use dev_to_iio_dev() in sysfs callbacks
Using `dev_get_drvdata()` in IIO sysfs callbacks to get a pointer to the IIO device is a relic from the very early days of IIO. The IIO core as well as most other drivers have switched over to using `dev_to_iio_dev()` instead. This driver is one of the last few drivers remaining that uses the outdated idiom, update it. This will allow to eventually update the IIO core to no longer set the drvdata for the IIO device and free it up for driver usage. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Link: https://lore.kernel.org/r/20211019082929.30503-2-lars@metafoo.de Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> (cherry picked from commit 0d376dc)
1 parent 56f5029 commit 5a00961

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

drivers/iio/adc/at91-sama5d2_adc.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1825,7 +1825,7 @@ static void at91_adc_hw_init(struct iio_dev *indio_dev)
18251825
static ssize_t at91_adc_get_fifo_state(struct device *dev,
18261826
struct device_attribute *attr, char *buf)
18271827
{
1828-
struct iio_dev *indio_dev = dev_get_drvdata(dev);
1828+
struct iio_dev *indio_dev = dev_to_iio_dev(dev);
18291829
struct at91_adc_state *st = iio_priv(indio_dev);
18301830

18311831
return scnprintf(buf, PAGE_SIZE, "%d\n", !!st->dma_st.dma_chan);
@@ -1834,7 +1834,7 @@ static ssize_t at91_adc_get_fifo_state(struct device *dev,
18341834
static ssize_t at91_adc_get_watermark(struct device *dev,
18351835
struct device_attribute *attr, char *buf)
18361836
{
1837-
struct iio_dev *indio_dev = dev_get_drvdata(dev);
1837+
struct iio_dev *indio_dev = dev_to_iio_dev(dev);
18381838
struct at91_adc_state *st = iio_priv(indio_dev);
18391839

18401840
return scnprintf(buf, PAGE_SIZE, "%d\n", st->dma_st.watermark);

0 commit comments

Comments
 (0)