Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

clk: tegra: pll: convert from round_rate() to determine_rate()

The round_rate() clk ops is deprecated, so migrate this driver from
round_rate() to determine_rate() using the Coccinelle semantic patch
on the cover letter of this series.

Signed-off-by: Brian Masney <bmasney@redhat.com>

+31 -21
+31 -21
drivers/clk/tegra/clk-pll.c
··· 840 840 return ret; 841 841 } 842 842 843 - static long clk_pll_round_rate(struct clk_hw *hw, unsigned long rate, 844 - unsigned long *prate) 843 + static int clk_pll_determine_rate(struct clk_hw *hw, 844 + struct clk_rate_request *req) 845 845 { 846 846 struct tegra_clk_pll *pll = to_clk_pll(hw); 847 847 struct tegra_clk_pll_freq_table cfg; ··· 849 849 if (pll->params->flags & TEGRA_PLL_FIXED) { 850 850 /* PLLM/MB are used for memory; we do not change rate */ 851 851 if (pll->params->flags & (TEGRA_PLLM | TEGRA_PLLMB)) 852 - return clk_hw_get_rate(hw); 853 - return pll->params->fixed_rate; 852 + req->rate = clk_hw_get_rate(hw); 853 + else 854 + req->rate = pll->params->fixed_rate; 855 + 856 + return 0; 854 857 } 855 858 856 - if (_get_table_rate(hw, &cfg, rate, *prate) && 857 - pll->params->calc_rate(hw, &cfg, rate, *prate)) 859 + if (_get_table_rate(hw, &cfg, req->rate, req->best_parent_rate) && 860 + pll->params->calc_rate(hw, &cfg, req->rate, req->best_parent_rate)) 858 861 return -EINVAL; 859 862 860 - return cfg.output_rate; 863 + req->rate = cfg.output_rate; 864 + 865 + return 0; 861 866 } 862 867 863 868 static unsigned long clk_pll_recalc_rate(struct clk_hw *hw, ··· 1062 1057 .enable = clk_pll_enable, 1063 1058 .disable = clk_pll_disable, 1064 1059 .recalc_rate = clk_pll_recalc_rate, 1065 - .round_rate = clk_pll_round_rate, 1060 + .determine_rate = clk_pll_determine_rate, 1066 1061 .set_rate = clk_pll_set_rate, 1067 1062 .restore_context = tegra_clk_pll_restore_context, 1068 1063 }; ··· 1200 1195 .enable = clk_pllu_enable, 1201 1196 .disable = clk_pll_disable, 1202 1197 .recalc_rate = clk_pll_recalc_rate, 1203 - .round_rate = clk_pll_round_rate, 1198 + .determine_rate = clk_pll_determine_rate, 1204 1199 .set_rate = clk_pll_set_rate, 1205 1200 }; 1206 1201 ··· 1358 1353 return ret; 1359 1354 } 1360 1355 1361 - static long clk_pll_ramp_round_rate(struct clk_hw *hw, unsigned long rate, 1362 - unsigned long *prate) 1356 + static int clk_pll_ramp_determine_rate(struct clk_hw *hw, 1357 + struct clk_rate_request *req) 1363 1358 { 1364 1359 struct tegra_clk_pll *pll = to_clk_pll(hw); 1365 1360 struct tegra_clk_pll_freq_table cfg; 1366 1361 int ret, p_div; 1367 - u64 output_rate = *prate; 1362 + u64 output_rate = req->best_parent_rate; 1368 1363 1369 - ret = _pll_ramp_calc_pll(hw, &cfg, rate, *prate); 1364 + ret = _pll_ramp_calc_pll(hw, &cfg, req->rate, req->best_parent_rate); 1370 1365 if (ret < 0) 1371 1366 return ret; 1372 1367 ··· 1380 1375 output_rate *= cfg.n; 1381 1376 do_div(output_rate, cfg.m * p_div); 1382 1377 1383 - return output_rate; 1378 + req->rate = output_rate; 1379 + 1380 + return 0; 1384 1381 } 1385 1382 1386 1383 static void _pllcx_strobe(struct tegra_clk_pll *pll) ··· 1605 1598 return rate; 1606 1599 } 1607 1600 1608 - static long clk_pllre_round_rate(struct clk_hw *hw, unsigned long rate, 1609 - unsigned long *prate) 1601 + static int clk_pllre_determine_rate(struct clk_hw *hw, 1602 + struct clk_rate_request *req) 1610 1603 { 1611 1604 struct tegra_clk_pll *pll = to_clk_pll(hw); 1612 1605 1613 - return _pllre_calc_rate(pll, NULL, rate, *prate); 1606 + req->rate = _pllre_calc_rate(pll, NULL, req->rate, 1607 + req->best_parent_rate); 1608 + 1609 + return 0; 1614 1610 } 1615 1611 1616 1612 static int clk_plle_tegra114_enable(struct clk_hw *hw) ··· 2013 2003 .enable = clk_pll_enable, 2014 2004 .disable = clk_pll_disable, 2015 2005 .recalc_rate = clk_pll_recalc_rate, 2016 - .round_rate = clk_pll_ramp_round_rate, 2006 + .determine_rate = clk_pll_ramp_determine_rate, 2017 2007 .set_rate = clk_pllxc_set_rate, 2018 2008 }; 2019 2009 ··· 2022 2012 .enable = clk_pllc_enable, 2023 2013 .disable = clk_pllc_disable, 2024 2014 .recalc_rate = clk_pll_recalc_rate, 2025 - .round_rate = clk_pll_ramp_round_rate, 2015 + .determine_rate = clk_pll_ramp_determine_rate, 2026 2016 .set_rate = clk_pllc_set_rate, 2027 2017 }; 2028 2018 ··· 2031 2021 .enable = clk_pll_enable, 2032 2022 .disable = clk_pll_disable, 2033 2023 .recalc_rate = clk_pllre_recalc_rate, 2034 - .round_rate = clk_pllre_round_rate, 2024 + .determine_rate = clk_pllre_determine_rate, 2035 2025 .set_rate = clk_pllre_set_rate, 2036 2026 }; 2037 2027 ··· 2331 2321 .enable = clk_pll_enable, 2332 2322 .disable = clk_pll_disable, 2333 2323 .recalc_rate = clk_pll_recalc_rate, 2334 - .round_rate = clk_pll_ramp_round_rate, 2324 + .determine_rate = clk_pll_ramp_determine_rate, 2335 2325 .set_rate = clk_pllxc_set_rate, 2336 2326 .restore_context = tegra_clk_pll_restore_context, 2337 2327 };