Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

vgacon: switch boolean variables to bool

These variables:
* vga_can_do_color
* vgacon_text_mode_force
* vga_font_is_default
* vga_hardscroll_enabled
* vga_hardscroll_user_enable
* vga_init_done
* vga_is_gfx
* vga_palette_blanked
* vga_512_chars
are used exclusively as a boolean value, so make them really a bool.

Remove also useless "? true : false".

__read_mostly annotations removed too as they obfuscate the code and I
doubt they improve anything measurable given the variables are used
from .con_scroll, .con_startup and such.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Tomi Valkeinen <tomi.valkeinen@ti.com>
Cc: <linux-fbdev@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Jiri Slaby and committed by
Greg Kroah-Hartman
96fd9554 7c918cdc

+23 -22
+23 -22
drivers/video/console/vgacon.c
··· 88 88 static int vgacon_refcount; 89 89 90 90 /* Description of the hardware situation */ 91 - static int vga_init_done __read_mostly; 91 + static bool vga_init_done; 92 92 static unsigned long vga_vram_base __read_mostly; /* Base of video memory */ 93 93 static unsigned long vga_vram_end __read_mostly; /* End of video memory */ 94 94 static unsigned int vga_vram_size __read_mostly; /* Size of video memory */ ··· 96 96 static u16 vga_video_port_val __read_mostly; /* Video register value port */ 97 97 static unsigned int vga_video_num_columns; /* Number of text columns */ 98 98 static unsigned int vga_video_num_lines; /* Number of text lines */ 99 - static int vga_can_do_color __read_mostly; /* Do we support colors? */ 99 + static bool vga_can_do_color; /* Do we support colors? */ 100 100 static unsigned int vga_default_font_height __read_mostly; /* Height of default screen font */ 101 101 static unsigned char vga_video_type __read_mostly; /* Card type */ 102 - static unsigned char vga_hardscroll_enabled __read_mostly; 103 - static unsigned char vga_hardscroll_user_enable __read_mostly = 1; 104 - static unsigned char vga_font_is_default = 1; 102 + static bool vga_font_is_default = true; 105 103 static int vga_vesa_blanked; 106 - static int vga_palette_blanked; 107 - static int vga_is_gfx; 108 - static int vga_512_chars; 104 + static bool vga_palette_blanked; 105 + static bool vga_is_gfx; 106 + static bool vga_512_chars; 109 107 static int vga_video_font_height; 110 108 static int vga_scan_lines __read_mostly; 111 109 static unsigned int vga_rolled_over; 112 110 113 - static int vgacon_text_mode_force; 111 + static bool vgacon_text_mode_force; 112 + static bool vga_hardscroll_enabled; 113 + static bool vga_hardscroll_user_enable = true; 114 114 115 115 bool vgacon_text_force(void) 116 116 { 117 - return vgacon_text_mode_force ? true : false; 117 + return vgacon_text_mode_force; 118 118 } 119 119 EXPORT_SYMBOL(vgacon_text_force); 120 120 121 121 static int __init text_mode(char *str) 122 122 { 123 - vgacon_text_mode_force = 1; 123 + vgacon_text_mode_force = true; 124 124 return 1; 125 125 } 126 126 ··· 134 134 * Braille reader made by F.H. Papenmeier (Germany). 135 135 * Use the "no-scroll" bootflag. 136 136 */ 137 - vga_hardscroll_user_enable = vga_hardscroll_enabled = 0; 137 + vga_hardscroll_user_enable = vga_hardscroll_enabled = false; 138 138 return 1; 139 139 } 140 140 ··· 402 402 } 403 403 } else { 404 404 /* If not, it is color. */ 405 - vga_can_do_color = 1; 405 + vga_can_do_color = true; 406 406 vga_vram_base = 0xb8000; 407 407 vga_video_port_reg = VGA_CRT_IC; 408 408 vga_video_port_val = VGA_CRT_DC; ··· 517 517 518 518 if (!vga_init_done) { 519 519 vgacon_scrollback_startup(); 520 - vga_init_done = 1; 520 + vga_init_done = true; 521 521 } 522 522 523 523 return display_desc; ··· 609 609 610 610 static void vgacon_invert_region(struct vc_data *c, u16 * p, int count) 611 611 { 612 - int col = vga_can_do_color; 612 + const bool col = vga_can_do_color; 613 613 614 614 while (count--) { 615 615 u16 a = scr_readw(p); ··· 981 981 } 982 982 if (vga_palette_blanked) { 983 983 vga_set_palette(c, color_table); 984 - vga_palette_blanked = 0; 984 + vga_palette_blanked = false; 985 985 return 0; 986 986 } 987 - vga_is_gfx = 0; 987 + vga_is_gfx = false; 988 988 /* Tell console.c that it has to restore the screen itself */ 989 989 return 1; 990 990 case 1: /* Normal blanking */ 991 991 case -1: /* Obsolete */ 992 992 if (!mode_switch && vga_video_type == VIDEO_TYPE_VGAC) { 993 993 vga_pal_blank(&vgastate); 994 - vga_palette_blanked = 1; 994 + vga_palette_blanked = true; 995 995 return 0; 996 996 } 997 997 vgacon_set_origin(c); 998 998 scr_memsetw((void *) vga_vram_base, BLANK, 999 999 c->vc_screenbuf_size); 1000 1000 if (mode_switch) 1001 - vga_is_gfx = 1; 1001 + vga_is_gfx = true; 1002 1002 return 1; 1003 1003 default: /* VESA blanking */ 1004 1004 if (vga_video_type == VIDEO_TYPE_VGAC) { ··· 1029 1029 #define blackwmap 0xa0000 1030 1030 #define cmapsz 8192 1031 1031 1032 - static int vgacon_do_font_op(struct vgastate *state,char *arg,int set,int ch512) 1032 + static int vgacon_do_font_op(struct vgastate *state, char *arg, int set, 1033 + bool ch512) 1033 1034 { 1034 1035 unsigned short video_port_status = vga_video_port_reg + 6; 1035 1036 int font_select = 0x00, beg, i; ··· 1056 1055 if (!arg) 1057 1056 return -EINVAL; /* Return to default font not supported */ 1058 1057 1059 - vga_font_is_default = 0; 1058 + vga_font_is_default = false; 1060 1059 font_select = ch512 ? 0x04 : 0x00; 1061 1060 #else 1062 1061 /* ··· 1067 1066 if (set) { 1068 1067 vga_font_is_default = !arg; 1069 1068 if (!arg) 1070 - ch512 = 0; /* Default font is always 256 */ 1069 + ch512 = false; /* Default font is always 256 */ 1071 1070 font_select = arg ? (ch512 ? 0x0e : 0x0a) : 0x00; 1072 1071 } 1073 1072