Skip to content

Commit dba4380

Browse files
masneybtsbogend
authored andcommitted
MIPS: Alchemy: 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. Note that prior to running Coccinelle, alchemy_clk_aux_roundr() was renamed to alchemy_clk_aux_round_rate(). A few minor style cleanups were also done by hand. Signed-off-by: Brian Masney <bmasney@redhat.com> Tested-by: Manuel Lauss <manuel.lauss@gmail.com> Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
1 parent 157f953 commit dba4380

1 file changed

Lines changed: 11 additions & 7 deletions

File tree

arch/mips/alchemy/common/clock.c

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -211,30 +211,34 @@ static int alchemy_clk_aux_setr(struct clk_hw *hw,
211211
return 0;
212212
}
213213

214-
static long alchemy_clk_aux_roundr(struct clk_hw *hw,
215-
unsigned long rate,
216-
unsigned long *parent_rate)
214+
static int alchemy_clk_aux_determine_rate(struct clk_hw *hw,
215+
struct clk_rate_request *req)
217216
{
218217
struct alchemy_auxpll_clk *a = to_auxpll_clk(hw);
219218
unsigned long mult;
220219

221-
if (!rate || !*parent_rate)
220+
if (!req->rate || !req->best_parent_rate) {
221+
req->rate = 0;
222+
222223
return 0;
224+
}
223225

224-
mult = rate / (*parent_rate);
226+
mult = req->rate / req->best_parent_rate;
225227

226228
if (mult && (mult < 7))
227229
mult = 7;
228230
if (mult > a->maxmult)
229231
mult = a->maxmult;
230232

231-
return (*parent_rate) * mult;
233+
req->rate = req->best_parent_rate * mult;
234+
235+
return 0;
232236
}
233237

234238
static const struct clk_ops alchemy_clkops_aux = {
235239
.recalc_rate = alchemy_clk_aux_recalc,
236240
.set_rate = alchemy_clk_aux_setr,
237-
.round_rate = alchemy_clk_aux_roundr,
241+
.determine_rate = alchemy_clk_aux_determine_rate,
238242
};
239243

240244
static struct clk __init *alchemy_clk_setup_aux(const char *parent_name,

0 commit comments

Comments
 (0)