mirror of
https://github.com/torvalds/linux.git
synced 2025-11-03 18:20:25 +02:00
clk: mxs: frac: 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:
parent
da730b17aa
commit
755e4880f9
1 changed files with 9 additions and 7 deletions
|
|
@ -44,18 +44,18 @@ static unsigned long clk_frac_recalc_rate(struct clk_hw *hw,
|
|||
return tmp_rate >> frac->width;
|
||||
}
|
||||
|
||||
static long clk_frac_round_rate(struct clk_hw *hw, unsigned long rate,
|
||||
unsigned long *prate)
|
||||
static int clk_frac_determine_rate(struct clk_hw *hw,
|
||||
struct clk_rate_request *req)
|
||||
{
|
||||
struct clk_frac *frac = to_clk_frac(hw);
|
||||
unsigned long parent_rate = *prate;
|
||||
unsigned long parent_rate = req->best_parent_rate;
|
||||
u32 div;
|
||||
u64 tmp, tmp_rate, result;
|
||||
|
||||
if (rate > parent_rate)
|
||||
if (req->rate > parent_rate)
|
||||
return -EINVAL;
|
||||
|
||||
tmp = rate;
|
||||
tmp = req->rate;
|
||||
tmp <<= frac->width;
|
||||
do_div(tmp, parent_rate);
|
||||
div = tmp;
|
||||
|
|
@ -67,7 +67,9 @@ static long clk_frac_round_rate(struct clk_hw *hw, unsigned long rate,
|
|||
result = tmp_rate >> frac->width;
|
||||
if ((result << frac->width) < tmp_rate)
|
||||
result += 1;
|
||||
return result;
|
||||
req->rate = result;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int clk_frac_set_rate(struct clk_hw *hw, unsigned long rate,
|
||||
|
|
@ -103,7 +105,7 @@ static int clk_frac_set_rate(struct clk_hw *hw, unsigned long rate,
|
|||
|
||||
static const struct clk_ops clk_frac_ops = {
|
||||
.recalc_rate = clk_frac_recalc_rate,
|
||||
.round_rate = clk_frac_round_rate,
|
||||
.determine_rate = clk_frac_determine_rate,
|
||||
.set_rate = clk_frac_set_rate,
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue