From 74d22fd1a9633efe12a7a9c6b7662d80c0185f87 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Thu, 22 Nov 2012 13:03:09 +0100 Subject: score: Inline _API_extensions_Run_postswitch() The _API_extensions_Run_postswitch() function is only used in _Thread_Dispatch(). Avoid superfluous load of _Thread_Executing. --- cpukit/score/include/rtems/score/apiext.h | 16 +++++++++++++++- cpukit/score/src/apiext.c | 19 ------------------- cpukit/score/src/threaddispatch.c | 2 +- 3 files changed, 16 insertions(+), 21 deletions(-) diff --git a/cpukit/score/include/rtems/score/apiext.h b/cpukit/score/include/rtems/score/apiext.h index 514e4bab95..afd828ca38 100644 --- a/cpukit/score/include/rtems/score/apiext.h +++ b/cpukit/score/include/rtems/score/apiext.h @@ -130,7 +130,21 @@ void _API_extensions_Run_postdriver( void ); * * This routine executes all of the post context switch callouts. */ -void _API_extensions_Run_postswitch( void ); +static inline void _API_extensions_Run_postswitch( Thread_Control *executing ) +{ + const Chain_Control *chain = &_API_extensions_List; + const Chain_Node *tail = _Chain_Immutable_tail( chain ); + const Chain_Node *node = _Chain_Immutable_first( chain ); + + while ( node != tail ) { + const API_extensions_Control *extension = + (const API_extensions_Control *) node; + + (*extension->postswitch_hook)( executing ); + + node = _Chain_Immutable_next( node ); + } +} /**@}*/ diff --git a/cpukit/score/src/apiext.c b/cpukit/score/src/apiext.c index 51b94515e3..b2ca87cba2 100644 --- a/cpukit/score/src/apiext.c +++ b/cpukit/score/src/apiext.c @@ -84,23 +84,4 @@ void _API_extensions_Run_postdriver( void ) } } -/* - * _API_extensions_Run_postswitch - */ - -void _API_extensions_Run_postswitch( void ) -{ - Chain_Node *the_node; - API_extensions_Control *the_extension; - - for ( the_node = _Chain_First( &_API_extensions_List ); - !_Chain_Is_tail( &_API_extensions_List, the_node ) ; - the_node = the_node->next ) { - - the_extension = (API_extensions_Control *) the_node; - - (*the_extension->postswitch_hook)( _Thread_Executing ); - } -} - /* end of file */ diff --git a/cpukit/score/src/threaddispatch.c b/cpukit/score/src/threaddispatch.c index db1f1043f2..f3d67b480e 100644 --- a/cpukit/score/src/threaddispatch.c +++ b/cpukit/score/src/threaddispatch.c @@ -211,5 +211,5 @@ post_switch: _Thread_Unnest_dispatch(); #endif - _API_extensions_Run_postswitch(); + _API_extensions_Run_postswitch( executing ); } -- cgit v1.2.3