Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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

authored by

Brian Masney and committed by
Daniel Lezcano
21b8a635 764d0654

+16 -11
+16 -11
drivers/clocksource/ingenic-sysost.c
··· 127 127 return 2; /* /16 divider */ 128 128 } 129 129 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) 132 132 { 133 - unsigned long rate = *parent_rate; 133 + unsigned long rate = req->best_parent_rate; 134 134 u8 prescale; 135 135 136 - if (req_rate > rate) 137 - return rate; 136 + if (req->rate > rate) { 137 + req->rate = rate; 138 138 139 - prescale = ingenic_ost_get_prescale(rate, req_rate); 139 + return 0; 140 + } 140 141 141 - return rate >> (prescale * 2); 142 + prescale = ingenic_ost_get_prescale(rate, req->rate); 143 + 144 + req->rate = rate >> (prescale * 2); 145 + 146 + return 0; 142 147 } 143 148 144 149 static int ingenic_ost_percpu_timer_set_rate(struct clk_hw *hw, unsigned long req_rate, ··· 180 175 181 176 static const struct clk_ops ingenic_ost_percpu_timer_ops = { 182 177 .recalc_rate = ingenic_ost_percpu_timer_recalc_rate, 183 - .round_rate = ingenic_ost_round_rate, 184 - .set_rate = ingenic_ost_percpu_timer_set_rate, 178 + .determine_rate = ingenic_ost_determine_rate, 179 + .set_rate = ingenic_ost_percpu_timer_set_rate, 185 180 }; 186 181 187 182 static const struct clk_ops ingenic_ost_global_timer_ops = { 188 183 .recalc_rate = ingenic_ost_global_timer_recalc_rate, 189 - .round_rate = ingenic_ost_round_rate, 190 - .set_rate = ingenic_ost_global_timer_set_rate, 184 + .determine_rate = ingenic_ost_determine_rate, 185 + .set_rate = ingenic_ost_global_timer_set_rate, 191 186 }; 192 187 193 188 static const char * const ingenic_ost_clk_parents[] = { "ext" };