
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 sjg@chromium.org ---
Changes in v4: - Rebase to master
Changes in v3: None Changes in v2: - Make CONFIG_SYS_STDIO_DEREGISTER the default if USB_KEYBOARD - Drop Kconfig changes
common/Kconfig | 9 +++++++++ common/stdio.c | 6 +++--- common/usb_kbd.c | 2 +- configs/MPC8610HPCD_defconfig | 1 + configs/MPC8641HPCN_36BIT_defconfig | 1 + configs/MPC8641HPCN_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 - 24 files changed, 18 insertions(+), 27 deletions(-)
diff --git a/common/Kconfig b/common/Kconfig index e0bc1bb..0a3e114 100644 --- a/common/Kconfig +++ b/common/Kconfig @@ -336,6 +336,15 @@ 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" + default y if USB_KEYBOARD + 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 ab9b05d..8e4a9be 100644 --- a/common/stdio.c +++ b/common/stdio.c @@ -37,7 +37,7 @@ char *stdio_names[MAX_FILES] = { "stdin", "stdout", "stderr" }; #define CONFIG_SYS_DEVICE_NULLDEV 1 #endif
-#ifdef CONFIG_SYS_STDIO_DEREGISTER +#if CONFIG_IS_ENABLED(SYS_STDIO_DEREGISTER) #define CONFIG_SYS_DEVICE_NULLDEV 1 #endif
@@ -245,7 +245,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; @@ -292,7 +292,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 a9872a6..5f9a64a 100644 --- a/common/usb_kbd.c +++ b/common/usb_kbd.c @@ -570,7 +570,7 @@ int drv_usb_kbd_init(void) /* Deregister the keyboard. */ int usb_kbd_deregister(int force) { -#ifdef CONFIG_SYS_STDIO_DEREGISTER +#if CONFIG_IS_ENABLED(SYS_STDIO_DEREGISTER) struct stdio_dev *dev; struct usb_device *usb_kbd_dev; struct usb_kbd_pdata *data; diff --git a/configs/MPC8610HPCD_defconfig b/configs/MPC8610HPCD_defconfig index 2c03ba2..1ff4fdb 100644 --- a/configs/MPC8610HPCD_defconfig +++ b/configs/MPC8610HPCD_defconfig @@ -5,6 +5,7 @@ CONFIG_TARGET_MPC8610HPCD=y CONFIG_OF_BOARD_SETUP=y CONFIG_OF_STDOUT_VIA_ALIAS=y CONFIG_BOOTDELAY=10 +CONFIG_SYS_STDIO_DEREGISTER=y CONFIG_HUSH_PARSER=y CONFIG_CMD_I2C=y CONFIG_CMD_USB=y diff --git a/configs/MPC8641HPCN_36BIT_defconfig b/configs/MPC8641HPCN_36BIT_defconfig index 0c3d60b..dafdf58 100644 --- a/configs/MPC8641HPCN_36BIT_defconfig +++ b/configs/MPC8641HPCN_36BIT_defconfig @@ -6,6 +6,7 @@ CONFIG_PHYS_64BIT=y CONFIG_OF_BOARD_SETUP=y CONFIG_OF_STDOUT_VIA_ALIAS=y CONFIG_BOOTDELAY=10 +CONFIG_SYS_STDIO_DEREGISTER=y CONFIG_HUSH_PARSER=y CONFIG_CMD_I2C=y CONFIG_CMD_USB=y diff --git a/configs/MPC8641HPCN_defconfig b/configs/MPC8641HPCN_defconfig index d2250ec..1f7ceb3 100644 --- a/configs/MPC8641HPCN_defconfig +++ b/configs/MPC8641HPCN_defconfig @@ -5,6 +5,7 @@ CONFIG_TARGET_MPC8641HPCN=y CONFIG_OF_BOARD_SETUP=y CONFIG_OF_STDOUT_VIA_ALIAS=y CONFIG_BOOTDELAY=10 +CONFIG_SYS_STDIO_DEREGISTER=y CONFIG_HUSH_PARSER=y CONFIG_CMD_I2C=y CONFIG_CMD_USB=y diff --git a/drivers/serial/serial-uclass.c b/drivers/serial/serial-uclass.c index 19f38e1..43c028e 100644 --- a/drivers/serial/serial-uclass.c +++ b/drivers/serial/serial-uclass.c @@ -346,7 +346,7 @@ static int serial_post_probe(struct udevice *dev)
static int serial_pre_remove(struct udevice *dev) { -#ifdef CONFIG_SYS_STDIO_DEREGISTER +#if CONFIG_IS_ENABLED(SYS_STDIO_DEREGISTER) struct serial_dev_priv *upriv = dev_get_uclass_priv(dev);
if (stdio_deregister_dev(upriv->sdev, 0)) diff --git a/include/configs/MIP405.h b/include/configs/MIP405.h index 0538332..9aba1dd 100644 --- a/include/configs/MIP405.h +++ b/include/configs/MIP405.h @@ -348,7 +348,6 @@ #define CONFIG_USB_UHCI
/* Enable needed helper functions */ -#define CONFIG_SYS_STDIO_DEREGISTER /* needs stdio_deregister */ #endif /************************************************************ * Debug support diff --git a/include/configs/MPC8610HPCD.h b/include/configs/MPC8610HPCD.h index 4021be7..e3c9e5b 100644 --- a/include/configs/MPC8610HPCD.h +++ b/include/configs/MPC8610HPCD.h @@ -283,7 +283,6 @@ ************************************************************/ #define CONFIG_PCI_OHCI 1 #define CONFIG_USB_OHCI_NEW 1 -#define CONFIG_SYS_STDIO_DEREGISTER #define CONFIG_SYS_USB_EVENT_POLL 1 #define CONFIG_SYS_USB_OHCI_SLOT_NAME "ohci_pci" #define CONFIG_SYS_USB_OHCI_MAX_ROOT_PORTS 15 diff --git a/include/configs/MPC8641HPCN.h b/include/configs/MPC8641HPCN.h index 94a9399..e0b856f 100644 --- a/include/configs/MPC8641HPCN.h +++ b/include/configs/MPC8641HPCN.h @@ -361,7 +361,6 @@ extern unsigned long get_board_sys_clk(unsigned long dummy); ************************************************************/ #define CONFIG_PCI_OHCI 1 #define CONFIG_USB_OHCI_NEW 1 -#define CONFIG_SYS_STDIO_DEREGISTER #define CONFIG_SYS_USB_EVENT_POLL 1 #define CONFIG_SYS_USB_OHCI_SLOT_NAME "ohci_pci" #define CONFIG_SYS_USB_OHCI_MAX_ROOT_PORTS 15 diff --git a/include/configs/PIP405.h b/include/configs/PIP405.h index eaa8b26..8516eb7 100644 --- a/include/configs/PIP405.h +++ b/include/configs/PIP405.h @@ -308,7 +308,6 @@ #define CONFIG_USB_UHCI
/* Enable needed helper functions */ -#define CONFIG_SYS_STDIO_DEREGISTER /* needs stdio_deregister */
/************************************************************ * Debug support diff --git a/include/configs/VCMA9.h b/include/configs/VCMA9.h index 75c6d50..bb26261 100644 --- a/include/configs/VCMA9.h +++ b/include/configs/VCMA9.h @@ -103,7 +103,6 @@ #define CONFIG_DOS_PARTITION
/* Enable needed helper functions */ -#define CONFIG_SYS_STDIO_DEREGISTER /* needs stdio_deregister */
/* RTC */ #define CONFIG_RTC_S3C24X0 diff --git a/include/configs/cm_fx6.h b/include/configs/cm_fx6.h index 0b3f034..0ac3ec7 100644 --- a/include/configs/cm_fx6.h +++ b/include/configs/cm_fx6.h @@ -210,7 +210,6 @@ #define CONFIG_MXC_USB_FLAGS 0 #define CONFIG_USB_MAX_CONTROLLER_COUNT 2 #define CONFIG_EHCI_HCD_INIT_AFTER_RESET /* For OTG port */ -#define CONFIG_SYS_STDIO_DEREGISTER
/* I2C */ #define CONFIG_SYS_I2C diff --git a/include/configs/cyrus.h b/include/configs/cyrus.h index cb85c6b..8ce23e6 100644 --- a/include/configs/cyrus.h +++ b/include/configs/cyrus.h @@ -446,7 +446,6 @@ #define CONFIG_USB_EHCI_FSL #define CONFIG_EHCI_HCD_INIT_AFTER_RESET #define CONFIG_EHCI_IS_TDI -#define CONFIG_SYS_STDIO_DEREGISTER #define CONFIG_SYS_USB_EVENT_POLL /* _VIA_CONTROL_EP */ #endif diff --git a/include/configs/gr_ep2s60.h b/include/configs/gr_ep2s60.h index 36a91c6..ad0c126 100644 --- a/include/configs/gr_ep2s60.h +++ b/include/configs/gr_ep2s60.h @@ -58,7 +58,6 @@ #if USE_GRUSB #define CONFIG_USB_UHCI /* Enable needed helper functions */ -#define CONFIG_SYS_STDIO_DEREGISTER /* needs stdio_deregister */ #endif
/* diff --git a/include/configs/novena.h b/include/configs/novena.h index ee4267a..ecc7e7e 100644 --- a/include/configs/novena.h +++ b/include/configs/novena.h @@ -142,7 +142,6 @@ #ifdef CONFIG_CMD_USB #define CONFIG_USB_EHCI #define CONFIG_USB_EHCI_MX6 -#define CONFIG_SYS_STDIO_DEREGISTER #define CONFIG_SYS_USB_EVENT_POLL_VIA_CONTROL_EP #define CONFIG_USB_HOST_ETHER #define CONFIG_USB_ETHER_ASIX diff --git a/include/configs/rpi.h b/include/configs/rpi.h index 25a90cc..45c8234 100644 --- a/include/configs/rpi.h +++ b/include/configs/rpi.h @@ -101,7 +101,6 @@ #define CONFIG_TFTP_TSIZE #define CONFIG_MISC_INIT_R #define CONFIG_SYS_USB_EVENT_POLL -#define CONFIG_SYS_STDIO_DEREGISTER #endif
/* Console UART */ diff --git a/include/configs/sandbox.h b/include/configs/sandbox.h index b6533c3..31ab765 100644 --- a/include/configs/sandbox.h +++ b/include/configs/sandbox.h @@ -25,8 +25,6 @@ #define CONFIG_SYS_TIMER_RATE 1000000 #endif
-#define CONFIG_SYS_STDIO_DEREGISTER - /* * Number of bits in a C 'long' on this architecture. Set this to 32 when * building on a 32-bit machine. diff --git a/include/configs/sunxi-common.h b/include/configs/sunxi-common.h index f98a48b..e0464df 100644 --- a/include/configs/sunxi-common.h +++ b/include/configs/sunxi-common.h @@ -347,7 +347,6 @@ extern int soft_i2c_gpio_scl;
#ifdef CONFIG_USB_KEYBOARD #define CONFIG_PREBOOT -#define CONFIG_SYS_STDIO_DEREGISTER #define CONFIG_SYS_USB_EVENT_POLL_VIA_INT_QUEUE #endif
diff --git a/include/configs/tbs2910.h b/include/configs/tbs2910.h index b541937..61bd489 100644 --- a/include/configs/tbs2910.h +++ b/include/configs/tbs2910.h @@ -116,7 +116,6 @@ #endif /* CONFIG_CMD_USB_MASS_STORAGE */ #ifdef CONFIG_USB_KEYBOARD #define CONFIG_SYS_USB_EVENT_POLL_VIA_INT_QUEUE -#define CONFIG_SYS_STDIO_DEREGISTER #define CONFIG_PREBOOT \ "usb start; " \ "if hdmidet; then " \ diff --git a/include/configs/tegra-common.h b/include/configs/tegra-common.h index 3590be4..63b711b 100644 --- a/include/configs/tegra-common.h +++ b/include/configs/tegra-common.h @@ -60,10 +60,6 @@
#define CONFIG_SYS_NO_FLASH
-#ifndef CONFIG_SPL_BUILD -#define CONFIG_SYS_STDIO_DEREGISTER -#endif - /* * Increasing the size of the IO buffer as default nfsargs size is more * than 256 and so it is not possible to edit it diff --git a/include/configs/x86-common.h b/include/configs/x86-common.h index f2c2b50..3bf42b5 100644 --- a/include/configs/x86-common.h +++ b/include/configs/x86-common.h @@ -61,8 +61,6 @@ 9600, 19200, 38400, 115200} #define CONFIG_SYS_NS16550_PORT_MAPPED
-#define CONFIG_SYS_STDIO_DEREGISTER - #define CONFIG_CMDLINE_EDITING #define CONFIG_COMMAND_HISTORY #define CONFIG_AUTO_COMPLETE diff --git a/include/stdio_dev.h b/include/stdio_dev.h index 13f76be..e4fc8b1 100644 --- a/include/stdio_dev.h +++ b/include/stdio_dev.h @@ -100,7 +100,7 @@ int stdio_add_devices(void); int stdio_init(void);
void stdio_print_current_devices(void); -#ifdef CONFIG_SYS_STDIO_DEREGISTER +#if CONFIG_IS_ENABLED(SYS_STDIO_DEREGISTER) int stdio_deregister(const char *devname, int force); int stdio_deregister_dev(struct stdio_dev *dev, int force); #endif diff --git a/scripts/config_whitelist.txt b/scripts/config_whitelist.txt index a0306a6..11b5a22 100644 --- a/scripts/config_whitelist.txt +++ b/scripts/config_whitelist.txt @@ -7681,7 +7681,6 @@ CONFIG_SYS_STACK_LENGTH CONFIG_SYS_STACK_SIZE CONFIG_SYS_STATUS_C CONFIG_SYS_STATUS_OK -CONFIG_SYS_STDIO_DEREGISTER CONFIG_SYS_STMICRO_BOOT CONFIG_SYS_SUPPORT_64BIT_DATA CONFIG_SYS_SXCNFG_VAL