diff options
| author | Lars-Peter Clausen <lars@metafoo.de> | 2016-10-19 20:07:03 +0300 |
|---|---|---|
| committer | Jonathan Cameron <jic23@kernel.org> | 2016-10-23 21:34:15 +0300 |
| commit | 382a4777ec03ef2b3320a39eec415003f76e9be4 (patch) | |
| tree | 58b69d7394c7390253fc2a9f6cd5f711ac775cda | |
| parent | 91b7334bae734586b153a79fd82873c5d00eb950 (diff) | |
| download | linux-382a4777ec03ef2b3320a39eec415003f76e9be4.tar.xz | |
staging:iio:ad7606: Move set_drvdata() into common code
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>
| -rw-r--r-- | drivers/staging/iio/adc/ad7606_core.c | 2 | ||||
| -rw-r--r-- | drivers/staging/iio/adc/ad7606_par.c | 2 | ||||
| -rw-r--r-- | drivers/staging/iio/adc/ad7606_spi.c | 2 |
3 files changed, 2 insertions, 4 deletions
diff --git a/drivers/staging/iio/adc/ad7606_core.c b/drivers/staging/iio/adc/ad7606_core.c index 4ce103a16eeb..13d8090bd821 100644 --- a/drivers/staging/iio/adc/ad7606_core.c +++ b/drivers/staging/iio/adc/ad7606_core.c @@ -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); diff --git a/drivers/staging/iio/adc/ad7606_par.c b/drivers/staging/iio/adc/ad7606_par.c index 0a23cd923415..c273993a7f2e 100644 --- a/drivers/staging/iio/adc/ad7606_par.c +++ b/drivers/staging/iio/adc/ad7606_par.c @@ -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; } diff --git a/drivers/staging/iio/adc/ad7606_spi.c b/drivers/staging/iio/adc/ad7606_spi.c index f69db597d6e0..9abbc151a771 100644 --- a/drivers/staging/iio/adc/ad7606_spi.c +++ b/drivers/staging/iio/adc/ad7606_spi.c @@ -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; } |
