Commit 38fa8d3c authored by Mark Brown's avatar Mark Brown

ASoC: Use dev_err_probe() helper

Merge series from Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>:

This patch-set tries to use dev_err_probe() helper function
instead of manual dev_err() code.
I hope ASoC will be more clean code by this patch-set.
parents 98bf33ca 11a95c58
......@@ -144,9 +144,9 @@ static int snd_proto_probe(struct platform_device *pdev)
of_node_put(cpu_np);
ret = snd_soc_register_card(&snd_proto);
if (ret && ret != -EPROBE_DEFER)
dev_err(&pdev->dev,
"snd_soc_register_card() failed: %d\n", ret);
if (ret)
dev_err_probe(&pdev->dev, ret,
"snd_soc_register_card() failed\n");
return ret;
}
......
......@@ -371,35 +371,27 @@ static int tse850_probe(struct platform_device *pdev)
}
tse850->add = devm_gpiod_get(dev, "axentia,add", GPIOD_OUT_HIGH);
if (IS_ERR(tse850->add)) {
if (PTR_ERR(tse850->add) != -EPROBE_DEFER)
dev_err(dev, "failed to get 'add' gpio\n");
return PTR_ERR(tse850->add);
}
if (IS_ERR(tse850->add))
return dev_err_probe(dev, PTR_ERR(tse850->add),
"failed to get 'add' gpio\n");
tse850->add_cache = 1;
tse850->loop1 = devm_gpiod_get(dev, "axentia,loop1", GPIOD_OUT_HIGH);
if (IS_ERR(tse850->loop1)) {
if (PTR_ERR(tse850->loop1) != -EPROBE_DEFER)
dev_err(dev, "failed to get 'loop1' gpio\n");
return PTR_ERR(tse850->loop1);
}
if (IS_ERR(tse850->loop1))
return dev_err_probe(dev, PTR_ERR(tse850->loop1),
"failed to get 'loop1' gpio\n");
tse850->loop1_cache = 1;
tse850->loop2 = devm_gpiod_get(dev, "axentia,loop2", GPIOD_OUT_HIGH);
if (IS_ERR(tse850->loop2)) {
if (PTR_ERR(tse850->loop2) != -EPROBE_DEFER)
dev_err(dev, "failed to get 'loop2' gpio\n");
return PTR_ERR(tse850->loop2);
}
if (IS_ERR(tse850->loop2))
return dev_err_probe(dev, PTR_ERR(tse850->loop2),
"failed to get 'loop2' gpio\n");
tse850->loop2_cache = 1;
tse850->ana = devm_regulator_get(dev, "axentia,ana");
if (IS_ERR(tse850->ana)) {
if (PTR_ERR(tse850->ana) != -EPROBE_DEFER)
dev_err(dev, "failed to get 'ana' regulator\n");
return PTR_ERR(tse850->ana);
}
if (IS_ERR(tse850->ana))
return dev_err_probe(dev, PTR_ERR(tse850->ana),
"failed to get 'ana' regulator\n");
ret = regulator_enable(tse850->ana);
if (ret < 0) {
......
......@@ -374,20 +374,14 @@ static int ak4118_i2c_probe(struct i2c_client *i2c,
i2c_set_clientdata(i2c, ak4118);
ak4118->reset = devm_gpiod_get(&i2c->dev, "reset", GPIOD_OUT_HIGH);
if (IS_ERR(ak4118->reset)) {
ret = PTR_ERR(ak4118->reset);
if (ret != -EPROBE_DEFER)
dev_err(&i2c->dev, "Failed to get reset: %d\n", ret);
return ret;
}
if (IS_ERR(ak4118->reset))
return dev_err_probe(&i2c->dev, PTR_ERR(ak4118->reset),
"Failed to get reset\n");
ak4118->irq = devm_gpiod_get(&i2c->dev, "irq", GPIOD_IN);
if (IS_ERR(ak4118->irq)) {
ret = PTR_ERR(ak4118->irq);
if (ret != -EPROBE_DEFER)
dev_err(&i2c->dev, "Failed to get IRQ: %d\n", ret);
return ret;
}
if (IS_ERR(ak4118->irq))
return dev_err_probe(&i2c->dev, PTR_ERR(ak4118->irq),
"Failed to get IRQ\n");
ret = devm_request_threaded_irq(&i2c->dev, gpiod_to_irq(ak4118->irq),
NULL, ak4118_irq_handler,
......
......@@ -255,7 +255,6 @@ static int es7241_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
struct es7241_data *priv;
int err;
priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
if (!priv)
......@@ -271,28 +270,19 @@ static int es7241_probe(struct platform_device *pdev)
es7241_parse_fmt(dev, priv);
priv->reset = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_LOW);
if (IS_ERR(priv->reset)) {
err = PTR_ERR(priv->reset);
if (err != -EPROBE_DEFER)
dev_err(dev, "Failed to get 'reset' gpio: %d", err);
return err;
}
if (IS_ERR(priv->reset))
return dev_err_probe(dev, PTR_ERR(priv->reset),
"Failed to get 'reset' gpio");
priv->m0 = devm_gpiod_get_optional(dev, "m0", GPIOD_OUT_LOW);
if (IS_ERR(priv->m0)) {
err = PTR_ERR(priv->m0);
if (err != -EPROBE_DEFER)
dev_err(dev, "Failed to get 'm0' gpio: %d", err);
return err;
}
if (IS_ERR(priv->m0))
return dev_err_probe(dev, PTR_ERR(priv->m0),
"Failed to get 'm0' gpio");
priv->m1 = devm_gpiod_get_optional(dev, "m1", GPIOD_OUT_LOW);
if (IS_ERR(priv->m1)) {
err = PTR_ERR(priv->m1);
if (err != -EPROBE_DEFER)
dev_err(dev, "Failed to get 'm1' gpio: %d", err);
return err;
}
if (IS_ERR(priv->m1))
return dev_err_probe(dev, PTR_ERR(priv->m1),
"Failed to get 'm1' gpio");
return devm_snd_soc_register_component(&pdev->dev,
&es7241_component_driver,
......
......@@ -140,7 +140,6 @@ static int max9759_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
struct max9759 *priv;
int err;
priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
if (!priv)
......@@ -149,29 +148,20 @@ static int max9759_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, priv);
priv->gpiod_shutdown = devm_gpiod_get(dev, "shutdown", GPIOD_OUT_HIGH);
if (IS_ERR(priv->gpiod_shutdown)) {
err = PTR_ERR(priv->gpiod_shutdown);
if (err != -EPROBE_DEFER)
dev_err(dev, "Failed to get 'shutdown' gpio: %d", err);
return err;
}
if (IS_ERR(priv->gpiod_shutdown))
return dev_err_probe(dev, PTR_ERR(priv->gpiod_shutdown),
"Failed to get 'shutdown' gpio");
priv->gpiod_mute = devm_gpiod_get(dev, "mute", GPIOD_OUT_HIGH);
if (IS_ERR(priv->gpiod_mute)) {
err = PTR_ERR(priv->gpiod_mute);
if (err != -EPROBE_DEFER)
dev_err(dev, "Failed to get 'mute' gpio: %d", err);
return err;
}
if (IS_ERR(priv->gpiod_mute))
return dev_err_probe(dev, PTR_ERR(priv->gpiod_mute),
"Failed to get 'mute' gpio");
priv->is_mute = true;
priv->gpiod_gain = devm_gpiod_get_array(dev, "gain", GPIOD_OUT_HIGH);
if (IS_ERR(priv->gpiod_gain)) {
err = PTR_ERR(priv->gpiod_gain);
if (err != -EPROBE_DEFER)
dev_err(dev, "Failed to get 'gain' gpios: %d", err);
return err;
}
if (IS_ERR(priv->gpiod_gain))
return dev_err_probe(dev, PTR_ERR(priv->gpiod_gain),
"Failed to get 'gain' gpios");
priv->gain = 0;
if (priv->gpiod_gain->ndescs != 2) {
......
......@@ -606,12 +606,9 @@ static int max9860_probe(struct i2c_client *i2c)
return -ENOMEM;
max9860->dvddio = devm_regulator_get(dev, "DVDDIO");
if (IS_ERR(max9860->dvddio)) {
ret = PTR_ERR(max9860->dvddio);
if (ret != -EPROBE_DEFER)
dev_err(dev, "Failed to get DVDDIO supply: %d\n", ret);
return ret;
}
if (IS_ERR(max9860->dvddio))
return dev_err_probe(dev, PTR_ERR(max9860->dvddio),
"Failed to get DVDDIO supply\n");
max9860->dvddio_nb.notifier_call = max9860_dvddio_event;
......@@ -643,8 +640,7 @@ static int max9860_probe(struct i2c_client *i2c)
if (IS_ERR(mclk)) {
ret = PTR_ERR(mclk);
if (ret != -EPROBE_DEFER)
dev_err(dev, "Failed to get MCLK: %d\n", ret);
dev_err_probe(dev, ret, "Failed to get MCLK\n");
goto err_regulator;
}
......
......@@ -751,21 +751,14 @@ int pcm3168a_probe(struct device *dev, struct regmap *regmap)
pcm3168a->gpio_rst = devm_gpiod_get_optional(dev, "reset",
GPIOD_OUT_LOW |
GPIOD_FLAGS_BIT_NONEXCLUSIVE);
if (IS_ERR(pcm3168a->gpio_rst)) {
ret = PTR_ERR(pcm3168a->gpio_rst);
if (ret != -EPROBE_DEFER )
dev_err(dev, "failed to acquire RST gpio: %d\n", ret);
return ret;
}
if (IS_ERR(pcm3168a->gpio_rst))
return dev_err_probe(dev, PTR_ERR(pcm3168a->gpio_rst),
"failed to acquire RST gpio\n");
pcm3168a->scki = devm_clk_get(dev, "scki");
if (IS_ERR(pcm3168a->scki)) {
ret = PTR_ERR(pcm3168a->scki);
if (ret != -EPROBE_DEFER)
dev_err(dev, "failed to acquire clock 'scki': %d\n", ret);
return ret;
}
if (IS_ERR(pcm3168a->scki))
return dev_err_probe(dev, PTR_ERR(pcm3168a->scki),
"failed to acquire clock 'scki'\n");
ret = clk_prepare_enable(pcm3168a->scki);
if (ret) {
......@@ -781,8 +774,7 @@ int pcm3168a_probe(struct device *dev, struct regmap *regmap)
ret = devm_regulator_bulk_get(dev,
ARRAY_SIZE(pcm3168a->supplies), pcm3168a->supplies);
if (ret) {
if (ret != -EPROBE_DEFER)
dev_err(dev, "failed to request supplies: %d\n", ret);
dev_err_probe(dev, ret, "failed to request supplies\n");
goto err_clk;
}
......
......@@ -1612,9 +1612,8 @@ static int sgtl5000_i2c_probe(struct i2c_client *client,
if (ret == -ENOENT)
ret = -EPROBE_DEFER;
if (ret != -EPROBE_DEFER)
dev_err(&client->dev, "Failed to get mclock: %d\n",
ret);
dev_err_probe(&client->dev, ret, "Failed to get mclock\n");
goto disable_regs;
}
......
......@@ -69,7 +69,6 @@ static int simple_amp_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
struct simple_amp *priv;
int err;
priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
if (priv == NULL)
......@@ -78,12 +77,9 @@ static int simple_amp_probe(struct platform_device *pdev)
priv->gpiod_enable = devm_gpiod_get_optional(dev, "enable",
GPIOD_OUT_LOW);
if (IS_ERR(priv->gpiod_enable)) {
err = PTR_ERR(priv->gpiod_enable);
if (err != -EPROBE_DEFER)
dev_err(dev, "Failed to get 'enable' gpio: %d", err);
return err;
}
if (IS_ERR(priv->gpiod_enable))
return dev_err_probe(dev, PTR_ERR(priv->gpiod_enable),
"Failed to get 'enable' gpio");
return devm_snd_soc_register_component(dev,
&simple_amp_component_driver,
......
......@@ -82,7 +82,6 @@ static int simple_mux_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
struct simple_mux *priv;
int err;
priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
if (!priv)
......@@ -91,12 +90,9 @@ static int simple_mux_probe(struct platform_device *pdev)
dev_set_drvdata(dev, priv);
priv->gpiod_mux = devm_gpiod_get(dev, "mux", GPIOD_OUT_LOW);
if (IS_ERR(priv->gpiod_mux)) {
err = PTR_ERR(priv->gpiod_mux);
if (err != -EPROBE_DEFER)
dev_err(dev, "Failed to get 'mux' gpio: %d", err);
return err;
}
if (IS_ERR(priv->gpiod_mux))
return dev_err_probe(dev, PTR_ERR(priv->gpiod_mux),
"Failed to get 'mux' gpio");
return devm_snd_soc_register_component(dev, &simple_mux_component_driver, NULL, 0);
}
......
......@@ -57,7 +57,6 @@ static int ssm2305_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
struct ssm2305 *priv;
int err;
/* Allocate the private data */
priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
......@@ -69,13 +68,9 @@ static int ssm2305_probe(struct platform_device *pdev)
/* Get shutdown gpio */
priv->gpiod_shutdown = devm_gpiod_get(dev, "shutdown",
GPIOD_OUT_LOW);
if (IS_ERR(priv->gpiod_shutdown)) {
err = PTR_ERR(priv->gpiod_shutdown);
if (err != -EPROBE_DEFER)
dev_err(dev, "Failed to get 'shutdown' gpio: %d\n",
err);
return err;
}
if (IS_ERR(priv->gpiod_shutdown))
return dev_err_probe(dev, PTR_ERR(priv->gpiod_shutdown),
"Failed to get 'shutdown' gpio\n");
return devm_snd_soc_register_component(dev, &ssm2305_component_driver,
NULL, 0);
......
......@@ -1680,11 +1680,9 @@ static int aic31xx_i2c_probe(struct i2c_client *i2c,
aic31xx->gpio_reset = devm_gpiod_get_optional(aic31xx->dev, "reset",
GPIOD_OUT_LOW);
if (IS_ERR(aic31xx->gpio_reset)) {
if (PTR_ERR(aic31xx->gpio_reset) != -EPROBE_DEFER)
dev_err(aic31xx->dev, "not able to acquire gpio\n");
return PTR_ERR(aic31xx->gpio_reset);
}
if (IS_ERR(aic31xx->gpio_reset))
return dev_err_probe(aic31xx->dev, PTR_ERR(aic31xx->gpio_reset),
"not able to acquire gpio\n");
for (i = 0; i < ARRAY_SIZE(aic31xx->supplies); i++)
aic31xx->supplies[i].supply = aic31xx_supply_names[i];
......@@ -1692,12 +1690,8 @@ static int aic31xx_i2c_probe(struct i2c_client *i2c,
ret = devm_regulator_bulk_get(aic31xx->dev,
ARRAY_SIZE(aic31xx->supplies),
aic31xx->supplies);
if (ret) {
if (ret != -EPROBE_DEFER)
dev_err(aic31xx->dev,
"Failed to request supplies: %d\n", ret);
return ret;
}
if (ret)
return dev_err_probe(aic31xx->dev, ret, "Failed to request supplies\n");
aic31xx_configure_ocmv(aic31xx);
......
......@@ -853,8 +853,7 @@ static int fsl_asoc_card_probe(struct platform_device *pdev)
ret = devm_snd_soc_register_card(&pdev->dev, &priv->card);
if (ret) {
if (ret != -EPROBE_DEFER)
dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n", ret);
dev_err_probe(&pdev->dev, ret, "snd_soc_register_card failed\n");
goto asrc_fail;
}
......
......@@ -563,9 +563,8 @@ static int imx_card_parse_of(struct imx_card_data *data)
ret = snd_soc_of_get_dai_name(cpu, &link->cpus->dai_name);
if (ret) {
if (ret != -EPROBE_DEFER)
dev_err(card->dev, "%s: error getting cpu dai name: %d\n",
link->name, ret);
dev_err_probe(card->dev, ret,
"%s: error getting cpu dai name\n", link->name);
goto err;
}
......@@ -573,9 +572,8 @@ static int imx_card_parse_of(struct imx_card_data *data)
if (codec) {
ret = snd_soc_of_get_dai_link_codecs(dev, codec, link);
if (ret < 0) {
if (ret != -EPROBE_DEFER)
dev_err(dev, "%s: codec dai not found: %d\n",
link->name, ret);
dev_err_probe(dev, ret, "%s: codec dai not found\n",
link->name);
goto err;
}
......@@ -814,11 +812,8 @@ static int imx_card_probe(struct platform_device *pdev)
}
ret = devm_snd_soc_register_card(&pdev->dev, &data->card);
if (ret) {
if (ret != -EPROBE_DEFER)
dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n", ret);
return ret;
}
if (ret)
return dev_err_probe(&pdev->dev, ret, "snd_soc_register_card failed\n");
return 0;
}
......
......@@ -173,9 +173,7 @@ static int imx_sgtl5000_probe(struct platform_device *pdev)
ret = devm_snd_soc_register_card(&pdev->dev, &data->card);
if (ret) {
if (ret != -EPROBE_DEFER)
dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n",
ret);
dev_err_probe(&pdev->dev, ret, "snd_soc_register_card failed\n");
goto fail;
}
......
......@@ -70,8 +70,8 @@ static int imx_spdif_audio_probe(struct platform_device *pdev)
goto end;
ret = devm_snd_soc_register_card(&pdev->dev, &data->card);
if (ret && ret != -EPROBE_DEFER)
dev_err(&pdev->dev, "snd_soc_register_card failed: %d\n", ret);
if (ret)
dev_err_probe(&pdev->dev, ret, "snd_soc_register_card failed\n");
end:
of_node_put(spdif_np);
......
......@@ -593,10 +593,7 @@ int audio_graph_parse_of(struct asoc_simple_priv *priv, struct device *dev)
err:
asoc_simple_clean_reference(card);
if (ret != -EPROBE_DEFER)
dev_err(dev, "parse error %d\n", ret);
return ret;
return dev_err_probe(dev, ret, "parse error\n");
}
EXPORT_SYMBOL_GPL(audio_graph_parse_of);
......
......@@ -1238,8 +1238,8 @@ int audio_graph2_parse_of(struct asoc_simple_priv *priv, struct device *dev,
err:
devm_kfree(dev, li);
if ((ret < 0) && (ret != -EPROBE_DEFER))
dev_err(dev, "parse error %d\n", ret);
if (ret < 0)
dev_err_probe(dev, ret, "parse error\n");
return ret;
}
......
......@@ -642,8 +642,7 @@ static int asoc_simple_probe(struct platform_device *pdev)
ret = simple_parse_of(priv, li);
if (ret < 0) {
if (ret != -EPROBE_DEFER)
dev_err(dev, "parse error %d\n", ret);
dev_err_probe(dev, ret, "parse error\n");
goto err;
}
......
......@@ -451,11 +451,9 @@ static int img_i2s_in_probe(struct platform_device *pdev)
i2s->channel_base = base + (max_i2s_chan_pow_2 * 0x20);
i2s->clk_sys = devm_clk_get(dev, "sys");
if (IS_ERR(i2s->clk_sys)) {
if (PTR_ERR(i2s->clk_sys) != -EPROBE_DEFER)
dev_err(dev, "Failed to acquire clock 'sys'\n");
return PTR_ERR(i2s->clk_sys);
}
if (IS_ERR(i2s->clk_sys))
return dev_err_probe(dev, PTR_ERR(i2s->clk_sys),
"Failed to acquire clock 'sys'\n");
pm_runtime_enable(&pdev->dev);
if (!pm_runtime_enabled(&pdev->dev)) {
......
......@@ -457,25 +457,19 @@ static int img_i2s_out_probe(struct platform_device *pdev)
i2s->channel_base = base + (max_i2s_chan_pow_2 * 0x20);
i2s->rst = devm_reset_control_get_exclusive(&pdev->dev, "rst");
if (IS_ERR(i2s->rst)) {
if (PTR_ERR(i2s->rst) != -EPROBE_DEFER)
dev_err(&pdev->dev, "No top level reset found\n");
return PTR_ERR(i2s->rst);
}
if (IS_ERR(i2s->rst))
return dev_err_probe(&pdev->dev, PTR_ERR(i2s->rst),
"No top level reset found\n");
i2s->clk_sys = devm_clk_get(&pdev->dev, "sys");
if (IS_ERR(i2s->clk_sys)) {
if (PTR_ERR(i2s->clk_sys) != -EPROBE_DEFER)
dev_err(dev, "Failed to acquire clock 'sys'\n");
return PTR_ERR(i2s->clk_sys);
}
if (IS_ERR(i2s->clk_sys))
return dev_err_probe(dev, PTR_ERR(i2s->clk_sys),
"Failed to acquire clock 'sys'\n");
i2s->clk_ref = devm_clk_get(&pdev->dev, "ref");
if (IS_ERR(i2s->clk_ref)) {
if (PTR_ERR(i2s->clk_ref) != -EPROBE_DEFER)
dev_err(dev, "Failed to acquire clock 'ref'\n");
return PTR_ERR(i2s->clk_ref);
}
if (IS_ERR(i2s->clk_ref))
return dev_err_probe(dev, PTR_ERR(i2s->clk_ref),
"Failed to acquire clock 'ref'\n");
i2s->suspend_ch_ctl = devm_kcalloc(dev,
i2s->max_i2s_chan, sizeof(*i2s->suspend_ch_ctl), GFP_KERNEL);
......
......@@ -229,25 +229,19 @@ static int img_prl_out_probe(struct platform_device *pdev)
prl->base = base;
prl->rst = devm_reset_control_get_exclusive(&pdev->dev, "rst");
if (IS_ERR(prl->rst)) {
if (PTR_ERR(prl->rst) != -EPROBE_DEFER)
dev_err(&pdev->dev, "No top level reset found\n");
return PTR_ERR(prl->rst);
}
if (IS_ERR(prl->rst))
return dev_err_probe(&pdev->dev, PTR_ERR(prl->rst),
"No top level reset found\n");
prl->clk_sys = devm_clk_get(&pdev->dev, "sys");
if (IS_ERR(prl->clk_sys)) {
if (PTR_ERR(prl->clk_sys) != -EPROBE_DEFER)
dev_err(dev, "Failed to acquire clock 'sys'\n");
return PTR_ERR(prl->clk_sys);
}
if (IS_ERR(prl->clk_sys))
return dev_err_probe(dev, PTR_ERR(prl->clk_sys),
"Failed to acquire clock 'sys'\n");
prl->clk_ref = devm_clk_get(&pdev->dev, "ref");
if (IS_ERR(prl->clk_ref)) {
if (PTR_ERR(prl->clk_ref) != -EPROBE_DEFER)
dev_err(dev, "Failed to acquire clock 'ref'\n");
return PTR_ERR(prl->clk_ref);
}
if (IS_ERR(prl->clk_ref))
return dev_err_probe(dev, PTR_ERR(prl->clk_ref),
"Failed to acquire clock 'ref'\n");
ret = clk_prepare_enable(prl->clk_sys);
if (ret)
......
......@@ -739,11 +739,9 @@ static int img_spdif_in_probe(struct platform_device *pdev)
spdif->base = base;
spdif->clk_sys = devm_clk_get(dev, "sys");
if (IS_ERR(spdif->clk_sys)) {
if (PTR_ERR(spdif->clk_sys) != -EPROBE_DEFER)
dev_err(dev, "Failed to acquire clock 'sys'\n");
return PTR_ERR(spdif->clk_sys);
}
if (IS_ERR(spdif->clk_sys))
return dev_err_probe(dev, PTR_ERR(spdif->clk_sys),
"Failed to acquire clock 'sys'\n");
pm_runtime_enable(&pdev->dev);
if (!pm_runtime_enabled(&pdev->dev)) {
......
......@@ -342,25 +342,19 @@ static int img_spdif_out_probe(struct platform_device *pdev)
spdif->base = base;
spdif->rst = devm_reset_control_get_exclusive(&pdev->dev, "rst");
if (IS_ERR(spdif->rst)) {
if (PTR_ERR(spdif->rst) != -EPROBE_DEFER)
dev_err(&pdev->dev, "No top level reset found\n");
return PTR_ERR(spdif->rst);
}
if (IS_ERR(spdif->rst))
return dev_err_probe(&pdev->dev, PTR_ERR(spdif->rst),
"No top level reset found\n");
spdif->clk_sys = devm_clk_get(&pdev->dev, "sys");
if (IS_ERR(spdif->clk_sys)) {
if (PTR_ERR(spdif->clk_sys) != -EPROBE_DEFER)
dev_err(dev, "Failed to acquire clock 'sys'\n");
return PTR_ERR(spdif->clk_sys);
}
if (IS_ERR(spdif->clk_sys))
return dev_err_probe(dev, PTR_ERR(spdif->clk_sys),
"Failed to acquire clock 'sys'\n");
spdif->clk_ref = devm_clk_get(&pdev->dev, "ref");
if (IS_ERR(spdif->clk_ref)) {
if (PTR_ERR(spdif->clk_ref) != -EPROBE_DEFER)
dev_err(dev, "Failed to acquire clock 'ref'\n");
return PTR_ERR(spdif->clk_ref);
}
if (IS_ERR(spdif->clk_ref))
return dev_err_probe(dev, PTR_ERR(spdif->clk_ref),
"Failed to acquire clock 'ref'\n");
pm_runtime_enable(&pdev->dev);
if (!pm_runtime_enabled(&pdev->dev)) {
......
......@@ -161,12 +161,9 @@ static int pistachio_internal_dac_probe(struct platform_device *pdev)
return PTR_ERR(dac->regmap);
dac->supply = devm_regulator_get(dev, "VDD");
if (IS_ERR(dac->supply)) {
ret = PTR_ERR(dac->supply);
if (ret != -EPROBE_DEFER)
dev_err(dev, "failed to acquire supply 'VDD-supply': %d\n", ret);
return ret;
}
if (IS_ERR(dac->supply))
return dev_err_probe(dev, PTR_ERR(dac->supply),
"failed to acquire supply 'VDD-supply'\n");
ret = regulator_enable(dac->supply);
if (ret) {
......
......@@ -218,34 +218,23 @@ static int aiu_clk_get(struct device *dev)
int ret;
aiu->pclk = devm_clk_get(dev, "pclk");
if (IS_ERR(aiu->pclk)) {
if (PTR_ERR(aiu->pclk) != -EPROBE_DEFER)
dev_err(dev, "Can't get the aiu pclk\n");
return PTR_ERR(aiu->pclk);
}
if (IS_ERR(aiu->pclk))
return dev_err_probe(dev, PTR_ERR(aiu->pclk), "Can't get the aiu pclk\n");
aiu->spdif_mclk = devm_clk_get(dev, "spdif_mclk");
if (IS_ERR(aiu->spdif_mclk)) {
if (PTR_ERR(aiu->spdif_mclk) != -EPROBE_DEFER)
dev_err(dev, "Can't get the aiu spdif master clock\n");
return PTR_ERR(aiu->spdif_mclk);
}
if (IS_ERR(aiu->spdif_mclk))
return dev_err_probe(dev, PTR_ERR(aiu->spdif_mclk),
"Can't get the aiu spdif master clock\n");
ret = aiu_clk_bulk_get(dev, aiu_i2s_ids, ARRAY_SIZE(aiu_i2s_ids),
&aiu->i2s);
if (ret) {
if (ret != -EPROBE_DEFER)
dev_err(dev, "Can't get the i2s clocks\n");
return ret;
}
if (ret)
return dev_err_probe(dev, ret, "Can't get the i2s clocks\n");
ret = aiu_clk_bulk_get(dev, aiu_spdif_ids, ARRAY_SIZE(aiu_spdif_ids),
&aiu->spdif);
if (ret) {
if (ret != -EPROBE_DEFER)
dev_err(dev, "Can't get the spdif clocks\n");
return ret;
}
if (ret)
return dev_err_probe(dev, ret, "Can't get the spdif clocks\n");
ret = clk_prepare_enable(aiu->pclk);
if (ret) {
......@@ -281,11 +270,8 @@ static int aiu_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, aiu);
ret = device_reset(dev);
if (ret) {
if (ret != -EPROBE_DEFER)
dev_err(dev, "Failed to reset device\n");
return ret;
}
if (ret)
return dev_err_probe(dev, ret, "Failed to reset device\n");
regs = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(regs))
......
......@@ -351,20 +351,12 @@ int axg_fifo_probe(struct platform_device *pdev)
}
fifo->pclk = devm_clk_get(dev, NULL);
if (IS_ERR(fifo->pclk)) {
if (PTR_ERR(fifo->pclk) != -EPROBE_DEFER)
dev_err(dev, "failed to get pclk: %ld\n",
PTR_ERR(fifo->pclk));
return PTR_ERR(fifo->pclk);
}
if (IS_ERR(fifo->pclk))
return dev_err_probe(dev, PTR_ERR(fifo->pclk), "failed to get pclk\n");
fifo->arb = devm_reset_control_get_exclusive(dev, NULL);
if (IS_ERR(fifo->arb)) {
if (PTR_ERR(fifo->arb) != -EPROBE_DEFER)
dev_err(dev, "failed to get arb reset: %ld\n",
PTR_ERR(fifo->arb));
return PTR_ERR(fifo->arb);
}
if (IS_ERR(fifo->arb))
return dev_err_probe(dev, PTR_ERR(fifo->arb), "failed to get arb reset\n");
fifo->irq = of_irq_get(dev->of_node, 0);
if (fifo->irq <= 0) {
......
......@@ -586,7 +586,6 @@ static int axg_pdm_probe(struct platform_device *pdev)
struct device *dev = &pdev->dev;
struct axg_pdm *priv;
void __iomem *regs;
int ret;
priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
if (!priv)
......@@ -611,28 +610,16 @@ static int axg_pdm_probe(struct platform_device *pdev)
}
priv->pclk = devm_clk_get(dev, "pclk");
if (IS_ERR(priv->pclk)) {
ret = PTR_ERR(priv->pclk);
if (ret != -EPROBE_DEFER)
dev_err(dev, "failed to get pclk: %d\n", ret);
return ret;
}
if (IS_ERR(priv->pclk))
return dev_err_probe(dev, PTR_ERR(priv->pclk), "failed to get pclk\n");
priv->dclk = devm_clk_get(dev, "dclk");
if (IS_ERR(priv->dclk)) {
ret = PTR_ERR(priv->dclk);
if (ret != -EPROBE_DEFER)
dev_err(dev, "failed to get dclk: %d\n", ret);
return ret;
}
if (IS_ERR(priv->dclk))
return dev_err_probe(dev, PTR_ERR(priv->dclk), "failed to get dclk\n");
priv->sysclk = devm_clk_get(dev, "sysclk");
if (IS_ERR(priv->sysclk)) {
ret = PTR_ERR(priv->sysclk);
if (ret != -EPROBE_DEFER)
dev_err(dev, "failed to get dclk: %d\n", ret);
return ret;
}
if (IS_ERR(priv->sysclk))
return dev_err_probe(dev, PTR_ERR(priv->sysclk), "failed to get dclk\n");
return devm_snd_soc_register_component(dev, &axg_pdm_component_drv,
&axg_pdm_dai_drv, 1);
......
......@@ -454,7 +454,6 @@ static int axg_spdifin_probe(struct platform_device *pdev)
struct axg_spdifin *priv;
struct snd_soc_dai_driver *dai_drv;
void __iomem *regs;
int ret;
priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
if (!priv)
......@@ -479,20 +478,12 @@ static int axg_spdifin_probe(struct platform_device *pdev)
}
priv->pclk = devm_clk_get(dev, "pclk");
if (IS_ERR(priv->pclk)) {
ret = PTR_ERR(priv->pclk);
if (ret != -EPROBE_DEFER)
dev_err(dev, "failed to get pclk: %d\n", ret);
return ret;
}
if (IS_ERR(priv->pclk))
return dev_err_probe(dev, PTR_ERR(priv->pclk), "failed to get pclk\n");
priv->refclk = devm_clk_get(dev, "refclk");
if (IS_ERR(priv->refclk)) {
ret = PTR_ERR(priv->refclk);
if (ret != -EPROBE_DEFER)
dev_err(dev, "failed to get mclk: %d\n", ret);
return ret;
}
if (IS_ERR(priv->refclk))
return dev_err_probe(dev, PTR_ERR(priv->refclk), "failed to get mclk\n");
dai_drv = axg_spdifin_get_dai_drv(dev, priv);
if (IS_ERR(dai_drv)) {
......
......@@ -403,7 +403,6 @@ static int axg_spdifout_probe(struct platform_device *pdev)
struct device *dev = &pdev->dev;
struct axg_spdifout *priv;
void __iomem *regs;
int ret;
priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
if (!priv)
......@@ -422,20 +421,12 @@ static int axg_spdifout_probe(struct platform_device *pdev)
}
priv->pclk = devm_clk_get(dev, "pclk");
if (IS_ERR(priv->pclk)) {
ret = PTR_ERR(priv->pclk);
if (ret != -EPROBE_DEFER)
dev_err(dev, "failed to get pclk: %d\n", ret);
return ret;
}
if (IS_ERR(priv->pclk))
return dev_err_probe(dev, PTR_ERR(priv->pclk), "failed to get pclk\n");
priv->mclk = devm_clk_get(dev, "mclk");
if (IS_ERR(priv->mclk)) {
ret = PTR_ERR(priv->mclk);
if (ret != -EPROBE_DEFER)
dev_err(dev, "failed to get mclk: %d\n", ret);
return ret;
}
if (IS_ERR(priv->mclk))
return dev_err_probe(dev, PTR_ERR(priv->mclk), "failed to get mclk\n");
return devm_snd_soc_register_component(dev, &axg_spdifout_component_drv,
axg_spdifout_dai_drv, ARRAY_SIZE(axg_spdifout_dai_drv));
......
......@@ -255,7 +255,6 @@ int axg_tdm_formatter_probe(struct platform_device *pdev)
const struct axg_tdm_formatter_driver *drv;
struct axg_tdm_formatter *formatter;
void __iomem *regs;
int ret;
drv = of_device_get_match_data(dev);
if (!drv) {
......@@ -282,57 +281,34 @@ int axg_tdm_formatter_probe(struct platform_device *pdev)
/* Peripharal clock */
formatter->pclk = devm_clk_get(dev, "pclk");
if (IS_ERR(formatter->pclk)) {
ret = PTR_ERR(formatter->pclk);
if (ret != -EPROBE_DEFER)
dev_err(dev, "failed to get pclk: %d\n", ret);
return ret;
}
if (IS_ERR(formatter->pclk))
return dev_err_probe(dev, PTR_ERR(formatter->pclk), "failed to get pclk\n");
/* Formatter bit clock */
formatter->sclk = devm_clk_get(dev, "sclk");
if (IS_ERR(formatter->sclk)) {
ret = PTR_ERR(formatter->sclk);
if (ret != -EPROBE_DEFER)
dev_err(dev, "failed to get sclk: %d\n", ret);
return ret;
}
if (IS_ERR(formatter->sclk))
return dev_err_probe(dev, PTR_ERR(formatter->sclk), "failed to get sclk\n");
/* Formatter sample clock */
formatter->lrclk = devm_clk_get(dev, "lrclk");
if (IS_ERR(formatter->lrclk)) {
ret = PTR_ERR(formatter->lrclk);
if (ret != -EPROBE_DEFER)
dev_err(dev, "failed to get lrclk: %d\n", ret);
return ret;
}
if (IS_ERR(formatter->lrclk))
return dev_err_probe(dev, PTR_ERR(formatter->lrclk), "failed to get lrclk\n");
/* Formatter bit clock input multiplexer */
formatter->sclk_sel = devm_clk_get(dev, "sclk_sel");
if (IS_ERR(formatter->sclk_sel)) {
ret = PTR_ERR(formatter->sclk_sel);
if (ret != -EPROBE_DEFER)
dev_err(dev, "failed to get sclk_sel: %d\n", ret);
return ret;
}
if (IS_ERR(formatter->sclk_sel))
return dev_err_probe(dev, PTR_ERR(formatter->sclk_sel), "failed to get sclk_sel\n");
/* Formatter sample clock input multiplexer */
formatter->lrclk_sel = devm_clk_get(dev, "lrclk_sel");
if (IS_ERR(formatter->lrclk_sel)) {
ret = PTR_ERR(formatter->lrclk_sel);
if (ret != -EPROBE_DEFER)
dev_err(dev, "failed to get lrclk_sel: %d\n", ret);
return ret;
}
if (IS_ERR(formatter->lrclk_sel))
return dev_err_probe(dev, PTR_ERR(formatter->lrclk_sel),
"failed to get lrclk_sel\n");
/* Formatter dedicated reset line */
formatter->reset = devm_reset_control_get_optional_exclusive(dev, NULL);
if (IS_ERR(formatter->reset)) {
ret = PTR_ERR(formatter->reset);
if (ret != -EPROBE_DEFER)
dev_err(dev, "failed to get reset: %d\n", ret);
return ret;
}
if (IS_ERR(formatter->reset))
return dev_err_probe(dev, PTR_ERR(formatter->reset), "failed to get reset\n");
return devm_snd_soc_register_component(dev, drv->component_drv,
NULL, 0);
......
......@@ -533,21 +533,13 @@ static int axg_tdm_iface_probe(struct platform_device *pdev)
/* Bit clock provided on the pad */
iface->sclk = devm_clk_get(dev, "sclk");
if (IS_ERR(iface->sclk)) {
ret = PTR_ERR(iface->sclk);
if (ret != -EPROBE_DEFER)
dev_err(dev, "failed to get sclk: %d\n", ret);
return ret;
}
if (IS_ERR(iface->sclk))
return dev_err_probe(dev, PTR_ERR(iface->sclk), "failed to get sclk\n");
/* Sample clock provided on the pad */
iface->lrclk = devm_clk_get(dev, "lrclk");
if (IS_ERR(iface->lrclk)) {
ret = PTR_ERR(iface->lrclk);
if (ret != -EPROBE_DEFER)
dev_err(dev, "failed to get lrclk: %d\n", ret);
return ret;
}
if (IS_ERR(iface->lrclk))
return dev_err_probe(dev, PTR_ERR(iface->lrclk), "failed to get lrclk\n");
/*
* mclk maybe be missing when the cpu dai is in slave mode and
......@@ -558,13 +550,10 @@ static int axg_tdm_iface_probe(struct platform_device *pdev)
iface->mclk = devm_clk_get(dev, "mclk");
if (IS_ERR(iface->mclk)) {
ret = PTR_ERR(iface->mclk);
if (ret == -ENOENT) {
if (ret == -ENOENT)
iface->mclk = NULL;
} else {
if (ret != -EPROBE_DEFER)
dev_err(dev, "failed to get mclk: %d\n", ret);
return ret;
}
else
return dev_err_probe(dev, ret, "failed to get mclk\n");
}
return devm_snd_soc_register_component(dev,
......
......@@ -85,11 +85,9 @@ int meson_card_parse_dai(struct snd_soc_card *card,
ret = of_parse_phandle_with_args(node, "sound-dai",
"#sound-dai-cells", 0, &args);
if (ret) {
if (ret != -EPROBE_DEFER)
dev_err(card->dev, "can't parse dai %d\n", ret);
return ret;
}
if (ret)
return dev_err_probe(card->dev, ret, "can't parse dai\n");
*dai_of_node = args.np;
return snd_soc_get_dai_name(&args, dai_name);
......
......@@ -258,18 +258,12 @@ static int t9015_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, priv);
priv->pclk = devm_clk_get(dev, "pclk");
if (IS_ERR(priv->pclk)) {
if (PTR_ERR(priv->pclk) != -EPROBE_DEFER)
dev_err(dev, "failed to get core clock\n");
return PTR_ERR(priv->pclk);
}
if (IS_ERR(priv->pclk))
return dev_err_probe(dev, PTR_ERR(priv->pclk), "failed to get core clock\n");
priv->avdd = devm_regulator_get(dev, "AVDD");
if (IS_ERR(priv->avdd)) {
if (PTR_ERR(priv->avdd) != -EPROBE_DEFER)
dev_err(dev, "failed to AVDD\n");
return PTR_ERR(priv->avdd);
}
if (IS_ERR(priv->avdd))
return dev_err_probe(dev, PTR_ERR(priv->avdd), "failed to AVDD\n");
ret = clk_prepare_enable(priv->pclk);
if (ret) {
......
......@@ -160,12 +160,8 @@ static int mxs_sgtl5000_probe(struct platform_device *pdev)
}
ret = devm_snd_soc_register_card(&pdev->dev, card);
if (ret) {
if (ret != -EPROBE_DEFER)
dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n",
ret);
return ret;
}
if (ret)
return dev_err_probe(&pdev->dev, ret, "snd_soc_register_card failed\n");
return 0;
}
......
......@@ -94,9 +94,8 @@ int qcom_snd_parse_of(struct snd_soc_card *card)
ret = snd_soc_of_get_dai_name(cpu, &link->cpus->dai_name);
if (ret) {
if (ret != -EPROBE_DEFER)
dev_err(card->dev, "%s: error getting cpu dai name: %d\n",
link->name, ret);
dev_err_probe(card->dev, ret,
"%s: error getting cpu dai name\n", link->name);
goto err;
}
......@@ -116,9 +115,8 @@ int qcom_snd_parse_of(struct snd_soc_card *card)
if (codec) {
ret = snd_soc_of_get_dai_link_codecs(dev, codec, link);
if (ret < 0) {
if (ret != -EPROBE_DEFER)
dev_err(card->dev, "%s: codec dai not found: %d\n",
link->name, ret);
dev_err_probe(card->dev, ret,
"%s: codec dai not found\n", link->name);
goto err;
}
......
......@@ -249,13 +249,9 @@ static int snd_rk_mc_probe(struct platform_device *pdev)
snd_soc_card_set_drvdata(card, machine);
ret = devm_snd_soc_register_card(&pdev->dev, card);
if (ret == -EPROBE_DEFER)
return -EPROBE_DEFER;
if (ret) {
dev_err(&pdev->dev,
"Soc register card failed %d\n", ret);
return ret;
}
if (ret)
return dev_err_probe(&pdev->dev, ret,
"Soc register card failed\n");
return ret;
}
......
......@@ -585,19 +585,16 @@ static int aries_audio_probe(struct platform_device *pdev)
extcon_np = of_parse_phandle(np, "extcon", 0);
priv->usb_extcon = extcon_find_edev_by_node(extcon_np);
if (IS_ERR(priv->usb_extcon)) {
if (PTR_ERR(priv->usb_extcon) != -EPROBE_DEFER)
dev_err(dev, "Failed to get extcon device");
return PTR_ERR(priv->usb_extcon);
}
if (IS_ERR(priv->usb_extcon))
return dev_err_probe(dev, PTR_ERR(priv->usb_extcon),
"Failed to get extcon device");
of_node_put(extcon_np);
priv->adc = devm_iio_channel_get(dev, "headset-detect");
if (IS_ERR(priv->adc)) {
if (PTR_ERR(priv->adc) != -EPROBE_DEFER)
dev_err(dev, "Failed to get ADC channel");
return PTR_ERR(priv->adc);
}
if (IS_ERR(priv->adc))
return dev_err_probe(dev, PTR_ERR(priv->adc),
"Failed to get ADC channel");
if (priv->adc->channel->type != IIO_VOLTAGE)
return -EINVAL;
......
......@@ -174,9 +174,8 @@ static int arndale_audio_probe(struct platform_device *pdev)
ret = devm_snd_soc_register_card(card->dev, card);
if (ret) {
if (ret != -EPROBE_DEFER)
dev_err(&pdev->dev,
"snd_soc_register_card() failed: %d\n", ret);
dev_err_probe(&pdev->dev, ret,
"snd_soc_register_card() failed\n");
goto err_put_of_nodes;
}
return 0;
......
......@@ -325,9 +325,8 @@ static int littlemill_probe(struct platform_device *pdev)
card->dev = &pdev->dev;
ret = devm_snd_soc_register_card(&pdev->dev, card);
if (ret && ret != -EPROBE_DEFER)
dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n",
ret);
if (ret)
dev_err_probe(&pdev->dev, ret, "snd_soc_register_card() failed\n");
return ret;
}
......
......@@ -183,9 +183,8 @@ static int lowland_probe(struct platform_device *pdev)
card->dev = &pdev->dev;
ret = devm_snd_soc_register_card(&pdev->dev, card);
if (ret && ret != -EPROBE_DEFER)
dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n",
ret);
if (ret)
dev_err_probe(&pdev->dev, ret, "snd_soc_register_card() failed\n");
return ret;
}
......
......@@ -311,9 +311,7 @@ static int odroid_audio_probe(struct platform_device *pdev)
ret = devm_snd_soc_register_card(dev, card);
if (ret < 0) {
if (ret != -EPROBE_DEFER)
dev_err(dev, "snd_soc_register_card() failed: %d\n",
ret);
dev_err_probe(dev, ret, "snd_soc_register_card() failed\n");
goto err_put_clk_i2s;
}
......
......@@ -179,8 +179,8 @@ static int smdk_audio_probe(struct platform_device *pdev)
ret = devm_snd_soc_register_card(&pdev->dev, card);
if (ret && ret != -EPROBE_DEFER)
dev_err(&pdev->dev, "snd_soc_register_card() failed:%d\n", ret);
if (ret)
dev_err_probe(&pdev->dev, ret, "snd_soc_register_card() failed\n");
return ret;
}
......
......@@ -118,8 +118,8 @@ static int snd_smdk_probe(struct platform_device *pdev)
smdk_pcm.dev = &pdev->dev;
ret = devm_snd_soc_register_card(&pdev->dev, &smdk_pcm);
if (ret && ret != -EPROBE_DEFER)
dev_err(&pdev->dev, "snd_soc_register_card failed %d\n", ret);
if (ret)
dev_err_probe(&pdev->dev, ret, "snd_soc_register_card failed\n");
return ret;
}
......
......@@ -212,12 +212,9 @@ static int snow_probe(struct platform_device *pdev)
snd_soc_card_set_drvdata(card, priv);
ret = devm_snd_soc_register_card(dev, card);
if (ret) {
if (ret != -EPROBE_DEFER)
dev_err(&pdev->dev,
"snd_soc_register_card failed (%d)\n", ret);
return ret;
}
if (ret)
return dev_err_probe(&pdev->dev, ret,
"snd_soc_register_card failed\n");
return ret;
}
......
......@@ -330,9 +330,8 @@ static int speyside_probe(struct platform_device *pdev)
card->dev = &pdev->dev;
ret = devm_snd_soc_register_card(&pdev->dev, card);
if (ret && ret != -EPROBE_DEFER)
dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n",
ret);
if (ret)
dev_err_probe(&pdev->dev, ret, "snd_soc_register_card() failed\n");
return ret;
}
......
......@@ -612,8 +612,7 @@ static int tm2_probe(struct platform_device *pdev)
ret = devm_snd_soc_register_card(dev, card);
if (ret < 0) {
if (ret != -EPROBE_DEFER)
dev_err(dev, "Failed to register card: %d\n", ret);
dev_err_probe(dev, ret, "Failed to register card\n");
goto dai_node_put;
}
......
......@@ -229,9 +229,8 @@ static int tobermory_probe(struct platform_device *pdev)
card->dev = &pdev->dev;
ret = devm_snd_soc_register_card(&pdev->dev, card);
if (ret && ret != -EPROBE_DEFER)
dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n",
ret);
if (ret)
dev_err_probe(&pdev->dev, ret, "snd_soc_register_card() failed\n");
return ret;
}
......
......@@ -1045,36 +1045,24 @@ static int stm32_i2s_parse_dt(struct platform_device *pdev,
/* Get clocks */
i2s->pclk = devm_clk_get(&pdev->dev, "pclk");
if (IS_ERR(i2s->pclk)) {
if (PTR_ERR(i2s->pclk) != -EPROBE_DEFER)
dev_err(&pdev->dev, "Could not get pclk: %ld\n",
PTR_ERR(i2s->pclk));
return PTR_ERR(i2s->pclk);
}
if (IS_ERR(i2s->pclk))
return dev_err_probe(&pdev->dev, PTR_ERR(i2s->pclk),
"Could not get pclk\n");
i2s->i2sclk = devm_clk_get(&pdev->dev, "i2sclk");
if (IS_ERR(i2s->i2sclk)) {
if (PTR_ERR(i2s->i2sclk) != -EPROBE_DEFER)
dev_err(&pdev->dev, "Could not get i2sclk: %ld\n",
PTR_ERR(i2s->i2sclk));
return PTR_ERR(i2s->i2sclk);
}
if (IS_ERR(i2s->i2sclk))
return dev_err_probe(&pdev->dev, PTR_ERR(i2s->i2sclk),
"Could not get i2sclk\n");
i2s->x8kclk = devm_clk_get(&pdev->dev, "x8k");
if (IS_ERR(i2s->x8kclk)) {
if (PTR_ERR(i2s->x8kclk) != -EPROBE_DEFER)
dev_err(&pdev->dev, "Could not get x8k parent clock: %ld\n",
PTR_ERR(i2s->x8kclk));
return PTR_ERR(i2s->x8kclk);
}
if (IS_ERR(i2s->x8kclk))
return dev_err_probe(&pdev->dev, PTR_ERR(i2s->x8kclk),
"Could not get x8k parent clock\n");
i2s->x11kclk = devm_clk_get(&pdev->dev, "x11k");
if (IS_ERR(i2s->x11kclk)) {
if (PTR_ERR(i2s->x11kclk) != -EPROBE_DEFER)
dev_err(&pdev->dev, "Could not get x11k parent clock: %ld\n",
PTR_ERR(i2s->x11kclk));
return PTR_ERR(i2s->x11kclk);
}
if (IS_ERR(i2s->x11kclk))
return dev_err_probe(&pdev->dev, PTR_ERR(i2s->x11kclk),
"Could not get x11k parent clock\n");
/* Register mclk provider if requested */
if (of_find_property(np, "#clock-cells", NULL)) {
......@@ -1097,12 +1085,10 @@ static int stm32_i2s_parse_dt(struct platform_device *pdev,
/* Reset */
rst = devm_reset_control_get_optional_exclusive(&pdev->dev, NULL);
if (IS_ERR(rst)) {
if (PTR_ERR(rst) != -EPROBE_DEFER)
dev_err(&pdev->dev, "Reset controller error %ld\n",
PTR_ERR(rst));
return PTR_ERR(rst);
}
if (IS_ERR(rst))
return dev_err_probe(&pdev->dev, PTR_ERR(rst),
"Reset controller error\n");
reset_control_assert(rst);
udelay(2);
reset_control_deassert(rst);
......@@ -1145,21 +1131,15 @@ static int stm32_i2s_probe(struct platform_device *pdev)
i2s->regmap = devm_regmap_init_mmio_clk(&pdev->dev, "pclk",
i2s->base, i2s->regmap_conf);
if (IS_ERR(i2s->regmap)) {
if (PTR_ERR(i2s->regmap) != -EPROBE_DEFER)
dev_err(&pdev->dev, "Regmap init error %ld\n",
PTR_ERR(i2s->regmap));
return PTR_ERR(i2s->regmap);
}
if (IS_ERR(i2s->regmap))
return dev_err_probe(&pdev->dev, PTR_ERR(i2s->regmap),
"Regmap init error\n");
pm_runtime_enable(&pdev->dev);
ret = snd_dmaengine_pcm_register(&pdev->dev, &stm32_i2s_pcm_config, 0);
if (ret) {
if (ret != -EPROBE_DEFER)
dev_err(&pdev->dev, "PCM DMA register error %d\n", ret);
return ret;
}
if (ret)
return dev_err_probe(&pdev->dev, ret, "PCM DMA register error\n");
ret = snd_soc_register_component(&pdev->dev, &stm32_i2s_component,
i2s->dai_drv, 1);
......
......@@ -173,29 +173,20 @@ static int stm32_sai_probe(struct platform_device *pdev)
if (!STM_SAI_IS_F4(sai)) {
sai->pclk = devm_clk_get(&pdev->dev, "pclk");
if (IS_ERR(sai->pclk)) {
if (PTR_ERR(sai->pclk) != -EPROBE_DEFER)
dev_err(&pdev->dev, "missing bus clock pclk: %ld\n",
PTR_ERR(sai->pclk));
return PTR_ERR(sai->pclk);
}
if (IS_ERR(sai->pclk))
return dev_err_probe(&pdev->dev, PTR_ERR(sai->pclk),
"missing bus clock pclk\n");
}
sai->clk_x8k = devm_clk_get(&pdev->dev, "x8k");
if (IS_ERR(sai->clk_x8k)) {
if (PTR_ERR(sai->clk_x8k) != -EPROBE_DEFER)
dev_err(&pdev->dev, "missing x8k parent clock: %ld\n",
PTR_ERR(sai->clk_x8k));
return PTR_ERR(sai->clk_x8k);
}
if (IS_ERR(sai->clk_x8k))
return dev_err_probe(&pdev->dev, PTR_ERR(sai->clk_x8k),
"missing x8k parent clock\n");
sai->clk_x11k = devm_clk_get(&pdev->dev, "x11k");
if (IS_ERR(sai->clk_x11k)) {
if (PTR_ERR(sai->clk_x11k) != -EPROBE_DEFER)
dev_err(&pdev->dev, "missing x11k parent clock: %ld\n",
PTR_ERR(sai->clk_x11k));
return PTR_ERR(sai->clk_x11k);
}
if (IS_ERR(sai->clk_x11k))
return dev_err_probe(&pdev->dev, PTR_ERR(sai->clk_x11k),
"missing x11k parent clock\n");
/* init irqs */
sai->irq = platform_get_irq(pdev, 0);
......@@ -204,12 +195,10 @@ static int stm32_sai_probe(struct platform_device *pdev)
/* reset */
rst = devm_reset_control_get_optional_exclusive(&pdev->dev, NULL);
if (IS_ERR(rst)) {
if (PTR_ERR(rst) != -EPROBE_DEFER)
dev_err(&pdev->dev, "Reset controller error %ld\n",
PTR_ERR(rst));
return PTR_ERR(rst);
}
if (IS_ERR(rst))
return dev_err_probe(&pdev->dev, PTR_ERR(rst),
"Reset controller error\n");
reset_control_assert(rst);
udelay(2);
reset_control_deassert(rst);
......
......@@ -1379,12 +1379,9 @@ static int stm32_sai_sub_parse_of(struct platform_device *pdev,
*/
sai->regmap = devm_regmap_init_mmio(&pdev->dev, base,
sai->regmap_config);
if (IS_ERR(sai->regmap)) {
if (PTR_ERR(sai->regmap) != -EPROBE_DEFER)
dev_err(&pdev->dev, "Regmap init error %ld\n",
PTR_ERR(sai->regmap));
return PTR_ERR(sai->regmap);
}
if (IS_ERR(sai->regmap))
return dev_err_probe(&pdev->dev, PTR_ERR(sai->regmap),
"Regmap init error\n");
/* Get direction property */
if (of_property_match_string(np, "dma-names", "tx") >= 0) {
......@@ -1472,12 +1469,9 @@ static int stm32_sai_sub_parse_of(struct platform_device *pdev,
of_node_put(args.np);
sai->sai_ck = devm_clk_get(&pdev->dev, "sai_ck");
if (IS_ERR(sai->sai_ck)) {
if (PTR_ERR(sai->sai_ck) != -EPROBE_DEFER)
dev_err(&pdev->dev, "Missing kernel clock sai_ck: %ld\n",
PTR_ERR(sai->sai_ck));
return PTR_ERR(sai->sai_ck);
}
if (IS_ERR(sai->sai_ck))
return dev_err_probe(&pdev->dev, PTR_ERR(sai->sai_ck),
"Missing kernel clock sai_ck\n");
ret = clk_prepare(sai->pdata->pclk);
if (ret < 0)
......@@ -1551,11 +1545,8 @@ static int stm32_sai_sub_probe(struct platform_device *pdev)
conf = &stm32_sai_pcm_config_spdif;
ret = snd_dmaengine_pcm_register(&pdev->dev, conf, 0);
if (ret) {
if (ret != -EPROBE_DEFER)
dev_err(&pdev->dev, "Could not register pcm dma\n");
return ret;
}
if (ret)
return dev_err_probe(&pdev->dev, ret, "Could not register pcm dma\n");
ret = snd_soc_register_component(&pdev->dev, &stm32_component,
&sai->cpu_dai_drv, 1);
......
......@@ -406,12 +406,9 @@ static int stm32_spdifrx_dma_ctrl_register(struct device *dev,
int ret;
spdifrx->ctrl_chan = dma_request_chan(dev, "rx-ctrl");
if (IS_ERR(spdifrx->ctrl_chan)) {
if (PTR_ERR(spdifrx->ctrl_chan) != -EPROBE_DEFER)
dev_err(dev, "dma_request_slave_channel error %ld\n",
PTR_ERR(spdifrx->ctrl_chan));
return PTR_ERR(spdifrx->ctrl_chan);
}
if (IS_ERR(spdifrx->ctrl_chan))
return dev_err_probe(dev, PTR_ERR(spdifrx->ctrl_chan),
"dma_request_slave_channel error\n");
spdifrx->dmab = devm_kzalloc(dev, sizeof(struct snd_dma_buffer),
GFP_KERNEL);
......@@ -930,12 +927,9 @@ static int stm32_spdifrx_parse_of(struct platform_device *pdev,
spdifrx->phys_addr = res->start;
spdifrx->kclk = devm_clk_get(&pdev->dev, "kclk");
if (IS_ERR(spdifrx->kclk)) {
if (PTR_ERR(spdifrx->kclk) != -EPROBE_DEFER)
dev_err(&pdev->dev, "Could not get kclk: %ld\n",
PTR_ERR(spdifrx->kclk));
return PTR_ERR(spdifrx->kclk);
}
if (IS_ERR(spdifrx->kclk))
return dev_err_probe(&pdev->dev, PTR_ERR(spdifrx->kclk),
"Could not get kclk\n");
spdifrx->irq = platform_get_irq(pdev, 0);
if (spdifrx->irq < 0)
......@@ -987,12 +981,9 @@ static int stm32_spdifrx_probe(struct platform_device *pdev)
spdifrx->regmap = devm_regmap_init_mmio_clk(&pdev->dev, "kclk",
spdifrx->base,
spdifrx->regmap_conf);
if (IS_ERR(spdifrx->regmap)) {
if (PTR_ERR(spdifrx->regmap) != -EPROBE_DEFER)
dev_err(&pdev->dev, "Regmap init error %ld\n",
PTR_ERR(spdifrx->regmap));
return PTR_ERR(spdifrx->regmap);
}
if (IS_ERR(spdifrx->regmap))
return dev_err_probe(&pdev->dev, PTR_ERR(spdifrx->regmap),
"Regmap init error\n");
ret = devm_request_irq(&pdev->dev, spdifrx->irq, stm32_spdifrx_isr, 0,
dev_name(&pdev->dev), spdifrx);
......@@ -1002,12 +993,10 @@ static int stm32_spdifrx_probe(struct platform_device *pdev)
}
rst = devm_reset_control_get_optional_exclusive(&pdev->dev, NULL);
if (IS_ERR(rst)) {
if (PTR_ERR(rst) != -EPROBE_DEFER)
dev_err(&pdev->dev, "Reset controller error %ld\n",
PTR_ERR(rst));
return PTR_ERR(rst);
}
if (IS_ERR(rst))
return dev_err_probe(&pdev->dev, PTR_ERR(rst),
"Reset controller error\n");
reset_control_assert(rst);
udelay(2);
reset_control_deassert(rst);
......@@ -1016,11 +1005,8 @@ static int stm32_spdifrx_probe(struct platform_device *pdev)
pcm_config = &stm32_spdifrx_pcm_config;
ret = snd_dmaengine_pcm_register(&pdev->dev, pcm_config, 0);
if (ret) {
if (ret != -EPROBE_DEFER)
dev_err(&pdev->dev, "PCM DMA register error %d\n", ret);
return ret;
}
if (ret)
return dev_err_probe(&pdev->dev, ret, "PCM DMA register error\n");
ret = snd_soc_register_component(&pdev->dev,
&stm32_spdifrx_component,
......
......@@ -1752,8 +1752,7 @@ static int sun4i_codec_probe(struct platform_device *pdev)
GPIOD_OUT_LOW);
if (IS_ERR(scodec->gpio_pa)) {
ret = PTR_ERR(scodec->gpio_pa);
if (ret != -EPROBE_DEFER)
dev_err(&pdev->dev, "Failed to get pa gpio: %d\n", ret);
dev_err_probe(&pdev->dev, ret, "Failed to get pa gpio\n");
return ret;
}
......
......@@ -2024,13 +2024,9 @@ static int davinci_mcasp_get_dma_type(struct davinci_mcasp *mcasp)
tmp = mcasp->dma_data[SNDRV_PCM_STREAM_PLAYBACK].filter_data;
chan = dma_request_chan(mcasp->dev, tmp);
if (IS_ERR(chan)) {
if (PTR_ERR(chan) != -EPROBE_DEFER)
dev_err(mcasp->dev,
"Can't verify DMA configuration (%ld)\n",
PTR_ERR(chan));
return PTR_ERR(chan);
}
if (IS_ERR(chan))
return dev_err_probe(mcasp->dev, PTR_ERR(chan),
"Can't verify DMA configuration\n");
if (WARN_ON(!chan->device || !chan->device->dev)) {
dma_release_channel(chan);
return -EINVAL;
......
......@@ -464,13 +464,9 @@ static int j721e_get_clocks(struct device *dev,
int ret;
clocks->target = devm_clk_get(dev, prefix);
if (IS_ERR(clocks->target)) {
ret = PTR_ERR(clocks->target);
if (ret != -EPROBE_DEFER)
dev_err(dev, "failed to acquire %s: %d\n",
prefix, ret);
return ret;
}
if (IS_ERR(clocks->target))
return dev_err_probe(dev, PTR_ERR(clocks->target),
"failed to acquire %s\n", prefix);
clk_name = kasprintf(GFP_KERNEL, "%s-48000", prefix);
if (clk_name) {
......
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