Commit 82866275 authored by Masahiro Yamada's avatar Masahiro Yamada Committed by Kalle Valo

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: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
Signed-off-by: default avatarKalle Valo <kvalo@qca.qualcomm.com>
parent e13dbead
...@@ -91,59 +91,37 @@ static int ath10k_ahb_clock_init(struct ath10k *ar) ...@@ -91,59 +91,37 @@ static int ath10k_ahb_clock_init(struct ath10k *ar)
{ {
struct ath10k_ahb *ar_ahb = ath10k_ahb_priv(ar); struct ath10k_ahb *ar_ahb = ath10k_ahb_priv(ar);
struct device *dev; struct device *dev;
int ret;
dev = &ar_ahb->pdev->dev; dev = &ar_ahb->pdev->dev;
ar_ahb->cmd_clk = clk_get(dev, "wifi_wcss_cmd"); ar_ahb->cmd_clk = devm_clk_get(dev, "wifi_wcss_cmd");
if (IS_ERR_OR_NULL(ar_ahb->cmd_clk)) { if (IS_ERR_OR_NULL(ar_ahb->cmd_clk)) {
ath10k_err(ar, "failed to get cmd clk: %ld\n", ath10k_err(ar, "failed to get cmd clk: %ld\n",
PTR_ERR(ar_ahb->cmd_clk)); PTR_ERR(ar_ahb->cmd_clk));
ret = ar_ahb->cmd_clk ? PTR_ERR(ar_ahb->cmd_clk) : -ENODEV; return ar_ahb->cmd_clk ? PTR_ERR(ar_ahb->cmd_clk) : -ENODEV;
goto out;
} }
ar_ahb->ref_clk = clk_get(dev, "wifi_wcss_ref"); ar_ahb->ref_clk = devm_clk_get(dev, "wifi_wcss_ref");
if (IS_ERR_OR_NULL(ar_ahb->ref_clk)) { if (IS_ERR_OR_NULL(ar_ahb->ref_clk)) {
ath10k_err(ar, "failed to get ref clk: %ld\n", ath10k_err(ar, "failed to get ref clk: %ld\n",
PTR_ERR(ar_ahb->ref_clk)); PTR_ERR(ar_ahb->ref_clk));
ret = ar_ahb->ref_clk ? PTR_ERR(ar_ahb->ref_clk) : -ENODEV; return ar_ahb->ref_clk ? PTR_ERR(ar_ahb->ref_clk) : -ENODEV;
goto err_cmd_clk_put;
} }
ar_ahb->rtc_clk = clk_get(dev, "wifi_wcss_rtc"); ar_ahb->rtc_clk = devm_clk_get(dev, "wifi_wcss_rtc");
if (IS_ERR_OR_NULL(ar_ahb->rtc_clk)) { if (IS_ERR_OR_NULL(ar_ahb->rtc_clk)) {
ath10k_err(ar, "failed to get rtc clk: %ld\n", ath10k_err(ar, "failed to get rtc clk: %ld\n",
PTR_ERR(ar_ahb->rtc_clk)); PTR_ERR(ar_ahb->rtc_clk));
ret = ar_ahb->rtc_clk ? PTR_ERR(ar_ahb->rtc_clk) : -ENODEV; return ar_ahb->rtc_clk ? PTR_ERR(ar_ahb->rtc_clk) : -ENODEV;
goto err_ref_clk_put;
} }
return 0; return 0;
err_ref_clk_put:
clk_put(ar_ahb->ref_clk);
err_cmd_clk_put:
clk_put(ar_ahb->cmd_clk);
out:
return ret;
} }
static void ath10k_ahb_clock_deinit(struct ath10k *ar) static void ath10k_ahb_clock_deinit(struct ath10k *ar)
{ {
struct ath10k_ahb *ar_ahb = ath10k_ahb_priv(ar); struct ath10k_ahb *ar_ahb = ath10k_ahb_priv(ar);
if (!IS_ERR_OR_NULL(ar_ahb->cmd_clk))
clk_put(ar_ahb->cmd_clk);
if (!IS_ERR_OR_NULL(ar_ahb->ref_clk))
clk_put(ar_ahb->ref_clk);
if (!IS_ERR_OR_NULL(ar_ahb->rtc_clk))
clk_put(ar_ahb->rtc_clk);
ar_ahb->cmd_clk = NULL; ar_ahb->cmd_clk = NULL;
ar_ahb->ref_clk = NULL; ar_ahb->ref_clk = NULL;
ar_ahb->rtc_clk = NULL; ar_ahb->rtc_clk = NULL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment