[PATCH 2/4] score: Modify _Thread_Dispatch_disable_critical()

Sebastian Huber sebastian.huber at embedded-brains.de
Mon Apr 20 13:45:04 UTC 2015


Return the current processor to be in line with
_Thread_Disable_dispatch().
---
 cpukit/score/include/rtems/score/objectimpl.h     |  4 ++--
 cpukit/score/include/rtems/score/threaddispatch.h | 16 +++++++++-------
 2 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/cpukit/score/include/rtems/score/objectimpl.h b/cpukit/score/include/rtems/score/objectimpl.h
index a96dc20..cf14c2d 100644
--- a/cpukit/score/include/rtems/score/objectimpl.h
+++ b/cpukit/score/include/rtems/score/objectimpl.h
@@ -674,9 +674,9 @@ _Objects_Release_and_thread_dispatch_disable(
   ISR_lock_Context *lock_context
 )
 {
-  Per_CPU_Control *cpu_self = _Per_CPU_Get();
+  Per_CPU_Control *cpu_self;
 
-  _Thread_Dispatch_disable_critical( cpu_self );
+  cpu_self = _Thread_Dispatch_disable_critical();
   _Objects_Release_and_ISR_enable( the_object, lock_context );
 
   return cpu_self;
diff --git a/cpukit/score/include/rtems/score/threaddispatch.h b/cpukit/score/include/rtems/score/threaddispatch.h
index f8c3611..89f5c0b 100644
--- a/cpukit/score/include/rtems/score/threaddispatch.h
+++ b/cpukit/score/include/rtems/score/threaddispatch.h
@@ -242,16 +242,19 @@ void _Thread_Do_dispatch( Per_CPU_Control *cpu_self, ISR_Level level );
  *
  * This function does not acquire the Giant lock.
  *
- * @param[in] cpu_self The current processor.
+ * @return The current processor.
  */
-RTEMS_INLINE_ROUTINE void _Thread_Dispatch_disable_critical(
-  Per_CPU_Control *cpu_self
-)
+RTEMS_INLINE_ROUTINE Per_CPU_Control *_Thread_Dispatch_disable_critical( void )
 {
-  uint32_t disable_level = cpu_self->thread_dispatch_disable_level;
+  Per_CPU_Control *cpu_self;
+  uint32_t         disable_level;
 
+  cpu_self = _Per_CPU_Get();
+  disable_level = cpu_self->thread_dispatch_disable_level;
   _Profiling_Thread_dispatch_disable( cpu_self, disable_level );
   cpu_self->thread_dispatch_disable_level = disable_level + 1;
+
+  return cpu_self;
 }
 
 /**
@@ -271,8 +274,7 @@ RTEMS_INLINE_ROUTINE Per_CPU_Control *_Thread_Dispatch_disable( void )
   _ISR_Disable_without_giant( level );
 #endif
 
-  cpu_self = _Per_CPU_Get();
-  _Thread_Dispatch_disable_critical( cpu_self );
+  cpu_self = _Thread_Dispatch_disable_critical();
 
 #if defined( RTEMS_SMP ) || defined( RTEMS_PROFILING )
   _ISR_Enable_without_giant( level );
-- 
1.8.4.5




More information about the devel mailing list