Skip to content

Commit 77923f7

Browse files
masneybbebarino
authored andcommitted
clk: bcm: bcm2835: 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 <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Florian Fainelli <[email protected]> Signed-off-by: Stephen Boyd <[email protected]>
1 parent cce39a0 commit 77923f7

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

drivers/clk/bcm/clk-bcm2835.c

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -570,18 +570,23 @@ static long bcm2835_pll_rate_from_divisors(unsigned long parent_rate,
570570
return rate >> A2W_PLL_FRAC_BITS;
571571
}
572572

573-
static long bcm2835_pll_round_rate(struct clk_hw *hw, unsigned long rate,
574-
unsigned long *parent_rate)
573+
static int bcm2835_pll_determine_rate(struct clk_hw *hw,
574+
struct clk_rate_request *req)
575575
{
576576
struct bcm2835_pll *pll = container_of(hw, struct bcm2835_pll, hw);
577577
const struct bcm2835_pll_data *data = pll->data;
578578
u32 ndiv, fdiv;
579579

580-
rate = clamp(rate, data->min_rate, data->max_rate);
580+
req->rate = clamp(req->rate, data->min_rate, data->max_rate);
581581

582-
bcm2835_pll_choose_ndiv_and_fdiv(rate, *parent_rate, &ndiv, &fdiv);
582+
bcm2835_pll_choose_ndiv_and_fdiv(req->rate, req->best_parent_rate,
583+
&ndiv, &fdiv);
583584

584-
return bcm2835_pll_rate_from_divisors(*parent_rate, ndiv, fdiv, 1);
585+
req->rate = bcm2835_pll_rate_from_divisors(req->best_parent_rate,
586+
ndiv, fdiv,
587+
1);
588+
589+
return 0;
585590
}
586591

587592
static unsigned long bcm2835_pll_get_rate(struct clk_hw *hw,
@@ -783,7 +788,7 @@ static const struct clk_ops bcm2835_pll_clk_ops = {
783788
.unprepare = bcm2835_pll_off,
784789
.recalc_rate = bcm2835_pll_get_rate,
785790
.set_rate = bcm2835_pll_set_rate,
786-
.round_rate = bcm2835_pll_round_rate,
791+
.determine_rate = bcm2835_pll_determine_rate,
787792
.debug_init = bcm2835_pll_debug_init,
788793
};
789794

0 commit comments

Comments
 (0)