spi: stm32: defer probe for reset

Defer the probe operation when a reset controller device is expected
but have not yet been probed.

This change replaces use of devm_reset_control_get_exclusive() with
devm_reset_control_get_optional_exclusive() as reset controller is
optional which is now explicitly stated.

Signed-off-by: Alain Volmat <alain.volmat@foss.st.com>
Link: https://lore.kernel.org/r/1612551572-495-7-git-send-email-alain.volmat@foss.st.com
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
Alain Volmat 2021-02-05 19:59:30 +01:00 committed by Mark Brown
parent 1c75cfd53e
commit c63b95b76e
No known key found for this signature in database
GPG Key ID: 24D68B725D5487D0

View File

@ -1871,8 +1871,14 @@ static int stm32_spi_probe(struct platform_device *pdev)
goto err_clk_disable; goto err_clk_disable;
} }
rst = devm_reset_control_get_exclusive(&pdev->dev, NULL); rst = devm_reset_control_get_optional_exclusive(&pdev->dev, NULL);
if (!IS_ERR(rst)) { if (rst) {
if (IS_ERR(rst)) {
ret = dev_err_probe(&pdev->dev, PTR_ERR(rst),
"failed to get reset\n");
goto err_clk_disable;
}
reset_control_assert(rst); reset_control_assert(rst);
udelay(2); udelay(2);
reset_control_deassert(rst); reset_control_deassert(rst);