diff options
author | Masahiro Yamada <yamada.masahiro@socionext.com> | 2016-09-26 14:56:23 -0400 |
---|---|---|
committer | Kalle Valo <kvalo@qca.qualcomm.com> | 2016-09-27 08:11:48 -0400 |
commit | c5d8a34675d9160493a990007ae85ced02241d29 (patch) | |
tree | 8ab407047d519606881f9d6011caa11a220b6b54 | |
parent | 828662753d60e5f95d082dd50dfc6ce1abe82095 (diff) |
ath10k: use devm_reset_control_get() instead of reset_control_get()
Use the managed variant of reset_control_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>
-rw-r--r-- | drivers/net/wireless/ath/ath10k/ahb.c | 56 |
1 files changed, 10 insertions, 46 deletions
diff --git a/drivers/net/wireless/ath/ath10k/ahb.c b/drivers/net/wireless/ath/ath10k/ahb.c index 2de481b48e5d..751b7fed536d 100644 --- a/drivers/net/wireless/ath/ath10k/ahb.c +++ b/drivers/net/wireless/ath/ath10k/ahb.c | |||
@@ -191,92 +191,56 @@ static int ath10k_ahb_rst_ctrl_init(struct ath10k *ar) | |||
191 | { | 191 | { |
192 | struct ath10k_ahb *ar_ahb = ath10k_ahb_priv(ar); | 192 | struct ath10k_ahb *ar_ahb = ath10k_ahb_priv(ar); |
193 | struct device *dev; | 193 | struct device *dev; |
194 | int ret; | ||
195 | 194 | ||
196 | dev = &ar_ahb->pdev->dev; | 195 | dev = &ar_ahb->pdev->dev; |
197 | 196 | ||
198 | ar_ahb->core_cold_rst = reset_control_get(dev, "wifi_core_cold"); | 197 | ar_ahb->core_cold_rst = devm_reset_control_get(dev, "wifi_core_cold"); |
199 | if (IS_ERR_OR_NULL(ar_ahb->core_cold_rst)) { | 198 | if (IS_ERR_OR_NULL(ar_ahb->core_cold_rst)) { |
200 | ath10k_err(ar, "failed to get core cold rst ctrl: %ld\n", | 199 | ath10k_err(ar, "failed to get core cold rst ctrl: %ld\n", |
201 | PTR_ERR(ar_ahb->core_cold_rst)); | 200 | PTR_ERR(ar_ahb->core_cold_rst)); |
202 | ret = ar_ahb->core_cold_rst ? | 201 | return ar_ahb->core_cold_rst ? |
203 | PTR_ERR(ar_ahb->core_cold_rst) : -ENODEV; | 202 | PTR_ERR(ar_ahb->core_cold_rst) : -ENODEV; |
204 | goto out; | ||
205 | } | 203 | } |
206 | 204 | ||
207 | ar_ahb->radio_cold_rst = reset_control_get(dev, "wifi_radio_cold"); | 205 | ar_ahb->radio_cold_rst = devm_reset_control_get(dev, "wifi_radio_cold"); |
208 | if (IS_ERR_OR_NULL(ar_ahb->radio_cold_rst)) { | 206 | if (IS_ERR_OR_NULL(ar_ahb->radio_cold_rst)) { |
209 | ath10k_err(ar, "failed to get radio cold rst ctrl: %ld\n", | 207 | ath10k_err(ar, "failed to get radio cold rst ctrl: %ld\n", |
210 | PTR_ERR(ar_ahb->radio_cold_rst)); | 208 | PTR_ERR(ar_ahb->radio_cold_rst)); |
211 | ret = ar_ahb->radio_cold_rst ? | 209 | return ar_ahb->radio_cold_rst ? |
212 | PTR_ERR(ar_ahb->radio_cold_rst) : -ENODEV; | 210 | PTR_ERR(ar_ahb->radio_cold_rst) : -ENODEV; |
213 | goto err_core_cold_rst_put; | ||
214 | } | 211 | } |
215 | 212 | ||
216 | ar_ahb->radio_warm_rst = reset_control_get(dev, "wifi_radio_warm"); | 213 | ar_ahb->radio_warm_rst = devm_reset_control_get(dev, "wifi_radio_warm"); |
217 | if (IS_ERR_OR_NULL(ar_ahb->radio_warm_rst)) { | 214 | if (IS_ERR_OR_NULL(ar_ahb->radio_warm_rst)) { |
218 | ath10k_err(ar, "failed to get radio warm rst ctrl: %ld\n", | 215 | ath10k_err(ar, "failed to get radio warm rst ctrl: %ld\n", |
219 | PTR_ERR(ar_ahb->radio_warm_rst)); | 216 | PTR_ERR(ar_ahb->radio_warm_rst)); |
220 | ret = ar_ahb->radio_warm_rst ? | 217 | return ar_ahb->radio_warm_rst ? |
221 | PTR_ERR(ar_ahb->radio_warm_rst) : -ENODEV; | 218 | PTR_ERR(ar_ahb->radio_warm_rst) : -ENODEV; |
222 | goto err_radio_cold_rst_put; | ||
223 | } | 219 | } |
224 | 220 | ||
225 | ar_ahb->radio_srif_rst = reset_control_get(dev, "wifi_radio_srif"); | 221 | ar_ahb->radio_srif_rst = devm_reset_control_get(dev, "wifi_radio_srif"); |
226 | if (IS_ERR_OR_NULL(ar_ahb->radio_srif_rst)) { | 222 | if (IS_ERR_OR_NULL(ar_ahb->radio_srif_rst)) { |
227 | ath10k_err(ar, "failed to get radio srif rst ctrl: %ld\n", | 223 | ath10k_err(ar, "failed to get radio srif rst ctrl: %ld\n", |
228 | PTR_ERR(ar_ahb->radio_srif_rst)); | 224 | PTR_ERR(ar_ahb->radio_srif_rst)); |
229 | ret = ar_ahb->radio_srif_rst ? | 225 | return ar_ahb->radio_srif_rst ? |
230 | PTR_ERR(ar_ahb->radio_srif_rst) : -ENODEV; | 226 | PTR_ERR(ar_ahb->radio_srif_rst) : -ENODEV; |
231 | goto err_radio_warm_rst_put; | ||
232 | } | 227 | } |
233 | 228 | ||
234 | ar_ahb->cpu_init_rst = reset_control_get(dev, "wifi_cpu_init"); | 229 | ar_ahb->cpu_init_rst = devm_reset_control_get(dev, "wifi_cpu_init"); |
235 | if (IS_ERR_OR_NULL(ar_ahb->cpu_init_rst)) { | 230 | if (IS_ERR_OR_NULL(ar_ahb->cpu_init_rst)) { |
236 | ath10k_err(ar, "failed to get cpu init rst ctrl: %ld\n", | 231 | ath10k_err(ar, "failed to get cpu init rst ctrl: %ld\n", |
237 | PTR_ERR(ar_ahb->cpu_init_rst)); | 232 | PTR_ERR(ar_ahb->cpu_init_rst)); |
238 | ret = ar_ahb->cpu_init_rst ? | 233 | return ar_ahb->cpu_init_rst ? |
239 | PTR_ERR(ar_ahb->cpu_init_rst) : -ENODEV; | 234 | PTR_ERR(ar_ahb->cpu_init_rst) : -ENODEV; |
240 | goto err_radio_srif_rst_put; | ||
241 | } | 235 | } |
242 | 236 | ||
243 | return 0; | 237 | return 0; |
244 | |||
245 | err_radio_srif_rst_put: | ||
246 | reset_control_put(ar_ahb->radio_srif_rst); | ||
247 | |||
248 | err_radio_warm_rst_put: | ||
249 | reset_control_put(ar_ahb->radio_warm_rst); | ||
250 | |||
251 | err_radio_cold_rst_put: | ||
252 | reset_control_put(ar_ahb->radio_cold_rst); | ||
253 | |||
254 | err_core_cold_rst_put: | ||
255 | reset_control_put(ar_ahb->core_cold_rst); | ||
256 | |||
257 | out: | ||
258 | return ret; | ||
259 | } | 238 | } |
260 | 239 | ||
261 | static void ath10k_ahb_rst_ctrl_deinit(struct ath10k *ar) | 240 | static void ath10k_ahb_rst_ctrl_deinit(struct ath10k *ar) |
262 | { | 241 | { |
263 | struct ath10k_ahb *ar_ahb = ath10k_ahb_priv(ar); | 242 | struct ath10k_ahb *ar_ahb = ath10k_ahb_priv(ar); |
264 | 243 | ||
265 | if (!IS_ERR_OR_NULL(ar_ahb->core_cold_rst)) | ||
266 | reset_control_put(ar_ahb->core_cold_rst); | ||
267 | |||
268 | if (!IS_ERR_OR_NULL(ar_ahb->radio_cold_rst)) | ||
269 | reset_control_put(ar_ahb->radio_cold_rst); | ||
270 | |||
271 | if (!IS_ERR_OR_NULL(ar_ahb->radio_warm_rst)) | ||
272 | reset_control_put(ar_ahb->radio_warm_rst); | ||
273 | |||
274 | if (!IS_ERR_OR_NULL(ar_ahb->radio_srif_rst)) | ||
275 | reset_control_put(ar_ahb->radio_srif_rst); | ||
276 | |||
277 | if (!IS_ERR_OR_NULL(ar_ahb->cpu_init_rst)) | ||
278 | reset_control_put(ar_ahb->cpu_init_rst); | ||
279 | |||
280 | ar_ahb->core_cold_rst = NULL; | 244 | ar_ahb->core_cold_rst = NULL; |
281 | ar_ahb->radio_cold_rst = NULL; | 245 | ar_ahb->radio_cold_rst = NULL; |
282 | ar_ahb->radio_warm_rst = NULL; | 246 | ar_ahb->radio_warm_rst = NULL; |