From: Antoniu Miclaus Date: Mon, 30 Mar 2026 11:18:49 +0000 (+0300) Subject: iio: adc: ad7292: add dev variable X-Git-Tag: v7.2-rc1~67^2~5^2~242 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=655c5e04e1aba4895525095863ac786ff51bd906;p=thirdparty%2Fkernel%2Flinux.git 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 Signed-off-by: Jonathan Cameron --- diff --git a/drivers/iio/adc/ad7292.c b/drivers/iio/adc/ad7292.c index a398973f313d8..64d40b053582d 100644 --- a/drivers/iio/adc/ad7292.c +++ b/drivers/iio/adc/ad7292.c @@ -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[] = {