Skip to contentSkip to conversation

mdacon: fix redefinition of 'scr_memsetw'

PATCH Superseded Jackie Liu 2 participants 4 messages Sep 6, 2021

Subsystems (3)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Jackie Liu

author
#0 lore raw

PATCH 1/1 mdacon: fix redefinition of 'scr_memsetw'

From: Jackie Liu <[email protected]>

CONFIG_VGA_CONSOLE=n and CONFIG_MDA_CONSOLE=n will cause vt_buffer.h not include <asm/vga.h>.

But if we set CONFIG_MDA_CONSOLE=m, mdacon.c include <linux/vt_buffer.h> is in front of include <asm/vga.h>. VT_BUF_HAVE_MEMSETW is not defined, so vt_buffer.h will define a scr_memsetw, after that, vga.h also define a scr_memsetw, so the repeated definition of scr_memsetw appears, builds error.

We only need to make vt_buffer.h also contain vga.h when CONFIG_MDA_CONSOLE=m. This problem can be fixed.

BTW, mdacon.c no need to include vga.h forcibly, let vt_buffer.h do it.

Fixes 1da177e4c3f4 ("Linux-2.6.12-rc2")
Cc Greg Kroah-Hartman <[email protected]>
---
 drivers/video/console/mdacon.c | 1 -
 include/linux/vt_buffer.h      | 2 +-
 2 files changed, 1 insertion(+), 2 deletions(-)
drivers/video/console/mdacon.c +0 -1
index ef29b321967f..5898d01bc492 100644
@@ -42,7 +42,6 @@
 #include <linux/init.h>
 
 #include <asm/io.h>
-#include <asm/vga.h>
 
 static DEFINE_SPINLOCK(mda_lock);
 
include/linux/vt_buffer.h +1 -1
index 848db1b1569f..3e71f879e7c0 100644
@@ -16,7 +16,7 @@
 
 #include <linux/string.h>
 
-#if defined(CONFIG_VGA_CONSOLE) || defined(CONFIG_MDA_CONSOLE)
+#if defined(CONFIG_VGA_CONSOLE) || defined(CONFIG_MDA_CONSOLE) || defined(CONFIG_MDA_CONSOLE_MODULE)
 #include <asm/vga.h>
 #endif
 
Signature · 1 line
2.25.1
maintainer
#1 lore raw
Quoted 11 lines · Jackie Liu

From: Jackie Liu <[email protected]>

CONFIG_VGA_CONSOLE=n and CONFIG_MDA_CONSOLE=n will cause vt_buffer.h not include <asm/vga.h>.

But if we set CONFIG_MDA_CONSOLE=m, mdacon.c include <linux/vt_buffer.h> is in front of include <asm/vga.h>. VT_BUF_HAVE_MEMSETW is not defined, so vt_buffer.h will define a scr_memsetw, after that, vga.h also define a scr_memsetw, so the repeated definition of scr_memsetw appears, builds error.

Quoted 6 lines

We only need to make vt_buffer.h also contain vga.h when CONFIG_MDA_CONSOLE=m. This problem can be fixed.

BTW, mdacon.c no need to include vga.h forcibly, let vt_buffer.h do it.

Fixes 1da177e4c3f4 ("Linux-2.6.12-rc2")

As this has always been an issue, how is this really a "fix"?

How can the above config options be set in this manner, do you have to do it manually or does a system really need that configuration?

Quoted 26 lines
---
 drivers/video/console/mdacon.c | 1 -
 include/linux/vt_buffer.h      | 2 +-
 2 files changed, 1 insertion(+), 2 deletions(-)
drivers/video/console/mdacon.c +0 -1
index ef29b321967f..5898d01bc492 100644
@@ -42,7 +42,6 @@
 #include <linux/init.h>
 
 #include <asm/io.h>
-#include <asm/vga.h>
 
 static DEFINE_SPINLOCK(mda_lock);
 
include/linux/vt_buffer.h +0 -0
index 848db1b1569f..3e71f879e7c0 100644

include/linux/vt_buffer.h line 19

Quoted 5 lines
include/linux/vt_buffer.h +1 -1
@@ -16,7 +16,7 @@
 
 #include <linux/string.h>
 
-#if defined(CONFIG_VGA_CONSOLE) || defined(CONFIG_MDA_CONSOLE)
+#if defined(CONFIG_VGA_CONSOLE) || defined(CONFIG_MDA_CONSOLE) || defined(CONFIG_MDA_CONSOLE_MODULE)

If this really is needed, please use the correct define macro that catches both of these options.

thanks,

greg k-h

author
#2 lore raw

Hi, Greg.

September 6, 2021 6:46 PM, "Greg KH" <[email protected]> 写到:

Quoted 13 lines · Jackie Liu
Quoted 12 lines

From: Jackie Liu <[email protected]>

CONFIG_VGA_CONSOLE=n and CONFIG_MDA_CONSOLE=n will cause vt_buffer.h not include <asm/vga.h>.

But if we set CONFIG_MDA_CONSOLE=m, mdacon.c include <linux/vt_buffer.h> is in front of include <asm/vga.h>. VT_BUF_HAVE_MEMSETW is not defined, so vt_buffer.h will define a scr_memsetw, after that, vga.h also define a scr_memsetw, so the repeated definition of scr_memsetw appears, builds error.

Quoted 8 lines
Quoted 6 lines

We only need to make vt_buffer.h also contain vga.h when CONFIG_MDA_CONSOLE=m. This problem can be fixed.

