[PATCH 08/15] score: Delete _Chain_Prepend()

Sebastian Huber sebastian.huber at embedded-brains.de
Tue Apr 5 13:09:53 UTC 2016


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/chainprotected.c             | 139 +++++++++++++++++++++++++++
 cpukit/sapi/src/chainsmp.c                   | 136 --------------------------
 cpukit/score/include/rtems/score/chainimpl.h |  19 ----
 5 files changed, 140 insertions(+), 166 deletions(-)
 create mode 100644 cpukit/sapi/src/chainprotected.c
 delete mode 100644 cpukit/sapi/src/chainsmp.c

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/chainprotected.c b/cpukit/sapi/src/chainprotected.c
new file mode 100644
index 0000000..ce8bc5e
--- /dev/null
+++ b/cpukit/sapi/src/chainprotected.c
@@ -0,0 +1,139 @@
+/*
+ * Copyright (c) 2013, 2016 embedded brains GmbH.  All rights reserved.
+ *
+ *  embedded brains GmbH
+ *  Dornierstr. 4
+ *  82178 Puchheim
+ *  Germany
+ *  <rtems at embedded-brains.de>
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.org/license/LICENSE.
+ */
+
+#if HAVE_CONFIG_H
+  #include "config.h"
+#endif
+
+#include <rtems/chain.h>
+#include <rtems/rtems/intr.h>
+
+RTEMS_INTERRUPT_LOCK_DEFINE( static, chain_lock, "Chains" )
+
+static void chain_acquire( rtems_interrupt_lock_context *lock_context )
+{
+  rtems_interrupt_lock_acquire( &chain_lock, lock_context );
+}
+
+static void chain_release( rtems_interrupt_lock_context *lock_context )
+{
+  rtems_interrupt_lock_release( &chain_lock, lock_context );
+}
+
+#if defined( RTEMS_SMP )
+
+void rtems_chain_extract( rtems_chain_node *node )
+{
+  rtems_interrupt_lock_context lock_context;
+
+  chain_acquire( &lock_context );
+  _Chain_Extract_unprotected( node );
+  chain_release( &lock_context );
+}
+
+rtems_chain_node *rtems_chain_get( rtems_chain_control *chain )
+{
+  rtems_chain_node *node;
+  rtems_interrupt_lock_context lock_context;
+
+  chain_acquire( &lock_context );
+  node = _Chain_Get_unprotected( chain );
+  chain_release( &lock_context );
+
+  return node;
+}
+
+void rtems_chain_insert( rtems_chain_node *after_node, rtems_chain_node *node )
+{
+  rtems_interrupt_lock_context lock_context;
+
+  chain_acquire( &lock_context );
+  _Chain_Insert_unprotected( after_node, node );
+  chain_release( &lock_context );
+}
+
+void rtems_chain_append(
+  rtems_chain_control *chain,
+  rtems_chain_node *node
+)
+{
+  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
+)
+{
+  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;
+  rtems_interrupt_lock_context lock_context;
+
+  chain_acquire( &lock_context );
+  was_empty = _Chain_Append_with_empty_check_unprotected( chain, node );
+  chain_release( &lock_context );
+
+  return was_empty;
+}
+
+bool rtems_chain_prepend_with_empty_check(
+  rtems_chain_control *chain,
+  rtems_chain_node *node
+)
+{
+  bool was_empty;
+  rtems_interrupt_lock_context lock_context;
+
+  chain_acquire( &lock_context );
+  was_empty = _Chain_Prepend_with_empty_check_unprotected( chain, node );
+  chain_release( &lock_context );
+
+  return was_empty;
+}
+
+bool rtems_chain_get_with_empty_check(
+  rtems_chain_control *chain,
+  rtems_chain_node **node
+)
+{
+  bool is_empty_now;
+  rtems_interrupt_lock_context lock_context;
+
+  chain_acquire( &lock_context );
+  is_empty_now = _Chain_Get_with_empty_check_unprotected( chain, node );
+  chain_release( &lock_context );
+
+  return is_empty_now;
+}
+
+#endif /* defined( RTEMS_SMP ) */
diff --git a/cpukit/sapi/src/chainsmp.c b/cpukit/sapi/src/chainsmp.c
deleted file mode 100644
index a3da213..0000000
--- a/cpukit/sapi/src/chainsmp.c
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
- * Copyright (c) 2013-2014 embedded brains GmbH.  All rights reserved.
- *
- *  embedded brains GmbH
- *  Dornierstr. 4
- *  82178 Puchheim
- *  Germany
- *  <rtems at embedded-brains.de>
- *
- * The license and distribution terms for this file may be
- * found in the file LICENSE in this distribution or at
- * http://www.rtems.org/license/LICENSE.
- */
-
-#if HAVE_CONFIG_H
-  #include "config.h"
-#endif
-
-#include <rtems/chain.h>
-
-#if defined( RTEMS_SMP )
-
-#include <rtems/score/smplock.h>
-
-static SMP_lock_Control chain_lock = SMP_LOCK_INITIALIZER("chains");
-
-static void chain_acquire( SMP_lock_Context *lock_context )
-{
-  _SMP_lock_ISR_disable_and_acquire( &chain_lock, lock_context );
-}
-
-static void chain_release( SMP_lock_Context *lock_context )
-{
-  _SMP_lock_Release_and_ISR_enable( &chain_lock, lock_context );
-}
-
-void rtems_chain_extract( rtems_chain_node *node )
-{
-  SMP_lock_Context lock_context;
-
-  chain_acquire( &lock_context );
-  _Chain_Extract_unprotected( node );
-  chain_release( &lock_context );
-}
-
-rtems_chain_node *rtems_chain_get( rtems_chain_control *chain )
-{
-  rtems_chain_node *node;
-  SMP_lock_Context lock_context;
-
-  chain_acquire( &lock_context );
-  node = _Chain_Get_unprotected( chain );
-  chain_release( &lock_context );
-
-  return node;
-}
-
-void rtems_chain_insert( rtems_chain_node *after_node, rtems_chain_node *node )
-{
-  SMP_lock_Context lock_context;
-
-  chain_acquire( &lock_context );
-  _Chain_Insert_unprotected( after_node, node );
-  chain_release( &lock_context );
-}
-
-void rtems_chain_append(
-  rtems_chain_control *chain,
-  rtems_chain_node *node
-)
-{
-  SMP_lock_Context lock_context;
-
-  chain_acquire( &lock_context );
-  _Chain_Append_unprotected( chain, node );
-  chain_release( &lock_context );
-}
-
-void rtems_chain_prepend(
-  rtems_chain_control *chain,
-  rtems_chain_node *node
-)
-{
-  SMP_lock_Context lock_context;
-
-  chain_acquire( &lock_context );
-  _Chain_Prepend_unprotected( chain, node );
-  chain_release( &lock_context );
-}
-
-bool rtems_chain_append_with_empty_check(
-  rtems_chain_control *chain,
-  rtems_chain_node *node
-)
-{
-  bool was_empty;
-  SMP_lock_Context lock_context;
-
-  chain_acquire( &lock_context );
-  was_empty = _Chain_Append_with_empty_check_unprotected( chain, node );
-  chain_release( &lock_context );
-
-  return was_empty;
-}
-
-bool rtems_chain_prepend_with_empty_check(
-  rtems_chain_control *chain,
-  rtems_chain_node *node
-)
-{
-  bool was_empty;
-  SMP_lock_Context lock_context;
-
-  chain_acquire( &lock_context );
-  was_empty = _Chain_Prepend_with_empty_check_unprotected( chain, node );
-  chain_release( &lock_context );
-
-  return was_empty;
-}
-
-bool rtems_chain_get_with_empty_check(
-  rtems_chain_control *chain,
-  rtems_chain_node **node
-)
-{
-  bool is_empty_now;
-  SMP_lock_Context lock_context;
-
-  chain_acquire( &lock_context );
-  is_empty_now = _Chain_Get_with_empty_check_unprotected( chain, node );
-  chain_release( &lock_context );
-
-  return is_empty_now;
-}
-
-#endif /* defined( RTEMS_SMP ) */
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.
-- 
1.8.4.5




More information about the devel mailing list