From 7e685d6b366655851392950eae3fc74253ccb667 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Kijewski?= Date: Fri, 7 Feb 2014 21:14:02 +0100 Subject: [PATCH] Do not zero out sched_threads needlessly The function sched_init() zeroes out sched_threads needlessly. All static variables can be assumed to be initialized with zero, anyways. The C standard mandates it, and all at other places in the code it is assumed. --- core/include/sched.h | 5 ----- core/kernel_init.c | 2 -- core/sched.c | 26 +------------------------- 3 files changed, 1 insertion(+), 32 deletions(-) diff --git a/core/include/sched.h b/core/include/sched.h index 66f086d855..2d770b3c4e 100644 --- a/core/include/sched.h +++ b/core/include/sched.h @@ -34,11 +34,6 @@ #define SCHED_PRIO_LEVELS 16 #endif -/** - * @brief Initializes thread table, active thread information, and runqueues - */ -void sched_init(void); - /** * @brief Triggers the scheduler to schedule the next task */ diff --git a/core/kernel_init.c b/core/kernel_init.c index 8474ed19f9..0feb051ada 100644 --- a/core/kernel_init.c +++ b/core/kernel_init.c @@ -70,8 +70,6 @@ void kernel_init(void) dINT(); printf("kernel_init(): This is RIOT! (Version: %s)\n", VERSION); - sched_init(); - if (thread_create(idle_stack, sizeof(idle_stack), PRIORITY_IDLE, CREATE_WOUT_YIELD | CREATE_STACKTEST, idle_thread, idle_name) < 0) { printf("kernel_init(): error creating idle task.\n"); } diff --git a/core/sched.c b/core/sched.c index a9b085e624..e70069a41c 100644 --- a/core/sched.c +++ b/core/sched.c @@ -43,7 +43,7 @@ volatile unsigned int sched_context_switch_request; volatile tcb_t *sched_threads[MAXTHREADS]; volatile tcb_t *active_thread; -volatile int thread_pid; +volatile int thread_pid = -1; volatile int last_pid = -1; clist_node_t *runqueues[SCHED_PRIO_LEVELS]; @@ -54,30 +54,6 @@ static void (*sched_cb) (uint32_t timestamp, uint32_t value) = NULL; schedstat pidlist[MAXTHREADS]; #endif -void sched_init() -{ - printf("Scheduler..."); - int i; - - for (i = 0; i < MAXTHREADS; i++) { - sched_threads[i] = NULL; -#if SCHEDSTATISTICS - pidlist[i].laststart = 0; - pidlist[i].runtime_ticks = 0; - pidlist[i].schedules = 0; -#endif - } - - active_thread = NULL; - thread_pid = -1; - - for (i = 0; i < SCHED_PRIO_LEVELS; i++) { - runqueues[i] = NULL; - } - - printf("[OK]\n"); -} - void sched_run() { sched_context_switch_request = 0;