Commit 0de6db30 authored by Sowjanya Komatineni's avatar Sowjanya Komatineni Committed by Thierry Reding

ASoC: tegra: Use device managed resource APIs to get the clock

tegra_asoc_utils uses clk_get() to get the clock and clk_put() to free
them explicitly.

This patch updates it to use device managed resource API devm_clk_get()
so the clock will be automatically released and freed when the device is
unbound and removes tegra_asoc_utils_fini() as its no longer needed.
Tested-by: default avatarDmitry Osipenko <digetx@gmail.com>
Reviewed-by: default avatarDmitry Osipenko <digetx@gmail.com>
Reviewed-by: default avatarSameer Pujar <spujar@nvidia.com>
Signed-off-by: default avatarSowjanya Komatineni <skomatineni@nvidia.com>
Signed-off-by: default avatarThierry Reding <treding@nvidia.com>
parent 8f3d9f35
...@@ -205,13 +205,11 @@ static int tegra_alc5632_probe(struct platform_device *pdev) ...@@ -205,13 +205,11 @@ static int tegra_alc5632_probe(struct platform_device *pdev)
if (ret) { if (ret) {
dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n", dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n",
ret); ret);
goto err_fini_utils; goto err_put_cpu_of_node;
} }
return 0; return 0;
err_fini_utils:
tegra_asoc_utils_fini(&alc5632->util_data);
err_put_cpu_of_node: err_put_cpu_of_node:
of_node_put(tegra_alc5632_dai.cpus->of_node); of_node_put(tegra_alc5632_dai.cpus->of_node);
tegra_alc5632_dai.cpus->of_node = NULL; tegra_alc5632_dai.cpus->of_node = NULL;
...@@ -226,12 +224,9 @@ static int tegra_alc5632_probe(struct platform_device *pdev) ...@@ -226,12 +224,9 @@ static int tegra_alc5632_probe(struct platform_device *pdev)
static int tegra_alc5632_remove(struct platform_device *pdev) static int tegra_alc5632_remove(struct platform_device *pdev)
{ {
struct snd_soc_card *card = platform_get_drvdata(pdev); struct snd_soc_card *card = platform_get_drvdata(pdev);
struct tegra_alc5632 *machine = snd_soc_card_get_drvdata(card);
snd_soc_unregister_card(card); snd_soc_unregister_card(card);
tegra_asoc_utils_fini(&machine->util_data);
of_node_put(tegra_alc5632_dai.cpus->of_node); of_node_put(tegra_alc5632_dai.cpus->of_node);
tegra_alc5632_dai.cpus->of_node = NULL; tegra_alc5632_dai.cpus->of_node = NULL;
tegra_alc5632_dai.platforms->of_node = NULL; tegra_alc5632_dai.platforms->of_node = NULL;
......
...@@ -175,52 +175,32 @@ int tegra_asoc_utils_init(struct tegra_asoc_utils_data *data, ...@@ -175,52 +175,32 @@ int tegra_asoc_utils_init(struct tegra_asoc_utils_data *data,
return -EINVAL; return -EINVAL;
} }
data->clk_pll_a = clk_get(dev, "pll_a"); data->clk_pll_a = devm_clk_get(dev, "pll_a");
if (IS_ERR(data->clk_pll_a)) { if (IS_ERR(data->clk_pll_a)) {
dev_err(data->dev, "Can't retrieve clk pll_a\n"); dev_err(data->dev, "Can't retrieve clk pll_a\n");
ret = PTR_ERR(data->clk_pll_a); return PTR_ERR(data->clk_pll_a);
goto err;
} }
data->clk_pll_a_out0 = clk_get(dev, "pll_a_out0"); data->clk_pll_a_out0 = devm_clk_get(dev, "pll_a_out0");
if (IS_ERR(data->clk_pll_a_out0)) { if (IS_ERR(data->clk_pll_a_out0)) {
dev_err(data->dev, "Can't retrieve clk pll_a_out0\n"); dev_err(data->dev, "Can't retrieve clk pll_a_out0\n");
ret = PTR_ERR(data->clk_pll_a_out0); return PTR_ERR(data->clk_pll_a_out0);
goto err_put_pll_a;
} }
data->clk_cdev1 = clk_get(dev, "mclk"); data->clk_cdev1 = devm_clk_get(dev, "mclk");
if (IS_ERR(data->clk_cdev1)) { if (IS_ERR(data->clk_cdev1)) {
dev_err(data->dev, "Can't retrieve clk cdev1\n"); dev_err(data->dev, "Can't retrieve clk cdev1\n");
ret = PTR_ERR(data->clk_cdev1); return PTR_ERR(data->clk_cdev1);
goto err_put_pll_a_out0;
} }
ret = tegra_asoc_utils_set_rate(data, 44100, 256 * 44100); ret = tegra_asoc_utils_set_rate(data, 44100, 256 * 44100);
if (ret) if (ret)
goto err_put_cdev1; return ret;
return 0; return 0;
err_put_cdev1:
clk_put(data->clk_cdev1);
err_put_pll_a_out0:
clk_put(data->clk_pll_a_out0);
err_put_pll_a:
clk_put(data->clk_pll_a);
err:
return ret;
} }
EXPORT_SYMBOL_GPL(tegra_asoc_utils_init); EXPORT_SYMBOL_GPL(tegra_asoc_utils_init);
void tegra_asoc_utils_fini(struct tegra_asoc_utils_data *data)
{
clk_put(data->clk_cdev1);
clk_put(data->clk_pll_a_out0);
clk_put(data->clk_pll_a);
}
EXPORT_SYMBOL_GPL(tegra_asoc_utils_fini);
MODULE_AUTHOR("Stephen Warren <swarren@nvidia.com>"); MODULE_AUTHOR("Stephen Warren <swarren@nvidia.com>");
MODULE_DESCRIPTION("Tegra ASoC utility code"); MODULE_DESCRIPTION("Tegra ASoC utility code");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
...@@ -34,6 +34,5 @@ int tegra_asoc_utils_set_rate(struct tegra_asoc_utils_data *data, int srate, ...@@ -34,6 +34,5 @@ int tegra_asoc_utils_set_rate(struct tegra_asoc_utils_data *data, int srate,
int tegra_asoc_utils_set_ac97_rate(struct tegra_asoc_utils_data *data); int tegra_asoc_utils_set_ac97_rate(struct tegra_asoc_utils_data *data);
int tegra_asoc_utils_init(struct tegra_asoc_utils_data *data, int tegra_asoc_utils_init(struct tegra_asoc_utils_data *data,
struct device *dev); struct device *dev);
void tegra_asoc_utils_fini(struct tegra_asoc_utils_data *data);
#endif #endif
...@@ -218,19 +218,18 @@ static int tegra_max98090_probe(struct platform_device *pdev) ...@@ -218,19 +218,18 @@ static int tegra_max98090_probe(struct platform_device *pdev)
ret = snd_soc_of_parse_card_name(card, "nvidia,model"); ret = snd_soc_of_parse_card_name(card, "nvidia,model");
if (ret) if (ret)
goto err; return ret;
ret = snd_soc_of_parse_audio_routing(card, "nvidia,audio-routing"); ret = snd_soc_of_parse_audio_routing(card, "nvidia,audio-routing");
if (ret) if (ret)
goto err; return ret;
tegra_max98090_dai.codecs->of_node = of_parse_phandle(np, tegra_max98090_dai.codecs->of_node = of_parse_phandle(np,
"nvidia,audio-codec", 0); "nvidia,audio-codec", 0);
if (!tegra_max98090_dai.codecs->of_node) { if (!tegra_max98090_dai.codecs->of_node) {
dev_err(&pdev->dev, dev_err(&pdev->dev,
"Property 'nvidia,audio-codec' missing or invalid\n"); "Property 'nvidia,audio-codec' missing or invalid\n");
ret = -EINVAL; return -EINVAL;
goto err;
} }
tegra_max98090_dai.cpus->of_node = of_parse_phandle(np, tegra_max98090_dai.cpus->of_node = of_parse_phandle(np,
...@@ -238,40 +237,31 @@ static int tegra_max98090_probe(struct platform_device *pdev) ...@@ -238,40 +237,31 @@ static int tegra_max98090_probe(struct platform_device *pdev)
if (!tegra_max98090_dai.cpus->of_node) { if (!tegra_max98090_dai.cpus->of_node) {
dev_err(&pdev->dev, dev_err(&pdev->dev,
"Property 'nvidia,i2s-controller' missing or invalid\n"); "Property 'nvidia,i2s-controller' missing or invalid\n");
ret = -EINVAL; return -EINVAL;
goto err;
} }
tegra_max98090_dai.platforms->of_node = tegra_max98090_dai.cpus->of_node; tegra_max98090_dai.platforms->of_node = tegra_max98090_dai.cpus->of_node;
ret = tegra_asoc_utils_init(&machine->util_data, &pdev->dev); ret = tegra_asoc_utils_init(&machine->util_data, &pdev->dev);
if (ret) if (ret)
goto err; return ret;
ret = snd_soc_register_card(card); ret = snd_soc_register_card(card);
if (ret) { if (ret) {
dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n", dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n",
ret); ret);
goto err_fini_utils; return ret;
} }
return 0; return 0;
err_fini_utils:
tegra_asoc_utils_fini(&machine->util_data);
err:
return ret;
} }
static int tegra_max98090_remove(struct platform_device *pdev) static int tegra_max98090_remove(struct platform_device *pdev)
{ {
struct snd_soc_card *card = platform_get_drvdata(pdev); struct snd_soc_card *card = platform_get_drvdata(pdev);
struct tegra_max98090 *machine = snd_soc_card_get_drvdata(card);
snd_soc_unregister_card(card); snd_soc_unregister_card(card);
tegra_asoc_utils_fini(&machine->util_data);
return 0; return 0;
} }
......
...@@ -164,19 +164,18 @@ static int tegra_rt5640_probe(struct platform_device *pdev) ...@@ -164,19 +164,18 @@ static int tegra_rt5640_probe(struct platform_device *pdev)
ret = snd_soc_of_parse_card_name(card, "nvidia,model"); ret = snd_soc_of_parse_card_name(card, "nvidia,model");
if (ret) if (ret)
goto err; return ret;
ret = snd_soc_of_parse_audio_routing(card, "nvidia,audio-routing"); ret = snd_soc_of_parse_audio_routing(card, "nvidia,audio-routing");
if (ret) if (ret)
goto err; return ret;
tegra_rt5640_dai.codecs->of_node = of_parse_phandle(np, tegra_rt5640_dai.codecs->of_node = of_parse_phandle(np,
"nvidia,audio-codec", 0); "nvidia,audio-codec", 0);
if (!tegra_rt5640_dai.codecs->of_node) { if (!tegra_rt5640_dai.codecs->of_node) {
dev_err(&pdev->dev, dev_err(&pdev->dev,
"Property 'nvidia,audio-codec' missing or invalid\n"); "Property 'nvidia,audio-codec' missing or invalid\n");
ret = -EINVAL; return -EINVAL;
goto err;
} }
tegra_rt5640_dai.cpus->of_node = of_parse_phandle(np, tegra_rt5640_dai.cpus->of_node = of_parse_phandle(np,
...@@ -184,40 +183,31 @@ static int tegra_rt5640_probe(struct platform_device *pdev) ...@@ -184,40 +183,31 @@ static int tegra_rt5640_probe(struct platform_device *pdev)
if (!tegra_rt5640_dai.cpus->of_node) { if (!tegra_rt5640_dai.cpus->of_node) {
dev_err(&pdev->dev, dev_err(&pdev->dev,
"Property 'nvidia,i2s-controller' missing or invalid\n"); "Property 'nvidia,i2s-controller' missing or invalid\n");
ret = -EINVAL; return -EINVAL;
goto err;
} }
tegra_rt5640_dai.platforms->of_node = tegra_rt5640_dai.cpus->of_node; tegra_rt5640_dai.platforms->of_node = tegra_rt5640_dai.cpus->of_node;
ret = tegra_asoc_utils_init(&machine->util_data, &pdev->dev); ret = tegra_asoc_utils_init(&machine->util_data, &pdev->dev);
if (ret) if (ret)
goto err; return ret;
ret = snd_soc_register_card(card); ret = snd_soc_register_card(card);
if (ret) { if (ret) {
dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n", dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n",
ret); ret);
goto err_fini_utils; return ret;
} }
return 0; return 0;
err_fini_utils:
tegra_asoc_utils_fini(&machine->util_data);
err:
return ret;
} }
static int tegra_rt5640_remove(struct platform_device *pdev) static int tegra_rt5640_remove(struct platform_device *pdev)
{ {
struct snd_soc_card *card = platform_get_drvdata(pdev); struct snd_soc_card *card = platform_get_drvdata(pdev);
struct tegra_rt5640 *machine = snd_soc_card_get_drvdata(card);
snd_soc_unregister_card(card); snd_soc_unregister_card(card);
tegra_asoc_utils_fini(&machine->util_data);
return 0; return 0;
} }
......
...@@ -270,13 +270,11 @@ static int tegra_rt5677_probe(struct platform_device *pdev) ...@@ -270,13 +270,11 @@ static int tegra_rt5677_probe(struct platform_device *pdev)
if (ret) { if (ret) {
dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n", dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n",
ret); ret);
goto err_fini_utils; goto err_put_cpu_of_node;
} }
return 0; return 0;
err_fini_utils:
tegra_asoc_utils_fini(&machine->util_data);
err_put_cpu_of_node: err_put_cpu_of_node:
of_node_put(tegra_rt5677_dai.cpus->of_node); of_node_put(tegra_rt5677_dai.cpus->of_node);
tegra_rt5677_dai.cpus->of_node = NULL; tegra_rt5677_dai.cpus->of_node = NULL;
...@@ -291,12 +289,9 @@ static int tegra_rt5677_probe(struct platform_device *pdev) ...@@ -291,12 +289,9 @@ static int tegra_rt5677_probe(struct platform_device *pdev)
static int tegra_rt5677_remove(struct platform_device *pdev) static int tegra_rt5677_remove(struct platform_device *pdev)
{ {
struct snd_soc_card *card = platform_get_drvdata(pdev); struct snd_soc_card *card = platform_get_drvdata(pdev);
struct tegra_rt5677 *machine = snd_soc_card_get_drvdata(card);
snd_soc_unregister_card(card); snd_soc_unregister_card(card);
tegra_asoc_utils_fini(&machine->util_data);
tegra_rt5677_dai.platforms->of_node = NULL; tegra_rt5677_dai.platforms->of_node = NULL;
of_node_put(tegra_rt5677_dai.codecs->of_node); of_node_put(tegra_rt5677_dai.codecs->of_node);
tegra_rt5677_dai.codecs->of_node = NULL; tegra_rt5677_dai.codecs->of_node = NULL;
......
...@@ -156,13 +156,11 @@ static int tegra_sgtl5000_driver_probe(struct platform_device *pdev) ...@@ -156,13 +156,11 @@ static int tegra_sgtl5000_driver_probe(struct platform_device *pdev)
if (ret) { if (ret) {
dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n", dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n",
ret); ret);
goto err_fini_utils; goto err_put_cpu_of_node;
} }
return 0; return 0;
err_fini_utils:
tegra_asoc_utils_fini(&machine->util_data);
err_put_cpu_of_node: err_put_cpu_of_node:
of_node_put(tegra_sgtl5000_dai.cpus->of_node); of_node_put(tegra_sgtl5000_dai.cpus->of_node);
tegra_sgtl5000_dai.cpus->of_node = NULL; tegra_sgtl5000_dai.cpus->of_node = NULL;
...@@ -177,13 +175,10 @@ static int tegra_sgtl5000_driver_probe(struct platform_device *pdev) ...@@ -177,13 +175,10 @@ static int tegra_sgtl5000_driver_probe(struct platform_device *pdev)
static int tegra_sgtl5000_driver_remove(struct platform_device *pdev) static int tegra_sgtl5000_driver_remove(struct platform_device *pdev)
{ {
struct snd_soc_card *card = platform_get_drvdata(pdev); struct snd_soc_card *card = platform_get_drvdata(pdev);
struct tegra_sgtl5000 *machine = snd_soc_card_get_drvdata(card);
int ret; int ret;
ret = snd_soc_unregister_card(card); ret = snd_soc_unregister_card(card);
tegra_asoc_utils_fini(&machine->util_data);
of_node_put(tegra_sgtl5000_dai.cpus->of_node); of_node_put(tegra_sgtl5000_dai.cpus->of_node);
tegra_sgtl5000_dai.cpus->of_node = NULL; tegra_sgtl5000_dai.cpus->of_node = NULL;
tegra_sgtl5000_dai.platforms->of_node = NULL; tegra_sgtl5000_dai.platforms->of_node = NULL;
......
...@@ -127,19 +127,18 @@ static int tegra_wm8753_driver_probe(struct platform_device *pdev) ...@@ -127,19 +127,18 @@ static int tegra_wm8753_driver_probe(struct platform_device *pdev)
ret = snd_soc_of_parse_card_name(card, "nvidia,model"); ret = snd_soc_of_parse_card_name(card, "nvidia,model");
if (ret) if (ret)
goto err; return ret;
ret = snd_soc_of_parse_audio_routing(card, "nvidia,audio-routing"); ret = snd_soc_of_parse_audio_routing(card, "nvidia,audio-routing");
if (ret) if (ret)
goto err; return ret;
tegra_wm8753_dai.codecs->of_node = of_parse_phandle(np, tegra_wm8753_dai.codecs->of_node = of_parse_phandle(np,
"nvidia,audio-codec", 0); "nvidia,audio-codec", 0);
if (!tegra_wm8753_dai.codecs->of_node) { if (!tegra_wm8753_dai.codecs->of_node) {
dev_err(&pdev->dev, dev_err(&pdev->dev,
"Property 'nvidia,audio-codec' missing or invalid\n"); "Property 'nvidia,audio-codec' missing or invalid\n");
ret = -EINVAL; return -EINVAL;
goto err;
} }
tegra_wm8753_dai.cpus->of_node = of_parse_phandle(np, tegra_wm8753_dai.cpus->of_node = of_parse_phandle(np,
...@@ -147,40 +146,31 @@ static int tegra_wm8753_driver_probe(struct platform_device *pdev) ...@@ -147,40 +146,31 @@ static int tegra_wm8753_driver_probe(struct platform_device *pdev)
if (!tegra_wm8753_dai.cpus->of_node) { if (!tegra_wm8753_dai.cpus->of_node) {
dev_err(&pdev->dev, dev_err(&pdev->dev,
"Property 'nvidia,i2s-controller' missing or invalid\n"); "Property 'nvidia,i2s-controller' missing or invalid\n");
ret = -EINVAL; return -EINVAL;
goto err;
} }
tegra_wm8753_dai.platforms->of_node = tegra_wm8753_dai.cpus->of_node; tegra_wm8753_dai.platforms->of_node = tegra_wm8753_dai.cpus->of_node;
ret = tegra_asoc_utils_init(&machine->util_data, &pdev->dev); ret = tegra_asoc_utils_init(&machine->util_data, &pdev->dev);
if (ret) if (ret)
goto err; return ret;
ret = snd_soc_register_card(card); ret = snd_soc_register_card(card);
if (ret) { if (ret) {
dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n", dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n",
ret); ret);
goto err_fini_utils; return ret;
} }
return 0; return 0;
err_fini_utils:
tegra_asoc_utils_fini(&machine->util_data);
err:
return ret;
} }
static int tegra_wm8753_driver_remove(struct platform_device *pdev) static int tegra_wm8753_driver_remove(struct platform_device *pdev)
{ {
struct snd_soc_card *card = platform_get_drvdata(pdev); struct snd_soc_card *card = platform_get_drvdata(pdev);
struct tegra_wm8753 *machine = snd_soc_card_get_drvdata(card);
snd_soc_unregister_card(card); snd_soc_unregister_card(card);
tegra_asoc_utils_fini(&machine->util_data);
return 0; return 0;
} }
......
...@@ -319,19 +319,18 @@ static int tegra_wm8903_driver_probe(struct platform_device *pdev) ...@@ -319,19 +319,18 @@ static int tegra_wm8903_driver_probe(struct platform_device *pdev)
ret = snd_soc_of_parse_card_name(card, "nvidia,model"); ret = snd_soc_of_parse_card_name(card, "nvidia,model");
if (ret) if (ret)
goto err; return ret;
ret = snd_soc_of_parse_audio_routing(card, "nvidia,audio-routing"); ret = snd_soc_of_parse_audio_routing(card, "nvidia,audio-routing");
if (ret) if (ret)
goto err; return ret;
tegra_wm8903_dai.codecs->of_node = of_parse_phandle(np, tegra_wm8903_dai.codecs->of_node = of_parse_phandle(np,
"nvidia,audio-codec", 0); "nvidia,audio-codec", 0);
if (!tegra_wm8903_dai.codecs->of_node) { if (!tegra_wm8903_dai.codecs->of_node) {
dev_err(&pdev->dev, dev_err(&pdev->dev,
"Property 'nvidia,audio-codec' missing or invalid\n"); "Property 'nvidia,audio-codec' missing or invalid\n");
ret = -EINVAL; return -EINVAL;
goto err;
} }
tegra_wm8903_dai.cpus->of_node = of_parse_phandle(np, tegra_wm8903_dai.cpus->of_node = of_parse_phandle(np,
...@@ -339,40 +338,31 @@ static int tegra_wm8903_driver_probe(struct platform_device *pdev) ...@@ -339,40 +338,31 @@ static int tegra_wm8903_driver_probe(struct platform_device *pdev)
if (!tegra_wm8903_dai.cpus->of_node) { if (!tegra_wm8903_dai.cpus->of_node) {
dev_err(&pdev->dev, dev_err(&pdev->dev,
"Property 'nvidia,i2s-controller' missing or invalid\n"); "Property 'nvidia,i2s-controller' missing or invalid\n");
ret = -EINVAL; return -EINVAL;
goto err;
} }
tegra_wm8903_dai.platforms->of_node = tegra_wm8903_dai.cpus->of_node; tegra_wm8903_dai.platforms->of_node = tegra_wm8903_dai.cpus->of_node;
ret = tegra_asoc_utils_init(&machine->util_data, &pdev->dev); ret = tegra_asoc_utils_init(&machine->util_data, &pdev->dev);
if (ret) if (ret)
goto err; return ret;
ret = snd_soc_register_card(card); ret = snd_soc_register_card(card);
if (ret) { if (ret) {
dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n", dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n",
ret); ret);
goto err_fini_utils; return ret;
} }
return 0; return 0;
err_fini_utils:
tegra_asoc_utils_fini(&machine->util_data);
err:
return ret;
} }
static int tegra_wm8903_driver_remove(struct platform_device *pdev) static int tegra_wm8903_driver_remove(struct platform_device *pdev)
{ {
struct snd_soc_card *card = platform_get_drvdata(pdev); struct snd_soc_card *card = platform_get_drvdata(pdev);
struct tegra_wm8903 *machine = snd_soc_card_get_drvdata(card);
snd_soc_unregister_card(card); snd_soc_unregister_card(card);
tegra_asoc_utils_fini(&machine->util_data);
return 0; return 0;
} }
......
...@@ -113,19 +113,17 @@ static int tegra_wm9712_driver_probe(struct platform_device *pdev) ...@@ -113,19 +113,17 @@ static int tegra_wm9712_driver_probe(struct platform_device *pdev)
ret = tegra_asoc_utils_set_ac97_rate(&machine->util_data); ret = tegra_asoc_utils_set_ac97_rate(&machine->util_data);
if (ret) if (ret)
goto asoc_utils_fini; goto codec_unregister;
ret = snd_soc_register_card(card); ret = snd_soc_register_card(card);
if (ret) { if (ret) {
dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n", dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n",
ret); ret);
goto asoc_utils_fini; goto codec_unregister;
} }
return 0; return 0;
asoc_utils_fini:
tegra_asoc_utils_fini(&machine->util_data);
codec_unregister: codec_unregister:
platform_device_del(machine->codec); platform_device_del(machine->codec);
codec_put: codec_put:
...@@ -140,8 +138,6 @@ static int tegra_wm9712_driver_remove(struct platform_device *pdev) ...@@ -140,8 +138,6 @@ static int tegra_wm9712_driver_remove(struct platform_device *pdev)
snd_soc_unregister_card(card); snd_soc_unregister_card(card);
tegra_asoc_utils_fini(&machine->util_data);
platform_device_unregister(machine->codec); platform_device_unregister(machine->codec);
return 0; return 0;
......
...@@ -125,8 +125,7 @@ static int tegra_snd_trimslice_probe(struct platform_device *pdev) ...@@ -125,8 +125,7 @@ static int tegra_snd_trimslice_probe(struct platform_device *pdev)
if (!trimslice_tlv320aic23_dai.codecs->of_node) { if (!trimslice_tlv320aic23_dai.codecs->of_node) {
dev_err(&pdev->dev, dev_err(&pdev->dev,
"Property 'nvidia,audio-codec' missing or invalid\n"); "Property 'nvidia,audio-codec' missing or invalid\n");
ret = -EINVAL; return -EINVAL;
goto err;
} }
trimslice_tlv320aic23_dai.cpus->of_node = of_parse_phandle(np, trimslice_tlv320aic23_dai.cpus->of_node = of_parse_phandle(np,
...@@ -134,8 +133,7 @@ static int tegra_snd_trimslice_probe(struct platform_device *pdev) ...@@ -134,8 +133,7 @@ static int tegra_snd_trimslice_probe(struct platform_device *pdev)
if (!trimslice_tlv320aic23_dai.cpus->of_node) { if (!trimslice_tlv320aic23_dai.cpus->of_node) {
dev_err(&pdev->dev, dev_err(&pdev->dev,
"Property 'nvidia,i2s-controller' missing or invalid\n"); "Property 'nvidia,i2s-controller' missing or invalid\n");
ret = -EINVAL; return -EINVAL;
goto err;
} }
trimslice_tlv320aic23_dai.platforms->of_node = trimslice_tlv320aic23_dai.platforms->of_node =
...@@ -143,32 +141,24 @@ static int tegra_snd_trimslice_probe(struct platform_device *pdev) ...@@ -143,32 +141,24 @@ static int tegra_snd_trimslice_probe(struct platform_device *pdev)
ret = tegra_asoc_utils_init(&trimslice->util_data, &pdev->dev); ret = tegra_asoc_utils_init(&trimslice->util_data, &pdev->dev);
if (ret) if (ret)
goto err; return ret;
ret = snd_soc_register_card(card); ret = snd_soc_register_card(card);
if (ret) { if (ret) {
dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n", dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n",
ret); ret);
goto err_fini_utils; return ret;
} }
return 0; return 0;
err_fini_utils:
tegra_asoc_utils_fini(&trimslice->util_data);
err:
return ret;
} }
static int tegra_snd_trimslice_remove(struct platform_device *pdev) static int tegra_snd_trimslice_remove(struct platform_device *pdev)
{ {
struct snd_soc_card *card = platform_get_drvdata(pdev); struct snd_soc_card *card = platform_get_drvdata(pdev);
struct tegra_trimslice *trimslice = snd_soc_card_get_drvdata(card);
snd_soc_unregister_card(card); snd_soc_unregister_card(card);
tegra_asoc_utils_fini(&trimslice->util_data);
return 0; return 0;
} }
......
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