diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2016-04-18 17:21:43 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2016-04-21 07:29:39 +0200 |
commit | b8bdced14d82d07965a6fa45bb80687420bdbd8a (patch) | |
tree | 751836b60c1e49e7d6befe2ace73085b3d1d373e /cpukit/posix/src/mutexsetprioceiling.c | |
parent | beba41b504fcd1415cb89d86902692abe3e79501 (diff) |
posix: Simplify _POSIX_Mutex_Get_interrupt_disable
Remove superfluous location parameter.
Diffstat (limited to 'cpukit/posix/src/mutexsetprioceiling.c')
-rw-r--r-- | cpukit/posix/src/mutexsetprioceiling.c | 55 |
1 files changed, 18 insertions, 37 deletions
diff --git a/cpukit/posix/src/mutexsetprioceiling.c b/cpukit/posix/src/mutexsetprioceiling.c index 718bfc4167..1f9f5164bb 100644 --- a/cpukit/posix/src/mutexsetprioceiling.c +++ b/cpukit/posix/src/mutexsetprioceiling.c @@ -18,14 +18,7 @@ #include "config.h" #endif -#include <errno.h> -#include <pthread.h> - -#include <rtems/system.h> -#include <rtems/score/coremuteximpl.h> -#include <rtems/score/watchdog.h> #include <rtems/posix/muteximpl.h> -#include <rtems/posix/priorityimpl.h> /* * 13.6.2 Change the Priority Ceiling of a Mutex, P1003.1c/Draft 10, p. 131 @@ -38,7 +31,6 @@ int pthread_mutex_setprioceiling( ) { register POSIX_Mutex_Control *the_mutex; - Objects_Locations location; Priority_Control the_priority; ISR_lock_Context lock_context; @@ -64,36 +56,25 @@ int pthread_mutex_setprioceiling( * NOTE: This makes it easier to get 100% binary coverage since the * bad Id case is handled by the switch. */ - the_mutex = _POSIX_Mutex_Get_interrupt_disable( - mutex, - &location, - &lock_context - ); - switch ( location ) { - - case OBJECTS_LOCAL: - *old_ceiling = _POSIX_Priority_From_core( - the_mutex->Mutex.Attributes.priority_ceiling - ); - the_mutex->Mutex.Attributes.priority_ceiling = the_priority; - /* - * We are required to unlock the mutex before we return. - */ - _CORE_mutex_Surrender( - &the_mutex->Mutex, - NULL, - 0, - &lock_context - ); + the_mutex = _POSIX_Mutex_Get_interrupt_disable( mutex, &lock_context ); - return 0; - -#if defined(RTEMS_MULTIPROCESSING) - case OBJECTS_REMOTE: /* impossible to get here */ -#endif - case OBJECTS_ERROR: - break; + if ( the_mutex == NULL ) { + return EINVAL; } - return EINVAL; + *old_ceiling = _POSIX_Priority_From_core( + the_mutex->Mutex.Attributes.priority_ceiling + ); + the_mutex->Mutex.Attributes.priority_ceiling = the_priority; + + /* + * We are required to unlock the mutex before we return. + */ + _CORE_mutex_Surrender( + &the_mutex->Mutex, + NULL, + 0, + &lock_context + ); + return 0; } |