[PATCH 22/30] score: Simplify update priority scheduler op

Sebastian Huber sebastian.huber at embedded-brains.de
Mon Oct 31 08:51:53 UTC 2016


Remove unused return status.
---
 cpukit/score/include/rtems/score/scheduler.h            |  2 +-
 cpukit/score/include/rtems/score/scheduleredf.h         |  2 +-
 cpukit/score/include/rtems/score/schedulerpriority.h    |  2 +-
 .../include/rtems/score/schedulerpriorityaffinitysmp.h  |  8 +-------
 cpukit/score/include/rtems/score/schedulerprioritysmp.h |  2 +-
 cpukit/score/include/rtems/score/schedulersimple.h      |  2 +-
 cpukit/score/include/rtems/score/schedulersimplesmp.h   |  2 +-
 cpukit/score/include/rtems/score/schedulersmpimpl.h     | 17 ++++++-----------
 cpukit/score/include/rtems/score/schedulerstrongapa.h   |  2 +-
 cpukit/score/src/scheduleredfchangepriority.c           |  8 +++-----
 cpukit/score/src/schedulerpriorityaffinitysmp.c         | 10 ++--------
 cpukit/score/src/schedulerprioritychangepriority.c      |  8 +++-----
 cpukit/score/src/schedulerprioritysmp.c                 |  4 ++--
 cpukit/score/src/schedulersimplechangepriority.c        |  6 ++----
 cpukit/score/src/schedulersimplesmp.c                   |  4 ++--
 cpukit/score/src/schedulerstrongapa.c                   |  4 ++--
 testsuites/smptests/smpscheduler03/init.c               | 16 +++++-----------
 17 files changed, 35 insertions(+), 64 deletions(-)

diff --git a/cpukit/score/include/rtems/score/scheduler.h b/cpukit/score/include/rtems/score/scheduler.h
index 07e415a..a8afcd0 100644
--- a/cpukit/score/include/rtems/score/scheduler.h
+++ b/cpukit/score/include/rtems/score/scheduler.h
@@ -84,7 +84,7 @@ typedef struct {
   );
 
   /** @see _Scheduler_Update_priority() */
