Commit 5ab48409 authored by Marcin Slusarz's avatar Marcin Slusarz Committed by Linus Torvalds

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: default avatarMarcin Slusarz <marcin.slusarz@gmail.com>
Cc: Antonino Daplas <adaplas@gmail.com>
Acked-by: default avatarKrzysztof Helt <krzysztof.h1@wp.pl>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent c38182a7
...@@ -239,8 +239,7 @@ static void vgacon_restore_screen(struct vc_data *c) ...@@ -239,8 +239,7 @@ static void vgacon_restore_screen(struct vc_data *c)
static int vgacon_scrolldelta(struct vc_data *c, int lines) static int vgacon_scrolldelta(struct vc_data *c, int lines)
{ {
int start, end, count, soff, diff; int start, end, count, soff;
void *d, *s;
if (!lines) { if (!lines) {
c->vc_visible_origin = c->vc_origin; c->vc_visible_origin = c->vc_origin;
...@@ -287,13 +286,13 @@ static int vgacon_scrolldelta(struct vc_data *c, int lines) ...@@ -287,13 +286,13 @@ static int vgacon_scrolldelta(struct vc_data *c, int lines)
if (count > c->vc_rows) if (count > c->vc_rows)
count = c->vc_rows; count = c->vc_rows;
diff = c->vc_rows - count;
d = (void *) c->vc_origin;
s = (void *) c->vc_screenbuf;
if (count) { if (count) {
int copysize; int copysize;
int diff = c->vc_rows - count;
void *d = (void *) c->vc_origin;
void *s = (void *) c->vc_screenbuf;
count *= c->vc_size_row; count *= c->vc_size_row;
/* how much memory to end of buffer left? */ /* how much memory to end of buffer left? */
copysize = min(count, vgacon_scrollback_size - soff); copysize = min(count, vgacon_scrollback_size - soff);
...@@ -305,14 +304,11 @@ static int vgacon_scrolldelta(struct vc_data *c, int lines) ...@@ -305,14 +304,11 @@ static int vgacon_scrolldelta(struct vc_data *c, int lines)
scr_memcpyw(d, vgacon_scrollback, count); scr_memcpyw(d, vgacon_scrollback, count);
d += count; d += count;
} }
}
if (diff == c->vc_rows) {
vgacon_cursor(c, CM_MOVE);
} else {
if (diff) if (diff)
scr_memcpyw(d, s, diff * c->vc_size_row); scr_memcpyw(d, s, diff * c->vc_size_row);
} } else
vgacon_cursor(c, CM_MOVE);
return 1; return 1;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment