mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 03:01:39 -04:00
tty: vgacon+sisusb, move scrolldelta to a common helper
The code is mirrorred in scrolldelta implementations of both vgacon and sisusb. Let's move the code to a separate helper where we will perform a common cleanup and further changes. While we are moving the code, make it linear and save one indentation level. This is done by returning from the "!lines" then-branch immediatelly. This allows flushing the else-branch 1 level to the left, obviously. Few more new lines and comments were added too. And do not forget to export the helper function given sisusb can be built as module. Signed-off-by: Jiri Slaby <[email protected]> Cc: Thomas Winischhofer <[email protected]> Cc: Tomi Valkeinen <[email protected]> Cc: <[email protected]> Cc: <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
This commit is contained in:
parent
89765b9424
commit
35cc56f9a3
4 changed files with 44 additions and 60 deletions
|
|
@ -332,31 +332,8 @@ static void vgacon_restore_screen(struct vc_data *c)
|
|||
|
||||
static void vgacon_scrolldelta(struct vc_data *c, int lines)
|
||||
{
|
||||
if (!lines) /* Turn scrollback off */
|
||||
c->vc_visible_origin = c->vc_origin;
|
||||
else {
|
||||
int margin = c->vc_size_row * 4;
|
||||
int ul, we, p, st;
|
||||
|
||||
if (vga_rolled_over >
|
||||
(c->vc_scr_end - vga_vram_base) + margin) {
|
||||
ul = c->vc_scr_end - vga_vram_base;
|
||||
we = vga_rolled_over + c->vc_size_row;
|
||||
} else {
|
||||
ul = 0;
|
||||
we = vga_vram_size;
|
||||
}
|
||||
p = (c->vc_visible_origin - vga_vram_base - ul + we) % we +
|
||||
lines * c->vc_size_row;
|
||||
st = (c->vc_origin - vga_vram_base - ul + we) % we;
|
||||
if (st < 2 * margin)
|
||||
margin = 0;
|
||||
if (p < margin)
|
||||
p = 0;
|
||||
if (p > st - margin)
|
||||
p = st;
|
||||
c->vc_visible_origin = vga_vram_base + (p + ul) % we;
|
||||
}
|
||||
vc_scrolldelta_helper(c, lines, vga_rolled_over, (void *)vga_vram_base,
|
||||
vga_vram_size);
|
||||
vga_set_mem_top(c);
|
||||
}
|
||||
#endif /* CONFIG_VGACON_SOFT_SCROLLBACK */
|
||||
|
|
|
|||
Loading…
Reference in a new issue