fbdev: use DIV_ROUND_UP or roundup
authorJulia Lawall <julia@diku.dk>
Mon, 28 Apr 2008 09:14:51 +0000 (02:14 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Mon, 28 Apr 2008 15:58:35 +0000 (08:58 -0700)
commit416e74ea7813597b586eafc24f67779eeb86e12f
treeddb2312349310de0e7a045c6d81bf79d72ed2d0c
parent7f29b87a7779505288a31df16ba84a85fc1ae93c
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>
drivers/video/atafb.c
drivers/video/cirrusfb.c
drivers/video/console/fbcon.c
drivers/video/gxt4500.c