Merge branch 'kbuild' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild
[deliverable/linux.git] / drivers / clk / clk-divider.c
index 3ace102a2a0a4da1d3c0046181de2cca8b406d0e..ded3ff4b91b9a2492710c0487976c36fcb6dfa80 100644 (file)
 
 #define div_mask(width)        ((1 << (width)) - 1)
 
-static unsigned int _get_table_maxdiv(const struct clk_div_table *table)
+static unsigned int _get_table_maxdiv(const struct clk_div_table *table,
+                                     u8 width)
 {
-       unsigned int maxdiv = 0;
+       unsigned int maxdiv = 0, mask = div_mask(width);
        const struct clk_div_table *clkt;
 
        for (clkt = table; clkt->div; clkt++)
-               if (clkt->div > maxdiv)
+               if (clkt->div > maxdiv && clkt->val <= mask)
                        maxdiv = clkt->div;
        return maxdiv;
 }
@@ -62,7 +63,7 @@ static unsigned int _get_maxdiv(const struct clk_div_table *table, u8 width,
        if (flags & CLK_DIVIDER_POWER_OF_TWO)
                return 1 << div_mask(width);
        if (table)
-               return _get_table_maxdiv(table);
+               return _get_table_maxdiv(table, width);
        return div_mask(width) + 1;
 }
 
This page took 0.026603 seconds and 5 git commands to generate.