mirror of
https://github.com/torvalds/linux.git
synced 2026-01-12 00:42:35 +08:00
clk: at91: plldiv: 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:
@@ -33,21 +33,33 @@ static unsigned long clk_plldiv_recalc_rate(struct clk_hw *hw,
|
||||
return parent_rate;
|
||||
}
|
||||
|
||||
static long clk_plldiv_round_rate(struct clk_hw *hw, unsigned long rate,
|
||||
unsigned long *parent_rate)
|
||||
static int clk_plldiv_determine_rate(struct clk_hw *hw,
|
||||
struct clk_rate_request *req)
|
||||
{
|
||||
unsigned long div;
|
||||
|
||||
if (rate > *parent_rate)
|
||||
return *parent_rate;
|
||||
div = *parent_rate / 2;
|
||||
if (rate < div)
|
||||
return div;
|
||||
if (req->rate > req->best_parent_rate) {
|
||||
req->rate = req->best_parent_rate;
|
||||
|
||||
if (rate - div < *parent_rate - rate)
|
||||
return div;
|
||||
return 0;
|
||||
}
|
||||
|
||||
return *parent_rate;
|
||||
div = req->best_parent_rate / 2;
|
||||
if (req->rate < div) {
|
||||
req->rate = div;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (req->rate - div < req->best_parent_rate - req->rate) {
|
||||
req->rate = div;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
req->rate = req->best_parent_rate;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int clk_plldiv_set_rate(struct clk_hw *hw, unsigned long rate,
|
||||
@@ -66,7 +78,7 @@ static int clk_plldiv_set_rate(struct clk_hw *hw, unsigned long rate,
|
||||
|
||||
static const struct clk_ops plldiv_ops = {
|
||||
.recalc_rate = clk_plldiv_recalc_rate,
|
||||
.round_rate = clk_plldiv_round_rate,
|
||||
.determine_rate = clk_plldiv_determine_rate,
|
||||
.set_rate = clk_plldiv_set_rate,
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user