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

clk: ti: fapll: 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.

Tested-by: Anddreas Kemnade <andreas@kemnade.info> # OMAP3 GTA04, OMAP4 Panda
Reviewed-by: Kevin Hilman <khilman@baylibre.com>
Tested-by: Kevin Hilman <khilman@baylibre.com>
Signed-off-by: Brian Masney <bmasney@redhat.com>

+27 -21
+27 -21
drivers/clk/ti/fapll.c
··· 214 214 return 0; 215 215 } 216 216 217 - static long ti_fapll_round_rate(struct clk_hw *hw, unsigned long rate, 218 - unsigned long *parent_rate) 217 + static int ti_fapll_determine_rate(struct clk_hw *hw, 218 + struct clk_rate_request *req) 219 219 { 220 220 u32 pre_div_p, mult_n; 221 221 int error; 222 222 223 - if (!rate) 223 + if (!req->rate) 224 224 return -EINVAL; 225 225 226 - error = ti_fapll_set_div_mult(rate, *parent_rate, 226 + error = ti_fapll_set_div_mult(req->rate, req->best_parent_rate, 227 227 &pre_div_p, &mult_n); 228 - if (error) 229 - return error; 228 + if (error) { 229 + req->rate = error; 230 230 231 - rate = *parent_rate / pre_div_p; 232 - rate *= mult_n; 231 + return 0; 232 + } 233 233 234 - return rate; 234 + req->rate = req->best_parent_rate / pre_div_p; 235 + req->rate *= mult_n; 236 + 237 + return 0; 235 238 } 236 239 237 240 static int ti_fapll_set_rate(struct clk_hw *hw, unsigned long rate, ··· 271 268 .is_enabled = ti_fapll_is_enabled, 272 269 .recalc_rate = ti_fapll_recalc_rate, 273 270 .get_parent = ti_fapll_get_parent, 274 - .round_rate = ti_fapll_round_rate, 271 + .determine_rate = ti_fapll_determine_rate, 275 272 .set_rate = ti_fapll_set_rate, 276 273 }; 277 274 ··· 402 399 return post_div_m; 403 400 } 404 401 405 - static long ti_fapll_synth_round_rate(struct clk_hw *hw, unsigned long rate, 406 - unsigned long *parent_rate) 402 + static int ti_fapll_synth_determine_rate(struct clk_hw *hw, 403 + struct clk_rate_request *req) 407 404 { 408 405 struct fapll_synth *synth = to_synth(hw); 409 406 struct fapll_data *fd = synth->fd; 410 407 unsigned long r; 411 408 412 - if (ti_fapll_clock_is_bypass(fd) || !synth->div || !rate) 409 + if (ti_fapll_clock_is_bypass(fd) || !synth->div || !req->rate) 413 410 return -EINVAL; 414 411 415 412 /* Only post divider m available with no fractional divider? */ ··· 417 414 unsigned long frac_rate; 418 415 u32 synth_post_div_m; 419 416 420 - frac_rate = ti_fapll_synth_get_frac_rate(hw, *parent_rate); 421 - synth_post_div_m = DIV_ROUND_UP(frac_rate, rate); 417 + frac_rate = ti_fapll_synth_get_frac_rate(hw, 418 + req->best_parent_rate); 419 + synth_post_div_m = DIV_ROUND_UP(frac_rate, req->rate); 422 420 r = DIV_ROUND_UP(frac_rate, synth_post_div_m); 423 421 goto out; 424 422 } 425 423 426 - r = *parent_rate * SYNTH_PHASE_K; 427 - if (rate > r) 424 + r = req->best_parent_rate * SYNTH_PHASE_K; 425 + if (req->rate > r) 428 426 goto out; 429 427 430 428 r = DIV_ROUND_UP_ULL(r, SYNTH_MAX_INT_DIV * SYNTH_MAX_DIV_M); 431 - if (rate < r) 429 + if (req->rate < r) 432 430 goto out; 433 431 434 - r = rate; 432 + r = req->rate; 435 433 out: 436 - return r; 434 + req->rate = r; 435 + 436 + return 0; 437 437 } 438 438 439 439 static int ti_fapll_synth_set_rate(struct clk_hw *hw, unsigned long rate, ··· 483 477 .disable = ti_fapll_synth_disable, 484 478 .is_enabled = ti_fapll_synth_is_enabled, 485 479 .recalc_rate = ti_fapll_synth_recalc_rate, 486 - .round_rate = ti_fapll_synth_round_rate, 480 + .determine_rate = ti_fapll_synth_determine_rate, 487 481 .set_rate = ti_fapll_synth_set_rate, 488 482 }; 489 483