Backend initialization code has been moved from common settings_init.c to proper backend source files. Missing static specifiers have been added. Minor cleanup has been done to source files: exported functions have been moved to the end of source files and definitions of static variables, that are used by only a single function, have been moved from global scope into functions that use them. Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
44 lines
661 B
C
44 lines
661 B
C
/*
|
|
* Copyright (c) 2018 Nordic Semiconductor ASA
|
|
* Copyright (c) 2015 Runtime Inc
|
|
*
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
|
|
#include <string.h>
|
|
#include <stdio.h>
|
|
#include <stdbool.h>
|
|
|
|
#include <errno.h>
|
|
|
|
#include "settings/settings.h"
|
|
#include "settings/settings_file.h"
|
|
#include <zephyr.h>
|
|
|
|
|
|
bool settings_subsys_initialized;
|
|
|
|
void settings_init(void);
|
|
|
|
int settings_backend_init(void);
|
|
|
|
int settings_subsys_init(void)
|
|
{
|
|
|
|
int err = 0;
|
|
|
|
if (settings_subsys_initialized) {
|
|
return 0;
|
|
}
|
|
|
|
settings_init();
|
|
|
|
err = settings_backend_init(); /* func rises kernel panic once error */
|
|
|
|
if (!err) {
|
|
settings_subsys_initialized = true;
|
|
}
|
|
|
|
return err;
|
|
}
|