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

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

+3 -25
+3 -25
drivers/iio/adc/cc10001_adc.c
··· 390 390 391 391 mutex_init(&adc_dev->lock); 392 392 393 - ret = iio_triggered_buffer_setup(indio_dev, NULL, 394 - &cc10001_adc_trigger_h, NULL); 393 + ret = devm_iio_triggered_buffer_setup(dev, indio_dev, NULL, 394 + &cc10001_adc_trigger_h, NULL); 395 395 if (ret < 0) 396 396 return ret; 397 397 398 - ret = iio_device_register(indio_dev); 399 - if (ret < 0) 400 - goto err_cleanup_buffer; 401 - 402 - platform_set_drvdata(pdev, indio_dev); 403 - 404 - return 0; 405 - 406 - err_cleanup_buffer: 407 - iio_triggered_buffer_cleanup(indio_dev); 408 - return ret; 409 - } 410 - 411 - static int cc10001_adc_remove(struct platform_device *pdev) 412 - { 413 - struct iio_dev *indio_dev = platform_get_drvdata(pdev); 414 - struct cc10001_adc_device *adc_dev = iio_priv(indio_dev); 415 - 416 - iio_device_unregister(indio_dev); 417 - iio_triggered_buffer_cleanup(indio_dev); 418 - 419 - return 0; 398 + return devm_iio_device_register(dev, indio_dev); 420 399 } 421 400 422 401 static const struct of_device_id cc10001_adc_dt_ids[] = { ··· 410 431 .of_match_table = cc10001_adc_dt_ids, 411 432 }, 412 433 .probe = cc10001_adc_probe, 413 - .remove = cc10001_adc_remove, 414 434 }; 415 435 module_platform_driver(cc10001_adc_driver); 416 436