]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
staging:iio:ad7606: Move set_drvdata() into common code
authorLars-Peter Clausen <lars@metafoo.de>
Wed, 19 Oct 2016 17:07:03 +0000 (19:07 +0200)
committerJonathan Cameron <jic23@kernel.org>
Sun, 23 Oct 2016 18:34:15 +0000 (19:34 +0100)
Both the platform_device and SPI driver call set_drvdata() at the end of
their probe function. Move this into the common probe() function to reduce
duplicated code.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
drivers/staging/iio/adc/ad7606_core.c
drivers/staging/iio/adc/ad7606_par.c
drivers/staging/iio/adc/ad7606_spi.c

index 4ce103a16eeb50e736f28d4462f78cb91b34d203..13d8090bd821f3f9c06f823ec60687dc496598b1 100644 (file)
@@ -517,6 +517,8 @@ struct iio_dev *ad7606_probe(struct device *dev, int irq,
        if (ret)
                goto error_unregister_ring;
 
+       dev_set_drvdata(dev, indio_dev);
+
        return indio_dev;
 error_unregister_ring:
        ad7606_ring_cleanup(indio_dev);
index 0a23cd923415f77f9dbe903b7c93ac79255276ca..c273993a7f2ecd34d99c9efb51bb542d16b562c0 100644 (file)
@@ -77,8 +77,6 @@ static int ad7606_par_probe(struct platform_device *pdev)
        if (IS_ERR(indio_dev))
                return PTR_ERR(indio_dev);
 
-       platform_set_drvdata(pdev, indio_dev);
-
        return 0;
 }
 
index f69db597d6e0fce96761e9f306451f01432611c6..9abbc151a7719001969b8696fc4f78fbe3371520 100644 (file)
@@ -52,8 +52,6 @@ static int ad7606_spi_probe(struct spi_device *spi)
        if (IS_ERR(indio_dev))
                return PTR_ERR(indio_dev);
 
-       spi_set_drvdata(spi, indio_dev);
-
        return 0;
 }