vgacon: inline vc_scrolldelta_helper() into vgacon_scrolldelta()
authorJiri Slaby (SUSE) <jirislaby@kernel.org>
Mon, 22 Jan 2024 11:03:15 +0000 (12:03 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 28 Jan 2024 02:08:52 +0000 (18:08 -0800)
Since commit 74d58cd48a8f ("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: "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.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/vt/vt.c
drivers/video/console/vgacon.c
include/linux/vt_kern.h

index 156efda7c80d64b3c512d8cc84f228521aefec11..3f3f7c2168193de6e0b60b5458652b65c683bb27 100644 (file)
@@ -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);
index 8ef1579fa57fdda1b079a17247286d0c809018d9..9176fff9ce6e5b2a48eabde3496d0faf8c42585b 100644 (file)
@@ -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);
 }
 
index c1f5aebef1705c15ba03120653d5cfbea104b39c..a789ea3ed2a076257fcd93d96ee9c8f6a77f36e2 100644 (file)
@@ -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 */