Commit 17465747 authored by Jiri Slaby (SUSE)'s avatar Jiri Slaby (SUSE) Committed by Greg Kroah-Hartman

vgacon: inline vc_scrolldelta_helper() into vgacon_scrolldelta()

Since commit 74d58cd4 ("USB: sisusbvga: remove console support"),
vgacon_scrolldelta() is the only user of vc_scrolldelta_helper().

Inline the helper into vgacon_scrolldelta() and drop it.
Signed-off-by: default avatar"Jiri Slaby (SUSE)" <jirislaby@kernel.org>
Cc: Helge Deller <deller@gmx.de>
Cc: linux-fbdev@vger.kernel.org
Cc: dri-devel@lists.freedesktop.org
Tested-by: Helge Deller <deller@gmx.de> # parisc STI console
Link: https://lore.kernel.org/r/20240122110401.7289-2-jirislaby@kernel.orgSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 6613476e
......@@ -4748,43 +4748,3 @@ void vcs_scr_updated(struct vc_data *vc)
{
notify_update(vc);
}
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 from, wrap, from_off, avail;
/* Turn scrollback off */
if (!lines) {
c->vc_visible_origin = c->vc_origin;
return;
}
/* Do we have already enough to allow jumping from 0 to the end? */
if (rolled_over > scr_end + margin) {
from = scr_end;
wrap = rolled_over + c->vc_size_row;
} else {
from = 0;
wrap = size;
}
from_off = (vorigin - from + wrap) % wrap + lines * c->vc_size_row;
avail = (origin - from + wrap) % wrap;
/* Only a little piece would be left? Show all incl. the piece! */
if (avail < 2 * margin)
margin = 0;
if (from_off < margin)
from_off = 0;
if (from_off > avail - margin)
from_off = avail;
c->vc_visible_origin = ubase + (from + from_off) % wrap;
}
EXPORT_SYMBOL_GPL(vc_scrolldelta_helper);
......@@ -138,8 +138,40 @@ static inline void vga_set_mem_top(struct vc_data *c)
static void vgacon_scrolldelta(struct vc_data *c, int lines)
{
vc_scrolldelta_helper(c, lines, vga_rolled_over, (void *)vga_vram_base,
vga_vram_size);
unsigned long scr_end = c->vc_scr_end - vga_vram_base;
unsigned long vorigin = c->vc_visible_origin - vga_vram_base;
unsigned long origin = c->vc_origin - vga_vram_base;
int margin = c->vc_size_row * 4;
int from, wrap, from_off, avail;
/* Turn scrollback off */
if (!lines) {
c->vc_visible_origin = c->vc_origin;
return;
}
/* Do we have already enough to allow jumping from 0 to the end? */
if (vga_rolled_over > scr_end + margin) {
from = scr_end;
wrap = vga_rolled_over + c->vc_size_row;
} else {
from = 0;
wrap = vga_vram_size;
}
from_off = (vorigin - from + wrap) % wrap + lines * c->vc_size_row;
avail = (origin - from + wrap) % wrap;
/* Only a little piece would be left? Show all incl. the piece! */
if (avail < 2 * margin)
margin = 0;
if (from_off < margin)
from_off = 0;
if (from_off > avail - margin)
from_off = avail;
c->vc_visible_origin = vga_vram_base + (from + from_off) % wrap;
vga_set_mem_top(c);
}
......
......@@ -168,7 +168,4 @@ void vt_set_led_state(unsigned int console, int leds);
void vt_kbd_con_start(unsigned int console);
void vt_kbd_con_stop(unsigned int console);
void vc_scrolldelta_helper(struct vc_data *c, int lines,
unsigned int rolled_over, void *_base, unsigned int size);
#endif /* _VT_KERN_H */
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