diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2020-04-13 19:29:35 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2020-04-14 07:19:53 +0200 |
commit | fb07f730c1dd400b6d2f79a5393ff5e3cdded73e (patch) | |
tree | 5dab6cb6049e3ec82afeb109345af064ed394344 /cpukit/score | |
parent | d35722e66c68ee2bbdbe14d8d30fa8f3a02da993 (diff) |
score: Return status in _TOD_Set()
Update #3949.
Diffstat (limited to 'cpukit/score')
-rw-r--r-- | cpukit/score/src/coretodhookrun.c | 30 | ||||
-rw-r--r-- | cpukit/score/src/coretodset.c | 12 |
2 files changed, 23 insertions, 19 deletions
diff --git a/cpukit/score/src/coretodhookrun.c b/cpukit/score/src/coretodhookrun.c index ae9cf66dfc..c0acc6e5fb 100644 --- a/cpukit/score/src/coretodhookrun.c +++ b/cpukit/score/src/coretodhookrun.c @@ -42,31 +42,35 @@ #include <rtems/score/assert.h> #include <rtems/score/chainimpl.h> -bool _TOD_Hook_Run( +Status_Control _TOD_Hook_Run( TOD_Action action, const struct timespec *tod ) { - Chain_Node *the_node; - bool retval = true; + const Chain_Node *the_node; + Status_Control status; + + status = STATUS_SUCCESSFUL; /* * This is assumed to be called only from _TOD_Set() which is supposed - * to be called only while holding the TOD lock. + * to be called only while holding the TOD lock. */ _Assert( _TOD_Is_owner() ); - for ( the_node = _Chain_First( &_TOD_Hooks ); - !_Chain_Is_tail( &_TOD_Hooks, the_node ) ; - the_node = the_node->next ) { - TOD_Hook *the_hook = (TOD_Hook *) the_node; - - retval = (the_hook->handler)( action, tod ); - if ( retval == false ) { + for ( + the_node = _Chain_Immutable_first( &_TOD_Hooks ); + !_Chain_Is_tail( &_TOD_Hooks, the_node ); + the_node = _Chain_Immutable_next( the_node ) + ) { + const TOD_Hook *the_hook; + + the_hook = (const TOD_Hook *) the_node; + status = ( *the_hook->handler )( action, tod ); + if ( status != STATUS_SUCCESSFUL ) { break; } } - return retval; + return status; } - diff --git a/cpukit/score/src/coretodset.c b/cpukit/score/src/coretodset.c index 94ecd0b322..ed840ece2b 100644 --- a/cpukit/score/src/coretodset.c +++ b/cpukit/score/src/coretodset.c @@ -22,7 +22,7 @@ #include <rtems/score/assert.h> #include <rtems/score/watchdogimpl.h> -bool _TOD_Set( +Status_Control _TOD_Set( const struct timespec *tod, ISR_lock_Context *lock_context ) @@ -31,14 +31,14 @@ bool _TOD_Set( uint64_t tod_as_ticks; uint32_t cpu_max; uint32_t cpu_index; - bool retval; + Status_Control status; _Assert( _TOD_Is_owner() ); - retval = _TOD_Hook_Run( TOD_ACTION_SET_CLOCK, tod ); - if ( retval == false ) { + status = _TOD_Hook_Run( TOD_ACTION_SET_CLOCK, tod ); + if ( status != STATUS_SUCCESSFUL ) { _TOD_Release( lock_context ); - return false; + return status; } timespec2bintime( tod, &tod_as_bintime ); @@ -75,5 +75,5 @@ bool _TOD_Set( _TOD.is_set = true; - return true; + return STATUS_SUCCESSFUL; } |