-  Scheduler_Void_or_thread ( *update_priority )(
+  void ( *update_priority )(
     const Scheduler_Control *,
     Thread_Control *,
     Scheduler_Node *
diff --git a/cpukit/score/include/rtems/score/scheduleredf.h b/cpukit/score/include/rtems/score/scheduleredf.h
index 65218e7..f6bf2e5 100644
--- a/cpukit/score/include/rtems/score/scheduleredf.h
+++ b/cpukit/score/include/rtems/score/scheduleredf.h
@@ -150,7 +150,7 @@ Scheduler_Void_or_thread _Scheduler_EDF_Unblock(
   Scheduler_Node          *node
 );
 
-Scheduler_Void_or_thread _Scheduler_EDF_Update_priority(
+void _Scheduler_EDF_Update_priority(
   const Scheduler_Control *scheduler,
   Thread_Control          *the_thread,
   Scheduler_Node          *node
diff --git a/cpukit/score/include/rtems/score/schedulerpriority.h b/cpukit/score/include/rtems/score/schedulerpriority.h
index 57855aa..d0d6a86 100644
--- a/cpukit/score/include/rtems/score/schedulerpriority.h
+++ b/cpukit/score/include/rtems/score/schedulerpriority.h
@@ -134,7 +134,7 @@ Scheduler_Void_or_thread _Scheduler_priority_Unblock(
   Scheduler_Node          *node
 );
 
-Scheduler_Void_or_thread _Scheduler_priority_Update_priority(
+void _Scheduler_priority_Update_priority(
   const Scheduler_Control *scheduler,
   Thread_Control          *the_thread,
   Scheduler_Node          *base_node
diff --git a/cpukit/score/include/rtems/score/schedulerpriorityaffinitysmp.h b/cpukit/score/include/rtems/score/schedulerpriorityaffinitysmp.h
index ab83435..dceac92 100644
--- a/cpukit/score/include/rtems/score/schedulerpriorityaffinitysmp.h
+++ b/cpukit/score/include/rtems/score/schedulerpriorityaffinitysmp.h
@@ -119,13 +119,7 @@ bool _Scheduler_priority_affinity_SMP_Get_affinity(
   cpu_set_t               *cpuset
 );
 
-/**
- * @brief Update priority for the priority affinity SMP scheduler.
- *
- * @param[in] scheduler The scheduler of the thread.
- * @param[in] the_thread The associated thread.
- */
-Thread_Control *_Scheduler_priority_affinity_SMP_Update_priority(
+void _Scheduler_priority_affinity_SMP_Update_priority(
   const Scheduler_Control *scheduler,
   Thread_Control          *the_thread,
   Scheduler_Node          *node
diff --git a/cpukit/score/include/rtems/score/schedulerprioritysmp.h b/cpukit/score/include/rtems/score/schedulerprioritysmp.h
index 4b3e577..90c4566 100644
--- a/cpukit/score/include/rtems/score/schedulerprioritysmp.h
+++ b/cpukit/score/include/rtems/score/schedulerprioritysmp.h
@@ -120,7 +120,7 @@ Thread_Control *_Scheduler_priority_SMP_Unblock(
   Scheduler_Node          *node
 );
 
-Thread_Control *_Scheduler_priority_SMP_Update_priority(
+void _Scheduler_priority_SMP_Update_priority(
   const Scheduler_Control *scheduler,
   Thread_Control          *the_thread,
   Scheduler_Node          *node
diff --git a/cpukit/score/include/rtems/score/schedulersimple.h b/cpukit/score/include/rtems/score/schedulersimple.h
index cd18650..0f340bd 100644
--- a/cpukit/score/include/rtems/score/schedulersimple.h
+++ b/cpukit/score/include/rtems/score/schedulersimple.h
@@ -110,7 +110,7 @@ Scheduler_Void_or_thread _Scheduler_simple_Unblock(
   Scheduler_Node          *node
 );
 
-Scheduler_Void_or_thread _Scheduler_simple_Update_priority(
+void _Scheduler_simple_Update_priority(
   const Scheduler_Control *scheduler,
   Thread_Control          *the_thread,
   Scheduler_Node          *node
diff --git a/cpukit/score/include/rtems/score/schedulersimplesmp.h b/cpukit/score/include/rtems/score/schedulersimplesmp.h
index 2afe10b..76037dd 100644
--- a/cpukit/score/include/rtems/score/schedulersimplesmp.h
+++ b/cpukit/score/include/rtems/score/schedulersimplesmp.h
@@ -103,7 +103,7 @@ Thread_Control *_Scheduler_simple_SMP_Unblock(
   Scheduler_Node          *node
 );
 
-Thread_Control *_Scheduler_simple_SMP_Update_priority(
+void _Scheduler_simple_SMP_Update_priority(
   const Scheduler_Control *scheduler,
   Thread_Control          *the_thread,
   Scheduler_Node          *node
diff --git a/cpukit/score/include/rtems/score/schedulersmpimpl.h b/cpukit/score/include/rtems/score/schedulersmpimpl.h
index 0e7d358..0846d49 100644
--- a/cpukit/score/include/rtems/score/schedulersmpimpl.h
+++ b/cpukit/score/include/rtems/score/schedulersmpimpl.h
@@ -1011,7 +1011,7 @@ static inline Thread_Control *_Scheduler_SMP_Unblock(
   return needs_help;
 }
 
-static inline Thread_Control *_Scheduler_SMP_Update_priority(
+static inline void _Scheduler_SMP_Update_priority(
   Scheduler_Context               *context,
   Thread_Control                  *thread,
   Scheduler_Node                  *node,
@@ -1024,7 +1024,6 @@ static inline Thread_Control *_Scheduler_SMP_Update_priority(
   Scheduler_SMP_Ask_for_help       ask_for_help
 )
 {
-  Thread_Control          *needs_help;
   Priority_Control         new_priority;
   bool                     prepend_it;
   Scheduler_SMP_Node_state node_state;
@@ -1036,7 +1035,7 @@ static inline Thread_Control *_Scheduler_SMP_Update_priority(
       ( *ask_for_help )( context, thread, node );
     }
 
-    return NULL;
+    return;
   }
 
   node_state = _Scheduler_SMP_Node_state( node );
@@ -1047,9 +1046,9 @@ static inline Thread_Control *_Scheduler_SMP_Update_priority(
     ( *update )( context, node, new_priority );
 
     if ( prepend_it ) {
-      needs_help = ( *enqueue_scheduled_lifo )( context, node );
+      ( *enqueue_scheduled_lifo )( context, node );
     } else {
-      needs_help = ( *enqueue_scheduled_fifo )( context, node );
+      ( *enqueue_scheduled_fifo )( context, node );
     }
   } else if ( node_state == SCHEDULER_SMP_NODE_READY ) {
     ( *extract_from_ready )( context, node );
@@ -1057,9 +1056,9 @@ static inline Thread_Control *_Scheduler_SMP_Update_priority(
     ( *update )( context, node, new_priority );
 
     if ( prepend_it ) {
-      needs_help = ( *enqueue_lifo )( context, node, NULL );
+      ( *enqueue_lifo )( context, node, NULL );
     } else {
-      needs_help = ( *enqueue_fifo )( context, node, NULL );
+      ( *enqueue_fifo )( context, node, NULL );
     }
   } else {
     ( *update )( context, node, new_priority );
@@ -1067,11 +1066,7 @@ static inline Thread_Control *_Scheduler_SMP_Update_priority(
     if ( _Thread_Is_ready( thread ) ) {
       ( *ask_for_help )( context, thread, node );
     }
-
-    needs_help = NULL;
   }
-
-  return needs_help;
 }
 
 static inline Thread_Control *_Scheduler_SMP_Ask_for_help_X(
diff --git a/cpukit/score/include/rtems/score/schedulerstrongapa.h b/cpukit/score/include/rtems/score/schedulerstrongapa.h
index b8a5f2f..1b8418b 100644
--- a/cpukit/score/include/rtems/score/schedulerstrongapa.h
+++ b/cpukit/score/include/rtems/score/schedulerstrongapa.h
@@ -120,7 +120,7 @@ Thread_Control *_Scheduler_strong_APA_Unblock(
   Scheduler_Node          *node
 );
 
-Thread_Control *_Scheduler_strong_APA_Update_priority(
+void _Scheduler_strong_APA_Update_priority(
   const Scheduler_Control *scheduler,
   Thread_Control          *the_thread,
   Scheduler_Node          *node
diff --git a/cpukit/score/src/scheduleredfchangepriority.c b/cpukit/score/src/scheduleredfchangepriority.c
index 8fcc111..0b70bce 100644
--- a/cpukit/score/src/scheduleredfchangepriority.c
+++ b/cpukit/score/src/scheduleredfchangepriority.c
@@ -36,7 +36,7 @@ Priority_Control _Scheduler_EDF_Unmap_priority(
   return priority & ~SCHEDULER_EDF_PRIO_MSB;
 }
 
-Scheduler_Void_or_thread _Scheduler_EDF_Update_priority(
+void _Scheduler_EDF_Update_priority(
   const Scheduler_Control *scheduler,
   Thread_Control          *the_thread,
   Scheduler_Node          *node
@@ -49,7 +49,7 @@ Scheduler_Void_or_thread _Scheduler_EDF_Update_priority(
 
   if ( !_Thread_Is_ready( the_thread ) ) {
     /* Nothing to do */
-    SCHEDULER_RETURN_VOID_OR_NULL;
+    return;
   }
 
   the_node = _Scheduler_EDF_Node_downcast( node );
@@ -57,7 +57,7 @@ Scheduler_Void_or_thread _Scheduler_EDF_Update_priority(
 
   if ( priority == the_node->priority ) {
     /* Nothing to do */
-    SCHEDULER_RETURN_VOID_OR_NULL;
+    return;
   }
 
   the_node->priority = priority;
@@ -72,6 +72,4 @@ Scheduler_Void_or_thread _Scheduler_EDF_Update_priority(
   }
 
   _Scheduler_EDF_Schedule_body( scheduler, the_thread, false );
-
-  SCHEDULER_RETURN_VOID_OR_NULL;
 }
diff --git a/cpukit/score/src/schedulerpriorityaffinitysmp.c b/cpukit/score/src/schedulerpriorityaffinitysmp.c
index 466c399..c1cc5be 100644
--- a/cpukit/score/src/schedulerpriorityaffinitysmp.c
+++ b/cpukit/score/src/schedulerpriorityaffinitysmp.c
@@ -518,19 +518,15 @@ static bool _Scheduler_priority_affinity_SMP_Do_ask_for_help(
   );
 }
 
-/*
- * This is the public scheduler specific Change Priority operation.
- */
-Thread_Control *_Scheduler_priority_affinity_SMP_Update_priority(
+void _Scheduler_priority_affinity_SMP_Update_priority(
   const Scheduler_Control *scheduler,
   Thread_Control          *thread,
   Scheduler_Node          *node
 )
 {
   Scheduler_Context *context = _Scheduler_Get_context( scheduler );
-  Thread_Control    *displaced;
 
-  displaced = _Scheduler_SMP_Update_priority(
+  _Scheduler_SMP_Update_priority(
     context,
     thread,
     node,
@@ -547,8 +543,6 @@ Thread_Control *_Scheduler_priority_affinity_SMP_Update_priority(
    * Perform any thread migrations that are needed due to these changes.
    */
   _Scheduler_priority_affinity_SMP_Check_for_migrations( context );
-
-  return displaced;
 }
 
 bool _Scheduler_priority_affinity_SMP_Ask_for_help(
diff --git a/cpukit/score/src/schedulerprioritychangepriority.c b/cpukit/score/src/schedulerprioritychangepriority.c
index 339168f..eb640fe 100644
--- a/cpukit/score/src/schedulerprioritychangepriority.c
+++ b/cpukit/score/src/schedulerprioritychangepriority.c
@@ -21,7 +21,7 @@
 
 #include <rtems/score/schedulerpriorityimpl.h>
 
-Scheduler_Void_or_thread _Scheduler_priority_Update_priority(
+void _Scheduler_priority_Update_priority(
   const Scheduler_Control *scheduler,
   Thread_Control          *the_thread,
   Scheduler_Node          *node
@@ -34,7 +34,7 @@ Scheduler_Void_or_thread _Scheduler_priority_Update_priority(
 
   if ( !_Thread_Is_ready( the_thread ) ) {
     /* Nothing to do */
-    SCHEDULER_RETURN_VOID_OR_NULL;
+    return;
   }
 
   the_node = _Scheduler_priority_Node_downcast( node );
@@ -43,7 +43,7 @@ Scheduler_Void_or_thread _Scheduler_priority_Update_priority(
 
   if ( priority == the_node->Ready_queue.current_priority ) {
     /* Nothing to do */
-    SCHEDULER_RETURN_VOID_OR_NULL;
+    return;
   }
 
   context = _Scheduler_priority_Get_context( scheduler );
@@ -76,6 +76,4 @@ Scheduler_Void_or_thread _Scheduler_priority_Update_priority(
   }
 
   _Scheduler_priority_Schedule_body( scheduler, the_thread, false );
-
-  SCHEDULER_RETURN_VOID_OR_NULL;
 }
diff --git a/cpukit/score/src/schedulerprioritysmp.c b/cpukit/score/src/schedulerprioritysmp.c
index 7b498d3..4b8398a 100644
--- a/cpukit/score/src/schedulerprioritysmp.c
+++ b/cpukit/score/src/schedulerprioritysmp.c
@@ -248,7 +248,7 @@ static bool _Scheduler_priority_SMP_Do_ask_for_help(
   );
 }
 
-Thread_Control *_Scheduler_priority_SMP_Update_priority(
+void _Scheduler_priority_SMP_Update_priority(
   const Scheduler_Control *scheduler,
   Thread_Control          *thread,
   Scheduler_Node          *node
@@ -256,7 +256,7 @@ Thread_Control *_Scheduler_priority_SMP_Update_priority(
 {
   Scheduler_Context *context = _Scheduler_Get_context( scheduler );
 
-  return _Scheduler_SMP_Update_priority(
+  _Scheduler_SMP_Update_priority(
     context,
     thread,
     node,
diff --git a/cpukit/score/src/schedulersimplechangepriority.c b/cpukit/score/src/schedulersimplechangepriority.c
index cad75f8..8253a01 100644
--- a/cpukit/score/src/schedulersimplechangepriority.c
+++ b/cpukit/score/src/schedulersimplechangepriority.c
@@ -21,7 +21,7 @@
 
 #include <rtems/score/schedulersimpleimpl.h>
 
-Scheduler_Void_or_thread _Scheduler_simple_Update_priority(
+void _Scheduler_simple_Update_priority(
   const Scheduler_Control *scheduler,
   Thread_Control          *the_thread,
   Scheduler_Node          *node
@@ -32,7 +32,7 @@ Scheduler_Void_or_thread _Scheduler_simple_Update_priority(
 
   if ( !_Thread_Is_ready( the_thread ) ) {
     /* Nothing to do */
-    SCHEDULER_RETURN_VOID_OR_NULL;
+    return;
   }
 
   context = _Scheduler_simple_Get_context( scheduler );
@@ -47,6 +47,4 @@ Scheduler_Void_or_thread _Scheduler_simple_Update_priority(
   }
 
   _Scheduler_simple_Schedule_body( scheduler, the_thread, false );
-
-  SCHEDULER_RETURN_VOID_OR_NULL;
 }
diff --git a/cpukit/score/src/schedulersimplesmp.c b/cpukit/score/src/schedulersimplesmp.c
index d8f576f..ff43c8a 100644
--- a/cpukit/score/src/schedulersimplesmp.c
+++ b/cpukit/score/src/schedulersimplesmp.c
@@ -315,7 +315,7 @@ static bool _Scheduler_simple_SMP_Do_ask_for_help(
   );
 }
 
-Thread_Control *_Scheduler_simple_SMP_Update_priority(
+void _Scheduler_simple_SMP_Update_priority(
   const Scheduler_Control *scheduler,
   Thread_Control          *thread,
   Scheduler_Node          *node
@@ -323,7 +323,7 @@ Thread_Control *_Scheduler_simple_SMP_Update_priority(
 {
   Scheduler_Context *context = _Scheduler_Get_context( scheduler );
 
-  return _Scheduler_SMP_Update_priority(
+  _Scheduler_SMP_Update_priority(
     context,
     thread,
     node,
diff --git a/cpukit/score/src/schedulerstrongapa.c b/cpukit/score/src/schedulerstrongapa.c
index dca5e26..1fc9b52 100644
--- a/cpukit/score/src/schedulerstrongapa.c
+++ b/cpukit/score/src/schedulerstrongapa.c
@@ -374,7 +374,7 @@ static bool _Scheduler_strong_APA_Do_ask_for_help(
   );
 }
 
-Thread_Control *_Scheduler_strong_APA_Update_priority(
+void _Scheduler_strong_APA_Update_priority(
   const Scheduler_Control *scheduler,
   Thread_Control          *the_thread,
   Scheduler_Node          *node
@@ -382,7 +382,7 @@ Thread_Control *_Scheduler_strong_APA_Update_priority(
 {
   Scheduler_Context *context = _Scheduler_Get_context( scheduler );
 
-  return _Scheduler_SMP_Update_priority(
+  _Scheduler_SMP_Update_priority(
     context,
     the_thread,
     node,
diff --git a/testsuites/smptests/smpscheduler03/init.c b/testsuites/smptests/smpscheduler03/init.c
index 0d7b88c..d9e4862 100644
--- a/testsuites/smptests/smpscheduler03/init.c
+++ b/testsuites/smptests/smpscheduler03/init.c
@@ -199,7 +199,7 @@ static void test_change_priority(void)
   rtems_test_assert(sc == RTEMS_SUCCESSFUL);
 }
 
-static Thread_Control *update_priority_op(
+static void update_priority_op(
   Thread_Control *thread,
   Scheduler_SMP_Node *scheduler_node,
   Priority_Control new_priority,
@@ -209,7 +209,6 @@ static Thread_Control *update_priority_op(
   const Scheduler_Control *scheduler;
   ISR_lock_Context state_lock_context;
   ISR_lock_Context scheduler_lock_context;
-  Thread_Control *needs_help;
   Thread_queue_Context queue_context;
 
   apply_priority(thread, new_priority, prepend_it, &queue_context);
@@ -218,7 +217,7 @@ static Thread_Control *update_priority_op(
   scheduler = _Scheduler_Get( thread );
   _Scheduler_Acquire_critical( scheduler, &scheduler_lock_context );
 
-  needs_help = (*scheduler->Operations.update_priority)(
+  (*scheduler->Operations.update_priority)(
     scheduler,
     thread,
     &scheduler_node->Base
@@ -226,8 +225,6 @@ static Thread_Control *update_priority_op(
 
   _Scheduler_Release_critical( scheduler, &scheduler_lock_context );
   _Thread_State_release( thread, &state_lock_context );
-
-  return needs_help;
 }
 
 static void test_case_update_priority_op(
@@ -240,7 +237,6 @@ static void test_case_update_priority_op(
   Scheduler_SMP_Node_state new_state
 )
 {
-  Thread_Control *needs_help;
   Per_CPU_Control *cpu_self;
 
   cpu_self = _Thread_Dispatch_disable();
@@ -258,23 +254,21 @@ static void test_case_update_priority_op(
   }
   rtems_test_assert(executing_node->state == start_state);
 
-  needs_help = update_priority_op(executing, executing_node, prio, prepend_it);
+  update_priority_op(executing, executing_node, prio, prepend_it);
   rtems_test_assert(executing_node->state == new_state);
 
   if (start_state != new_state) {
     switch (start_state) {
       case SCHEDULER_SMP_NODE_SCHEDULED:
-        rtems_test_assert(needs_help == executing);
+        rtems_test_assert(cpu_self->heir == other);
         break;
       case SCHEDULER_SMP_NODE_READY:
-        rtems_test_assert(needs_help == other);
+        rtems_test_assert(cpu_self->heir == executing);
         break;
       default:
         rtems_test_assert(0);
         break;
     }
-  } else {
-    rtems_test_assert(needs_help == NULL);
   }
 
   change_priority(executing, 1, true);
-- 
1.8.4.5




More information about the devel mailing list