summaryrefslogtreecommitdiffstats
path: root/cpukit/rtems
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2016-11-02 06:36:13 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2016-11-09 15:27:29 +0100
commit2612a0bf5b9f0105315d62cbacfa9d29a5caa4b5 (patch)
treef27e6300271c5a5d47f6ef41a6d5c4780b715fc7 /cpukit/rtems
parentscore: Fix _MRSP_Initialize() (diff)
downloadrtems-2612a0bf5b9f0105315d62cbacfa9d29a5caa4b5.tar.bz2
score: Simplify _Scheduler_Get_by_id()
Avoid dead code in non-SMP configurations. Return scheduler identifier independent of the current processor count of the scheduler via rtems_scheduler_ident(), since this value may change during run-time. Check the processor count in _Scheduler_Set() under scheduler lock protection. Update #2797.
Diffstat (limited to 'cpukit/rtems')
-rw-r--r--cpukit/rtems/include/rtems/rtems/tasks.h2
-rw-r--r--cpukit/rtems/src/schedulergetprocessorset.c3
-rw-r--r--cpukit/rtems/src/schedulerident.c8
-rw-r--r--cpukit/rtems/src/semsetpriority.c3
-rw-r--r--cpukit/rtems/src/taskgetpriority.c3
-rw-r--r--cpukit/rtems/src/tasksetscheduler.c3
6 files changed, 10 insertions, 12 deletions
diff --git a/cpukit/rtems/include/rtems/rtems/tasks.h b/cpukit/rtems/include/rtems/rtems/tasks.h
index 180e50eed7..3a94e348ed 100644
--- a/cpukit/rtems/include/rtems/rtems/tasks.h
+++ b/cpukit/rtems/include/rtems/rtems/tasks.h
@@ -555,8 +555,6 @@ void rtems_task_iterate(
* @retval RTEMS_SUCCESSFUL Successful operation.
* @retval RTEMS_INVALID_ADDRESS The @a id parameter is @c NULL.
* @retval RTEMS_INVALID_NAME Invalid scheduler name.
- * @retval RTEMS_UNSATISFIED A scheduler with this name exists, but the
- * processor set of this scheduler is empty.
*/
rtems_status_code rtems_scheduler_ident(
rtems_name name,
diff --git a/cpukit/rtems/src/schedulergetprocessorset.c b/cpukit/rtems/src/schedulergetprocessorset.c
index 016c3681cf..275c563090 100644
--- a/cpukit/rtems/src/schedulergetprocessorset.c
+++ b/cpukit/rtems/src/schedulergetprocessorset.c
@@ -34,7 +34,8 @@ rtems_status_code rtems_scheduler_get_processor_set(
return RTEMS_INVALID_ADDRESS;
}
- if ( !_Scheduler_Get_by_id( scheduler_id, &scheduler ) ) {
+ scheduler = _Scheduler_Get_by_id( scheduler_id );
+ if ( scheduler == NULL ) {
return RTEMS_INVALID_ID;
}
diff --git a/cpukit/rtems/src/schedulerident.c b/cpukit/rtems/src/schedulerident.c
index ee18af009e..5bde8de8bc 100644
--- a/cpukit/rtems/src/schedulerident.c
+++ b/cpukit/rtems/src/schedulerident.c
@@ -36,12 +36,8 @@ rtems_status_code rtems_scheduler_ident(
const Scheduler_Control *scheduler = &_Scheduler_Table[ i ];
if ( scheduler->name == name ) {
- if ( _Scheduler_Get_processor_count( scheduler ) > 0 ) {
- *id = _Scheduler_Build_id( i );
- sc = RTEMS_SUCCESSFUL;
- } else {
- sc = RTEMS_UNSATISFIED;
- }
+ *id = _Scheduler_Build_id( i );
+ sc = RTEMS_SUCCESSFUL;
}
}
} else {
diff --git a/cpukit/rtems/src/semsetpriority.c b/cpukit/rtems/src/semsetpriority.c
index 37dea5da80..123f6277af 100644
--- a/cpukit/rtems/src/semsetpriority.c
+++ b/cpukit/rtems/src/semsetpriority.c
@@ -138,7 +138,8 @@ rtems_status_code rtems_semaphore_set_priority(
return RTEMS_INVALID_ADDRESS;
}
- if ( !_Scheduler_Get_by_id( scheduler_id, &scheduler ) ) {
+ scheduler = _Scheduler_Get_by_id( scheduler_id );
+ if ( scheduler == NULL ) {
return RTEMS_INVALID_ID;
}
diff --git a/cpukit/rtems/src/taskgetpriority.c b/cpukit/rtems/src/taskgetpriority.c
index b6800e2133..8fb8ad3b4f 100644
--- a/cpukit/rtems/src/taskgetpriority.c
+++ b/cpukit/rtems/src/taskgetpriority.c
@@ -36,7 +36,8 @@ rtems_status_code rtems_task_get_priority(
return RTEMS_INVALID_ADDRESS;
}
- if ( !_Scheduler_Get_by_id( scheduler_id, &scheduler ) ) {
+ scheduler = _Scheduler_Get_by_id( scheduler_id );
+ if ( scheduler == NULL ) {
return RTEMS_INVALID_ID;
}
diff --git a/cpukit/rtems/src/tasksetscheduler.c b/cpukit/rtems/src/tasksetscheduler.c
index 3a860a197b..f3b7143d7b 100644
--- a/cpukit/rtems/src/tasksetscheduler.c
+++ b/cpukit/rtems/src/tasksetscheduler.c
@@ -35,7 +35,8 @@ rtems_status_code rtems_task_set_scheduler(
Priority_Control core_priority;
Status_Control status;
- if ( !_Scheduler_Get_by_id( scheduler_id, &scheduler ) ) {
+ scheduler = _Scheduler_Get_by_id( scheduler_id );
+ if ( scheduler == NULL ) {
return RTEMS_INVALID_ID;
}