diff options
author | Jiri Slaby <jslaby@suse.cz> | 2016-10-03 11:18:36 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2016-10-27 16:37:44 +0200 |
commit | 210fd7460e755c6de4972bca4ffa9cd9580279aa (patch) | |
tree | f587d672591dfacf641957c9efd7ca8c3174a668 | |
parent | 35cc56f9a30480c8a0cca809cf341614a2144758 (diff) | |
download | linux-210fd7460e755c6de4972bca4ffa9cd9580279aa.tar.gz linux-210fd7460e755c6de4972bca4ffa9cd9580279aa.tar.bz2 linux-210fd7460e755c6de4972bca4ffa9cd9580279aa.zip |
tty: vt, compute vc offsets in advance
Only improves readability, no functional changes.
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/tty/vt/vt.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c index 2eab714aab67..3cb6504b41d3 100644 --- a/drivers/tty/vt/vt.c +++ b/drivers/tty/vt/vt.c @@ -4283,6 +4283,9 @@ void vc_scrolldelta_helper(struct vc_data *c, int lines, unsigned int rolled_over, void *base, unsigned int size) { 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 ul, we, p, st; @@ -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? */ - if (rolled_over > (c->vc_scr_end - ubase) + margin) { - ul = c->vc_scr_end - ubase; + if (rolled_over > scr_end + margin) { + ul = scr_end; we = rolled_over + c->vc_size_row; } else { ul = 0; we = size; } - p = (c->vc_visible_origin - ubase - ul + we) % we + - lines * c->vc_size_row; - st = (c->vc_origin - ubase - ul + we) % we; + p = (vorigin - ul + we) % we + lines * c->vc_size_row; + st = (origin - ul + we) % we; /* Only a little piece would be left? Show all incl. the piece! */ if (st < 2 * margin) |