diff options
author | Alexandru Ardelean <aardelean@deviqon.com> | 2021-09-03 10:29:14 +0300 |
---|---|---|
committer | Jonathan Cameron <Jonathan.Cameron@huawei.com> | 2021-10-19 10:27:34 +0300 |
commit | 7a29120c6e31e2f2ce3a0bacdcbc5efaf6603589 (patch) | |
tree | 6ec3931f1389355ac584802797291a4d2455136d /drivers/iio/adc/intel_mrfld_adc.c | |
parent | 25c02edfd41f0dd7aad9115149625d7e7f441b7d (diff) | |
download | linux-7a29120c6e31e2f2ce3a0bacdcbc5efaf6603589.tar.xz |
iio: adc: intel_mrfld_adc: convert probe to full device-managed
The only call in the remove hook is the iio_map_array_unregister() call.
Since we have a devm_iio_map_array_register() function now, we can use that
and remove the remove hook entirely.
The IIO device was registered with the devm_iio_device_register() prior to
this change.
Also, the platform_set_drvdata() can be removed now, since it was used only
in the remove hook.
Signed-off-by: Alexandru Ardelean <aardelean@deviqon.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20210903072917.45769-3-aardelean@deviqon.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Diffstat (limited to 'drivers/iio/adc/intel_mrfld_adc.c')
-rw-r--r-- | drivers/iio/adc/intel_mrfld_adc.c | 24 |
1 files changed, 2 insertions, 22 deletions
diff --git a/drivers/iio/adc/intel_mrfld_adc.c b/drivers/iio/adc/intel_mrfld_adc.c index 75394350eb4c..616de0c3a049 100644 --- a/drivers/iio/adc/intel_mrfld_adc.c +++ b/drivers/iio/adc/intel_mrfld_adc.c @@ -205,8 +205,6 @@ static int mrfld_adc_probe(struct platform_device *pdev) if (ret) return ret; - platform_set_drvdata(pdev, indio_dev); - indio_dev->name = pdev->name; indio_dev->channels = mrfld_adc_channels; @@ -214,28 +212,11 @@ static int mrfld_adc_probe(struct platform_device *pdev) indio_dev->info = &mrfld_adc_iio_info; indio_dev->modes = INDIO_DIRECT_MODE; - ret = iio_map_array_register(indio_dev, iio_maps); + ret = devm_iio_map_array_register(dev, indio_dev, iio_maps); if (ret) return ret; - ret = devm_iio_device_register(dev, indio_dev); - if (ret < 0) - goto err_array_unregister; - - return 0; - -err_array_unregister: - iio_map_array_unregister(indio_dev); - return ret; -} - -static int mrfld_adc_remove(struct platform_device *pdev) -{ - struct iio_dev *indio_dev = platform_get_drvdata(pdev); - - iio_map_array_unregister(indio_dev); - - return 0; + return devm_iio_device_register(dev, indio_dev); } static const struct platform_device_id mrfld_adc_id_table[] = { @@ -249,7 +230,6 @@ static struct platform_driver mrfld_adc_driver = { .name = "mrfld_bcove_adc", }, .probe = mrfld_adc_probe, - .remove = mrfld_adc_remove, .id_table = mrfld_adc_id_table, }; module_platform_driver(mrfld_adc_driver); |