mirror of https://github.com/torvalds/linux.git
clk: bcm: iproc-asiu: 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
8987b99357
commit
e84e82e576
|
|
@ -98,22 +98,27 @@ static unsigned long iproc_asiu_clk_recalc_rate(struct clk_hw *hw,
|
||||||
return clk->rate;
|
return clk->rate;
|
||||||
}
|
}
|
||||||
|
|
||||||
static long iproc_asiu_clk_round_rate(struct clk_hw *hw, unsigned long rate,
|
static int iproc_asiu_clk_determine_rate(struct clk_hw *hw,
|
||||||
unsigned long *parent_rate)
|
struct clk_rate_request *req)
|
||||||
{
|
{
|
||||||
unsigned int div;
|
unsigned int div;
|
||||||
|
|
||||||
if (rate == 0 || *parent_rate == 0)
|
if (req->rate == 0 || req->best_parent_rate == 0)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
if (rate == *parent_rate)
|
if (req->rate == req->best_parent_rate)
|
||||||
return *parent_rate;
|
return 0;
|
||||||
|
|
||||||
div = DIV_ROUND_CLOSEST(*parent_rate, rate);
|
div = DIV_ROUND_CLOSEST(req->best_parent_rate, req->rate);
|
||||||
if (div < 2)
|
if (div < 2) {
|
||||||
return *parent_rate;
|
req->rate = req->best_parent_rate;
|
||||||
|
|
||||||
return *parent_rate / div;
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
req->rate = req->best_parent_rate / div;
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int iproc_asiu_clk_set_rate(struct clk_hw *hw, unsigned long rate,
|
static int iproc_asiu_clk_set_rate(struct clk_hw *hw, unsigned long rate,
|
||||||
|
|
@ -168,7 +173,7 @@ static const struct clk_ops iproc_asiu_ops = {
|
||||||
.enable = iproc_asiu_clk_enable,
|
.enable = iproc_asiu_clk_enable,
|
||||||
.disable = iproc_asiu_clk_disable,
|
.disable = iproc_asiu_clk_disable,
|
||||||
.recalc_rate = iproc_asiu_clk_recalc_rate,
|
.recalc_rate = iproc_asiu_clk_recalc_rate,
|
||||||
.round_rate = iproc_asiu_clk_round_rate,
|
.determine_rate = iproc_asiu_clk_determine_rate,
|
||||||
.set_rate = iproc_asiu_clk_set_rate,
|
.set_rate = iproc_asiu_clk_set_rate,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue