From 7c8bcf0772e1dc5635d96f823d76ef2e90afb0f5 Mon Sep 17 00:00:00 2001 From: Ulf Magnusson Date: Thu, 23 May 2019 13:52:52 +0200 Subject: [PATCH] doc: kconfig: Clarify that 'depends on' works for string/int/hex Seems people are a bit hazy on this, so explain how it works. Signed-off-by: Ulf Magnusson --- doc/guides/kconfig/index.rst | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/doc/guides/kconfig/index.rst b/doc/guides/kconfig/index.rst index ba717496b1e..3584323c578 100644 --- a/doc/guides/kconfig/index.rst +++ b/doc/guides/kconfig/index.rst @@ -326,6 +326,31 @@ error-prone, since it can be hard to spot that the same dependency is added twice. +``depends on`` and ``string``/``int``/``hex`` symbols +***************************************************** + +``depends on`` works not just for ``bool`` symbols, but also for ``string``, +``int``, and ``hex`` symbols (and for choices). + +The Kconfig definitions below will hide the ``FOO_DEVICE_FREQUENCY`` symbol and +disable any configuration output for it when ``FOO_DEVICE`` is disabled. + +.. code-block:: none + + config FOO_DEVICE + bool "Foo device" + + config FOO_DEVICE_FREQUENCY + int "Foo device frequency" + depends on FOO_DEVICE + +In general, it's a good idea to check that only relevant symbols are ever shown +in the ``menuconfig`` interface. Having ``FOO_DEVICE_FREQUENCY`` show up when +``FOO_DEVICE`` is disabled (and possibly hidden) makes the relationship between +the symbols harder to understand, even if code never looks at +``FOO_DEVICE_FREQUENCY`` when ``FOO_DEVICE`` is disabled. + + Checking changes in ``menuconfig`` **********************************