[PATCH 5/9] score: Simplify _CORE_mutex_Seize_interrupt_try*

Sebastian Huber sebastian.huber at embedded-brains.de
Wed Jun 5 15:22:03 UTC 2013


---
 cpukit/score/include/rtems/score/coremutex.h  |   16 ++++++++--------
 cpukit/score/inline/rtems/score/coremutex.inl |   14 +++++++-------
 cpukit/score/src/coremutexseizeintr.c         |    4 ++--
 3 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/cpukit/score/include/rtems/score/coremutex.h b/cpukit/score/include/rtems/score/coremutex.h
index 69babb9..10dfe06 100644
--- a/cpukit/score/include/rtems/score/coremutex.h
+++ b/cpukit/score/include/rtems/score/coremutex.h
@@ -281,7 +281,7 @@ CORE_mutex_Status _CORE_mutex_Initialize(
  *  available.
  *
  *  @param[in] the_mutex is the mutex to attempt to lock
- *  @param[in] level_p is the interrupt level holder
+ *  @param[in] level is the interrupt level
  *
  *  @retval This routine returns 0 if "trylock" can resolve whether or not
  *  the mutex is immediately obtained or there was an error attempting to
@@ -294,7 +294,7 @@ CORE_mutex_Status _CORE_mutex_Initialize(
 
 RTEMS_INLINE_ROUTINE int _CORE_mutex_Seize_interrupt_trylock_body(
   CORE_mutex_Control  *the_mutex,
-  ISR_Level           *level_p
+  ISR_Level            level
 );
 
 #if defined(__RTEMS_DO_NOT_INLINE_CORE_MUTEX_SEIZE__)
@@ -307,11 +307,11 @@ RTEMS_INLINE_ROUTINE int _CORE_mutex_Seize_interrupt_trylock_body(
    *  which makes it harder to get full binary test coverage.
    *
    *  @param[in] the_mutex will attempt to lock
-   *  @param[in] level_p is the interrupt level holder
+   *  @param[in] level_p is the interrupt level
    */
   int _CORE_mutex_Seize_interrupt_trylock(
     CORE_mutex_Control  *the_mutex,
-    ISR_Level           *level_p
+    ISR_Level            level
   );
 #else
   /**
@@ -319,10 +319,10 @@ RTEMS_INLINE_ROUTINE int _CORE_mutex_Seize_interrupt_trylock_body(
    *  a few instructions.  This is very important for mutex performance.
    *
    *  @param[in] _mutex will attempt to lock
-   *  @param[in] _level_p is the interrupt level holder
+   *  @param[in] _level is the interrupt level
    */
-  #define _CORE_mutex_Seize_interrupt_trylock( _mutex, _level_p ) \
-     _CORE_mutex_Seize_interrupt_trylock_body( _mutex, _level_p )
+  #define _CORE_mutex_Seize_interrupt_trylock( _mutex, _level ) \
+     _CORE_mutex_Seize_interrupt_trylock_body( _mutex, _level )
 #endif
 
 /**
@@ -394,7 +394,7 @@ void _CORE_mutex_Seize_interrupt_blocking(
            INTERNAL_ERROR_MUTEX_OBTAIN_FROM_BAD_STATE \
            ); \
     } \
-    if ( _CORE_mutex_Seize_interrupt_trylock( _the_mutex, &(_level) ) ) {  \
+    if ( _CORE_mutex_Seize_interrupt_trylock( _the_mutex, _level ) ) {  \
       if ( !(_wait) ) { \
         _ISR_Enable( _level ); \
         _Thread_Executing->Wait.return_code = \
diff --git a/cpukit/score/inline/rtems/score/coremutex.inl b/cpukit/score/inline/rtems/score/coremutex.inl
index f41a4de..d34a967 100644
--- a/cpukit/score/inline/rtems/score/coremutex.inl
+++ b/cpukit/score/inline/rtems/score/coremutex.inl
@@ -130,7 +130,7 @@ RTEMS_INLINE_ROUTINE bool _CORE_mutex_Is_priority_ceiling(
 
 RTEMS_INLINE_ROUTINE int _CORE_mutex_Seize_interrupt_trylock_body(
   CORE_mutex_Control  *the_mutex,
-  ISR_Level           *level_p
+  ISR_Level            level
 )
 {
   Thread_Control   *executing;
@@ -157,7 +157,7 @@ RTEMS_INLINE_ROUTINE int _CORE_mutex_Seize_interrupt_trylock_body(
     }
 
     if ( !_CORE_mutex_Is_priority_ceiling( &the_mutex->Attributes ) ) {
-      _ISR_Enable( *level_p );
+      _ISR_Enable( level );
       return 0;
     } /* else must be CORE_MUTEX_DISCIPLINES_PRIORITY_CEILING
        *
@@ -171,13 +171,13 @@ RTEMS_INLINE_ROUTINE int _CORE_mutex_Seize_interrupt_trylock_body(
       ceiling = the_mutex->Attributes.priority_ceiling;
       current = executing->current_priority;
       if ( current == ceiling ) {
-        _ISR_Enable( *level_p );
+        _ISR_Enable( level );
         return 0;
       }
 
       if ( current > ceiling ) {
         _Thread_Disable_dispatch();
-        _ISR_Enable( *level_p );
+        _ISR_Enable( level );
         _Thread_Change_priority(
           the_mutex->holder,
           the_mutex->Attributes.priority_ceiling,
@@ -191,7 +191,7 @@ RTEMS_INLINE_ROUTINE int _CORE_mutex_Seize_interrupt_trylock_body(
         the_mutex->lock       = CORE_MUTEX_UNLOCKED;
         the_mutex->nest_count = 0;     /* undo locking above */
         executing->resource_count--;   /* undo locking above */
-        _ISR_Enable( *level_p );
+        _ISR_Enable( level );
         return 0;
       }
     }
@@ -207,12 +207,12 @@ RTEMS_INLINE_ROUTINE int _CORE_mutex_Seize_interrupt_trylock_body(
     switch ( the_mutex->Attributes.lock_nesting_behavior ) {
       case CORE_MUTEX_NESTING_ACQUIRES:
         the_mutex->nest_count++;
-        _ISR_Enable( *level_p );
+        _ISR_Enable( level );
         return 0;
       #if defined(RTEMS_POSIX_API)
         case CORE_MUTEX_NESTING_IS_ERROR:
           executing->Wait.return_code = CORE_MUTEX_STATUS_NESTING_NOT_ALLOWED;
-          _ISR_Enable( *level_p );
+          _ISR_Enable( level );
           return 0;
       #endif
       case CORE_MUTEX_NESTING_BLOCKS:
diff --git a/cpukit/score/src/coremutexseizeintr.c b/cpukit/score/src/coremutexseizeintr.c
index 128e8c0..b3b7c96 100644
--- a/cpukit/score/src/coremutexseizeintr.c
+++ b/cpukit/score/src/coremutexseizeintr.c
@@ -28,9 +28,9 @@
 #if defined(__RTEMS_DO_NOT_INLINE_CORE_MUTEX_SEIZE__)
 int _CORE_mutex_Seize_interrupt_trylock(
   CORE_mutex_Control  *the_mutex,
-  ISR_Level           *level_p
+  ISR_Level            level
 )
 {
-  return _CORE_mutex_Seize_interrupt_trylock_body( the_mutex, level_p );
+  return _CORE_mutex_Seize_interrupt_trylock_body( the_mutex, level );
 }
 #endif
-- 
1.7.7




More information about the devel mailing list