[PATCH v2 09/11] iio: adc: ad7793: rename platform data to config
From: Nuno Sá
Date: Wed Dec 02 2026 - 12:07:09 EST
As the configuration will no longer come from platform data, rename
struct ad7793_platform_data to struct ad7793_config, and the pdata
variables and ad7793_check_platform_data() accordingly. While at it,
fix the alignment of the lines touched by the rename.
No functional change.
Acked-by: Arnd Bergmann <arnd@xxxxxxxx>
Signed-off-by: Nuno Sá <nuno.sa@xxxxxxxxxx>
---
drivers/iio/adc/ad7793.c | 56 ++++++++++++++++++++++++------------------------
1 file changed, 28 insertions(+), 28 deletions(-)
diff --git a/drivers/iio/adc/ad7793.c b/drivers/iio/adc/ad7793.c
index 275ac576f898..79f8614e649e 100644
--- a/drivers/iio/adc/ad7793.c
+++ b/drivers/iio/adc/ad7793.c
@@ -215,7 +215,7 @@ enum ad7793_excitation_current {
};
/**
- * struct ad7793_platform_data - AD7793 platform data
+ * struct ad7793_config - AD7793 configuration
* @clock_src: Clock source selection
* @burnout_current: If set to true the 100nA burnout current is enabled.
* @boost_enable: Enable boost for the bias voltage generator.
@@ -227,7 +227,7 @@ enum ad7793_excitation_current {
* @exitation_current: Excitation current selection
* @current_source_direction: Excitation current direction selection
*/
-struct ad7793_platform_data {
+struct ad7793_config {
enum ad7793_clock_source clock_src;
bool burnout_current;
bool boost_enable;
@@ -324,36 +324,36 @@ static int ad7793_calibrate_all(struct ad7793_state *st)
ARRAY_SIZE(ad7793_calib_arr));
}
-static int ad7793_check_platform_data(struct ad7793_state *st,
- const struct ad7793_platform_data *pdata)
+static int ad7793_check_config(struct ad7793_state *st,
+ const struct ad7793_config *cfg)
{
- if ((pdata->current_source_direction == AD7793_IEXEC1_IEXEC2_IOUT1 ||
- pdata->current_source_direction == AD7793_IEXEC1_IEXEC2_IOUT2) &&
- ((pdata->exitation_current != AD7793_IX_10uA) &&
- (pdata->exitation_current != AD7793_IX_210uA)))
+ if ((cfg->current_source_direction == AD7793_IEXEC1_IEXEC2_IOUT1 ||
+ cfg->current_source_direction == AD7793_IEXEC1_IEXEC2_IOUT2) &&
+ cfg->exitation_current != AD7793_IX_10uA &&
+ cfg->exitation_current != AD7793_IX_210uA)
return -EINVAL;
if (!(st->chip_info->flags & AD7793_FLAG_HAS_CLKSEL) &&
- pdata->clock_src != AD7793_CLK_SRC_INT)
+ cfg->clock_src != AD7793_CLK_SRC_INT)
return -EINVAL;
if (!(st->chip_info->flags & AD7793_FLAG_HAS_REFSEL) &&
- pdata->refsel != AD7793_REFSEL_REFIN1)
+ cfg->refsel != AD7793_REFSEL_REFIN1)
return -EINVAL;
if (!(st->chip_info->flags & AD7793_FLAG_HAS_VBIAS) &&
- pdata->bias_voltage != AD7793_BIAS_VOLTAGE_DISABLED)
+ cfg->bias_voltage != AD7793_BIAS_VOLTAGE_DISABLED)
return -EINVAL;
if (!(st->chip_info->flags & AD7793_HAS_EXITATION_CURRENT) &&
- pdata->exitation_current != AD7793_IX_DISABLED)
+ cfg->exitation_current != AD7793_IX_DISABLED)
return -EINVAL;
return 0;
}
static int ad7793_setup(struct iio_dev *indio_dev,
- const struct ad7793_platform_data *pdata,
+ const struct ad7793_config *cfg,
unsigned int vref_mv)
{
struct ad7793_state *st = iio_priv(indio_dev);
@@ -361,7 +361,7 @@ static int ad7793_setup(struct iio_dev *indio_dev,
unsigned long long scale_uv;
u32 id;
- ret = ad7793_check_platform_data(st, pdata);
+ ret = ad7793_check_config(st, cfg);
if (ret)
return ret;
@@ -393,19 +393,19 @@ static int ad7793_setup(struct iio_dev *indio_dev,
st->conf = 0;
if (st->chip_info->flags & AD7793_FLAG_HAS_CLKSEL)
- st->mode |= AD7793_MODE_CLKSRC(pdata->clock_src);
+ st->mode |= AD7793_MODE_CLKSRC(cfg->clock_src);
if (st->chip_info->flags & AD7793_FLAG_HAS_REFSEL)
- st->conf |= AD7793_CONF_REFSEL(pdata->refsel);
+ st->conf |= AD7793_CONF_REFSEL(cfg->refsel);
if (st->chip_info->flags & AD7793_FLAG_HAS_VBIAS)
- st->conf |= AD7793_CONF_VBIAS(pdata->bias_voltage);
- if (pdata->buffered || !(st->chip_info->flags & AD7793_FLAG_HAS_BUFFER))
+ st->conf |= AD7793_CONF_VBIAS(cfg->bias_voltage);
+ if (cfg->buffered || !(st->chip_info->flags & AD7793_FLAG_HAS_BUFFER))
st->conf |= AD7793_CONF_BUF;
- if (pdata->boost_enable &&
- (st->chip_info->flags & AD7793_FLAG_HAS_VBIAS))
+ if (cfg->boost_enable &&
+ (st->chip_info->flags & AD7793_FLAG_HAS_VBIAS))
st->conf |= AD7793_CONF_BOOST;
- if (pdata->burnout_current)
+ if (cfg->burnout_current)
st->conf |= AD7793_CONF_BO_EN;
- if (pdata->unipolar)
+ if (cfg->unipolar)
st->conf |= AD7793_CONF_UNIPOLAR;
if (!(st->chip_info->flags & AD7793_FLAG_HAS_GAIN))
@@ -421,8 +421,8 @@ static int ad7793_setup(struct iio_dev *indio_dev,
if (st->chip_info->flags & AD7793_HAS_EXITATION_CURRENT) {
ret = ad_sd_write_reg(&st->sd, AD7793_REG_IO, 1,
- pdata->exitation_current |
- (pdata->current_source_direction << 2));
+ cfg->exitation_current |
+ (cfg->current_source_direction << 2));
if (ret)
goto out;
}
@@ -890,12 +890,12 @@ static int ad7793_probe(struct spi_device *spi)
{
static const char * const supplies[] = { "avdd", "dvdd" };
struct device *dev = &spi->dev;
- const struct ad7793_platform_data *pdata = dev_get_platdata(dev);
+ const struct ad7793_config *cfg = dev_get_platdata(dev);
struct ad7793_state *st;
struct iio_dev *indio_dev;
int ret, vref_mv = 0;
- if (!pdata)
+ if (!cfg)
return dev_err_probe(dev, -ENODEV, "no platform data?\n");
if (!spi->irq)
@@ -915,7 +915,7 @@ static int ad7793_probe(struct spi_device *spi)
if (ret)
return dev_err_probe(dev, ret, "Failed to enable supplies\n");
- if (pdata->refsel != AD7793_REFSEL_INTERNAL) {
+ if (cfg->refsel != AD7793_REFSEL_INTERNAL) {
ret = devm_regulator_get_enable_read_voltage(dev, "refin");
if (ret < 0)
return ret;
@@ -939,7 +939,7 @@ static int ad7793_probe(struct spi_device *spi)
if (ret)
return ret;
- ret = ad7793_setup(indio_dev, pdata, vref_mv);
+ ret = ad7793_setup(indio_dev, cfg, vref_mv);
if (ret)
return ret;
--
2.56.0