BTW, mdacon.c no need to include vga.h forcibly, let vt_buffer.h do it.

Fixes 1da177e4c3f4 ("Linux-2.6.12-rc2")

As this has always been an issue, how is this really a "fix"?

The problem has always existed, but there will be no compilation errors. The driver needs to include <asm/vga.h> at the beginning if we want build CONFIG_MDA_CONSOLE=m

After ac036f9570a2, redefined 'scr_memsetw'. but they are not arm and x86 architectures, so it's not very important. It can also be Fixes: ac036f9570a2 ("vga: optimise console scrolling")

Quoted 3 lines

How can the above config options be set in this manner, do you have to do it manually or does a system really need that configuration?

This is a problem reported by my CI, when doing make randomconfigs. Of course, this is a very tiny fix.

Quoted 28 lines
Quoted 28 lines

---
drivers/video/console/mdacon.c | 1 -
include/linux/vt_buffer.h | 2 +-

2 files changed, 1 insertion(+), 2 deletions(-)
drivers/video/console/mdacon.c +0 -1
index ef29b321967f..5898d01bc492 100644
@@ -42,7 +42,6 @@
 #include <linux/init.h>
 
 #include <asm/io.h>
-#include <asm/vga.h>
 
 static DEFINE_SPINLOCK(mda_lock);
 
include/linux/vt_buffer.h +0 -0
index 848db1b1569f..3e71f879e7c0 100644
@@ -16,7 +16,7 @@
 
Quoted 8 lines

include/linux/vt_buffer.h

Quoted 5 lines
include/linux/vt_buffer.h +1 -1
 #include <linux/string.h>
 
-#if defined(CONFIG_VGA_CONSOLE) || defined(CONFIG_MDA_CONSOLE)
+#if defined(CONFIG_VGA_CONSOLE) || defined(CONFIG_MDA_CONSOLE) ||
 defined(CONFIG_MDA_CONSOLE_MODULE)

If this really is needed, please use the correct define macro that catches both of these options.

Do you have any suggestions?

I saw that this file is also written like this: ./arch/arm/mach-pxa/spitz.c:455:#if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE)

Quoted 4 lines

thanks,

greg k-h

Best Regards.
Jackie Liu

maintainer
#3 lore raw
Quoted 25 lines · Jackie Liu

Hi, Greg.

September 6, 2021 6:46 PM, "Greg KH" <[email protected]> 写到:

Quoted 20 lines · Jackie Liu
Quoted 18 lines

From: Jackie Liu <[email protected]>

CONFIG_VGA_CONSOLE=n and CONFIG_MDA_CONSOLE=n will cause vt_buffer.h not include <asm/vga.h>.

But if we set CONFIG_MDA_CONSOLE=m, mdacon.c include <linux/vt_buffer.h> is in front of include <asm/vga.h>. VT_BUF_HAVE_MEMSETW is not defined, so vt_buffer.h will define a scr_memsetw, after that, vga.h also define a scr_memsetw, so the repeated definition of scr_memsetw appears, builds error.

We only need to make vt_buffer.h also contain vga.h when CONFIG_MDA_CONSOLE=m. This problem can be fixed.

BTW, mdacon.c no need to include vga.h forcibly, let vt_buffer.h do it.

Fixes 1da177e4c3f4 ("Linux-2.6.12-rc2")
Quoted 8 lines
Quoted 1 line

As this has always been an issue, how is this really a "fix"?

The problem has always existed, but there will be no compilation errors. The driver needs to include <asm/vga.h> at the beginning if we want build CONFIG_MDA_CONSOLE=m

After ac036f9570a2, redefined 'scr_memsetw'. but they are not arm and x86 architectures, so it's not very important. It can also be Fixes: ac036f9570a2 ("vga: optimise console scrolling")

That might make more sense to put here, instead of the "beginning of history".

Quoted 43 lines
Quoted 2 lines

How can the above config options be set in this manner, do you have to do it manually or does a system really need that configuration?

This is a problem reported by my CI, when doing make randomconfigs. Of course, this is a very tiny fix.

Quoted 28 lines
Quoted 28 lines

---
drivers/video/console/mdacon.c | 1 -
include/linux/vt_buffer.h | 2 +-

2 files changed, 1 insertion(+), 2 deletions(-)
drivers/video/console/mdacon.c +0 -1
index ef29b321967f..5898d01bc492 100644
@@ -42,7 +42,6 @@
 #include <linux/init.h>
 
 #include <asm/io.h>
-#include <asm/vga.h>
 
 static DEFINE_SPINLOCK(mda_lock);
 
include/linux/vt_buffer.h +0 -0
index 848db1b1569f..3e71f879e7c0 100644
@@ -16,7 +16,7 @@
 
Quoted 8 lines

include/linux/vt_buffer.h

Quoted 5 lines
include/linux/vt_buffer.h +1 -1
 #include <linux/string.h>
 
-#if defined(CONFIG_VGA_CONSOLE) || defined(CONFIG_MDA_CONSOLE)
+#if defined(CONFIG_VGA_CONSOLE) || defined(CONFIG_MDA_CONSOLE) ||
 defined(CONFIG_MDA_CONSOLE_MODULE)

If this really is needed, please use the correct define macro that catches both of these options.

Quoted 4 lines

Do you have any suggestions?

I saw that this file is also written like this: ./arch/arm/mach-pxa/spitz.c:455:#if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE)

Look at the IS_ENABLED() macro.

thanks,

greg k-h