aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ath/ath10k
diff options
context:
space:
mode:
authorMasahiro Yamada <yamada.masahiro@socionext.com>2016-09-26 14:56:22 -0400
committerKalle Valo <kvalo@qca.qualcomm.com>2016-09-27 08:11:43 -0400
commit828662753d60e5f95d082dd50dfc6ce1abe82095 (patch)
tree1815076cee0b0a3ab5c5db0716587500cce05927 /drivers/net/wireless/ath/ath10k
parente13dbead976d79968bd616b924f300cdaf15f852 (diff)
ath10k: use devm_clk_get() instead of clk_get()
Use the managed variant of clk_get() to simplify the failure path and the .remove callback. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
Diffstat (limited to 'drivers/net/wireless/ath/ath10k')
-rw-r--r--drivers/net/wireless/ath/ath10k/ahb.c34
1 files changed, 6 insertions, 28 deletions
diff --git a/drivers/net/wireless/ath/ath10k/ahb.c b/drivers/net/wireless/ath/ath10k/ahb.c
index b99ad5df383d..2de481b48e5d 100644
--- a/drivers/net/wireless/ath/ath10k/ahb.c
+++ b/drivers/net/wireless/ath/ath10k/ahb.c
@@ -91,59 +91,37 @@ static int ath10k_ahb_clock_init(struct ath10k *ar)
91{ 91{
92 struct ath10k_ahb *ar_ahb = ath10k_ahb_priv(ar); 92 struct ath10k_ahb *ar_ahb = ath10k_ahb_priv(ar);
93 struct device *dev; 93 struct device *dev;
94 int ret;
95 94
96 dev = &ar_ahb->pdev->dev; 95 dev = &ar_ahb->pdev->dev;
97 96
98 ar_ahb->cmd_clk = clk_get(dev, "wifi_wcss_cmd"); 97 ar_ahb->cmd_clk = devm_clk_get(dev, "wifi_wcss_cmd");
99 if (IS_ERR_OR_NULL(ar_ahb->cmd_clk)) { 98 if (IS_ERR_OR_NULL(ar_ahb->cmd_clk)) {
100 ath10k_err(ar, "failed to get cmd clk: %ld\n", 99 ath10k_err(ar, "failed to get cmd clk: %ld\n",
101 PTR_ERR(ar_ahb->cmd_clk)); 100 PTR_ERR(ar_ahb->cmd_clk));
102 ret = ar_ahb->cmd_clk ? PTR_ERR(ar_ahb->cmd_clk) : -ENODEV; 101 return ar_ahb->cmd_clk ? PTR_ERR(ar_ahb->cmd_clk) : -ENODEV;
103 goto out;
104 } 102 }
105 103
106 ar_ahb->ref_clk = clk_get(dev, "wifi_wcss_ref"); 104 ar_ahb->ref_clk = devm_clk_get(dev, "wifi_wcss_ref");
107 if (IS_ERR_OR_NULL(ar_ahb->ref_clk)) { 105 if (IS_ERR_OR_NULL(ar_ahb->ref_clk)) {
108 ath10k_err(ar, "failed to get ref clk: %ld\n", 106 ath10k_err(ar, "failed to get ref clk: %ld\n",
109 PTR_ERR(ar_ahb->ref_clk)); 107 PTR_ERR(ar_ahb->ref_clk));
110 ret = ar_ahb->ref_clk ? PTR_ERR(ar_ahb->ref_clk) : -ENODEV; 108 return ar_ahb->ref_clk ? PTR_ERR(ar_ahb->ref_clk) : -ENODEV;
111 goto err_cmd_clk_put;
112 } 109 }
113 110
114 ar_ahb->rtc_clk = clk_get(dev, "wifi_wcss_rtc"); 111 ar_ahb->rtc_clk = devm_clk_get(dev, "wifi_wcss_rtc");
115 if (IS_ERR_OR_NULL(ar_ahb->rtc_clk)) { 112 if (IS_ERR_OR_NULL(ar_ahb->rtc_clk)) {
116 ath10k_err(ar, "failed to get rtc clk: %ld\n", 113 ath10k_err(ar, "failed to get rtc clk: %ld\n",
117 PTR_ERR(ar_ahb->rtc_clk)); 114 PTR_ERR(ar_ahb->rtc_clk));
118 ret = ar_ahb->rtc_clk ? PTR_ERR(ar_ahb->rtc_clk) : -ENODEV; 115 return ar_ahb->rtc_clk ? PTR_ERR(ar_ahb->rtc_clk) : -ENODEV;
119 goto err_ref_clk_put;
120 } 116 }
121 117
122 return 0; 118 return 0;
123
124err_ref_clk_put:
125 clk_put(ar_ahb->ref_clk);
126
127err_cmd_clk_put:
128 clk_put(ar_ahb->cmd_clk);
129
130out:
131 return ret;
132} 119}
133 120
134static void ath10k_ahb_clock_deinit(struct ath10k *ar) 121static void ath10k_ahb_clock_deinit(struct ath10k *ar)
135{ 122{
136 struct ath10k_ahb *ar_ahb = ath10k_ahb_priv(ar); 123 struct ath10k_ahb *ar_ahb = ath10k_ahb_priv(ar);
137 124
138 if (!IS_ERR_OR_NULL(ar_ahb->cmd_clk))
139 clk_put(ar_ahb->cmd_clk);
140
141 if (!IS_ERR_OR_NULL(ar_ahb->ref_clk))
142 clk_put(ar_ahb->ref_clk);
143
144 if (!IS_ERR_OR_NULL(ar_ahb->rtc_clk))
145 clk_put(ar_ahb->rtc_clk);
146
147 ar_ahb->cmd_clk = NULL; 125 ar_ahb->cmd_clk = NULL;
148 ar_ahb->ref_clk = NULL; 126 ar_ahb->ref_clk = NULL;
149 ar_ahb->rtc_clk = NULL; 127 ar_ahb->rtc_clk = NULL;