subsys/settings: Update bluetooth module

Updated the bluetooth module to use static handlers. Removed the
old bt specific static registration.

The routine bt_settings_init() is still calling settings_init() which
IMO is not needed anymore.

Updates:

changed SETTINGS_REGISTER_STATIC() to SETTINGS_STATIC_HANDLER_DEFINE()
changed settings_handler_stat type to settings_handler_static type
removed NULL declarations
renamed bt_handler to bt_settingshandler, as bt_handler already exists.
renamed all bt_XXX_handler to bt_xxx_settingshandler to avoid any
overlap.
changed SETTINGS_STATIC_HANDLER_DEFINE() to create variable names from
_hname by just prepending them with settings_handler_.
updated all bt_xxx_settings_handler to just bt_xxx.

Signed-off-by: Laczen JMS <laczenjms@gmail.com>
This commit is contained in:
Laczen JMS 2019-06-20 11:52:18 +02:00 committed by Carles Cufí
commit 5f19c8160a
8 changed files with 32 additions and 89 deletions

View file

@ -150,17 +150,29 @@ struct settings_handler_static {
};
/**
* Register a static handler for settings items
* Define a static handler for settings items
*
* @param _handler Structure containing registration info, this must be const
* The handler name in ROM needs to be unique, it is generated from
* _handler and the linenumber of SETTINGS_REGISTER_STATIC()
* @param _hname handler name
* @param _tree subtree name
* @param _get get routine (can be NULL)
* @param _set set routine (can be NULL)
* @param _commit commit routine (can be NULL)
* @param _export export routine (can be NULL)
*
* This createa a variable _hname prepended by settings_handler_.
*
*/
#define SETTINGS_STATIC_HANDLER_DEFINE(_handler) \
const Z_STRUCT_SECTION_ITERABLE(settings_handler_static, \
_CONCAT(_handler, __LINE__))\
= _handler
#define SETTINGS_STATIC_HANDLER_DEFINE(_hname, _tree, _get, _set, _commit, \
_export) \
const Z_STRUCT_SECTION_ITERABLE(settings_handler_static, \
settings_handler_ ## _hname) = { \
.name = _tree, \
.h_get = _get, \
.h_set = _set, \
.h_commit = _commit, \
.h_export = _export, \
}
/**
* Initialization of settings and backend