score: Simplify update priority scheduler op

Remove unused return status.
This commit is contained in:
Sebastian Huber
2016-11-02 10:05:44 +01:00
parent 97f7dac660
commit 9c238e1bd4
17 changed files with 35 additions and 64 deletions
+1 -1
View File
@@ -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 *
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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(
@@ -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
@@ -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;
}
@@ -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(
@@ -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;
}
+2 -2
View File
@@ -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,
@@ -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;
}
+2 -2
View File
@@ -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,
+2 -2
View File
@@ -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,
+5 -11
View File
@@ -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);