1 /*
2  * Copyright (c) 2018 Nordic Semiconductor ASA
3  * Copyright (c) 2015 Runtime Inc
4  *
5  * SPDX-License-Identifier: Apache-2.0
6  */
7 
8 #include <string.h>
9 #include <stdio.h>
10 #include <stdbool.h>
11 
12 #include <errno.h>
13 
14 #include "settings/settings.h"
15 #include "settings/settings_file.h"
16 #include <zephyr.h>
17 
18 
19 bool settings_subsys_initialized;
20 
21 void settings_init(void);
22 
23 int settings_backend_init(void);
24 
settings_subsys_init(void)25 int settings_subsys_init(void)
26 {
27 
28 	int err = 0;
29 
30 	if (settings_subsys_initialized) {
31 		return 0;
32 	}
33 
34 	settings_init();
35 
36 	err = settings_backend_init(); /* func rises kernel panic once error */
37 
38 	if (!err) {
39 		settings_subsys_initialized = true;
40 	}
41 
42 	return err;
43 }
44