]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
iio: adc: ad7292: add dev variable
authorAntoniu Miclaus <antoniu.miclaus@analog.com>
Mon, 30 Mar 2026 11:18:49 +0000 (14:18 +0300)
committerJonathan Cameron <jic23@kernel.org>
Mon, 27 Apr 2026 08:58:18 +0000 (09:58 +0100)
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>
drivers/iio/adc/ad7292.c

index a398973f313d8a21a8bf298c9ce356ce616fb340..64d40b053582d1a07667a69ccaf4d53a99234e4f 100644 (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[] = {