summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2016-10-17 20:13:02 -0600
committerTom Rini <trini@konsulko.com>2016-10-23 18:34:17 -0400
commit869588decdf41b693c8977067f90f742b771d0ad (patch)
tree2f845d9c8c5359adc0e1ed7459dba018d1fa16f7 /common
parent4ef6ecec9cdf1ce4c7b4f2a6b0f903583bfa24a2 (diff)
Convert CONFIG_SYS_STDIO_DEREGISTER to Kconfig
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> [trini: Re-sync] Signed-off-by: Tom Rini <trini@konsulko.com>
Diffstat (limited to 'common')
-rw-r--r--common/Kconfig9
-rw-r--r--common/stdio.c6
-rw-r--r--common/usb_kbd.c2
3 files changed, 13 insertions, 4 deletions
diff --git a/common/Kconfig b/common/Kconfig
index ff2b1a400b..dbe5bb619b 100644
--- a/common/Kconfig
+++ b/common/Kconfig
@@ -335,6 +335,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 ab9b05df48..8e4a9beef4 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 a9872a6b5a..5f9a64ad1c 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;