ASoC: samsung: Use devm_snd_soc_register_component
authorTushar Behera <tushar.behera@linaro.org>
Wed, 21 May 2014 03:22:19 +0000 (08:52 +0530)
committerMark Brown <broonie@linaro.org>
Wed, 21 May 2014 23:20:11 +0000 (00:20 +0100)
Replaced snd_soc_register_component with its devres equivalent,
devm_snd_soc_register_component.

Signed-off-by: Tushar Behera <tushar.behera@linaro.org>
Signed-off-by: Mark Brown <broonie@linaro.org>
sound/soc/samsung/ac97.c
sound/soc/samsung/goni_wm8994.c
sound/soc/samsung/pcm.c
sound/soc/samsung/s3c-i2s-v2.c
sound/soc/samsung/s3c2412-i2s.c
sound/soc/samsung/s3c24xx-i2s.c
sound/soc/samsung/spdif.c

index fbce03bbdb2b5d6af1d6b93ac34063c513e5834c..68d9303047e85eea9dbd393a6c56aafda7a5bebc 100644 (file)
@@ -433,7 +433,7 @@ static int s3c_ac97_probe(struct platform_device *pdev)
                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));
        if (ret)
                goto err5;
@@ -441,12 +441,10 @@ static int s3c_ac97_probe(struct platform_device *pdev)
        ret = samsung_asoc_dma_platform_register(&pdev->dev);
        if (ret) {
                dev_err(&pdev->dev, "failed to get register DMA: %d\n", ret);
-               goto err6;
+               goto err5;
        }
 
        return 0;
-err6:
-       snd_soc_unregister_component(&pdev->dev);
 err5:
        free_irq(irq_res->start, NULL);
 err4:
@@ -461,8 +459,6 @@ static int s3c_ac97_remove(struct platform_device *pdev)
 {
        struct resource *irq_res;
 
-       snd_soc_unregister_component(&pdev->dev);
-
        irq_res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
        if (irq_res)
                free_irq(irq_res->start, NULL);
index 415ad81999c4bab0076d6e3f7933c19c338fee13..9506d7617223aed4bc6a76a2e0fc531099b1b13e 100644 (file)
@@ -274,8 +274,8 @@ static int __init goni_init(void)
                return -ENOMEM;
 
        /* register voice DAI here */
-       ret = snd_soc_register_component(&goni_snd_device->dev, &voice_component,
-                                        &voice_dai, 1);
+       ret = devm_snd_soc_register_component(&goni_snd_device->dev,
+                       &voice_component, &voice_dai, 1);
        if (ret) {
                platform_device_put(goni_snd_device);
                return ret;
@@ -284,17 +284,14 @@ static int __init goni_init(void)
        platform_set_drvdata(goni_snd_device, &goni);
        ret = platform_device_add(goni_snd_device);
 
-       if (ret) {
-               snd_soc_unregister_component(&goni_snd_device->dev);
+       if (ret)
                platform_device_put(goni_snd_device);
-       }
 
        return ret;
 }
 
 static void __exit goni_exit(void)
 {
-       snd_soc_unregister_component(&goni_snd_device->dev);
        platform_device_unregister(goni_snd_device);
 }
 
index 38df2a86bd5fbc365ed20e6cddb8b655911a47d3..90fcd522be1c2245ad29c1c7e7f56f7a1a508ac0 100644 (file)
@@ -588,7 +588,7 @@ static int s3c_pcm_dev_probe(struct platform_device *pdev)
 
        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);
        if (ret != 0) {
                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)
        ret = samsung_asoc_dma_platform_register(&pdev->dev);
        if (ret) {
                dev_err(&pdev->dev, "failed to get register DMA: %d\n", ret);
-               goto err6;
+               goto err5;
        }
 
        return 0;
 
-err6:
-       snd_soc_unregister_component(&pdev->dev);
 err5:
        clk_disable_unprepare(pcm->pclk);
        clk_put(pcm->pclk);
@@ -624,8 +622,6 @@ static int s3c_pcm_dev_remove(struct platform_device *pdev)
        struct s3c_pcm_info *pcm = &s3c_pcm[pdev->id];
        struct resource *mem_res;
 
