Skip to content

Commit ba6651a

Browse files
masneybbebarino
authored andcommitted
clk: imx: scu: 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. This driver also implements both the determine_rate() and round_rate() clk ops, and the round_rate() clk ops is deprecated. When both are defined, clk_core_determine_round_nolock() from the clk core will only use the determine_rate() clk ops, so let's remove the round_rate() clk ops since it's unused. Signed-off-by: Brian Masney <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Peng Fan <[email protected]> Signed-off-by: Stephen Boyd <[email protected]>
1 parent 62021be commit ba6651a

File tree

1 file changed

+9
-27
lines changed

1 file changed

+9
-27
lines changed

drivers/clk/imx/clk-scu.c

Lines changed: 9 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -269,24 +269,6 @@ static int clk_scu_determine_rate(struct clk_hw *hw,
269269
return 0;
270270
}
271271

272-
/*
273-
* clk_scu_round_rate - Round clock rate for a SCU clock
274-
* @hw: clock to round rate for
275-
* @rate: rate to round
276-
* @parent_rate: parent rate provided by common clock framework, not used
277-
*
278-
* Returns the current clock rate, or zero in failure.
279-
*/
280-
static long clk_scu_round_rate(struct clk_hw *hw, unsigned long rate,
281-
unsigned long *parent_rate)
282-
{
283-
/*
284-
* Assume we support all the requested rate and let the SCU firmware
285-
* to handle the left work
286-
*/
287-
return rate;
288-
}
289-
290272
static int clk_scu_atf_set_cpu_rate(struct clk_hw *hw, unsigned long rate,
291273
unsigned long parent_rate)
292274
{
@@ -454,15 +436,15 @@ static const struct clk_ops clk_scu_ops = {
454436

455437
static const struct clk_ops clk_scu_cpu_ops = {
456438
.recalc_rate = clk_scu_recalc_rate,
457-
.round_rate = clk_scu_round_rate,
439+
.determine_rate = clk_scu_determine_rate,
458440
.set_rate = clk_scu_atf_set_cpu_rate,
459441
.prepare = clk_scu_prepare,
460442
.unprepare = clk_scu_unprepare,
461443
};
462444

463445
static const struct clk_ops clk_scu_pi_ops = {
464446
.recalc_rate = clk_scu_recalc_rate,
465-
.round_rate = clk_scu_round_rate,
447+
.determine_rate = clk_scu_determine_rate,
466448
.set_rate = clk_scu_set_rate,
467449
};
468450

@@ -766,15 +748,15 @@ static unsigned long clk_gpr_div_scu_recalc_rate(struct clk_hw *hw,
766748
return err ? 0 : rate;
767749
}
768750

769-
static long clk_gpr_div_scu_round_rate(struct clk_hw *hw, unsigned long rate,
770-
unsigned long *prate)
751+
static int clk_gpr_div_scu_determine_rate(struct clk_hw *hw,
752+
struct clk_rate_request *req)
771753
{
772-
if (rate < *prate)
773-
rate = *prate / 2;
754+
if (req->rate < req->best_parent_rate)
755+
req->rate = req->best_parent_rate / 2;
774756
else
775-
rate = *prate;
757+
req->rate = req->best_parent_rate;
776758

777-
return rate;
759+
return 0;
778760
}
779761

780762
static int clk_gpr_div_scu_set_rate(struct clk_hw *hw, unsigned long rate,
@@ -793,7 +775,7 @@ static int clk_gpr_div_scu_set_rate(struct clk_hw *hw, unsigned long rate,
793775

794776
static const struct clk_ops clk_gpr_div_scu_ops = {
795777
.recalc_rate = clk_gpr_div_scu_recalc_rate,
796-
.round_rate = clk_gpr_div_scu_round_rate,
778+
.determine_rate = clk_gpr_div_scu_determine_rate,
797779
.set_rate = clk_gpr_div_scu_set_rate,
798780
};
799781

0 commit comments

Comments
 (0)