Skip to content

Commit 21b8a63

Browse files
masneybdlezcano
authored andcommitted
clocksource/drivers/ingenic-sysost: 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 appended to the "under-the-cut" portion of the patch. While changes are being made to 'struct clk_ops', let's also go ahead and fix the formatting of set_rate so that everything lines up as expected. Signed-off-by: Brian Masney <bmasney@redhat.com> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org> Link: https://lore.kernel.org/r/20250810-clocksource-round-rate-v1-1-486ef53e45eb@redhat.com
1 parent 764d065 commit 21b8a63

1 file changed

Lines changed: 16 additions & 11 deletions

File tree

drivers/clocksource/ingenic-sysost.c

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -127,18 +127,23 @@ static u8 ingenic_ost_get_prescale(unsigned long rate, unsigned long req_rate)
127127
return 2; /* /16 divider */
128128
}
129129

130-
static long ingenic_ost_round_rate(struct clk_hw *hw, unsigned long req_rate,
131-
unsigned long *parent_rate)
130+
static int ingenic_ost_determine_rate(struct clk_hw *hw,
131+
struct clk_rate_request *req)
132132
{
133-
unsigned long rate = *parent_rate;
133+
unsigned long rate = req->best_parent_rate;
134134
u8 prescale;
135135

136-
if (req_rate > rate)
137-
return rate;
136+
if (req->rate > rate) {
137+
req->rate = rate;
138138

139-
prescale = ingenic_ost_get_prescale(rate, req_rate);
139+
return 0;
140+
}
141+
142+
prescale = ingenic_ost_get_prescale(rate, req->rate);
140143

141-
return rate >> (prescale * 2);
144+
req->rate = rate >> (prescale * 2);
145+
146+
return 0;
142147
}
143148

144149
static int ingenic_ost_percpu_timer_set_rate(struct clk_hw *hw, unsigned long req_rate,
@@ -175,14 +180,14 @@ static int ingenic_ost_global_timer_set_rate(struct clk_hw *hw, unsigned long re
175180

176181
static const struct clk_ops ingenic_ost_percpu_timer_ops = {
177182
.recalc_rate = ingenic_ost_percpu_timer_recalc_rate,
178-
.round_rate = ingenic_ost_round_rate,
179-
.set_rate = ingenic_ost_percpu_timer_set_rate,
183+
.determine_rate = ingenic_ost_determine_rate,
184+
.set_rate = ingenic_ost_percpu_timer_set_rate,
180185
};
181186

182187
static const struct clk_ops ingenic_ost_global_timer_ops = {
183188
.recalc_rate = ingenic_ost_global_timer_recalc_rate,
184-
.round_rate = ingenic_ost_round_rate,
185-
.set_rate = ingenic_ost_global_timer_set_rate,
189+
.determine_rate = ingenic_ost_determine_rate,
190+
.set_rate = ingenic_ost_global_timer_set_rate,
186191
};
187192

188193
static const char * const ingenic_ost_clk_parents[] = { "ext" };

0 commit comments

Comments
 (0)