Skip to content

Commit 9f7d504

Browse files
lhikichibebarino
authored andcommitted
clk: iproc: round clock rate to the closest
Change from 'DIV_ROUND_UP' to 'DIV_ROUND_CLOSEST' when calculating the clock divisor in the iProc ASIU clock driver to allow to get to the closest clock rate. Fixes: 5fe225c ("clk: iproc: add initial common clock support") Signed-off-by: Lori Hikichi <[email protected]> Signed-off-by: Ray Jui <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Stephen Boyd <[email protected]>
1 parent b3a9e3b commit 9f7d504

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/clk/bcm/clk-iproc-asiu.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ static long iproc_asiu_clk_round_rate(struct clk_hw *hw, unsigned long rate,
119119
if (rate == *parent_rate)
120120
return *parent_rate;
121121

122-
div = DIV_ROUND_UP(*parent_rate, rate);
122+
div = DIV_ROUND_CLOSEST(*parent_rate, rate);
123123
if (div < 2)
124124
return *parent_rate;
125125

@@ -145,7 +145,7 @@ static int iproc_asiu_clk_set_rate(struct clk_hw *hw, unsigned long rate,
145145
return 0;
146146
}
147147

148-
div = DIV_ROUND_UP(parent_rate, rate);
148+
div = DIV_ROUND_CLOSEST(parent_rate, rate);
149149
if (div < 2)
150150
return -EINVAL;
151151

0 commit comments

Comments
 (0)