iio: adc: ad7292: add dev variable

Add a local struct device pointer to simplify repeated &spi->dev
dereferences throughout the probe function.

Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
This commit is contained in:
Antoniu Miclaus 2026-03-30 14:18:49 +03:00 committed by Jonathan Cameron
parent d145e05835
commit 655c5e04e1

View File

@ -253,12 +253,13 @@ static const struct iio_info ad7292_info = {
static int ad7292_probe(struct spi_device *spi)
{
struct device *dev = &spi->dev;
struct ad7292_state *st;
struct iio_dev *indio_dev;
bool diff_channels = false;
int ret;
indio_dev = devm_iio_device_alloc(&spi->dev, sizeof(*st));
indio_dev = devm_iio_device_alloc(dev, sizeof(*st));
if (!indio_dev)
return -ENOMEM;
@ -271,7 +272,7 @@ static int ad7292_probe(struct spi_device *spi)
return -EINVAL;
}
ret = devm_regulator_get_enable_read_voltage(&spi->dev, "vref");
ret = devm_regulator_get_enable_read_voltage(dev, "vref");
if (ret < 0 && ret != -ENODEV)
return ret;
@ -281,7 +282,7 @@ static int ad7292_probe(struct spi_device *spi)
indio_dev->modes = INDIO_DIRECT_MODE;
indio_dev->info = &ad7292_info;
device_for_each_child_node_scoped(&spi->dev, child) {
device_for_each_child_node_scoped(dev, child) {
diff_channels = fwnode_property_read_bool(child,
"diff-channels");
if (diff_channels)
@ -296,7 +297,7 @@ static int ad7292_probe(struct spi_device *spi)
indio_dev->channels = ad7292_channels;
}
return devm_iio_device_register(&spi->dev, indio_dev);
return devm_iio_device_register(dev, indio_dev);
}
static const struct spi_device_id ad7292_id_table[] = {