Skip to content

Commit 2532795

Browse files
committed
clk: stm32: stm32-core: convert from divider_round_rate_parent() to divider_determine_rate()
The divider_round_rate_parent() function is now deprecated, so let's migrate to divider_determine_rate() instead so that this deprecated API can be removed. Note that when the main function itself was migrated to use determine_rate, this was mistakenly converted to: req->rate = divider_round_rate(...) This is invalid in the case when an error occurs since it can set the rate to a negative value. Fixes: cd1cb38 ("clk: stm32: stm32-core: convert from round_rate() to determine_rate()") Signed-off-by: Brian Masney <bmasney@redhat.com>
1 parent 6587c9d commit 2532795

1 file changed

Lines changed: 4 additions & 16 deletions

File tree

drivers/clk/stm32/clk-stm32-core.c

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -375,13 +375,8 @@ static int clk_stm32_divider_determine_rate(struct clk_hw *hw,
375375
divider->flags, val);
376376
}
377377

378-
req->rate = divider_round_rate_parent(hw, clk_hw_get_parent(hw),
379-
req->rate,
380-
&req->best_parent_rate,
381-
divider->table,
382-
divider->width, divider->flags);
383-
384-
return 0;
378+
return divider_determine_rate(hw, req, divider->table, divider->width,
379+
divider->flags);
385380
}
386381

387382
static unsigned long clk_stm32_divider_recalc_rate(struct clk_hw *hw,
@@ -438,7 +433,6 @@ static int clk_stm32_composite_determine_rate(struct clk_hw *hw,
438433
{
439434
struct clk_stm32_composite *composite = to_clk_stm32_composite(hw);
440435
const struct stm32_div_cfg *divider;
441-
long rate;
442436

443437
if (composite->div_id == NO_STM32_DIV)
444438
return 0;
@@ -457,14 +451,8 @@ static int clk_stm32_composite_determine_rate(struct clk_hw *hw,
457451
val);
458452
}
459453

460-
rate = divider_round_rate_parent(hw, clk_hw_get_parent(hw),
461-
req->rate, &req->best_parent_rate,
462-
divider->table, divider->width, divider->flags);
463-
if (rate < 0)
464-
return rate;
465-
466-
req->rate = rate;
467-
return 0;
454+
return divider_determine_rate(hw, req, divider->table, divider->width,
455+
divider->flags);
468456
}
469457

470458
static u8 clk_stm32_composite_get_parent(struct clk_hw *hw)

0 commit comments

Comments
 (0)