Commit 7253e354 authored by Tushar Behera's avatar Tushar Behera Committed by Mark Brown

ASoC: samsung: Use devm_snd_soc_register_component

Replaced snd_soc_register_component with its devres equivalent,
devm_snd_soc_register_component.
Signed-off-by: default avatarTushar Behera <tushar.behera@linaro.org>
Signed-off-by: default avatarMark Brown <broonie@linaro.org>
parent 55313bd3
...@@ -433,7 +433,7 @@ static int s3c_ac97_probe(struct platform_device *pdev) ...@@ -433,7 +433,7 @@ static int s3c_ac97_probe(struct platform_device *pdev)
goto err4; goto err4;
} }
ret = snd_soc_register_component(&pdev->dev, &s3c_ac97_component, ret = devm_snd_soc_register_component(&pdev->dev, &s3c_ac97_component,
s3c_ac97_dai, ARRAY_SIZE(s3c_ac97_dai)); s3c_ac97_dai, ARRAY_SIZE(s3c_ac97_dai));
if (ret) if (ret)
goto err5; goto err5;
...@@ -441,12 +441,10 @@ static int s3c_ac97_probe(struct platform_device *pdev) ...@@ -441,12 +441,10 @@ static int s3c_ac97_probe(struct platform_device *pdev)
ret = samsung_asoc_dma_platform_register(&pdev->dev); ret = samsung_asoc_dma_platform_register(&pdev->dev);
if (ret) { if (ret) {
dev_err(&pdev->dev, "failed to get register DMA: %d\n", ret); dev_err(&pdev->dev, "failed to get register DMA: %d\n", ret);
goto err6; goto err5;
} }
return 0; return 0;
err6:
snd_soc_unregister_component(&pdev->dev);
err5: err5:
free_irq(irq_res->start, NULL); free_irq(irq_res->start, NULL);
err4: err4:
...@@ -461,8 +459,6 @@ static int s3c_ac97_remove(struct platform_device *pdev) ...@@ -461,8 +459,6 @@ static int s3c_ac97_remove(struct platform_device *pdev)
{ {
struct resource *irq_res; struct resource *irq_res;
snd_soc_unregister_component(&pdev->dev);
irq_res = platform_get_resource(pdev, IORESOURCE_IRQ, 0); irq_res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
if (irq_res) if (irq_res)
free_irq(irq_res->start, NULL); free_irq(irq_res->start, NULL);
......
...@@ -274,8 +274,8 @@ static int __init goni_init(void) ...@@ -274,8 +274,8 @@ static int __init goni_init(void)
return -ENOMEM; return -ENOMEM;
/* register voice DAI here */ /* register voice DAI here */
ret = snd_soc_register_component(&goni_snd_device->dev, &voice_component, ret = devm_snd_soc_register_component(&goni_snd_device->dev,
&voice_dai, 1); &voice_component, &voice_dai, 1);
if (ret) { if (ret) {
platform_device_put(goni_snd_device); platform_device_put(goni_snd_device);
return ret; return ret;
...@@ -284,17 +284,14 @@ static int __init goni_init(void) ...@@ -284,17 +284,14 @@ static int __init goni_init(void)
platform_set_drvdata(goni_snd_device, &goni); platform_set_drvdata(goni_snd_device, &goni);
ret = platform_device_add(goni_snd_device); ret = platform_device_add(goni_snd_device);
if (ret) { if (ret)
snd_soc_unregister_component(&goni_snd_device->dev);
platform_device_put(goni_snd_device); platform_device_put(goni_snd_device);
}
return ret; return ret;
} }
static void __exit goni_exit(void) static void __exit goni_exit(void)
{ {
snd_soc_unregister_component(&goni_snd_device->dev);
platform_device_unregister(goni_snd_device); platform_device_unregister(goni_snd_device);
} }
......
...@@ -588,7 +588,7 @@ static int s3c_pcm_dev_probe(struct platform_device *pdev) ...@@ -588,7 +588,7 @@ static int s3c_pcm_dev_probe(struct platform_device *pdev)
pm_runtime_enable(&pdev->dev); pm_runtime_enable(&pdev->dev);
ret = snd_soc_register_component(&pdev->dev, &s3c_pcm_component, ret = devm_snd_soc_register_component(&pdev->dev, &s3c_pcm_component,
&s3c_pcm_dai[pdev->id], 1); &s3c_pcm_dai[pdev->id], 1);
if (ret != 0) { if (ret != 0) {
dev_err(&pdev->dev, "failed to get register DAI: %d\n", ret); dev_err(&pdev->dev, "failed to get register DAI: %d\n", ret);
...@@ -598,13 +598,11 @@ static int s3c_pcm_dev_probe(struct platform_device *pdev) ...@@ -598,13 +598,11 @@ static int s3c_pcm_dev_probe(struct platform_device *pdev)
ret = samsung_asoc_dma_platform_register(&pdev->dev); ret = samsung_asoc_dma_platform_register(&pdev->dev);
if (ret) { if (ret) {
dev_err(&pdev->dev, "failed to get register DMA: %d\n", ret); dev_err(&pdev->dev, "failed to get register DMA: %d\n", ret);
goto err6; goto err5;
} }
return 0; return 0;
err6:
snd_soc_unregister_component(&pdev->dev);
err5: err5:
clk_disable_unprepare(pcm->pclk); clk_disable_unprepare(pcm->pclk);
clk_put(pcm->pclk); clk_put(pcm->pclk);
...@@ -624,8 +622,6 @@ static int s3c_pcm_dev_remove(struct platform_device *pdev) ...@@ -624,8 +622,6 @@ static int s3c_pcm_dev_remove(struct platform_device *pdev)
struct s3c_pcm_info *pcm = &s3c_pcm[pdev->id]; struct s3c_pcm_info *pcm = &s3c_pcm[pdev->id];
struct resource *mem_res; struct resource *mem_res;
snd_soc_unregister_component(&pdev->dev);
pm_runtime_disable(&pdev->dev); pm_runtime_disable(&pdev->dev);
iounmap(pcm->regs); iounmap(pcm->regs);
......
...@@ -745,7 +745,7 @@ int s3c_i2sv2_register_component(struct device *dev, int id, ...@@ -745,7 +745,7 @@ int s3c_i2sv2_register_component(struct device *dev, int id,
dai_drv->suspend = s3c2412_i2s_suspend; dai_drv->suspend = s3c2412_i2s_suspend;
dai_drv->resume = s3c2412_i2s_resume; dai_drv->resume = s3c2412_i2s_resume;
return snd_soc_register_component(dev, cmp_drv, dai_drv, 1); return devm_snd_soc_register_component(dev, cmp_drv, dai_drv, 1);
} }
EXPORT_SYMBOL_GPL(s3c_i2sv2_register_component); EXPORT_SYMBOL_GPL(s3c_i2sv2_register_component);
......
...@@ -179,26 +179,14 @@ static int s3c2412_iis_dev_probe(struct platform_device *pdev) ...@@ -179,26 +179,14 @@ static int s3c2412_iis_dev_probe(struct platform_device *pdev)
} }
ret = samsung_asoc_dma_platform_register(&pdev->dev); ret = samsung_asoc_dma_platform_register(&pdev->dev);
if (ret) { if (ret)
pr_err("failed to register the DMA: %d\n", ret); pr_err("failed to register the DMA: %d\n", ret);
goto err;
}
return 0;
err:
snd_soc_unregister_component(&pdev->dev);
return ret; return ret;
} }
static int s3c2412_iis_dev_remove(struct platform_device *pdev)
{
snd_soc_unregister_component(&pdev->dev);
return 0;
}
static struct platform_driver s3c2412_iis_driver = { static struct platform_driver s3c2412_iis_driver = {
.probe = s3c2412_iis_dev_probe, .probe = s3c2412_iis_dev_probe,
.remove = s3c2412_iis_dev_remove,
.driver = { .driver = {
.name = "s3c2412-iis", .name = "s3c2412-iis",
.owner = THIS_MODULE, .owner = THIS_MODULE,
......
...@@ -475,34 +475,22 @@ static int s3c24xx_iis_dev_probe(struct platform_device *pdev) ...@@ -475,34 +475,22 @@ static int s3c24xx_iis_dev_probe(struct platform_device *pdev)
{ {
int ret = 0; int ret = 0;
ret = snd_soc_register_component(&pdev->dev, &s3c24xx_i2s_component, ret = devm_snd_soc_register_component(&pdev->dev,
&s3c24xx_i2s_dai, 1); &s3c24xx_i2s_component, &s3c24xx_i2s_dai, 1);
if (ret) { if (ret) {
pr_err("failed to register the dai\n"); pr_err("failed to register the dai\n");
return ret; return ret;
} }
ret = samsung_asoc_dma_platform_register(&pdev->dev); ret = samsung_asoc_dma_platform_register(&pdev->dev);
if (ret) { if (ret)
pr_err("failed to register the dma: %d\n", ret); pr_err("failed to register the dma: %d\n", ret);
goto err;
}
return 0;
err:
snd_soc_unregister_component(&pdev->dev);
return ret; return ret;
} }
static int s3c24xx_iis_dev_remove(struct platform_device *pdev)
{
snd_soc_unregister_component(&pdev->dev);
return 0;
}
static struct platform_driver s3c24xx_iis_driver = { static struct platform_driver s3c24xx_iis_driver = {
.probe = s3c24xx_iis_dev_probe, .probe = s3c24xx_iis_dev_probe,
.remove = s3c24xx_iis_dev_remove,
.driver = { .driver = {
.name = "s3c24xx-iis", .name = "s3c24xx-iis",
.owner = THIS_MODULE, .owner = THIS_MODULE,
......
...@@ -427,8 +427,8 @@ static int spdif_probe(struct platform_device *pdev) ...@@ -427,8 +427,8 @@ static int spdif_probe(struct platform_device *pdev)
dev_set_drvdata(&pdev->dev, spdif); dev_set_drvdata(&pdev->dev, spdif);
ret = snd_soc_register_component(&pdev->dev, &samsung_spdif_component, ret = devm_snd_soc_register_component(&pdev->dev,
&samsung_spdif_dai, 1); &samsung_spdif_component, &samsung_spdif_dai, 1);
if (ret != 0) { if (ret != 0) {
dev_err(&pdev->dev, "fail to register dai\n"); dev_err(&pdev->dev, "fail to register dai\n");
goto err4; goto err4;
...@@ -444,12 +444,10 @@ static int spdif_probe(struct platform_device *pdev) ...@@ -444,12 +444,10 @@ static int spdif_probe(struct platform_device *pdev)
ret = samsung_asoc_dma_platform_register(&pdev->dev); ret = samsung_asoc_dma_platform_register(&pdev->dev);
if (ret) { if (ret) {
dev_err(&pdev->dev, "failed to register DMA: %d\n", ret); dev_err(&pdev->dev, "failed to register DMA: %d\n", ret);
goto err5; goto err4;
} }
return 0; return 0;
err5:
snd_soc_unregister_component(&pdev->dev);
err4: err4:
iounmap(spdif->regs); iounmap(spdif->regs);
err3: err3:
...@@ -467,8 +465,6 @@ static int spdif_remove(struct platform_device *pdev) ...@@ -467,8 +465,6 @@ static int spdif_remove(struct platform_device *pdev)
struct samsung_spdif_info *spdif = &spdif_info; struct samsung_spdif_info *spdif = &spdif_info;
struct resource *mem_res; struct resource *mem_res;
snd_soc_unregister_component(&pdev->dev);
iounmap(spdif->regs); iounmap(spdif->regs);
mem_res = platform_get_resource(pdev, IORESOURCE_MEM, 0); mem_res = platform_get_resource(pdev, IORESOURCE_MEM, 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