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

clk: si5341: 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 <bmasney@redhat.com>

+14 -8
+14 -8
drivers/clk/clk-si5341.c
··· 663 663 return f; 664 664 } 665 665 666 - static long si5341_synth_clk_round_rate(struct clk_hw *hw, unsigned long rate, 667 - unsigned long *parent_rate) 666 + static int si5341_synth_clk_determine_rate(struct clk_hw *hw, 667 + struct clk_rate_request *req) 668 668 { 669 669 struct clk_si5341_synth *synth = to_clk_si5341_synth(hw); 670 670 u64 f; ··· 672 672 /* The synthesizer accuracy is such that anything in range will work */ 673 673 f = synth->data->freq_vco; 674 674 do_div(f, SI5341_SYNTH_N_MAX); 675 - if (rate < f) 676 - return f; 675 + if (req->rate < f) { 676 + req->rate = f; 677 + 678 + return 0; 679 + } 677 680 678 681 f = synth->data->freq_vco; 679 682 do_div(f, SI5341_SYNTH_N_MIN); 680 - if (rate > f) 681 - return f; 683 + if (req->rate > f) { 684 + req->rate = f; 682 685 683 - return rate; 686 + return 0; 687 + } 688 + 689 + return 0; 684 690 } 685 691 686 692 static int si5341_synth_program(struct clk_si5341_synth *synth, ··· 747 741 .prepare = si5341_synth_clk_prepare, 748 742 .unprepare = si5341_synth_clk_unprepare, 749 743 .recalc_rate = si5341_synth_clk_recalc_rate, 750 - .round_rate = si5341_synth_clk_round_rate, 744 + .determine_rate = si5341_synth_clk_determine_rate, 751 745 .set_rate = si5341_synth_clk_set_rate, 752 746 }; 753 747