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

iio: adc: rockchip_saradc: replace custom logic with devm_reset_control_get_optional_exclusive

devm_reset_control_get_optional_exclusive does what this driver is
trying to do in its probe function, therefore let's switch over to that
subsystem function.

Signed-off-by: Quentin Schulz <quentin.schulz@theobroma-systems.com>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20240223-saradcv2-chan-mask-v1-3-84b06a0f623a@theobroma-systems.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

authored by

Quentin Schulz and committed by
Jonathan Cameron
9443c19c 5b4e4b72

+3 -8
+3 -8
drivers/iio/adc/rockchip_saradc.c
··· 450 450 * The reset should be an optional property, as it should work 451 451 * with old devicetrees as well 452 452 */ 453 - info->reset = devm_reset_control_get_exclusive(&pdev->dev, 454 - "saradc-apb"); 453 + info->reset = devm_reset_control_get_optional_exclusive(&pdev->dev, 454 + "saradc-apb"); 455 455 if (IS_ERR(info->reset)) { 456 456 ret = PTR_ERR(info->reset); 457 - if (ret != -ENOENT) 458 - return dev_err_probe(&pdev->dev, ret, 459 - "failed to get saradc-apb\n"); 460 - 461 - dev_dbg(&pdev->dev, "no reset control found\n"); 462 - info->reset = NULL; 457 + return dev_err_probe(&pdev->dev, ret, "failed to get saradc-apb\n"); 463 458 } 464 459 465 460 init_completion(&info->completion);