diff options
author | Marcin Slusarz <marcin.slusarz@gmail.com> | 2008-10-16 01:03:50 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-10-16 14:21:45 -0400 |
commit | 5ab4840968cd094586f65fce978e35c66d25ac78 (patch) | |
tree | 97505fbfc59bb53771602dc7a733afd884886b58 /drivers/video/console | |
parent | c38182a713df5268d8a4a33819a77f93b950f84c (diff) |
vgacon: vgacon_scrolldelta simplification
There's no point in checking diff == c->vc_rows, because it can be true
only when count == 0, but we already checked that. Additionally move
variables used only in one block to this block.
Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Cc: Antonino Daplas <adaplas@gmail.com>
Acked-by: Krzysztof Helt <krzysztof.h1@wp.pl>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/video/console')
-rw-r--r-- | drivers/video/console/vgacon.c | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/drivers/video/console/vgacon.c b/drivers/video/console/vgacon.c index 3556268fe0a0..448d209a0bf2 100644 --- a/drivers/video/console/vgacon.c +++ b/drivers/video/console/vgacon.c | |||
@@ -239,8 +239,7 @@ static void vgacon_restore_screen(struct vc_data *c) | |||
239 | 239 | ||
240 | static int vgacon_scrolldelta(struct vc_data *c, int lines) | 240 | static int vgacon_scrolldelta(struct vc_data *c, int lines) |
241 | { | 241 | { |
242 | int start, end, count, soff, diff; | 242 | int start, end, count, soff; |
243 | void *d, *s; | ||
244 | 243 | ||
245 | if (!lines) { | 244 | if (!lines) { |
246 | c->vc_visible_origin = c->vc_origin; | 245 | c->vc_visible_origin = c->vc_origin; |
@@ -287,13 +286,13 @@ static int vgacon_scrolldelta(struct vc_data *c, int lines) | |||
287 | if (count > c->vc_rows) | 286 | if (count > c->vc_rows) |
288 | count = c->vc_rows; | 287 | count = c->vc_rows; |
289 | 288 | ||
290 | diff = c->vc_rows - count; | ||
291 | |||
292 | d = (void *) c->vc_origin; | ||
293 | s = (void *) c->vc_screenbuf; | ||
294 | |||
295 | if (count) { | 289 | if (count) { |
296 | int copysize; | 290 | int copysize; |
291 | |||
292 | int diff = c->vc_rows - count; | ||
293 | void *d = (void *) c->vc_origin; | ||
294 | void *s = (void *) c->vc_screenbuf; | ||
295 | |||
297 | count *= c->vc_size_row; | 296 | count *= c->vc_size_row; |
298 | /* how much memory to end of buffer left? */ | 297 | /* how much memory to end of buffer left? */ |
299 | copysize = min(count, vgacon_scrollback_size - soff); | 298 | copysize = min(count, vgacon_scrollback_size - soff); |
@@ -305,14 +304,11 @@ static int vgacon_scrolldelta(struct vc_data *c, int lines) | |||
305 | scr_memcpyw(d, vgacon_scrollback, count); | 304 | scr_memcpyw(d, vgacon_scrollback, count); |
306 | d += count; | 305 | d += count; |
307 | } | 306 | } |
308 | } | ||
309 | 307 | ||
310 | if (diff == c->vc_rows) { | ||
311 | vgacon_cursor(c, CM_MOVE); | ||
312 | } else { | ||
313 | if (diff) | 308 | if (diff) |
314 | scr_memcpyw(d, s, diff * c->vc_size_row); | 309 | scr_memcpyw(d, s, diff * c->vc_size_row); |
315 | } | 310 | } else |
311 | vgacon_cursor(c, CM_MOVE); | ||
316 | 312 | ||
317 | return 1; | 313 | return 1; |
318 | } | 314 | } |