aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video
diff options
context:
space:
mode:
authorJulia Lawall <julia@diku.dk>2008-04-28 05:14:51 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-04-28 11:58:35 -0400
commit416e74ea7813597b586eafc24f67779eeb86e12f (patch)
treeddb2312349310de0e7a045c6d81bf79d72ed2d0c /drivers/video
parent7f29b87a7779505288a31df16ba84a85fc1ae93c (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')
-rw-r--r--drivers/video/atafb.c2
-rw-r--r--drivers/video/cirrusfb.c2
-rw-r--r--drivers/video/console/fbcon.c3
-rw-r--r--drivers/video/gxt4500.c2
4 files changed, 4 insertions, 5 deletions
diff --git a/drivers/video/atafb.c b/drivers/video/atafb.c
index 5d4fbaa53a6c..dff35474b854 100644
--- a/drivers/video/atafb.c
+++ b/drivers/video/atafb.c
@@ -1270,7 +1270,7 @@ again:
1270 1270
1271 gstart = (prescale / 2 + plen * left_margin) / prescale; 1271 gstart = (prescale / 2 + plen * left_margin) / prescale;
1272 /* gend1 is for hde (gend-gstart multiple of align), shifter's xres */ 1272 /* gend1 is for hde (gend-gstart multiple of align), shifter's xres */
1273 gend1 = gstart + ((xres + align - 1) / align) * align * plen / prescale; 1273 gend1 = gstart + roundup(xres, align) * plen / prescale;
1274 /* gend2 is for hbb, visible xres (rest to gend1 is cut off by hblank) */ 1274 /* gend2 is for hbb, visible xres (rest to gend1 is cut off by hblank) */
1275 gend2 = gstart + xres * plen / prescale; 1275 gend2 = gstart + xres * plen / prescale;
1276 par->HHT = plen * (left_margin + xres + right_margin) / 1276 par->HHT = plen * (left_margin + xres + right_margin) /
diff --git a/drivers/video/cirrusfb.c b/drivers/video/cirrusfb.c
index f7e2d5add831..ccfbdc5a40db 100644
--- a/drivers/video/cirrusfb.c
+++ b/drivers/video/cirrusfb.c
@@ -3117,7 +3117,7 @@ static void bestclock(long freq, long *best, long *nom,
3117 } 3117 }
3118 } 3118 }
3119 } 3119 }
3120 d = ((143181 * n) + f - 1) / f; 3120 d = DIV_ROUND_UP(143181 * n, f);
3121 if ((d >= 7) && (d <= 63)) { 3121 if ((d >= 7) && (d <= 63)) {
3122 if (d > 31) 3122 if (d > 31)
3123 d = (d / 2) * 2; 3123 d = (d / 2) * 2;
diff --git a/drivers/video/console/fbcon.c b/drivers/video/console/fbcon.c
index 022282494d3f..025d4f5e1f6f 100644
--- a/drivers/video/console/fbcon.c
+++ b/drivers/video/console/fbcon.c
@@ -620,8 +620,7 @@ static void fbcon_prepare_logo(struct vc_data *vc, struct fb_info *info,
620 if (fb_get_color_depth(&info->var, &info->fix) == 1) 620 if (fb_get_color_depth(&info->var, &info->fix) == 1)
621 erase &= ~0x400; 621 erase &= ~0x400;
622 logo_height = fb_prepare_logo(info, ops->rotate); 622 logo_height = fb_prepare_logo(info, ops->rotate);
623 logo_lines = (logo_height + vc->vc_font.height - 1) / 623 logo_lines = DIV_ROUND_UP(logo_height, vc->vc_font.height);
624 vc->vc_font.height;
625 q = (unsigned short *) (vc->vc_origin + 624 q = (unsigned short *) (vc->vc_origin +
626 vc->vc_size_row * rows); 625 vc->vc_size_row * rows);
627 step = logo_lines * cols; 626 step = logo_lines * cols;
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;