Commit 210fd746 authored by Jiri Slaby's avatar Jiri Slaby Committed by Greg Kroah-Hartman

tty: vt, compute vc offsets in advance

Only improves readability, no functional changes.
Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 35cc56f9
...@@ -4283,6 +4283,9 @@ void vc_scrolldelta_helper(struct vc_data *c, int lines, ...@@ -4283,6 +4283,9 @@ void vc_scrolldelta_helper(struct vc_data *c, int lines,
unsigned int rolled_over, void *base, unsigned int size) unsigned int rolled_over, void *base, unsigned int size)
{ {
unsigned long ubase = (unsigned long)base; unsigned long ubase = (unsigned long)base;
ptrdiff_t scr_end = (void *)c->vc_scr_end - base;
ptrdiff_t vorigin = (void *)c->vc_visible_origin - base;
ptrdiff_t origin = (void *)c->vc_origin - base;
int margin = c->vc_size_row * 4; int margin = c->vc_size_row * 4;
int ul, we, p, st; int ul, we, p, st;
...@@ -4293,17 +4296,16 @@ void vc_scrolldelta_helper(struct vc_data *c, int lines, ...@@ -4293,17 +4296,16 @@ void vc_scrolldelta_helper(struct vc_data *c, int lines,
} }
/* Do we have already enough to allow jumping from 0 to the end? */ /* Do we have already enough to allow jumping from 0 to the end? */
if (rolled_over > (c->vc_scr_end - ubase) + margin) { if (rolled_over > scr_end + margin) {
ul = c->vc_scr_end - ubase; ul = scr_end;
we = rolled_over + c->vc_size_row; we = rolled_over + c->vc_size_row;
} else { } else {
ul = 0; ul = 0;
we = size; we = size;
} }
p = (c->vc_visible_origin - ubase - ul + we) % we + p = (vorigin - ul + we) % we + lines * c->vc_size_row;
lines * c->vc_size_row; st = (origin - ul + we) % we;
st = (c->vc_origin - ubase - ul + we) % we;
/* Only a little piece would be left? Show all incl. the piece! */ /* Only a little piece would be left? Show all incl. the piece! */
if (st < 2 * margin) if (st < 2 * margin)
......
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