[U-Boot] [PATCH v3 29/29] Convert CONFIG_SYS_STDIO_DEREGISTER to Kconfig

Simon Glass sjg at chromium.org
Thu Sep 29 22:23:28 CEST 2016


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 at chromium.org>
---

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 ae93143..936c8bc 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 f99cfe7..c849a9a 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
 
@@ -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 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 b047466..9c98738 100644
--- a/include/configs/MPC8610HPCD.h
+++ b/include/configs/MPC8610HPCD.h
@@ -285,7 +285,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 fe0868f..ef5653f 100644
--- a/include/configs/MPC8641HPCN.h
+++ b/include/configs/MPC8641HPCN.h
@@ -363,7 +363,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 b570fd3..f58c18b 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 325c019..8b1e30d 100644
--- a/include/configs/cm_fx6.h
+++ b/include/configs/cm_fx6.h
@@ -211,7 +211,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 31f2437..474eef1 100644
--- a/include/configs/cyrus.h
+++ b/include/configs/cyrus.h
@@ -448,7 +448,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 fa10676..544e5fc 100644
--- a/include/configs/gr_ep2s60.h
+++ b/include/configs/gr_ep2s60.h
@@ -60,7 +60,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 a2969e7..efea259 100644
--- a/include/configs/sunxi-common.h
+++ b/include/configs/sunxi-common.h
@@ -349,7 +349,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 890bd69..fba345f 100644
--- a/include/configs/tbs2910.h
+++ b/include/configs/tbs2910.h
@@ -114,7 +114,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 78024af..0bd6680 100644
--- a/include/configs/tegra-common.h
+++ b/include/configs/tegra-common.h
@@ -66,10 +66,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 fa07417..f9b7206 100644
--- a/include/configs/x86-common.h
+++ b/include/configs/x86-common.h
@@ -62,8 +62,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 94b3108..ab44b29 100644
--- a/scripts/config_whitelist.txt
+++ b/scripts/config_whitelist.txt
@@ -7694,7 +7694,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
-- 
2.8.0.rc3.226.g39d4020



More information about the U-Boot mailing list