[rtems commit] score: Delete _Chain_Prepend()

Sebastian Huber sebh at rtems.org
Wed Apr 6 08:32:11 UTC 2016


Module:    rtems
Branch:    master
Commit:    6406b693b612bc6cbb7e3d55ae48ba7c55716659
Changeset: http://git.rtems.org/rtems/commit/?id=6406b693b612bc6cbb7e3d55ae48ba7c55716659

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Mon Apr  4 06:52:55 2016 +0200

score: Delete _Chain_Prepend()

This function is not used in the score.

Update #2555.

---

 cpukit/sapi/Makefile.am                          |  2 +-
 cpukit/sapi/include/rtems/chain.h                | 10 ------
 cpukit/sapi/src/{chainsmp.c => chainprotected.c} | 39 +++++++++++++-----------
 cpukit/score/include/rtems/score/chainimpl.h     | 19 ------------
 4 files changed, 22 insertions(+), 48 deletions(-)

diff --git a/cpukit/sapi/Makefile.am b/cpukit/sapi/Makefile.am
index edfdfc1..8970e3d 100644
--- a/cpukit/sapi/Makefile.am
+++ b/cpukit/sapi/Makefile.am
@@ -35,7 +35,7 @@ libsapi_a_SOURCES = src/extension.c src/extensioncreate.c \
     src/chainappendnotify.c src/chaingetnotify.c src/chaingetwait.c \
     src/chainprependnotify.c src/rbheap.c src/interrtext.c \
     src/fatal2.c src/fatalsrctext.c
-libsapi_a_SOURCES += src/chainsmp.c
+libsapi_a_SOURCES += src/chainprotected.c
 libsapi_a_SOURCES += src/cpucounterconverter.c
 libsapi_a_SOURCES += src/delayticks.c
 libsapi_a_SOURCES += src/delaynano.c
