zephyr/subsys/net/lib/lwm2m
Ulf Magnusson ec3eff57e0 Kconfig: Use the first default with a satisfied condition
Up until now, Zephyr has patched Kconfig to use the last 'default' with
a satisfied condition, instead of the first one. I'm not sure why the
patch was added (it predates Kconfiglib), but I suspect it's related to
Kconfig.defconfig files.

There are at least three problems with the patch:

  1. It's inconsistent with how Kconfig works in other projects, which
     might confuse newcomers.

  2. Due to oversights, earlier 'range' properties are still preferred,
     as well as earlier 'default' properties on choices.

     In addition to being inconsistent, this makes it impossible to
     override 'range' properties and choice 'default' properties if the
     base definition of the symbol/choice already has 'range'/'default'
     properties.

     I've seen errors caused by the inconsistency, and I suspect there
     are more.

  3. A fork of Kconfiglib that adds the patch needs to be maintained.

Get rid of the patch and go back to standard Kconfig behavior, as
follows:

  1. Include the Kconfig.defconfig files first instead of last in
     Kconfig.zephyr.

  2. Include boards/Kconfig and arch/<arch>/Kconfig first instead of
     last in arch/Kconfig.

  3. Include arch/<arch>/soc/*/Kconfig first instead of last in
     arch/<arch>/Kconfig.

  4. Swap a few other 'source's to preserve behavior for some scattered
     symbols with multiple definitions.

     Swap 'source's in some no-op cases too, where it might match the
     intent.

  5. Reverse the defaults on symbol definitions that have more than one
     default.

     Skip defaults that are mutually exclusive, e.g. where each default
     has an 'if <some board>' condition. They are already safe.

  6. Remove the prefer-later-defaults patch from Kconfiglib.

Testing was done with a Python script that lists all Kconfig
symbols/choices with multiple defaults, along with a whitelist of fixed
symbols. The script also verifies that there are no "unreachable"
defaults hidden by defaults without conditions

As an additional test, zephyr/.config was generated before and after the
change for several samples and checked to be identical (after sorting).

This commit includes some default-related cleanups as well:

  - Simplify some symbol definitions, e.g. where a default has 'if FOO'
    when the symbol already has 'depends on FOO'.

  - Remove some redundant 'default ""' for string symbols. This is the
    implicit default.

Piggyback fixes for swapped ranges on BT_L2CAP_RX_MTU and
BT_L2CAP_TX_MTU (caused by confusing inconsistency).

Piggyback some fixes for style nits too, e.g. unindented help texts.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2018-08-10 12:38:28 -07:00
..
CMakeLists.txt net: lwm2m: add support for DTLS 2017-12-15 16:46:48 -05:00
ipso_light_control.c samples, subsys, tests: Use ARRAY_SIZE() whenever possible 2018-06-14 19:12:51 -04:00
ipso_temp_sensor.c samples, subsys, tests: Use ARRAY_SIZE() whenever possible 2018-06-14 19:12:51 -04:00
Kconfig Kconfig: Use the first default with a satisfied condition 2018-08-10 12:38:28 -07:00
Kconfig.ipso subsys: kconfig: Remove 'default n' properties and clean up a bit 2018-07-12 23:13:22 -04:00
lwm2m_engine.c net: lwm2m: use ARRAY_SIZE to calculate # of options 2018-07-17 13:03:18 +03:00
lwm2m_engine.h net: lwm2m: dont release reply for duplicate block transfer 2018-05-25 17:19:34 -04:00
lwm2m_obj_device.c samples, subsys, tests: Use ARRAY_SIZE() whenever possible 2018-06-14 19:12:51 -04:00
lwm2m_obj_firmware_pull.c net: lwm2m: dont release reply for duplicate block transfer 2018-05-25 17:19:34 -04:00
lwm2m_obj_firmware.c net: lwm2m: make lwm2m_engine_exec_cb_t more generic 2018-07-17 13:03:18 +03:00
lwm2m_obj_security.c samples, subsys, tests: Use ARRAY_SIZE() whenever possible 2018-06-14 19:12:51 -04:00
lwm2m_obj_server.c samples, subsys, tests: Use ARRAY_SIZE() whenever possible 2018-06-14 19:12:51 -04:00
lwm2m_object.h net: lwm2m: introduce user-code callbacks for obj create/delete 2018-07-17 13:03:18 +03:00
lwm2m_rd_client.c net: lwm2m: no need to cleanup net_app_ctx in RD client 2018-08-07 19:55:49 +03:00
lwm2m_rd_client.h net: lwm2m: add SPX Apache-2.0 license tag w/ Linaro copyright 2017-08-09 10:55:53 +03:00
lwm2m_rw_json.c net: lwm2m: introduce LWM2M_HAS_PERM macro 2018-05-04 09:45:35 +03:00
lwm2m_rw_json.h net: lwm2m: move non-public data out of shared JSON include 2017-10-20 10:40:55 +03:00
lwm2m_rw_oma_tlv.c net: lwm2m: read past not supported TLV resources 2018-07-17 13:03:18 +03:00
lwm2m_rw_oma_tlv.h net: lwm2m: move non-public data out of shared TLV include 2017-10-20 10:40:55 +03:00
lwm2m_rw_plain_text.c net: lwm2m: introduce LWM2M_HAS_PERM macro 2018-05-04 09:45:35 +03:00
lwm2m_rw_plain_text.h net: lwm2m: add multi fragment support to LwM2M library 2017-10-31 09:41:27 +02:00