[PATCH 06/12] score: Simplify _Thread_Create_idle()

Sebastian Huber sebastian.huber at embedded-brains.de
Wed Jun 12 15:12:32 UTC 2013


---
 cpukit/score/src/threadcreateidle.c |   34 +++++++++++-----------------------
 1 files changed, 11 insertions(+), 23 deletions(-)

diff --git a/cpukit/score/src/threadcreateidle.c b/cpukit/score/src/threadcreateidle.c
index e588657..11460e0 100644
--- a/cpukit/score/src/threadcreateidle.c
+++ b/cpukit/score/src/threadcreateidle.c
@@ -31,21 +31,13 @@
 #include <rtems/score/threadq.h>
 #include <rtems/score/wkspace.h>
 #include <rtems/config.h>
-#if defined(RTEMS_SMP)
-  #include <rtems/score/smp.h>
-#endif
 
-static inline void _Thread_Create_idle_helper(
-  uint32_t name_u32,
-  int      cpu
-)
+static void _Thread_Create_idle_for_cpu( Per_CPU_Control *per_cpu )
 {
-  Per_CPU_Control *per_cpu;
-  Objects_Name     name;
-  Thread_Control  *idle;
+  Objects_Name    name;
+  Thread_Control *idle;
 
-  per_cpu = &_Per_CPU_Information[ cpu ];
-  name.name_u32 = name_u32;
+  name.name_u32 = _Objects_Build_name( 'I', 'D', 'L', 'E' );
 
   /*
    *  The entire workspace is zeroed during its initialization.  Thus, all
@@ -86,16 +78,12 @@ static inline void _Thread_Create_idle_helper(
 
 void _Thread_Create_idle( void )
 {
-  #if defined(RTEMS_SMP)
-    int cpu;
+  uint32_t processor_count = _Processors_Count;
+  uint32_t processor;
+
+  for ( processor = 0 ; processor < processor_count ; ++processor ) {
+    Per_CPU_Control *per_cpu = &_Per_CPU_Information[ processor ];
 
-    for ( cpu=0 ; cpu < _Processors_Count ; cpu++ ) {
-      _Thread_Create_idle_helper(
-        _Objects_Build_name( 'I', 'D', 'L', 'E' ),
-        cpu
-      );
-    }
-  #else
-    _Thread_Create_idle_helper(_Objects_Build_name( 'I', 'D', 'L', 'E' ), 0);
-  #endif
+    _Thread_Create_idle_for_cpu( per_cpu );
+  }
 }
-- 
1.7.7




More information about the devel mailing list