diff --git a/cpukit/sapi/include/rtems/chain.h b/cpukit/sapi/include/rtems/chain.h
index 4d586ff..ba8cd32 100644
--- a/cpukit/sapi/include/rtems/chain.h
+++ b/cpukit/sapi/include/rtems/chain.h
@@ -718,20 +718,10 @@ RTEMS_INLINE_ROUTINE void rtems_chain_append_unprotected(
  * NOTE: It disables interrupts to ensure the atomicity of the
  *       prepend operation.
  */
-#if defined( RTEMS_SMP )
 void rtems_chain_prepend(
   rtems_chain_control *the_chain,
   rtems_chain_node    *the_node
 );
-#else
-RTEMS_INLINE_ROUTINE void rtems_chain_prepend(
-  rtems_chain_control *the_chain,
-  rtems_chain_node    *the_node
-)
-{
-  _Chain_Prepend( the_chain, the_node );
-}
-#endif
 
 /** 
  * @brief Prepend a node (unprotected).
diff --git a/cpukit/sapi/src/chainsmp.c b/cpukit/sapi/src/chainprotected.c
similarity index 72%
rename from cpukit/sapi/src/chainsmp.c
rename to cpukit/sapi/src/chainprotected.c
index a3da213..ce8bc5e 100644
--- a/cpukit/sapi/src/chainsmp.c
+++ b/cpukit/sapi/src/chainprotected.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013-2014 embedded brains GmbH.  All rights reserved.
+ * Copyright (c) 2013, 2016 embedded brains GmbH.  All rights reserved.
  *
  *  embedded brains GmbH
  *  Dornierstr. 4
@@ -17,26 +17,25 @@
 #endif
 
 #include <rtems/chain.h>
+#include <rtems/rtems/intr.h>
 
-#if defined( RTEMS_SMP )
-
-#include <rtems/score/smplock.h>
-
-static SMP_lock_Control chain_lock = SMP_LOCK_INITIALIZER("chains");
+RTEMS_INTERRUPT_LOCK_DEFINE( static, chain_lock, "Chains" )
 
-static void chain_acquire( SMP_lock_Context *lock_context )
+static void chain_acquire( rtems_interrupt_lock_context *lock_context )
 {
-  _SMP_lock_ISR_disable_and_acquire( &chain_lock, lock_context );
+  rtems_interrupt_lock_acquire( &chain_lock, lock_context );
 }
 
-static void chain_release( SMP_lock_Context *lock_context )
+static void chain_release( rtems_interrupt_lock_context *lock_context )
 {
-  _SMP_lock_Release_and_ISR_enable( &chain_lock, lock_context );
+  rtems_interrupt_lock_release( &chain_lock, lock_context );
 }
 
+#if defined( RTEMS_SMP )
+
 void rtems_chain_extract( rtems_chain_node *node )
 {
-  SMP_lock_Context lock_context;
+  rtems_interrupt_lock_context lock_context;
 
   chain_acquire( &lock_context );
   _Chain_Extract_unprotected( node );
@@ -46,7 +45,7 @@ void rtems_chain_extract( rtems_chain_node *node )
 rtems_chain_node *rtems_chain_get( rtems_chain_control *chain )
 {
   rtems_chain_node *node;
-  SMP_lock_Context lock_context;
+  rtems_interrupt_lock_context lock_context;
 
   chain_acquire( &lock_context );
   node = _Chain_Get_unprotected( chain );
@@ -57,7 +56,7 @@ rtems_chain_node *rtems_chain_get( rtems_chain_control *chain )
 
 void rtems_chain_insert( rtems_chain_node *after_node, rtems_chain_node *node )
 {
-  SMP_lock_Context lock_context;
+  rtems_interrupt_lock_context lock_context;
 
   chain_acquire( &lock_context );
   _Chain_Insert_unprotected( after_node, node );
@@ -69,32 +68,36 @@ void rtems_chain_append(
   rtems_chain_node *node
 )
 {
-  SMP_lock_Context lock_context;
+  rtems_interrupt_lock_context lock_context;
 
   chain_acquire( &lock_context );
   _Chain_Append_unprotected( chain, node );
   chain_release( &lock_context );
 }
 
+#endif /* defined( RTEMS_SMP ) */
+
 void rtems_chain_prepend(
   rtems_chain_control *chain,
   rtems_chain_node *node
 )
 {
-  SMP_lock_Context lock_context;
+  rtems_interrupt_lock_context lock_context;
 
   chain_acquire( &lock_context );
   _Chain_Prepend_unprotected( chain, node );
   chain_release( &lock_context );
 }
 
+#if defined( RTEMS_SMP )
+
 bool rtems_chain_append_with_empty_check(
   rtems_chain_control *chain,
   rtems_chain_node *node
 )
 {
   bool was_empty;
-  SMP_lock_Context lock_context;
+  rtems_interrupt_lock_context lock_context;
 
   chain_acquire( &lock_context );
   was_empty = _Chain_Append_with_empty_check_unprotected( chain, node );
@@ -109,7 +112,7 @@ bool rtems_chain_prepend_with_empty_check(
 )
 {
   bool was_empty;
-  SMP_lock_Context lock_context;
+  rtems_interrupt_lock_context lock_context;
 
   chain_acquire( &lock_context );
   was_empty = _Chain_Prepend_with_empty_check_unprotected( chain, node );
@@ -124,7 +127,7 @@ bool rtems_chain_get_with_empty_check(
 )
 {
   bool is_empty_now;
-  SMP_lock_Context lock_context;
+  rtems_interrupt_lock_context lock_context;
 
   chain_acquire( &lock_context );
   is_empty_now = _Chain_Get_with_empty_check_unprotected( chain, node );
diff --git a/cpukit/score/include/rtems/score/chainimpl.h b/cpukit/score/include/rtems/score/chainimpl.h
index 08cbab6..8b888a7 100644
--- a/cpukit/score/include/rtems/score/chainimpl.h
+++ b/cpukit/score/include/rtems/score/chainimpl.h
@@ -793,25 +793,6 @@ RTEMS_INLINE_ROUTINE void _Chain_Prepend_unprotected(
 }
 
 /**
- * @brief Prepend a node (protected).
- *
- * This routine prepends the_node onto the front of the_chain.
- *
- * @param[in] the_chain is the chain to be operated upon.
- * @param[in] the_node is the node to be prepended.
- *
- * @note It disables interrupts to ensure the atomicity of the
- *       prepend operation.
- */
-RTEMS_INLINE_ROUTINE void _Chain_Prepend(
-  Chain_Control *the_chain,
-  Chain_Node    *the_node
-)
-{
-  _Chain_Insert(_Chain_Head(the_chain), the_node);
-}
-
-/**
  * @brief Append a node and check if the chain was empty before (unprotected).
  *
  * This routine appends the_node onto the end of the_chain.



More information about the vc mailing list