Skip to content

Commit 8a736dd

Browse files
arndbgregkh
authored andcommitted
vgacon: rework screen_info #ifdef checks
On non-x86 architectures, the screen_info variable is generally only used for the VGA console where supported, and in some cases the EFI framebuffer or vga16fb. Now that we have a definite list of which architectures actually use it for what, use consistent #ifdef checks so the global variable is only defined when it is actually used on those architectures. Loongarch and riscv have no support for vgacon or vga16fb, but they support EFI firmware, so only that needs to be checked, and the initialization can be removed because that is handled by EFI. IA64 has both vgacon and EFI, though EFI apparently never uses a framebuffer here. Reviewed-by: Javier Martinez Canillas <[email protected]> Reviewed-by: Thomas Zimmermann <[email protected]> Reviewed-by: Khalid Aziz <[email protected]> Acked-by: Helge Deller <[email protected]> Signed-off-by: Arnd Bergmann <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent e9e3300 commit 8a736dd

File tree

8 files changed

+17
-12
lines changed

8 files changed

+17
-12
lines changed

arch/alpha/kernel/setup.c

+2
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ static void determine_cpu_caches (unsigned int);
131131

132132
static char __initdata command_line[COMMAND_LINE_SIZE];
133133

134+
#ifdef CONFIG_VGA_CONSOLE
134135
/*
135136
* The format of "screen_info" is strange, and due to early
136137
* i386-setup code. This is just enough to make the console
@@ -147,6 +148,7 @@ struct screen_info screen_info = {
147148
};
148149

149150
EXPORT_SYMBOL(screen_info);
151+
#endif
150152

151153
/*
152154
* The direct map I/O window, if any. This should be the same

arch/alpha/kernel/sys_sio.c

+2
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,13 @@ sio_init_irq(void)
5757
static inline void __init
5858
alphabook1_init_arch(void)
5959
{
60+
#ifdef CONFIG_VGA_CONSOLE
6061
/* The AlphaBook1 has LCD video fixed at 800x600,
6162
37 rows and 100 cols. */
6263
screen_info.orig_y = 37;
6364
screen_info.orig_video_cols = 100;
6465
screen_info.orig_video_lines = 37;
66+
#endif
6567

6668
lca_init_arch();
6769
}

arch/ia64/kernel/setup.c

+6
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,13 @@ EXPORT_SYMBOL(local_per_cpu_offset);
8686
#endif
8787
unsigned long ia64_cycles_per_usec;
8888
struct ia64_boot_param *ia64_boot_param;
89+
#if defined(CONFIG_VGA_CONSOLE) || defined(CONFIG_EFI)
8990
struct screen_info screen_info;
91+
#endif
92+
#ifdef CONFIG_VGA_CONSOLE
9093
unsigned long vga_console_iobase;
9194
unsigned long vga_console_membase;
95+
#endif
9296

9397
static struct resource data_resource = {
9498
.name = "Kernel data",
@@ -497,6 +501,7 @@ early_console_setup (char *cmdline)
497501
static void __init
498502
screen_info_setup(void)
499503
{
504+
#ifdef CONFIG_VGA_CONSOLE
500505
unsigned int orig_x, orig_y, num_cols, num_rows, font_height;
501506

502507
memset(&screen_info, 0, sizeof(screen_info));
@@ -525,6 +530,7 @@ screen_info_setup(void)
525530
screen_info.orig_video_mode = 3; /* XXX fake */
526531
screen_info.orig_video_isVGA = 1; /* XXX fake */
527532
screen_info.orig_video_ega_bx = 3; /* XXX fake */
533+
#endif
528534
}
529535

530536
static inline void

arch/loongarch/kernel/setup.c

+2
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,9 @@
5757
#define SMBIOS_CORE_PACKAGE_OFFSET 0x23
5858
#define LOONGSON_EFI_ENABLE (1 << 3)
5959

60+
#ifdef CONFIG_EFI
6061
struct screen_info screen_info __section(".data");
62+
#endif
6163

6264
unsigned long fw_arg0, fw_arg1, fw_arg2;
6365
DEFINE_PER_CPU(unsigned long, kernelsp);

arch/mips/kernel/setup.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ struct cpuinfo_mips cpu_data[NR_CPUS] __read_mostly;
5454

5555
EXPORT_SYMBOL(cpu_data);
5656

57-
#ifdef CONFIG_VT
57+
#ifdef CONFIG_VGA_CONSOLE
5858
struct screen_info screen_info;
5959
#endif
6060

arch/mips/sibyte/swarm/setup.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ void __init plat_mem_setup(void)
129129
if (m41t81_probe())
130130
swarm_rtc_type = RTC_M41T81;
131131

132-
#ifdef CONFIG_VT
132+
#ifdef CONFIG_VGA_CONSOLE
133133
screen_info = (struct screen_info) {
134134
.orig_video_page = 52,
135135
.orig_video_mode = 3,

arch/mips/sni/setup.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ extern void sni_machine_power_off(void);
3838

3939
static void __init sni_display_setup(void)
4040
{
41-
#if defined(CONFIG_VT) && defined(CONFIG_VGA_CONSOLE) && defined(CONFIG_FW_ARC)
41+
#if defined(CONFIG_VGA_CONSOLE) && defined(CONFIG_FW_ARC)
4242
struct screen_info *si = &screen_info;
4343
DISPLAY_STATUS *di;
4444

arch/riscv/kernel/setup.c

+2-9
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,8 @@
4040

4141
#include "head.h"
4242

43-
#if defined(CONFIG_DUMMY_CONSOLE) || defined(CONFIG_EFI)
44-
struct screen_info screen_info __section(".data") = {
45-
.orig_video_lines = 30,
46-
.orig_video_cols = 80,
47-
.orig_video_mode = 0,
48-
.orig_video_ega_bx = 0,
49-
.orig_video_isVGA = 1,
50-
.orig_video_points = 8
51-
};
43+
#if defined(CONFIG_EFI)
44+
struct screen_info screen_info __section(".data");
5245
#endif
5346

5447
/*

0 commit comments

Comments
 (0)