diff options
author | Fabio Estevam <fabio.estevam@freescale.com> | 2012-08-07 00:29:43 -0400 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2012-08-07 10:10:50 -0400 |
commit | 730963f8190b7650b0445a76e701fdef20c31cfb (patch) | |
tree | ce255f13f00ac2152e3c3ed0777732ca4b316e10 /sound/soc/mxs | |
parent | 5f800080ca6840326b3048202fb63fc4a71a4c49 (diff) |
ASoC: mxs-saif: Use devm_clk_get()
Using devm_clk_get can make the code simpler and smaller.
Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc/mxs')
-rw-r--r-- | sound/soc/mxs/mxs-saif.c | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/sound/soc/mxs/mxs-saif.c b/sound/soc/mxs/mxs-saif.c index b3030718c228..aa037b292f3d 100644 --- a/sound/soc/mxs/mxs-saif.c +++ b/sound/soc/mxs/mxs-saif.c | |||
@@ -704,7 +704,7 @@ static int __devinit mxs_saif_probe(struct platform_device *pdev) | |||
704 | return ret; | 704 | return ret; |
705 | } | 705 | } |
706 | 706 | ||
707 | saif->clk = clk_get(&pdev->dev, NULL); | 707 | saif->clk = devm_clk_get(&pdev->dev, NULL); |
708 | if (IS_ERR(saif->clk)) { | 708 | if (IS_ERR(saif->clk)) { |
709 | ret = PTR_ERR(saif->clk); | 709 | ret = PTR_ERR(saif->clk); |
710 | dev_err(&pdev->dev, "Cannot get the clock: %d\n", | 710 | dev_err(&pdev->dev, "Cannot get the clock: %d\n", |
@@ -717,8 +717,7 @@ static int __devinit mxs_saif_probe(struct platform_device *pdev) | |||
717 | saif->base = devm_request_and_ioremap(&pdev->dev, iores); | 717 | saif->base = devm_request_and_ioremap(&pdev->dev, iores); |
718 | if (!saif->base) { | 718 | if (!saif->base) { |
719 | dev_err(&pdev->dev, "ioremap failed\n"); | 719 | dev_err(&pdev->dev, "ioremap failed\n"); |
720 | ret = -ENODEV; | 720 | return -ENODEV; |
721 | goto failed_get_resource; | ||
722 | } | 721 | } |
723 | 722 | ||
724 | dmares = platform_get_resource(pdev, IORESOURCE_DMA, 0); | 723 | dmares = platform_get_resource(pdev, IORESOURCE_DMA, 0); |
@@ -731,7 +730,7 @@ static int __devinit mxs_saif_probe(struct platform_device *pdev) | |||
731 | &saif->dma_param.chan_num); | 730 | &saif->dma_param.chan_num); |
732 | if (ret) { | 731 | if (ret) { |
733 | dev_err(&pdev->dev, "failed to get dma channel\n"); | 732 | dev_err(&pdev->dev, "failed to get dma channel\n"); |
734 | goto failed_get_resource; | 733 | return ret; |
735 | } | 734 | } |
736 | } else { | 735 | } else { |
737 | saif->dma_param.chan_num = dmares->start; | 736 | saif->dma_param.chan_num = dmares->start; |
@@ -742,7 +741,7 @@ static int __devinit mxs_saif_probe(struct platform_device *pdev) | |||
742 | ret = saif->irq; | 741 | ret = saif->irq; |
743 | dev_err(&pdev->dev, "failed to get irq resource: %d\n", | 742 | dev_err(&pdev->dev, "failed to get irq resource: %d\n", |
744 | ret); | 743 | ret); |
745 | goto failed_get_resource; | 744 | return ret; |
746 | } | 745 | } |
747 | 746 | ||
748 | saif->dev = &pdev->dev; | 747 | saif->dev = &pdev->dev; |
@@ -750,7 +749,7 @@ static int __devinit mxs_saif_probe(struct platform_device *pdev) | |||
750 | "mxs-saif", saif); | 749 | "mxs-saif", saif); |
751 | if (ret) { | 750 | if (ret) { |
752 | dev_err(&pdev->dev, "failed to request irq\n"); | 751 | dev_err(&pdev->dev, "failed to request irq\n"); |
753 | goto failed_get_resource; | 752 | return ret; |
754 | } | 753 | } |
755 | 754 | ||
756 | saif->dma_param.chan_irq = platform_get_irq(pdev, 1); | 755 | saif->dma_param.chan_irq = platform_get_irq(pdev, 1); |
@@ -758,7 +757,7 @@ static int __devinit mxs_saif_probe(struct platform_device *pdev) | |||
758 | ret = saif->dma_param.chan_irq; | 757 | ret = saif->dma_param.chan_irq; |
759 | dev_err(&pdev->dev, "failed to get dma irq resource: %d\n", | 758 | dev_err(&pdev->dev, "failed to get dma irq resource: %d\n", |
760 | ret); | 759 | ret); |
761 | goto failed_get_resource; | 760 | return ret; |
762 | } | 761 | } |
763 | 762 | ||
764 | platform_set_drvdata(pdev, saif); | 763 | platform_set_drvdata(pdev, saif); |
@@ -766,7 +765,7 @@ static int __devinit mxs_saif_probe(struct platform_device *pdev) | |||
766 | ret = snd_soc_register_dai(&pdev->dev, &mxs_saif_dai); | 765 | ret = snd_soc_register_dai(&pdev->dev, &mxs_saif_dai); |
767 | if (ret) { | 766 | if (ret) { |
768 | dev_err(&pdev->dev, "register DAI failed\n"); | 767 | dev_err(&pdev->dev, "register DAI failed\n"); |
769 | goto failed_get_resource; | 768 | return ret; |
770 | } | 769 | } |
771 | 770 | ||
772 | ret = mxs_pcm_platform_register(&pdev->dev); | 771 | ret = mxs_pcm_platform_register(&pdev->dev); |
@@ -779,19 +778,14 @@ static int __devinit mxs_saif_probe(struct platform_device *pdev) | |||
779 | 778 | ||
780 | failed_pdev_alloc: | 779 | failed_pdev_alloc: |
781 | snd_soc_unregister_dai(&pdev->dev); | 780 | snd_soc_unregister_dai(&pdev->dev); |
782 | failed_get_resource: | ||
783 | clk_put(saif->clk); | ||
784 | 781 | ||
785 | return ret; | 782 | return ret; |
786 | } | 783 | } |
787 | 784 | ||
788 | static int __devexit mxs_saif_remove(struct platform_device *pdev) | 785 | static int __devexit mxs_saif_remove(struct platform_device *pdev) |
789 | { | 786 | { |
790 | struct mxs_saif *saif = platform_get_drvdata(pdev); | ||
791 | |||
792 | mxs_pcm_platform_unregister(&pdev->dev); | 787 | mxs_pcm_platform_unregister(&pdev->dev); |
793 | snd_soc_unregister_dai(&pdev->dev); | 788 | snd_soc_unregister_dai(&pdev->dev); |
794 | clk_put(saif->clk); | ||
795 | 789 | ||
796 | return 0; | 790 | return 0; |
797 | } | 791 | } |