consoles small cleanups
Subsystems (6)
Jiri Slaby (SUSE)
maintainerPATCH 1/7 vgacon: switch vgacon_scrolldelta() and vgacon_restore_screen()
In reply to Jiri Slaby (SUSE)Switch vgacon_scrolldelta() and vgacon_restore_screen() positions, so that the former is not needed to be forward-declared.
--- drivers/video/console/vgacon.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/video/console/vgacon.c +6 -6
@@ -142,12 +142,6 @@ static inline void vga_set_mem_top(struct vc_data *c)write_vga (12 , (c->vc_visible_origin - vga_vram_base) /2 ); } -static void vgacon_restore_screen (struct vc_data *c) -{ -if (c->vc_origin != c->vc_visible_origin) -vgacon_scrolldelta (c,0 ); -} -static void vgacon_scrolldelta (struct vc_data *c,int lines) { vc_scrolldelta_helper(c, lines, vga_rolled_over, (void *)vga_vram_base,
@@ -155,6 +149,12 @@ static void vgacon_scrolldelta(struct vc_data *c, int lines)vga_set_mem_top (c); } +static void vgacon_restore_screen (struct vc_data *c) +{ +if (c->vc_origin != c->vc_visible_origin) +vgacon_scrolldelta (c,0 ); +} +static const char *vgacon_startup (void ) {const char *display_desc =NULL ;
Signature · 1 line
2.41.0
Jiri Slaby (SUSE)
maintainerPATCH 2/7 vgacon: remove unneeded forward declarations
In reply to Jiri Slaby (SUSE)Most of the forward declarations in vgacon are not needed. Drop them.
--- drivers/video/console/vgacon.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-)
drivers/video/console/vgacon.c +1 -9
@@ -65,16 +65,8 @@ static struct vgastate vgastate;* Interface used by the world */ -static const char *vgacon_startup (void ); -static void vgacon_init (struct vc_data *c,int init); -static void vgacon_deinit (struct vc_data *c); -static void vgacon_cursor (struct vc_data *c,int mode); -static int vgacon_switch (struct vc_data *c); -static int vgacon_blank (struct vc_data *c,int blank,int mode_switch); -static void vgacon_scrolldelta (struct vc_data *c,int lines);static int vgacon_set_origin (struct vc_data *c); -static void vgacon_save_screen (struct vc_data *c); -static void vgacon_invert_region (struct vc_data *c,u16 * p,int count); +static struct uni_pagedict *vgacon_uni_pagedir;static int vgacon_refcount;
Signature · 1 line
2.41.0
Jiri Slaby (SUSE)
maintainerPATCH 4/7 vgacon: let vgacon_doresize() return void
In reply to Jiri Slaby (SUSE)The return value is neither used, nor vgacon_doresize() returns an error. So change the reurn type to void.
--- drivers/video/console/vgacon.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/video/console/vgacon.c +1 -2
@@ -528,7 +528,7 @@ static void vgacon_cursor(struct vc_data *c, int mode) } } -static int vgacon_doresize (struct vc_data *c, +static void vgacon_doresize (struct vc_data *c,unsigned int width,unsigned int height) {unsigned long flags;
@@ -587,7 +587,6 @@ static int vgacon_doresize(struct vc_data *c, }raw_spin_unlock_irqrestore (&vga_lock, flags); -return 0 ; }static int vgacon_switch (struct vc_data *c)
Signature · 1 line
2.41.0
Jiri Slaby (SUSE)
maintainerPATCH 3/7 vgacon: remove unused xpos from vgacon_set_cursor_size()
In reply to Jiri Slaby (SUSE)xpos is unused, remove it.
--- drivers/video/console/vgacon.c | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-)
drivers/video/console/vgacon.c +10 -15
@@ -437,7 +437,7 @@ static void vgacon_invert_region(struct vc_data *c, u16 * p, int count) } } -static void vgacon_set_cursor_size (int xpos,int from,int to) +static void vgacon_set_cursor_size (int from,int to) {unsigned long flags;int curs, cure;
@@ -479,9 +479,9 @@ static void vgacon_cursor(struct vc_data *c, int mode)case CM_ERASE :write_vga (14 , (c->vc_pos - vga_vram_base) /2 );if (vga_video_type >=VIDEO_TYPE_VGAC ) -vgacon_set_cursor_size (c->state.x,31 ,30 ); +vgacon_set_cursor_size (31 ,30 );else -vgacon_set_cursor_size (c->state.x,31 ,31 ); +vgacon_set_cursor_size (31 ,31 );break ;case CM_MOVE :
@@ -489,8 +489,7 @@ static void vgacon_cursor(struct vc_data *c, int mode)write_vga (14 , (c->vc_pos - vga_vram_base) /2 );switch (CUR_SIZE (c->vc_cursor_type)) {case CUR_UNDERLINE : - vgacon_set_cursor_size(c->state.x, - c->vc_cell_height - + vgacon_set_cursor_size(c->vc_cell_height - (c->vc_cell_height < 10 ? 2 : 3), c->vc_cell_height -
@@ -498,35 +497,31 @@ static void vgacon_cursor(struct vc_data *c, int mode) 10 ? 1 : 2));break ;case CUR_TWO_THIRDS : -vgacon_set_cursor_size (c->state.x, - c->vc_cell_height /3 , +vgacon_set_cursor_size (c->vc_cell_height /3 , c->vc_cell_height - (c->vc_cell_height <10 ?1 :2 ));break ;case CUR_LOWER_THIRD : -vgacon_set_cursor_size (c->state.x, - (c->vc_cell_height *2 ) /3 , +vgacon_set_cursor_size ((c->vc_cell_height *2 ) /3 , c->vc_cell_height - (c->vc_cell_height <10 ?1 :2 ));break ;case CUR_LOWER_HALF : -vgacon_set_cursor_size (c->state.x, - c->vc_cell_height /2 , +vgacon_set_cursor_size (c->vc_cell_height /2 , c->vc_cell_height - (c->vc_cell_height <10 ?1 :2 ));break ;case CUR_NONE :if (vga_video_type >=VIDEO_TYPE_VGAC ) -vgacon_set_cursor_size (c->state.x,31 ,30 ); +vgacon_set_cursor_size (31 ,30 );else -vgacon_set_cursor_size (c->state.x,31 ,31 ); +vgacon_set_cursor_size (31 ,31 );break ;default : -vgacon_set_cursor_size (c->state.x,1 , - c->vc_cell_height); +vgacon_set_cursor_size (1 , c->vc_cell_height);break ; }break ;
Signature · 1 line
2.41.0
Jiri Slaby (SUSE)
maintainerPATCH 6/7 sticon: make sticon_set_def_font() void and remove op parameter
In reply to Jiri Slaby (SUSE)sticon_set_def_font() always returns 0, so make it void. And remove an unused 'op' parameter.
--- drivers/video/console/sticon.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/video/console/sticon.c +6 -6
@@ -156,7 +156,7 @@ static bool sticon_scroll(struct vc_data *conp, unsigned int t,return false; } -static int sticon_set_def_font (int unit,struct console_font *op) +static void sticon_set_def_font (int unit) {if (font_data[unit] !=STI_DEF_FONT ) {if (--FNTREFCOUNT (font_data[unit]) ==0 ) {
@@ -165,8 +165,6 @@ static int sticon_set_def_font(int unit, struct console_font *op) } font_data[unit] =STI_DEF_FONT ; } - -return 0 ; } static int sticon_set_font(struct vc_data *vc, struct console_font *op,
@@ -246,7 +244,7 @@ static int sticon_set_font(struct vc_data *vc, struct console_font *op, vc->vc_video_erase_char, font_data[vc->vc_num]);/* delete old font in case it is a user font */ -sticon_set_def_font (unit,NULL ); +sticon_set_def_font (unit);FNTREFCOUNT (cooked_font)++; font_data[unit] = cooked_font;
@@ -264,7 +262,9 @@ static int sticon_set_font(struct vc_data *vc, struct console_font *op,static int sticon_font_default (struct vc_data *vc,struct console_font *op,char *name) { -return sticon_set_def_font (vc->vc_num, op); +sticon_set_def_font (vc->vc_num); + +return 0 ; } static int sticon_font_set(struct vc_data *vc, struct console_font *font,
@@ -297,7 +297,7 @@ static void sticon_deinit(struct vc_data *c)/* free memory used by user font */ for (i =0 ; i <MAX_NR_CONSOLES ; i++) -sticon_set_def_font (i,NULL ); +sticon_set_def_font (i); } static void sticon_clear(struct vc_data *conp, int sy, int sx, int height,
Signature · 1 line
2.41.0
Jiri Slaby (SUSE)
maintainerPATCH 5/7 vgacon: cache vc_cell_height in vgacon_cursor()
In reply to Jiri Slaby (SUSE)There are many places c->vc_cell_height is used in the code of vgacon_cursor(). Caching the value to a local variable makes the code much easier to follow.
--- drivers/video/console/vgacon.c | 34 +++++++++++++++------------------- 1 file changed, 15 insertions(+), 19 deletions(-)
drivers/video/console/vgacon.c +15 -19
@@ -470,11 +470,15 @@ static void vgacon_set_cursor_size(int from, int to)static void vgacon_cursor (struct vc_data *c,int mode) { +unsigned int c_height; +if (c->vc_mode !=KD_TEXT )return ;vgacon_restore_screen (c); + c_height = c->vc_cell_height; +switch (mode) {case CM_ERASE :write_vga (14 , (c->vc_pos - vga_vram_base) /2 );
@@ -489,30 +493,22 @@ static void vgacon_cursor(struct vc_data *c, int mode)write_vga (14 , (c->vc_pos - vga_vram_base) /2 );switch (CUR_SIZE (c->vc_cursor_type)) {case CUR_UNDERLINE : -vgacon_set_cursor_size (c->vc_cell_height - - (c->vc_cell_height < -10 ?2 :3 ), - c->vc_cell_height - - (c->vc_cell_height < -10 ?1 :2 )); +vgacon_set_cursor_size (c_height - + (c_height <10 ?2 :3 ), + c_height - + (c_height <10 ?1 :2 ));break ;case CUR_TWO_THIRDS : -vgacon_set_cursor_size (c->vc_cell_height /3 , - c->vc_cell_height - - (c->vc_cell_height < -10 ?1 :2 )); +vgacon_set_cursor_size (c_height /3 , c_height - + (c_height <10 ?1 :2 ));break ;case CUR_LOWER_THIRD : -vgacon_set_cursor_size ((c->vc_cell_height *2 ) /3 , - c->vc_cell_height - - (c->vc_cell_height < -10 ?1 :2 )); +vgacon_set_cursor_size (c_height *2 /3 , c_height - + (c_height <10 ?1 :2 ));break ;case CUR_LOWER_HALF : -vgacon_set_cursor_size (c->vc_cell_height /2 , - c->vc_cell_height - - (c->vc_cell_height < -10 ?1 :2 )); +vgacon_set_cursor_size (c_height /2 , c_height - + (c_height <10 ?1 :2 ));break ;case CUR_NONE :if (vga_video_type >=VIDEO_TYPE_VGAC )
@@ -521,7 +517,7 @@ static void vgacon_cursor(struct vc_data *c, int mode)vgacon_set_cursor_size (31 ,31 );break ;default : -vgacon_set_cursor_size (1 , c->vc_cell_height); +vgacon_set_cursor_size (1 , c_height);break ; }break ;
Signature · 1 line
2.41.0
Jiri Slaby (SUSE)
maintainerPATCH 7/7 fbcon: remove unused display (p) from fbcon_redraw()
In reply to Jiri Slaby (SUSE)The parameter is unused.
--- drivers/video/fbdev/core/fbcon.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/video/fbdev/core/fbcon.c +3 -4
@@ -1612,8 +1612,7 @@ static void fbcon_redraw_blit(struct vc_data *vc, struct fb_info *info, } } -static void fbcon_redraw (struct vc_data *vc,struct fbcon_display *p, -int line,int count,int offset) +static void fbcon_redraw (struct vc_data *vc,int line,int count,int offset) {unsigned short *d = (unsigned short *) (vc->vc_origin + vc->vc_size_row * line);
@@ -1827,7 +1826,7 @@ static bool fbcon_scroll(struct vc_data *vc, unsigned int t, unsigned int b,case SCROLL_REDRAW : redraw_up: -fbcon_redraw (vc, p, t, b - t - count, +fbcon_redraw (vc, t, b - t - count, count * vc->vc_cols);fbcon_clear (vc, b - count,0 , count, vc->vc_cols); scr_memsetw((unsigned short *) (vc->vc_origin +
@@ -1913,7 +1912,7 @@ static bool fbcon_scroll(struct vc_data *vc, unsigned int t, unsigned int b,case SCROLL_REDRAW : redraw_down: -fbcon_redraw (vc, p, b -1 , b - t - count, +fbcon_redraw (vc, b -1 , b - t - count, -count * vc->vc_cols);fbcon_clear (vc, t,0 , count, vc->vc_cols); scr_memsetw((unsigned short *) (vc->vc_origin +
Signature · 1 line
2.41.0
Jiri Slaby (SUSE)
maintainercover consoles small cleanups
This is a series to do some small cleanups, especially in vgacon.
Jiri Slaby (SUSE) (7):
vgacon: switch vgacon_scrolldelta() and vgacon_restore_screen()
vgacon: remove unneeded forward declarations
vgacon: remove unused xpos from vgacon_set_cursor_size()
vgacon: let vgacon_doresize() return void
vgacon: cache vc_cell_height in vgacon_cursor()
sticon: make sticon_set_def_font() void and remove op parameter
fbcon: remove unused display (p) from fbcon_redraw()
drivers/video/console/sticon.c | 12 +++--- drivers/video/console/vgacon.c | 74 ++++++++++++-------------------- drivers/video/fbdev/core/fbcon.c | 7 ++- 3 files changed, 37 insertions(+), 56 deletions(-)
Signature · 1 line
2.41.0
Helge Deller
maintainerRe: [PATCH 1/7] vgacon: switch vgacon_scrolldelta() and vgacon_restore_screen()
In reply to Jiri Slaby (SUSE)Quoted 7 lines · Jiri Slaby (SUSE)
Switch
vgacon_scrolldelta()andvgacon_restore_screen()positions, so that the former is not needed to be forward-declared.Signed-off-by Jiri Slaby (SUSE) <[email protected]>Cc Helge Deller <[email protected]>
Thanks Jiri !
I've applied this series to the fbdev git tree.
Helge
Quoted 34 lines
--- drivers/video/console/vgacon.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)drivers/video/console/vgacon.c +6
-6@@ -142,12 +142,6 @@ static inline void vga_set_mem_top(struct vc_data *c)write_vga (12 , (c->vc_visible_origin - vga_vram_base) /2 ); } -static void vgacon_restore_screen (struct vc_data *c) -{ -if (c->vc_origin != c->vc_visible_origin) -vgacon_scrolldelta (c,0 ); -} -static void vgacon_scrolldelta (struct vc_data *c,int lines) { vc_scrolldelta_helper(c, lines, vga_rolled_over, (void *)vga_vram_base,@@ -155,6 +149,12 @@ static void vgacon_scrolldelta(struct vc_data *c, int lines)vga_set_mem_top (c); } +static void vgacon_restore_screen (struct vc_data *c) +{ +if (c->vc_origin != c->vc_visible_origin) +vgacon_scrolldelta (c,0 ); +} +static const char *vgacon_startup (void ) {const char *display_desc =NULL ;