diff options
author | Roger Quadros <rogerq@ti.com> | 2014-02-12 05:18:42 -0500 |
---|---|---|
committer | Lee Jones <lee.jones@linaro.org> | 2014-03-13 18:21:50 -0400 |
commit | 61b7025f6d6cebc9a8ebbe020c4de5a76a536c90 (patch) | |
tree | eb3fdf0d6d5eff6018cd4d4ea4d0e46dc7dba4fa | |
parent | 39a85bcbfc54d602934e2657c146c299d71b27ba (diff) |
mfd: omap-usb-host: Use resource managed clk_get()
Use devm_clk_get() instead of clk_get().
Signed-off-by: Roger Quadros <rogerq@ti.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
-rw-r--r-- | drivers/mfd/omap-usb-host.c | 81 |
1 files changed, 16 insertions, 65 deletions
diff --git a/drivers/mfd/omap-usb-host.c b/drivers/mfd/omap-usb-host.c index 90b630ccc8bc..0c3c9a0c7638 100644 --- a/drivers/mfd/omap-usb-host.c +++ b/drivers/mfd/omap-usb-host.c | |||
@@ -674,46 +674,46 @@ static int usbhs_omap_probe(struct platform_device *pdev) | |||
674 | 674 | ||
675 | omap->ehci_logic_fck = ERR_PTR(-EINVAL); | 675 | omap->ehci_logic_fck = ERR_PTR(-EINVAL); |
676 | if (need_logic_fck) { | 676 | if (need_logic_fck) { |
677 | omap->ehci_logic_fck = clk_get(dev, "ehci_logic_fck"); | 677 | omap->ehci_logic_fck = devm_clk_get(dev, "ehci_logic_fck"); |
678 | if (IS_ERR(omap->ehci_logic_fck)) { | 678 | if (IS_ERR(omap->ehci_logic_fck)) { |
679 | ret = PTR_ERR(omap->ehci_logic_fck); | 679 | ret = PTR_ERR(omap->ehci_logic_fck); |
680 | dev_dbg(dev, "ehci_logic_fck failed:%d\n", ret); | 680 | dev_dbg(dev, "ehci_logic_fck failed:%d\n", ret); |
681 | } | 681 | } |
682 | } | 682 | } |
683 | 683 | ||
684 | omap->utmi_p1_gfclk = clk_get(dev, "utmi_p1_gfclk"); | 684 | omap->utmi_p1_gfclk = devm_clk_get(dev, "utmi_p1_gfclk"); |
685 | if (IS_ERR(omap->utmi_p1_gfclk)) { | 685 | if (IS_ERR(omap->utmi_p1_gfclk)) { |
686 | ret = PTR_ERR(omap->utmi_p1_gfclk); | 686 | ret = PTR_ERR(omap->utmi_p1_gfclk); |
687 | dev_err(dev, "utmi_p1_gfclk failed error:%d\n", ret); | 687 | dev_err(dev, "utmi_p1_gfclk failed error:%d\n", ret); |
688 | goto err_p1_gfclk; | 688 | goto err_mem; |
689 | } | 689 | } |
690 | 690 | ||
691 | omap->utmi_p2_gfclk = clk_get(dev, "utmi_p2_gfclk"); | 691 | omap->utmi_p2_gfclk = devm_clk_get(dev, "utmi_p2_gfclk"); |
692 | if (IS_ERR(omap->utmi_p2_gfclk)) { | 692 | if (IS_ERR(omap->utmi_p2_gfclk)) { |
693 | ret = PTR_ERR(omap->utmi_p2_gfclk); | 693 | ret = PTR_ERR(omap->utmi_p2_gfclk); |
694 | dev_err(dev, "utmi_p2_gfclk failed error:%d\n", ret); | 694 | dev_err(dev, "utmi_p2_gfclk failed error:%d\n", ret); |
695 | goto err_p2_gfclk; | 695 | goto err_mem; |
696 | } | 696 | } |
697 | 697 | ||
698 | omap->xclk60mhsp1_ck = clk_get(dev, "xclk60mhsp1_ck"); | 698 | omap->xclk60mhsp1_ck = devm_clk_get(dev, "xclk60mhsp1_ck"); |
699 | if (IS_ERR(omap->xclk60mhsp1_ck)) { | 699 | if (IS_ERR(omap->xclk60mhsp1_ck)) { |
700 | ret = PTR_ERR(omap->xclk60mhsp1_ck); | 700 | ret = PTR_ERR(omap->xclk60mhsp1_ck); |
701 | dev_err(dev, "xclk60mhsp1_ck failed error:%d\n", ret); | 701 | dev_err(dev, "xclk60mhsp1_ck failed error:%d\n", ret); |
702 | goto err_xclk60mhsp1; | 702 | goto err_mem; |
703 | } | 703 | } |
704 | 704 | ||
705 | omap->xclk60mhsp2_ck = clk_get(dev, "xclk60mhsp2_ck"); | 705 | omap->xclk60mhsp2_ck = devm_clk_get(dev, "xclk60mhsp2_ck"); |
706 | if (IS_ERR(omap->xclk60mhsp2_ck)) { | 706 | if (IS_ERR(omap->xclk60mhsp2_ck)) { |
707 | ret = PTR_ERR(omap->xclk60mhsp2_ck); | 707 | ret = PTR_ERR(omap->xclk60mhsp2_ck); |
708 | dev_err(dev, "xclk60mhsp2_ck failed error:%d\n", ret); | 708 | dev_err(dev, "xclk60mhsp2_ck failed error:%d\n", ret); |
709 | goto err_xclk60mhsp2; | 709 | goto err_mem; |
710 | } | 710 | } |
711 | 711 | ||
712 | omap->init_60m_fclk = clk_get(dev, "init_60m_fclk"); | 712 | omap->init_60m_fclk = devm_clk_get(dev, "init_60m_fclk"); |
713 | if (IS_ERR(omap->init_60m_fclk)) { | 713 | if (IS_ERR(omap->init_60m_fclk)) { |
714 | ret = PTR_ERR(omap->init_60m_fclk); | 714 | ret = PTR_ERR(omap->init_60m_fclk); |
715 | dev_err(dev, "init_60m_fclk failed error:%d\n", ret); | 715 | dev_err(dev, "init_60m_fclk failed error:%d\n", ret); |
716 | goto err_init60m; | 716 | goto err_mem; |
717 | } | 717 | } |
718 | 718 | ||
719 | for (i = 0; i < omap->nports; i++) { | 719 | for (i = 0; i < omap->nports; i++) { |
@@ -727,21 +727,21 @@ static int usbhs_omap_probe(struct platform_device *pdev) | |||
727 | * platforms have all clocks and we can function without | 727 | * platforms have all clocks and we can function without |
728 | * them | 728 | * them |
729 | */ | 729 | */ |
730 | omap->utmi_clk[i] = clk_get(dev, clkname); | 730 | omap->utmi_clk[i] = devm_clk_get(dev, clkname); |
731 | if (IS_ERR(omap->utmi_clk[i])) | 731 | if (IS_ERR(omap->utmi_clk[i])) |
732 | dev_dbg(dev, "Failed to get clock : %s : %ld\n", | 732 | dev_dbg(dev, "Failed to get clock : %s : %ld\n", |
733 | clkname, PTR_ERR(omap->utmi_clk[i])); | 733 | clkname, PTR_ERR(omap->utmi_clk[i])); |
734 | 734 | ||
735 | snprintf(clkname, sizeof(clkname), | 735 | snprintf(clkname, sizeof(clkname), |
736 | "usb_host_hs_hsic480m_p%d_clk", i + 1); | 736 | "usb_host_hs_hsic480m_p%d_clk", i + 1); |
737 | omap->hsic480m_clk[i] = clk_get(dev, clkname); | 737 | omap->hsic480m_clk[i] = devm_clk_get(dev, clkname); |
738 | if (IS_ERR(omap->hsic480m_clk[i])) | 738 | if (IS_ERR(omap->hsic480m_clk[i])) |
739 | dev_dbg(dev, "Failed to get clock : %s : %ld\n", | 739 | dev_dbg(dev, "Failed to get clock : %s : %ld\n", |
740 | clkname, PTR_ERR(omap->hsic480m_clk[i])); | 740 | clkname, PTR_ERR(omap->hsic480m_clk[i])); |
741 | 741 | ||
742 | snprintf(clkname, sizeof(clkname), | 742 | snprintf(clkname, sizeof(clkname), |
743 | "usb_host_hs_hsic60m_p%d_clk", i + 1); | 743 | "usb_host_hs_hsic60m_p%d_clk", i + 1); |
744 | omap->hsic60m_clk[i] = clk_get(dev, clkname); | 744 | omap->hsic60m_clk[i] = devm_clk_get(dev, clkname); |
745 | if (IS_ERR(omap->hsic60m_clk[i])) | 745 | if (IS_ERR(omap->hsic60m_clk[i])) |
746 | dev_dbg(dev, "Failed to get clock : %s : %ld\n", | 746 | dev_dbg(dev, "Failed to get clock : %s : %ld\n", |
747 | clkname, PTR_ERR(omap->hsic60m_clk[i])); | 747 | clkname, PTR_ERR(omap->hsic60m_clk[i])); |
@@ -784,7 +784,7 @@ static int usbhs_omap_probe(struct platform_device *pdev) | |||
784 | 784 | ||
785 | if (ret) { | 785 | if (ret) { |
786 | dev_err(dev, "Failed to create DT children: %d\n", ret); | 786 | dev_err(dev, "Failed to create DT children: %d\n", ret); |
787 | goto err_alloc; | 787 | goto err_mem; |
788 | } | 788 | } |
789 | 789 | ||
790 | } else { | 790 | } else { |
@@ -792,40 +792,12 @@ static int usbhs_omap_probe(struct platform_device *pdev) | |||
792 | if (ret) { | 792 | if (ret) { |
793 | dev_err(dev, "omap_usbhs_alloc_children failed: %d\n", | 793 | dev_err(dev, "omap_usbhs_alloc_children failed: %d\n", |
794 | ret); | 794 | ret); |
795 | goto err_alloc; | 795 | goto err_mem; |
796 | } | 796 | } |
797 | } | 797 | } |
798 | 798 | ||
799 | return 0; | 799 | return 0; |
800 | 800 | ||
801 | err_alloc: | ||
802 | for (i = 0; i < omap->nports; i++) { | ||
803 | if (!IS_ERR(omap->utmi_clk[i])) | ||
804 | clk_put(omap->utmi_clk[i]); | ||
805 | if (!IS_ERR(omap->hsic60m_clk[i])) | ||
806 | clk_put(omap->hsic60m_clk[i]); | ||
807 | if (!IS_ERR(omap->hsic480m_clk[i])) | ||
808 | clk_put(omap->hsic480m_clk[i]); | ||
809 | } | ||
810 | |||
811 | clk_put(omap->init_60m_fclk); | ||
812 | |||
813 | err_init60m: | ||
814 | clk_put(omap->xclk60mhsp2_ck); | ||
815 | |||
816 | err_xclk60mhsp2: | ||
817 | clk_put(omap->xclk60mhsp1_ck); | ||
818 | |||
819 | err_xclk60mhsp1: | ||
820 | clk_put(omap->utmi_p2_gfclk); | ||
821 | |||
822 | err_p2_gfclk: | ||
823 | clk_put(omap->utmi_p1_gfclk); | ||
824 | |||
825 | err_p1_gfclk: | ||
826 | if (!IS_ERR(omap->ehci_logic_fck)) | ||
827 | clk_put(omap->ehci_logic_fck); | ||
828 | |||
829 | err_mem: | 801 | err_mem: |
830 | pm_runtime_disable(dev); | 802 | pm_runtime_disable(dev); |
831 | 803 | ||
@@ -847,27 +819,6 @@ static int usbhs_omap_remove_child(struct device *dev, void *data) | |||
847 | */ | 819 | */ |
848 | static int usbhs_omap_remove(struct platform_device *pdev) | 820 | static int usbhs_omap_remove(struct platform_device *pdev) |
849 | { | 821 | { |
850 | struct usbhs_hcd_omap *omap = platform_get_drvdata(pdev); | ||
851 | int i; | ||
852 | |||
853 | for (i = 0; i < omap->nports; i++) { | ||
854 | if (!IS_ERR(omap->utmi_clk[i])) | ||
855 | clk_put(omap->utmi_clk[i]); | ||
856 | if (!IS_ERR(omap->hsic60m_clk[i])) | ||
857 | clk_put(omap->hsic60m_clk[i]); | ||
858 | if (!IS_ERR(omap->hsic480m_clk[i])) | ||
859 | clk_put(omap->hsic480m_clk[i]); | ||
860 | } | ||
861 | |||
862 | clk_put(omap->init_60m_fclk); | ||
863 | clk_put(omap->utmi_p1_gfclk); | ||
864 | clk_put(omap->utmi_p2_gfclk); | ||
865 | clk_put(omap->xclk60mhsp2_ck); | ||
866 | clk_put(omap->xclk60mhsp1_ck); | ||
867 | |||
868 | if (!IS_ERR(omap->ehci_logic_fck)) | ||
869 | clk_put(omap->ehci_logic_fck); | ||
870 | |||
871 | pm_runtime_disable(&pdev->dev); | 822 | pm_runtime_disable(&pdev->dev); |
872 | 823 | ||
873 | /* remove children */ | 824 | /* remove children */ |