diff options
author | Julia Lawall <julia@diku.dk> | 2008-04-28 05:14:51 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-04-28 11:58:35 -0400 |
commit | 416e74ea7813597b586eafc24f67779eeb86e12f (patch) | |
tree | ddb2312349310de0e7a045c6d81bf79d72ed2d0c /drivers/video/gxt4500.c | |
parent | 7f29b87a7779505288a31df16ba84a85fc1ae93c (diff) |
fbdev: use DIV_ROUND_UP or roundup
The kernel.h macro DIV_ROUND_UP performs the computation (((n) + (d) - 1) /
(d)) but is perhaps more readable.
An extract of the semantic patch that makes this change is as follows:
(http://www.emn.fr/x-info/coccinelle/)
// <smpl>
@haskernel@
@@
#include <linux/kernel.h>
@depends on haskernel@
expression n,d;
@@
(
- (n + d - 1) / d
+ DIV_ROUND_UP(n,d)
|
- (n + (d - 1)) / d
+ DIV_ROUND_UP(n,d)
)
@depends on haskernel@
expression n,d;
@@
- DIV_ROUND_UP((n),d)
+ DIV_ROUND_UP(n,d)
@depends on haskernel@
expression n,d;
@@
- DIV_ROUND_UP(n,(d))
+ DIV_ROUND_UP(n,d)
// </smpl>
Signed-off-by: Julia Lawall <julia@diku.dk>
Cc: "Antonino A. Daplas" <adaplas@pol.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/video/gxt4500.c')
-rw-r--r-- | drivers/video/gxt4500.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/video/gxt4500.c b/drivers/video/gxt4500.c index e92337bef50d..564557792bed 100644 --- a/drivers/video/gxt4500.c +++ b/drivers/video/gxt4500.c | |||
@@ -238,7 +238,7 @@ static int calc_pll(int period_ps, struct gxt4500_par *par) | |||
238 | for (pdiv1 = 1; pdiv1 <= 8; ++pdiv1) { | 238 | for (pdiv1 = 1; pdiv1 <= 8; ++pdiv1) { |
239 | for (pdiv2 = 1; pdiv2 <= pdiv1; ++pdiv2) { | 239 | for (pdiv2 = 1; pdiv2 <= pdiv1; ++pdiv2) { |
240 | postdiv = pdiv1 * pdiv2; | 240 | postdiv = pdiv1 * pdiv2; |
241 | pll_period = (period_ps + postdiv - 1) / postdiv; | 241 | pll_period = DIV_ROUND_UP(period_ps, postdiv); |
242 | /* keep pll in range 350..600 MHz */ | 242 | /* keep pll in range 350..600 MHz */ |
243 | if (pll_period < 1666 || pll_period > 2857) | 243 | if (pll_period < 1666 || pll_period > 2857) |
244 | continue; | 244 | continue; |