Skip to content

Commit ee9c15c

Browse files
masneybwens
authored andcommitted
clk: sunxi-ng: ccu_gate: 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]> Reviewed-by: Maxime Ripard <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Chen-Yu Tsai <[email protected]>
1 parent ea879ce commit ee9c15c

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

drivers/clk/sunxi-ng/ccu_gate.c

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,8 @@ static unsigned long ccu_gate_recalc_rate(struct clk_hw *hw,
9191
return rate;
9292
}
9393

94-
static long ccu_gate_round_rate(struct clk_hw *hw, unsigned long rate,
95-
unsigned long *prate)
94+
static int ccu_gate_determine_rate(struct clk_hw *hw,
95+
struct clk_rate_request *req)
9696
{
9797
struct ccu_gate *cg = hw_to_ccu_gate(hw);
9898
int div = 1;
@@ -101,14 +101,16 @@ static long ccu_gate_round_rate(struct clk_hw *hw, unsigned long rate,
101101
div = cg->common.prediv;
102102

103103
if (clk_hw_get_flags(hw) & CLK_SET_RATE_PARENT) {
104-
unsigned long best_parent = rate;
104+
unsigned long best_parent = req->rate;
105105

106106
if (cg->common.features & CCU_FEATURE_ALL_PREDIV)
107107
best_parent *= div;
108-
*prate = clk_hw_round_rate(clk_hw_get_parent(hw), best_parent);
108+
req->best_parent_rate = clk_hw_round_rate(clk_hw_get_parent(hw), best_parent);
109109
}
110110

111-
return *prate / div;
111+
req->rate = req->best_parent_rate / div;
112+
113+
return 0;
112114
}
113115

114116
static int ccu_gate_set_rate(struct clk_hw *hw, unsigned long rate,
@@ -127,7 +129,7 @@ const struct clk_ops ccu_gate_ops = {
127129
.disable = ccu_gate_disable,
128130
.enable = ccu_gate_enable,
129131
.is_enabled = ccu_gate_is_enabled,
130-
.round_rate = ccu_gate_round_rate,
132+
.determine_rate = ccu_gate_determine_rate,
131133
.set_rate = ccu_gate_set_rate,
132134
.recalc_rate = ccu_gate_recalc_rate,
133135
};

0 commit comments

Comments
 (0)