mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-24 20:54:10 +08:00
regulator: pwm-regulator: Make use of the helper function dev_err_probe()
devm_pwm_get() can return -EPROBE_DEFER if the pwm regulator is not ready yet. Use dev_err_probe() for pwm regulator resources to indicate the deferral reason when waiting for the resource to come up. Cc: Martin Blumenstingl <martin.blumenstingl@googlemail.com> Acked-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com> Signed-off-by: Anand Moon <linux.amoon@gmail.com> Link: https://lore.kernel.org/r/20210925173413.1019-1-linux.amoon@gmail.com Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
5fa6863ba6
commit
e458d3f39d
@ -352,15 +352,9 @@ static int pwm_regulator_probe(struct platform_device *pdev)
|
||||
config.init_data = init_data;
|
||||
|
||||
drvdata->pwm = devm_pwm_get(&pdev->dev, NULL);
|
||||
if (IS_ERR(drvdata->pwm)) {
|
||||
ret = PTR_ERR(drvdata->pwm);
|
||||
if (ret == -EPROBE_DEFER)
|
||||
dev_dbg(&pdev->dev,
|
||||
"Failed to get PWM, deferring probe\n");
|
||||
else
|
||||
dev_err(&pdev->dev, "Failed to get PWM: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
if (IS_ERR(drvdata->pwm))
|
||||
return dev_err_probe(&pdev->dev, PTR_ERR(drvdata->pwm),
|
||||
"Failed to get PWM\n");
|
||||
|
||||
if (init_data->constraints.boot_on || init_data->constraints.always_on)
|
||||
gpio_flags = GPIOD_OUT_HIGH;
|
||||
|
Loading…
Reference in New Issue
Block a user