mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-12-27 12:21:22 -05:00
clk: tegra: divider: 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>
This commit is contained in:
@@ -58,23 +58,31 @@ static unsigned long clk_frac_div_recalc_rate(struct clk_hw *hw,
|
||||
return rate;
|
||||
}
|
||||
|
||||
static long clk_frac_div_round_rate(struct clk_hw *hw, unsigned long rate,
|
||||
unsigned long *prate)
|
||||
static int clk_frac_div_determine_rate(struct clk_hw *hw,
|
||||
struct clk_rate_request *req)
|
||||
{
|
||||
struct tegra_clk_frac_div *divider = to_clk_frac_div(hw);
|
||||
int div, mul;
|
||||
unsigned long output_rate = *prate;
|
||||
unsigned long output_rate = req->best_parent_rate;
|
||||
|
||||
if (!rate)
|
||||
return output_rate;
|
||||
if (!req->rate) {
|
||||
req->rate = output_rate;
|
||||
|
||||
div = get_div(divider, rate, output_rate);
|
||||
if (div < 0)
|
||||
return *prate;
|
||||
return 0;
|
||||
}
|
||||
|
||||
div = get_div(divider, req->rate, output_rate);
|
||||
if (div < 0) {
|
||||
req->rate = req->best_parent_rate;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
mul = get_mul(divider);
|
||||
|
||||
return DIV_ROUND_UP(output_rate * mul, div + mul);
|
||||
req->rate = DIV_ROUND_UP(output_rate * mul, div + mul);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int clk_frac_div_set_rate(struct clk_hw *hw, unsigned long rate,
|
||||
@@ -127,7 +135,7 @@ static void clk_divider_restore_context(struct clk_hw *hw)
|
||||
const struct clk_ops tegra_clk_frac_div_ops = {
|
||||
.recalc_rate = clk_frac_div_recalc_rate,
|
||||
.set_rate = clk_frac_div_set_rate,
|
||||
.round_rate = clk_frac_div_round_rate,
|
||||
.determine_rate = clk_frac_div_determine_rate,
|
||||
.restore_context = clk_divider_restore_context,
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user