This converts the following to Kconfig:
CONFIG_SYS_STDIO_DEREGISTER
This option should never be enabled in SPL, so use
CONFIG_IS_ENABLED(SYS_STDIO_DEREGISTER) when checking the option.
Signed-off-by: Simon Glass
---
arch/arm/mach-tegra/Kconfig | 3 +++
arch/x86/Kconfig| 3 +++
board/sunxi/Kconfig | 3 +++
common/Kconfig | 8
common/stdio.c | 6 +++---
common/usb_kbd.c| 2 +-
configs/Cyrus_P5020_defconfig | 1 +
configs/Cyrus_P5040_defconfig | 1 +
configs/MIP405_defconfig| 1 +
configs/MPC8610HPCD_defconfig | 1 +
configs/MPC8641HPCN_36BIT_defconfig | 1 +
configs/MPC8641HPCN_defconfig | 1 +
configs/PIP405_defconfig| 1 +
configs/VCMA9_defconfig | 1 +
configs/cm_fx6_defconfig| 1 +
configs/novena_defconfig| 1 +
configs/rpi_2_defconfig | 1 +
configs/rpi_3_32b_defconfig | 1 +
configs/rpi_3_defconfig | 1 +
configs/rpi_defconfig | 1 +
configs/sandbox_defconfig | 1 +
configs/sandbox_noblk_defconfig | 1 +
configs/sandbox_spl_defconfig | 1 +
configs/tbs2910_defconfig | 1 +
drivers/serial/serial-uclass.c | 2 +-
include/configs/MIP405.h| 1 -
include/configs/MPC8610HPCD.h | 1 -
include/configs/MPC8641HPCN.h | 1 -
include/configs/PIP405.h| 1 -
include/configs/VCMA9.h | 1 -
include/configs/cm_fx6.h| 1 -
include/configs/cyrus.h | 1 -
include/configs/gr_ep2s60.h | 1 -
include/configs/novena.h| 1 -
include/configs/rpi.h | 1 -
include/configs/sandbox.h | 2 --
include/configs/sunxi-common.h | 1 -
include/configs/tbs2910.h | 1 -
include/configs/tegra-common.h | 4
include/configs/x86-common.h| 2 --
include/stdio_dev.h | 2 +-
scripts/config_whitelist.txt| 1 -
42 files changed, 41 insertions(+), 27 deletions(-)
diff --git a/arch/arm/mach-tegra/Kconfig b/arch/arm/mach-tegra/Kconfig
index 76909ee..3800225 100644
--- a/arch/arm/mach-tegra/Kconfig
+++ b/arch/arm/mach-tegra/Kconfig
@@ -12,6 +12,9 @@ config SPL_LIBGENERIC_SUPPORT
config SPL_SERIAL_SUPPORT
default y
+config SYS_STDIO_DEREGISTER
+ default y
+
config TEGRA_IVC
bool "Tegra IVC protocol"
help
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 5193ee7..b15935d 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -34,6 +34,9 @@ config VENDOR_INTEL
endchoice
+config SYS_STDIO_DEREGISTER
+ default y if X86
+
# board-specific options below
source "board/advantech/Kconfig"
source "board/congatec/Kconfig"
diff --git a/board/sunxi/Kconfig b/board/sunxi/Kconfig
index 9954f0a..23413f1 100644
--- a/board/sunxi/Kconfig
+++ b/board/sunxi/Kconfig
@@ -27,6 +27,9 @@ config SPL_POWER_SUPPORT
config SPL_SERIAL_SUPPORT
default y
+config SYS_STDIO_DEREGISTER
+ default y
+
config PRE_CONSOLE_BUFFER
# Note only one of these may be selected at a time! But hidden choices are
# not supported by Kconfig
diff --git a/common/Kconfig b/common/Kconfig
index 815e11d..149d002 100644
--- a/common/Kconfig
+++ b/common/Kconfig
@@ -326,6 +326,14 @@ config SYS_CONSOLE_INFO_QUIET
Enable this option to supress this output. It can be obtained by
calling stdio_print_current_devices() from board code.
+config SYS_STDIO_DEREGISTER
+ bool "Allow deregistering stdio devices"
+ help
+ Generally there is no need to deregister stdio devices since they
+ are never deactivated. But if a stdio device is used which can be
+ removed (for example a USB keyboard) then this option can be
+ enabled to ensure this is handled correctly.
+
endmenu
config SYS_NO_FLASH
diff --git a/common/stdio.c b/common/stdio.c
index f99cfe7..c849a9a 100644
--- a/common/stdio.c
+++ b/common/stdio.c
@@ -37,7 +37,7 @@ char *stdio_names[MAX_FILES] = { "stdin", "stdout", "stderr"
};
#defineCONFIG_SYS_DEVICE_NULLDEV 1
#endif
-#ifdef CONFIG_SYS_STDIO_DEREGISTER
+#if CONFIG_IS_ENABLED(SYS_STDIO_DEREGISTER)
#defineCONFIG_SYS_DEVICE_NULLDEV 1
#endif
@@ -177,7 +177,7 @@ int stdio_register(struct stdio_dev *dev)
/* deregister the device "devname".
* returns 0 if success, -1 if device is assigned and 1 if devname not found
*/
-#ifdef CONFIG_SYS_STDIO_DEREGISTER
+#if CONFIG_IS_ENABLED(SYS_STDIO_DEREGISTER)
int stdio_deregister_dev(struct stdio_dev *dev, int force)
{
int l;
@@ -224,7 +224,7 @@ int stdio_deregister(const char *devname, int force)
return stdio_deregister_dev(dev, force);
}
-#endif /* CONFIG_SYS_STDIO_DEREGISTER */
+#endif /* CONFIG_IS_ENABLED(SYS_STDIO_DEREGISTER) */
int stdio_init_tables(void)
{
diff --git a/common/usb_kbd.c b/common/usb_kbd.c
index 97f79