diff options
author | Jonathan Cameron <Jonathan.Cameron@huawei.com> | 2022-10-16 18:09:50 +0100 |
---|---|---|
committer | Jonathan Cameron <Jonathan.Cameron@huawei.com> | 2022-11-23 19:44:04 +0000 |
commit | c5269fe908635c67c1eb4876df625efcfb156827 (patch) | |
tree | 83d4c2552115a35a87ddf3061d23c9ad04db8f97 | |
parent | a43d5155b9455d38c4b3e4656131d79af61a2978 (diff) | |
download | linux-stable-c5269fe908635c67c1eb4876df625efcfb156827.tar.gz linux-stable-c5269fe908635c67c1eb4876df625efcfb156827.tar.bz2 linux-stable-c5269fe908635c67c1eb4876df625efcfb156827.zip |
iio: adc: cc10001: Switch remaining IIO calls in probe to devm_ forms.
As everything else is now handled by devm managed releases the
triggered buffer setup and IIO device registration can also be
moved over to their devm forms allowing dropping of remove().
Only user of drvdata associated with the struct device was the
remove function, so also drop the platform_set_drvdata() call.
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Nuno Sá <nuno.sa@analog.com>
Link: https://lore.kernel.org/r/20221016170950.387751-6-jic23@kernel.org
-rw-r--r-- | drivers/iio/adc/cc10001_adc.c | 28 |
1 files changed, 3 insertions, 25 deletions
diff --git a/drivers/iio/adc/cc10001_adc.c b/drivers/iio/adc/cc10001_adc.c index aecad89c00ff..2cde4b44fc6e 100644 --- a/drivers/iio/adc/cc10001_adc.c +++ b/drivers/iio/adc/cc10001_adc.c @@ -390,33 +390,12 @@ static int cc10001_adc_probe(struct platform_device *pdev) mutex_init(&adc_dev->lock); - ret = iio_triggered_buffer_setup(indio_dev, NULL, - &cc10001_adc_trigger_h, NULL); + ret = devm_iio_triggered_buffer_setup(dev, indio_dev, NULL, + &cc10001_adc_trigger_h, NULL); if (ret < 0) return ret; - ret = iio_device_register(indio_dev); - if (ret < 0) - goto err_cleanup_buffer; - - platform_set_drvdata(pdev, indio_dev); - - return 0; - -err_cleanup_buffer: - iio_triggered_buffer_cleanup(indio_dev); - return ret; -} - -static int cc10001_adc_remove(struct platform_device *pdev) -{ - struct iio_dev *indio_dev = platform_get_drvdata(pdev); - struct cc10001_adc_device *adc_dev = iio_priv(indio_dev); - - iio_device_unregister(indio_dev); - iio_triggered_buffer_cleanup(indio_dev); - - return 0; + return devm_iio_device_register(dev, indio_dev); } static const struct of_device_id cc10001_adc_dt_ids[] = { @@ -431,7 +410,6 @@ static struct platform_driver cc10001_adc_driver = { .of_match_table = cc10001_adc_dt_ids, }, .probe = cc10001_adc_probe, - .remove = cc10001_adc_remove, }; module_platform_driver(cc10001_adc_driver); |