[PATCH 4/6] iio: adc: ad7791: drop platform data support

From: Nuno Sá

Date: Wed Nov 25 2026 - 05:21:06 EST


There are no in-tree users of struct ad7791_platform_data. Without it,
the driver already keeps the power-on reset configuration: buffered
mode (on parts that have a buffer), bipolar mode and no burnout
current.

Drop the platform data header together with the code applying it. As a
result, ad7791_setup() can no longer fail, so make it return void.

Signed-off-by: Nuno Sá <nuno.sa@xxxxxxxxxx>
---
drivers/iio/adc/ad7791.c | 26 ++------------------------
include/linux/platform_data/ad7791.h | 18 ------------------
2 files changed, 2 insertions(+), 42 deletions(-)

diff --git a/drivers/iio/adc/ad7791.c b/drivers/iio/adc/ad7791.c
index c2688307bbba..1edc2284626f 100644
--- a/drivers/iio/adc/ad7791.c
+++ b/drivers/iio/adc/ad7791.c
@@ -26,8 +26,6 @@
#include <linux/iio/triggered_buffer.h>
#include <linux/iio/adc/ad_sigma_delta.h>

-#include <linux/platform_data/ad7791.h>
-
#define AD7791_REG_COMM 0x0 /* For writes */
#define AD7791_REG_STATUS 0x0 /* For reads */
#define AD7791_REG_MODE 0x1
@@ -376,28 +374,11 @@ static const struct iio_info ad7791_no_filter_info = {
.validate_trigger = ad_sd_validate_trigger,
};

-static int ad7791_setup(struct ad7791_state *st,
- const struct ad7791_platform_data *pdata)
+static void ad7791_setup(struct ad7791_state *st)
{
/* Set to poweron-reset default values */
st->mode = AD7791_MODE_BUFFER;
st->filter = AD7791_FILTER_RATE_16_6;
-
- if (!pdata)
- return 0;
-
- if ((st->info->flags & AD7791_FLAG_HAS_BUFFER) && !pdata->buffered)
- st->mode &= ~AD7791_MODE_BUFFER;
-
- if ((st->info->flags & AD7791_FLAG_HAS_BURNOUT) &&
- pdata->burnout_current)
- st->mode |= AD7791_MODE_BURNOUT;
-
- if ((st->info->flags & AD7791_FLAG_HAS_UNIPOLAR) && pdata->unipolar)
- st->mode |= AD7791_MODE_UNIPOLAR;
-
- return ad_sd_write_reg(&st->sd, AD7791_REG_MODE, sizeof(st->mode),
- st->mode);
}

static void ad7791_reg_disable(void *reg)
@@ -408,7 +389,6 @@ static void ad7791_reg_disable(void *reg)
static int ad7791_probe(struct spi_device *spi)
{
struct device *dev = &spi->dev;
- const struct ad7791_platform_data *pdata = dev_get_platdata(dev);
struct iio_dev *indio_dev;
struct ad7791_state *st;
int ret;
@@ -450,9 +430,7 @@ static int ad7791_probe(struct spi_device *spi)
if (ret)
return ret;

- ret = ad7791_setup(st, pdata);
- if (ret)
- return ret;
+ ad7791_setup(st);

return devm_iio_device_register(dev, indio_dev);
}
diff --git a/include/linux/platform_data/ad7791.h b/include/linux/platform_data/ad7791.h
deleted file mode 100644
index cc7533049b5b..000000000000
--- a/include/linux/platform_data/ad7791.h
+++ /dev/null
@@ -1,18 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-#ifndef __LINUX_PLATFORM_DATA_AD7791__
-#define __LINUX_PLATFORM_DATA_AD7791__
-
-/**
- * struct ad7791_platform_data - AD7791 device platform data
- * @buffered: If set to true configure the device for buffered input mode.
- * @burnout_current: If set to true the 100mA burnout current is enabled.
- * @unipolar: If set to true sample in unipolar mode, if set to false sample in
- * bipolar mode.
- */
-struct ad7791_platform_data {
- bool buffered;
- bool burnout_current;
- bool unipolar;
-};
-
-#endif

--
2.56.0