[PATCH v2 03/11] mmc: sdhci-of-arasan: Replace deprecated clk API calls

From: Manish Narani
Date: Mon Jul 01 2019 - 01:30:22 EST


The clk framework APIs devm_clk_register and of_clk_add_provider, which
are used here, are deprecated. Replace the calls with the new API calls.
Also add an API call devm_clk_get() to get the clock from DT.

Signed-off-by: Manish Narani <manish.narani@xxxxxxxxxx>
---
drivers/mmc/host/sdhci-of-arasan.c | 21 ++++++++++++++++-----
1 file changed, 16 insertions(+), 5 deletions(-)

diff --git a/drivers/mmc/host/sdhci-of-arasan.c b/drivers/mmc/host/sdhci-of-arasan.c
index b12abf9..d60a2e8 100644
--- a/drivers/mmc/host/sdhci-of-arasan.c
+++ b/drivers/mmc/host/sdhci-of-arasan.c
@@ -641,14 +641,25 @@ static int sdhci_arasan_register_sdclk(struct sdhci_arasan_data *sdhci_arasan,
sdcardclk_init.ops = &arasan_sdcardclk_ops;

sdhci_arasan->sdcardclk_hw.init = &sdcardclk_init;
- sdhci_arasan->sdcardclk =
- devm_clk_register(dev, &sdhci_arasan->sdcardclk_hw);
+ ret = devm_clk_hw_register(dev, &sdhci_arasan->sdcardclk_hw);
+ if (ret) {
+ dev_err(dev, "Failed to register SD clk_hw\n");
+ return ret;
+ }
sdhci_arasan->sdcardclk_hw.init = NULL;

- ret = of_clk_add_provider(np, of_clk_src_simple_get,
- sdhci_arasan->sdcardclk);
- if (ret)
+ ret = of_clk_add_hw_provider(np, of_clk_hw_simple_get,
+ &sdhci_arasan->sdcardclk_hw);
+ if (ret) {
dev_err(dev, "Failed to add clock provider\n");
+ return ret;
+ }
+
+ sdhci_arasan->sdcardclk = devm_clk_get(dev, "clk_sdcard");
+ if (IS_ERR(sdhci_arasan->sdcardclk)) {
+ dev_err(dev, "sdcardclk clock not found.\n");
+ ret = PTR_ERR(sdhci_arasan->sdcardclk);
+ }

return ret;
}
--
2.1.1