Re: [PATCH] ia64: don't do IA64_CMPXCHG_DEBUG without CONFIG_PRINTK

From: Chris Down
Date: Sun Sep 26 2021 - 06:51:12 EST


Hi Randy,

Randy Dunlap writes:
When CONFIG_PRINTK is not set, the CMPXCHG_BUGCHECK() macro calls
_printk(), but _printk() is a static inline function, not available
as an extern.
Since the purpose of the macro is to print the BUGCHECK info,
make this config option depend on PRINTK.

Fixes multiple occurrences of this build error:

../include/linux/printk.h:208:5: error: static declaration of '_printk' follows non-static declaration
208 | int _printk(const char *s, ...)
| ^~~~~~~
In file included from ../arch/ia64/include/asm/cmpxchg.h:5,
../arch/ia64/include/uapi/asm/cmpxchg.h:146:28: note: previous declaration of '_printk' with type 'int(const char *, ...)'
146 | extern int _printk(const char *fmt, ...);

Fixes: 337015573718 ("printk: Userspace format indexing support")

This Fixes tag doesn't make much sense. This was already broken long before that patch, just the error message changed: printk() was already static inline on !CONFIG_PRINTK for eons.

Signed-off-by: Randy Dunlap <rdunlap@xxxxxxxxxxxxx>
Cc: linux-ia64@xxxxxxxxxxxxxxx
Cc: Petr Mladek <pmladek@xxxxxxxx>
Cc: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
Cc: Tony Luck <tony.luck@xxxxxxxxx>
Cc: Chris Down <chris@xxxxxxxxxxxxxx>
---
arch/ia64/Kconfig.debug | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

--- linux-next-20210917.orig/arch/ia64/Kconfig.debug
+++ linux-next-20210917/arch/ia64/Kconfig.debug
@@ -39,7 +39,7 @@ config DISABLE_VHPT

config IA64_DEBUG_CMPXCHG
bool "Turn on compare-and-exchange bug checking (slow!)"
- depends on DEBUG_KERNEL
+ depends on DEBUG_KERNEL && PRINTK
help
Selecting this option turns on bug checking for the IA-64
compare-and-exchange instructions. This is slow! Itaniums