Browse Source

misra: Fixes for MISRA-C rule 8.3

MISRA-C says all declarations of an object or function must use the
same name and qualifiers.

MISRA-C rule 8.3

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
pull/11966/head
Flavio Ceolin 7 years ago committed by Anas Nashif
parent
commit
118715c62d
  1. 10
      kernel/sched.c
  2. 6
      kernel/timeout.c
  3. 4
      kernel/timer.c
  4. 12
      kernel/userspace.c

10
kernel/sched.c

@ -80,7 +80,7 @@ static inline bool _is_idle(struct k_thread *thread)
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
return thread->base.is_idle; return thread->base.is_idle;
#else #else
extern struct k_thread * const _idle_thread; extern k_tid_t const _idle_thread;
return thread == _idle_thread; return thread == _idle_thread;
#endif #endif
@ -229,11 +229,11 @@ static void reset_time_slice(void)
z_set_timeout_expiry(slice_time, false); z_set_timeout_expiry(slice_time, false);
} }
void k_sched_time_slice_set(s32_t duration_in_ms, int prio) void k_sched_time_slice_set(s32_t slice, int prio)
{ {
LOCKED(&sched_lock) { LOCKED(&sched_lock) {
_current_cpu->slice_ticks = 0; _current_cpu->slice_ticks = 0;
slice_time = _ms_to_ticks(duration_in_ms); slice_time = _ms_to_ticks(slice);
slice_max_prio = prio; slice_max_prio = prio;
reset_time_slice(); reset_time_slice();
} }
@ -669,12 +669,12 @@ struct k_thread *_priq_mq_best(struct _priq_mq *pq)
return CONTAINER_OF(n, struct k_thread, base.qnode_dlist); return CONTAINER_OF(n, struct k_thread, base.qnode_dlist);
} }
int _unpend_all(_wait_q_t *waitq) int _unpend_all(_wait_q_t *wait_q)
{ {
int need_sched = 0; int need_sched = 0;
struct k_thread *th; struct k_thread *th;
while ((th = _waitq_head(waitq)) != NULL) { while ((th = _waitq_head(wait_q)) != NULL) {
_unpend_thread(th); _unpend_thread(th);
_ready_thread(th); _ready_thread(th);
need_sched = 1; need_sched = 1;

6
kernel/timeout.c

@ -105,18 +105,18 @@ int _abort_timeout(struct _timeout *to)
return ret; return ret;
} }
s32_t z_timeout_remaining(struct _timeout *to) s32_t z_timeout_remaining(struct _timeout *timeout)
{ {
s32_t ticks = 0; s32_t ticks = 0;
if (to->dticks == _INACTIVE) { if (timeout->dticks == _INACTIVE) {
return 0; return 0;
} }
LOCKED(&timeout_lock) { LOCKED(&timeout_lock) {
for (struct _timeout *t = first(); t != NULL; t = next(t)) { for (struct _timeout *t = first(); t != NULL; t = next(t)) {
ticks += t->dticks; ticks += t->dticks;
if (to == t) { if (timeout == t) {
break; break;
} }
} }

4
kernel/timer.c

@ -93,8 +93,8 @@ void _timer_expiration_handler(struct _timeout *t)
void k_timer_init(struct k_timer *timer, void k_timer_init(struct k_timer *timer,
void (*expiry_fn)(struct k_timer *t), k_timer_expiry_t expiry_fn,
void (*stop_fn)(struct k_timer *t)) k_timer_stop_t stop_fn)
{ {
timer->expiry_fn = expiry_fn; timer->expiry_fn = expiry_fn;
timer->stop_fn = stop_fn; timer->stop_fn = stop_fn;

12
kernel/userspace.c

@ -547,7 +547,7 @@ int _k_object_validate(struct _k_object *ko, enum k_objects otype,
return 0; return 0;
} }
void _k_object_init(void *object) void _k_object_init(void *obj)
{ {
struct _k_object *ko; struct _k_object *ko;
@ -559,7 +559,7 @@ void _k_object_init(void *object)
* finalizes it * finalizes it
*/ */
ko = _k_object_find(object); ko = _k_object_find(obj);
if (ko == NULL) { if (ko == NULL) {
/* Supervisor threads can ignore rules about kernel objects /* Supervisor threads can ignore rules about kernel objects
* and may declare them on stacks, etc. Such objects will never * and may declare them on stacks, etc. Such objects will never
@ -572,9 +572,9 @@ void _k_object_init(void *object)
ko->flags |= K_OBJ_FLAG_INITIALIZED; ko->flags |= K_OBJ_FLAG_INITIALIZED;
} }
void _k_object_recycle(void *object) void _k_object_recycle(void *obj)
{ {
struct _k_object *ko = _k_object_find(object); struct _k_object *ko = _k_object_find(obj);
if (ko != NULL) { if (ko != NULL) {
(void)memset(ko->perms, 0, sizeof(ko->perms)); (void)memset(ko->perms, 0, sizeof(ko->perms));
@ -583,12 +583,12 @@ void _k_object_recycle(void *object)
} }
} }
void _k_object_uninit(void *object) void _k_object_uninit(void *obj)
{ {
struct _k_object *ko; struct _k_object *ko;
/* See comments in _k_object_init() */ /* See comments in _k_object_init() */
ko = _k_object_find(object); ko = _k_object_find(obj);
if (ko == NULL) { if (ko == NULL) {
return; return;
} }

Loading…
Cancel
Save