aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJiri Slaby <jirislaby@gmail.com>2009-09-22 19:47:41 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-09-23 10:39:56 -0400
commit9a4a83d2ed83da0c4b45289ca72f10205aa96589 (patch)
treef2e501093b84f26e01af2a2014a49c6de98038b3
parent99e9e7d62becd6c7413a9e8fbda7f5b66adb5cbf (diff)
video: console, use DIV_ROUND_UP
Use DIV_ROUND_UP explicitly instead of manual shifts and adds. It makes the code more readable and consistent (sometimes there were shifts, sometimes divs). There is no change on the assembly level (compilers should do the right job). Signed-off-by: Jiri Slaby <jirislaby@gmail.com> Cc: Sergey Senozhatsky <sergey.senozhatsky@gmail.com> Cc: Andi Kleen <andi@firstfloor.org> Cc: Krzysztof Helt <krzysztof.h1@poczta.fm> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--drivers/video/console/bitblit.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/video/console/bitblit.c b/drivers/video/console/bitblit.c
index 69864b1b3f9e..6b7c8fbc5495 100644
--- a/drivers/video/console/bitblit.c
+++ b/drivers/video/console/bitblit.c
@@ -25,7 +25,7 @@ static inline void update_attr(u8 *dst, u8 *src, int attribute,
25 struct vc_data *vc) 25 struct vc_data *vc)
26{ 26{
27 int i, offset = (vc->vc_font.height < 10) ? 1 : 2; 27 int i, offset = (vc->vc_font.height < 10) ? 1 : 2;
28 int width = (vc->vc_font.width + 7) >> 3; 28 int width = DIV_ROUND_UP(vc->vc_font.width, 8);
29 unsigned int cellsize = vc->vc_font.height * width; 29 unsigned int cellsize = vc->vc_font.height * width;
30 u8 c; 30 u8 c;
31 31
@@ -144,7 +144,7 @@ static void bit_putcs(struct vc_data *vc, struct fb_info *info,
144 int fg, int bg) 144 int fg, int bg)
145{ 145{
146 struct fb_image image; 146 struct fb_image image;
147 u32 width = (vc->vc_font.width + 7)/8; 147 u32 width = DIV_ROUND_UP(vc->vc_font.width, 8);
148 u32 cellsize = width * vc->vc_font.height; 148 u32 cellsize = width * vc->vc_font.height;
149 u32 maxcnt = info->pixmap.size/cellsize; 149 u32 maxcnt = info->pixmap.size/cellsize;
150 u32 scan_align = info->pixmap.scan_align - 1; 150 u32 scan_align = info->pixmap.scan_align - 1;
@@ -173,7 +173,7 @@ static void bit_putcs(struct vc_data *vc, struct fb_info *info,
173 cnt = count; 173 cnt = count;
174 174
175 image.width = vc->vc_font.width * cnt; 175 image.width = vc->vc_font.width * cnt;
176 pitch = ((image.width + 7) >> 3) + scan_align; 176 pitch = DIV_ROUND_UP(image.width, 8) + scan_align;
177 pitch &= ~scan_align; 177 pitch &= ~scan_align;
178 size = pitch * image.height + buf_align; 178 size = pitch * image.height + buf_align;
179 size &= ~buf_align; 179 size &= ~buf_align;
@@ -239,7 +239,7 @@ static void bit_cursor(struct vc_data *vc, struct fb_info *info, int mode,
239 struct fb_cursor cursor; 239 struct fb_cursor cursor;
240 struct fbcon_ops *ops = info->fbcon_par; 240 struct fbcon_ops *ops = info->fbcon_par;
241 unsigned short charmask = vc->vc_hi_font_mask ? 0x1ff : 0xff; 241 unsigned short charmask = vc->vc_hi_font_mask ? 0x1ff : 0xff;
242 int w = (vc->vc_font.width + 7) >> 3, c; 242 int w = DIV_ROUND_UP(vc->vc_font.width, 8), c;
243 int y = real_y(ops->p, vc->vc_y); 243 int y = real_y(ops->p, vc->vc_y);
244 int attribute, use_sw = (vc->vc_cursor_type & 0x10); 244 int attribute, use_sw = (vc->vc_cursor_type & 0x10);
245 int err = 1; 245 int err = 1;