aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/tty
diff options
context:
space:
mode:
authorJiri Slaby <jslaby@suse.cz>2016-10-03 05:18:36 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2016-10-27 10:37:44 -0400
commit210fd7460e755c6de4972bca4ffa9cd9580279aa (patch)
treef587d672591dfacf641957c9efd7ca8c3174a668 /drivers/tty
parent35cc56f9a30480c8a0cca809cf341614a2144758 (diff)
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>
Diffstat (limited to 'drivers/tty')
-rw-r--r--drivers/tty/vt/vt.c12
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,
4283 unsigned int rolled_over, void *base, unsigned int size) 4283 unsigned int rolled_over, void *base, unsigned int size)
4284{ 4284{
4285 unsigned long ubase = (unsigned long)base; 4285 unsigned long ubase = (unsigned long)base;
4286 ptrdiff_t scr_end = (void *)c->vc_scr_end - base;
4287 ptrdiff_t vorigin = (void *)c->vc_visible_origin - base;
4288 ptrdiff_t origin = (void *)c->vc_origin - base;
4286 int margin = c->vc_size_row * 4; 4289 int margin = c->vc_size_row * 4;
4287 int ul, we, p, st; 4290 int ul, we, p, st;
4288 4291
@@ -4293,17 +4296,16 @@ void vc_scrolldelta_helper(struct vc_data *c, int lines,
4293 } 4296 }
4294 4297
4295 /* Do we have already enough to allow jumping from 0 to the end? */ 4298 /* Do we have already enough to allow jumping from 0 to the end? */
4296 if (rolled_over > (c->vc_scr_end - ubase) + margin) { 4299 if (rolled_over > scr_end + margin) {
4297 ul = c->vc_scr_end - ubase; 4300 ul = scr_end;
4298 we = rolled_over + c->vc_size_row; 4301 we = rolled_over + c->vc_size_row;
4299 } else { 4302 } else {
4300 ul = 0; 4303 ul = 0;
4301 we = size; 4304 we = size;
4302 } 4305 }
4303 4306
4304 p = (c->vc_visible_origin - ubase - ul + we) % we + 4307 p = (vorigin - ul + we) % we + lines * c->vc_size_row;
4305 lines * c->vc_size_row; 4308 st = (origin - ul + we) % we;
4306 st = (c->vc_origin - ubase - ul + we) % we;
4307 4309
4308 /* Only a little piece would be left? Show all incl. the piece! */ 4310 /* Only a little piece would be left? Show all incl. the piece! */
4309 if (st < 2 * margin) 4311 if (st < 2 * margin)