Commit 4a03b5db authored by Krzysztof Kozlowski's avatar Krzysztof Kozlowski Committed by Mark Brown

ASoC: codecs: wcd9335: Handle nicer probe deferral and simplify with dev_err_probe()

wcd9335_parse_dt() function is called only from probe(), so printing
errors on resource acquisition is discouraged, because it can pollute
dmesg.  Use dev_err_probe() to fix this and also make the code a bit
simpler.
Signed-off-by: default avatarKrzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://msgid.link/r/20240612-asoc-wcd9xxx-wide-cleanups-v1-4-0d15885b2a06@linaro.orgSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent b2ff7c88
......@@ -5031,22 +5031,16 @@ static int wcd9335_parse_dt(struct wcd9335_codec *wcd)
int ret;
wcd->reset_gpio = of_get_named_gpio(np, "reset-gpios", 0);
if (wcd->reset_gpio < 0) {
dev_err(dev, "Reset GPIO missing from DT\n");
return wcd->reset_gpio;
}
if (wcd->reset_gpio < 0)
return dev_err_probe(dev, wcd->reset_gpio, "Reset GPIO missing from DT\n");
wcd->mclk = devm_clk_get(dev, "mclk");
if (IS_ERR(wcd->mclk)) {
dev_err(dev, "mclk not found\n");
return PTR_ERR(wcd->mclk);
}
if (IS_ERR(wcd->mclk))
return dev_err_probe(dev, PTR_ERR(wcd->mclk), "mclk not found\n");
wcd->native_clk = devm_clk_get(dev, "slimbus");
if (IS_ERR(wcd->native_clk)) {
dev_err(dev, "slimbus clock not found\n");
return PTR_ERR(wcd->native_clk);
}
if (IS_ERR(wcd->native_clk))
return dev_err_probe(dev, PTR_ERR(wcd->native_clk), "slimbus clock not found\n");
wcd->supplies[0].supply = "vdd-buck";
wcd->supplies[1].supply = "vdd-buck-sido";
......@@ -5055,10 +5049,8 @@ static int wcd9335_parse_dt(struct wcd9335_codec *wcd)
wcd->supplies[4].supply = "vdd-io";
ret = regulator_bulk_get(dev, WCD9335_MAX_SUPPLY, wcd->supplies);
if (ret) {
dev_err(dev, "Failed to get supplies: err = %d\n", ret);
return ret;
}
if (ret)
return dev_err_probe(dev, ret, "Failed to get supplies\n");
return 0;
}
......@@ -5157,10 +5149,8 @@ static int wcd9335_slim_probe(struct slim_device *slim)
wcd->dev = dev;
ret = wcd9335_parse_dt(wcd);
if (ret) {
dev_err(dev, "Error parsing DT: %d\n", ret);
if (ret)
return ret;
}
ret = wcd9335_power_on_reset(wcd);
if (ret)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment