Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Alexandru Ardelean and committed by
Jonathan Cameron
7a29120c 25c02edf

+2 -22
+2 -22
drivers/iio/adc/intel_mrfld_adc.c
··· 205 205 if (ret) 206 206 return ret; 207 207 208 - platform_set_drvdata(pdev, indio_dev); 209 - 210 208 indio_dev->name = pdev->name; 211 209 212 210 indio_dev->channels = mrfld_adc_channels; ··· 212 214 indio_dev->info = &mrfld_adc_iio_info; 213 215 indio_dev->modes = INDIO_DIRECT_MODE; 214 216 215 - ret = iio_map_array_register(indio_dev, iio_maps); 217 + ret = devm_iio_map_array_register(dev, indio_dev, iio_maps); 216 218 if (ret) 217 219 return ret; 218 220 219 - ret = devm_iio_device_register(dev, indio_dev); 220 - if (ret < 0) 221 - goto err_array_unregister; 222 - 223 - return 0; 224 - 225 - err_array_unregister: 226 - iio_map_array_unregister(indio_dev); 227 - return ret; 228 - } 229 - 230 - static int mrfld_adc_remove(struct platform_device *pdev) 231 - { 232 - struct iio_dev *indio_dev = platform_get_drvdata(pdev); 233 - 234 - iio_map_array_unregister(indio_dev); 235 - 236 - return 0; 221 + return devm_iio_device_register(dev, indio_dev); 237 222 } 238 223 239 224 static const struct platform_device_id mrfld_adc_id_table[] = { ··· 230 249 .name = "mrfld_bcove_adc", 231 250 }, 232 251 .probe = mrfld_adc_probe, 233 - .remove = mrfld_adc_remove, 234 252 .id_table = mrfld_adc_id_table, 235 253 }; 236 254 module_platform_driver(mrfld_adc_driver);