-       snd_soc_unregister_component(&pdev->dev);
-
        pm_runtime_disable(&pdev->dev);
 
        iounmap(pcm->regs);
index 79e7efb9283cbf740e23b7310750bb4e0f2771f4..77a2ae50dc94ca5806299cc921b23d45c0355946 100644 (file)
@@ -745,7 +745,7 @@ int s3c_i2sv2_register_component(struct device *dev, int id,
        dai_drv->suspend = s3c2412_i2s_suspend;
        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);
 
index f42da8df3e3ca757314488e312e4f3570574853d..843f315dcb3ad360652ff4935adeb51bdef52a58 100644 (file)
@@ -179,26 +179,14 @@ static int s3c2412_iis_dev_probe(struct platform_device *pdev)
        }
 
        ret = samsung_asoc_dma_platform_register(&pdev->dev);
-       if (ret) {
+       if (ret)
                pr_err("failed to register the DMA: %d\n", ret);
-               goto err;
-       }
 
-       return 0;
-err:
-       snd_soc_unregister_component(&pdev->dev);
        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 = {
        .probe  = s3c2412_iis_dev_probe,
-       .remove = s3c2412_iis_dev_remove,
        .driver = {
                .name = "s3c2412-iis",
                .owner = THIS_MODULE,
index 8380443b1b39209a0f83f1fc1548dd06005b1f18..4a6d206db222c1131f98e946319e03e4b4d61da8 100644 (file)
@@ -475,34 +475,22 @@ static int s3c24xx_iis_dev_probe(struct platform_device *pdev)
 {
        int ret = 0;
 
-       ret = snd_soc_register_component(&pdev->dev, &s3c24xx_i2s_component,
-                                        &s3c24xx_i2s_dai, 1);
+       ret = devm_snd_soc_register_component(&pdev->dev,
+                       &s3c24xx_i2s_component, &s3c24xx_i2s_dai, 1);
        if (ret) {
                pr_err("failed to register the dai\n");
                return ret;
        }
 
        ret = samsung_asoc_dma_platform_register(&pdev->dev);
-       if (ret) {
+       if (ret)
                pr_err("failed to register the dma: %d\n", ret);
-               goto err;
-       }
 
-       return 0;
-err:
-       snd_soc_unregister_component(&pdev->dev);
        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 = {
        .probe  = s3c24xx_iis_dev_probe,
-       .remove = s3c24xx_iis_dev_remove,
        .driver = {
                .name = "s3c24xx-iis",
                .owner = THIS_MODULE,
index 7d89d016fa4945d73548c104c6b5617840feaeb6..e93a93e296f470b3557a70d1d455a59f2617d419 100644 (file)
@@ -427,8 +427,8 @@ static int spdif_probe(struct platform_device *pdev)
 
        dev_set_drvdata(&pdev->dev, spdif);
 
-       ret = snd_soc_register_component(&pdev->dev, &samsung_spdif_component,
-                                        &samsung_spdif_dai, 1);
+       ret = devm_snd_soc_register_component(&pdev->dev,
+                       &samsung_spdif_component, &samsung_spdif_dai, 1);
        if (ret != 0) {
                dev_err(&pdev->dev, "fail to register dai\n");
                goto err4;
@@ -444,12 +444,10 @@ static int spdif_probe(struct platform_device *pdev)
        ret = samsung_asoc_dma_platform_register(&pdev->dev);
        if (ret) {
                dev_err(&pdev->dev, "failed to register DMA: %d\n", ret);
-               goto err5;
+               goto err4;
        }
 
        return 0;
-err5:
-       snd_soc_unregister_component(&pdev->dev);
 err4:
        iounmap(spdif->regs);
 err3:
@@ -467,8 +465,6 @@ static int spdif_remove(struct platform_device *pdev)
        struct samsung_spdif_info *spdif = &spdif_info;
        struct resource *mem_res;
 
-       snd_soc_unregister_component(&pdev->dev);
-
        iounmap(spdif->regs);
 
        mem_res = platform_get_resource(pdev, IORESOURCE_MEM, 0);