kernel: Delimiting the scope of some variables
According with MISRA-C an object should be defined in a block scope if it is used in a single function. MISRA-C rule 8.9 Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
This commit is contained in:
parent
4369363f6c
commit
ac14685211
4 changed files with 20 additions and 16 deletions
|
@ -17,14 +17,6 @@ extern struct device __device_POST_KERNEL_start[];
|
||||||
extern struct device __device_APPLICATION_start[];
|
extern struct device __device_APPLICATION_start[];
|
||||||
extern struct device __device_init_end[];
|
extern struct device __device_init_end[];
|
||||||
|
|
||||||
static struct device *config_levels[] = {
|
|
||||||
__device_PRE_KERNEL_1_start,
|
|
||||||
__device_PRE_KERNEL_2_start,
|
|
||||||
__device_POST_KERNEL_start,
|
|
||||||
__device_APPLICATION_start,
|
|
||||||
/* End marker */
|
|
||||||
__device_init_end,
|
|
||||||
};
|
|
||||||
|
|
||||||
#ifdef CONFIG_DEVICE_POWER_MANAGEMENT
|
#ifdef CONFIG_DEVICE_POWER_MANAGEMENT
|
||||||
extern u32_t __device_busy_start[];
|
extern u32_t __device_busy_start[];
|
||||||
|
@ -46,6 +38,14 @@ extern u32_t __device_busy_end[];
|
||||||
void _sys_device_do_config_level(s32_t level)
|
void _sys_device_do_config_level(s32_t level)
|
||||||
{
|
{
|
||||||
struct device *info;
|
struct device *info;
|
||||||
|
static struct device *config_levels[] = {
|
||||||
|
__device_PRE_KERNEL_1_start,
|
||||||
|
__device_PRE_KERNEL_2_start,
|
||||||
|
__device_POST_KERNEL_start,
|
||||||
|
__device_APPLICATION_start,
|
||||||
|
/* End marker */
|
||||||
|
__device_init_end,
|
||||||
|
};
|
||||||
|
|
||||||
for (info = config_levels[level]; info < config_levels[level+1];
|
for (info = config_levels[level]; info < config_levels[level+1];
|
||||||
info++) {
|
info++) {
|
||||||
|
|
|
@ -43,10 +43,8 @@ LOG_MODULE_REGISTER(kernel);
|
||||||
#if defined(CONFIG_BOOT_DELAY) && CONFIG_BOOT_DELAY > 0
|
#if defined(CONFIG_BOOT_DELAY) && CONFIG_BOOT_DELAY > 0
|
||||||
#define BOOT_DELAY_BANNER " (delayed boot " \
|
#define BOOT_DELAY_BANNER " (delayed boot " \
|
||||||
STRINGIFY(CONFIG_BOOT_DELAY) "ms)"
|
STRINGIFY(CONFIG_BOOT_DELAY) "ms)"
|
||||||
static const unsigned int boot_delay = CONFIG_BOOT_DELAY;
|
|
||||||
#else
|
#else
|
||||||
#define BOOT_DELAY_BANNER ""
|
#define BOOT_DELAY_BANNER ""
|
||||||
static const unsigned int boot_delay;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef BUILD_VERSION
|
#ifdef BUILD_VERSION
|
||||||
|
@ -199,6 +197,12 @@ static void bg_thread_main(void *unused1, void *unused2, void *unused3)
|
||||||
ARG_UNUSED(unused2);
|
ARG_UNUSED(unused2);
|
||||||
ARG_UNUSED(unused3);
|
ARG_UNUSED(unused3);
|
||||||
|
|
||||||
|
#if defined(CONFIG_BOOT_DELAY) && CONFIG_BOOT_DELAY > 0
|
||||||
|
static const unsigned int boot_delay = CONFIG_BOOT_DELAY;
|
||||||
|
#else
|
||||||
|
static const unsigned int boot_delay;
|
||||||
|
#endif
|
||||||
|
|
||||||
_sys_device_do_config_level(_SYS_INIT_LEVEL_POST_KERNEL);
|
_sys_device_do_config_level(_SYS_INIT_LEVEL_POST_KERNEL);
|
||||||
#if CONFIG_STACK_POINTER_RANDOM
|
#if CONFIG_STACK_POINTER_RANDOM
|
||||||
z_stack_adjust_initialized = 1;
|
z_stack_adjust_initialized = 1;
|
||||||
|
|
|
@ -26,9 +26,6 @@ struct k_mbox_async {
|
||||||
struct k_mbox_msg tx_msg; /* transmit message descriptor */
|
struct k_mbox_msg tx_msg; /* transmit message descriptor */
|
||||||
};
|
};
|
||||||
|
|
||||||
/* array of asynchronous message descriptors */
|
|
||||||
static struct k_mbox_async __noinit async_msg[CONFIG_NUM_MBOX_ASYNC_MSGS];
|
|
||||||
|
|
||||||
/* stack of unused asynchronous message descriptors */
|
/* stack of unused asynchronous message descriptors */
|
||||||
K_STACK_DEFINE(async_msg_free, CONFIG_NUM_MBOX_ASYNC_MSGS);
|
K_STACK_DEFINE(async_msg_free, CONFIG_NUM_MBOX_ASYNC_MSGS);
|
||||||
|
|
||||||
|
@ -63,6 +60,9 @@ static int init_mbox_module(struct device *dev)
|
||||||
{
|
{
|
||||||
ARG_UNUSED(dev);
|
ARG_UNUSED(dev);
|
||||||
|
|
||||||
|
/* array of asynchronous message descriptors */
|
||||||
|
static struct k_mbox_async __noinit async_msg[CONFIG_NUM_MBOX_ASYNC_MSGS];
|
||||||
|
|
||||||
#if (CONFIG_NUM_MBOX_ASYNC_MSGS > 0)
|
#if (CONFIG_NUM_MBOX_ASYNC_MSGS > 0)
|
||||||
/*
|
/*
|
||||||
* Create pool of asynchronous message descriptors.
|
* Create pool of asynchronous message descriptors.
|
||||||
|
|
|
@ -45,9 +45,6 @@ struct k_pipe *_trace_list_k_pipe;
|
||||||
|
|
||||||
#if (CONFIG_NUM_PIPE_ASYNC_MSGS > 0)
|
#if (CONFIG_NUM_PIPE_ASYNC_MSGS > 0)
|
||||||
|
|
||||||
/* Array of asynchronous message descriptors */
|
|
||||||
static struct k_pipe_async __noinit async_msg[CONFIG_NUM_PIPE_ASYNC_MSGS];
|
|
||||||
|
|
||||||
/* stack of unused asynchronous message descriptors */
|
/* stack of unused asynchronous message descriptors */
|
||||||
K_STACK_DEFINE(pipe_async_msgs, CONFIG_NUM_PIPE_ASYNC_MSGS);
|
K_STACK_DEFINE(pipe_async_msgs, CONFIG_NUM_PIPE_ASYNC_MSGS);
|
||||||
|
|
||||||
|
@ -91,6 +88,9 @@ static int init_pipes_module(struct device *dev)
|
||||||
{
|
{
|
||||||
ARG_UNUSED(dev);
|
ARG_UNUSED(dev);
|
||||||
|
|
||||||
|
/* Array of asynchronous message descriptors */
|
||||||
|
static struct k_pipe_async __noinit async_msg[CONFIG_NUM_PIPE_ASYNC_MSGS];
|
||||||
|
|
||||||
#if (CONFIG_NUM_PIPE_ASYNC_MSGS > 0)
|
#if (CONFIG_NUM_PIPE_ASYNC_MSGS > 0)
|
||||||
/*
|
/*
|
||||||
* Create pool of asynchronous pipe message descriptors.
|
* Create pool of asynchronous pipe message descriptors.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue