]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
ASoC: sun4i-spdif: Make reset control non-optional and check for all errors
authorChen-Yu Tsai <wens@csie.org>
Mon, 23 Mar 2026 17:24:48 +0000 (01:24 +0800)
committerMark Brown <broonie@kernel.org>
Tue, 24 Mar 2026 00:11:20 +0000 (00:11 +0000)
The logic around the reset control is weird. The driver already has
quirks describing which compatible strings require a reset control, but
the reset control is acquired using the "optional" API. Then any errors
other than deferred probe are ignored.

Instead, switch to the non-optional variant. Also use the deassered
variant to simplify the code. This also fixes a missing reset assert
upon removal.

Last, clean up the error message printing with dev_err_probe().

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Reviewed-by: Jernej Skrabec <jernej.skrabec@gmail.com>
Link: https://patch.msgid.link/20260323172450.1259111-1-wens@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/sunxi/sun4i-spdif.c

index 65de03ca3ad2910642671374f92e923ae2530312..c2ec19437cd7aea74c6303d3452b5c46fb9fbc69 100644 (file)
@@ -712,15 +712,10 @@ static int sun4i_spdif_probe(struct platform_device *pdev)
        platform_set_drvdata(pdev, host);
 
        if (quirks->has_reset) {
-               host->rst = devm_reset_control_get_optional_exclusive(&pdev->dev,
-                                                                     NULL);
-               if (PTR_ERR(host->rst) == -EPROBE_DEFER) {
-                       ret = -EPROBE_DEFER;
-                       dev_err(&pdev->dev, "Failed to get reset: %d\n", ret);
-                       return ret;
-               }
-               if (!IS_ERR(host->rst))
-                       reset_control_deassert(host->rst);
+               host->rst = devm_reset_control_get_exclusive_deasserted(&pdev->dev, NULL);
+               if (IS_ERR(host->rst))
+                       return dev_err_probe(&pdev->dev, PTR_ERR(host->rst),
+                                            "Failed to get reset\n");
        }
 
        ret = devm_snd_soc_register_component(&pdev->dev,