mirror of https://github.com/torvalds/linux.git
clk: fractional-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:
parent
986a96226c
commit
b87d7e655a
|
|
@ -151,25 +151,32 @@ void clk_fractional_divider_general_approximation(struct clk_hw *hw,
|
|||
}
|
||||
EXPORT_SYMBOL_GPL(clk_fractional_divider_general_approximation);
|
||||
|
||||
static long clk_fd_round_rate(struct clk_hw *hw, unsigned long rate,
|
||||
unsigned long *parent_rate)
|
||||
static int clk_fd_determine_rate(struct clk_hw *hw,
|
||||
struct clk_rate_request *req)
|
||||
{
|
||||
struct clk_fractional_divider *fd = to_clk_fd(hw);
|
||||
unsigned long m, n;
|
||||
u64 ret;
|
||||
|
||||
if (!rate || (!clk_hw_can_set_rate_parent(hw) && rate >= *parent_rate))
|
||||
return *parent_rate;
|
||||
if (!req->rate || (!clk_hw_can_set_rate_parent(hw) && req->rate >= req->best_parent_rate)) {
|
||||
req->rate = req->best_parent_rate;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (fd->approximation)
|
||||
fd->approximation(hw, rate, parent_rate, &m, &n);
|
||||
fd->approximation(hw, req->rate, &req->best_parent_rate, &m, &n);
|
||||
else
|
||||
clk_fractional_divider_general_approximation(hw, rate, parent_rate, &m, &n);
|
||||
clk_fractional_divider_general_approximation(hw, req->rate,
|
||||
&req->best_parent_rate,
|
||||
&m, &n);
|
||||
|
||||
ret = (u64)*parent_rate * m;
|
||||
ret = (u64)req->best_parent_rate * m;
|
||||
do_div(ret, n);
|
||||
|
||||
return ret;
|
||||
req->rate = ret;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int clk_fd_set_rate(struct clk_hw *hw, unsigned long rate,
|
||||
|
|
@ -250,7 +257,7 @@ static void clk_fd_debug_init(struct clk_hw *hw, struct dentry *dentry)
|
|||
|
||||
const struct clk_ops clk_fractional_divider_ops = {
|
||||
.recalc_rate = clk_fd_recalc_rate,
|
||||
.round_rate = clk_fd_round_rate,
|
||||
.determine_rate = clk_fd_determine_rate,
|
||||
.set_rate = clk_fd_set_rate,
|
||||
#ifdef CONFIG_DEBUG_FS
|
||||
.debug_init = clk_fd_debug_init,
|
||||
|
|
|
|||
Loading…
Reference in New Issue