[PATCH 1/2] score: _Scheduler_Get_affinity()
Sebastian Huber
sebastian.huber at embedded-brains.de
Wed May 28 16:12:57 UTC 2014
Drop scheduler parameter. Coding style.
---
cpukit/posix/src/pthreadgetaffinitynp.c | 1 -
cpukit/rtems/src/taskgetaffinity.c | 1 -
cpukit/score/include/rtems/score/schedulerimpl.h | 7 +--
cpukit/score/src/schedulergetaffinity.c | 44 ++++++++++-----------
4 files changed, 24 insertions(+), 29 deletions(-)
diff --git a/cpukit/posix/src/pthreadgetaffinitynp.c b/cpukit/posix/src/pthreadgetaffinitynp.c
index 41b8d30..7636954 100644
--- a/cpukit/posix/src/pthreadgetaffinitynp.c
+++ b/cpukit/posix/src/pthreadgetaffinitynp.c
@@ -48,7 +48,6 @@ int pthread_getaffinity_np(
case OBJECTS_LOCAL:
ok = _Scheduler_Get_affinity(
- _Scheduler_Get( the_thread ),
the_thread,
cpusetsize,
cpuset
diff --git a/cpukit/rtems/src/taskgetaffinity.c b/cpukit/rtems/src/taskgetaffinity.c
index c389f1b..25339b4 100644
--- a/cpukit/rtems/src/taskgetaffinity.c
+++ b/cpukit/rtems/src/taskgetaffinity.c
@@ -45,7 +45,6 @@ rtems_status_code rtems_task_get_affinity(
case OBJECTS_LOCAL:
ok = _Scheduler_Get_affinity(
- _Scheduler_Get( the_thread ),
the_thread,
cpusetsize,
cpuset
diff --git a/cpukit/score/include/rtems/score/schedulerimpl.h b/cpukit/score/include/rtems/score/schedulerimpl.h
index be84164..a434c8c 100644
--- a/cpukit/score/include/rtems/score/schedulerimpl.h
+++ b/cpukit/score/include/rtems/score/schedulerimpl.h
@@ -406,10 +406,9 @@ RTEMS_INLINE_ROUTINE bool _Scheduler_default_Get_affinity_body(
}
bool _Scheduler_Get_affinity(
- const Scheduler_Control *scheduler,
- Thread_Control *the_thread,
- size_t cpusetsize,
- cpu_set_t *cpuset
+ Thread_Control *the_thread,
+ size_t cpusetsize,
+ cpu_set_t *cpuset
);
RTEMS_INLINE_ROUTINE bool _Scheduler_default_Set_affinity_body(
diff --git a/cpukit/score/src/schedulergetaffinity.c b/cpukit/score/src/schedulergetaffinity.c
index d9e62b5..06ebfbe 100644
--- a/cpukit/score/src/schedulergetaffinity.c
+++ b/cpukit/score/src/schedulergetaffinity.c
@@ -21,35 +21,33 @@
#if defined(__RTEMS_HAVE_SYS_CPUSET_H__)
bool _Scheduler_Get_affinity(
- const Scheduler_Control *scheduler,
- Thread_Control *the_thread,
- size_t cpusetsize,
- cpu_set_t *cpuset
+ Thread_Control *the_thread,
+ size_t cpusetsize,
+ cpu_set_t *cpuset
)
{
- bool ok;
+ const Scheduler_Control *scheduler = _Scheduler_Get( the_thread );
+
+ if ( !_CPU_set_Is_large_enough( cpusetsize ) ) {
+ return false;
+ }
+
- if ( _CPU_set_Is_large_enough( cpusetsize ) ) {
#if defined(RTEMS_SMP)
- ok = ( *scheduler->Operations.get_affinity )(
- scheduler,
- the_thread,
- cpusetsize,
- cpuset
- );
+ return ( *scheduler->Operations.get_affinity )(
+ scheduler,
+ the_thread,
+ cpusetsize,
+ cpuset
+ );
#else
- ok = _Scheduler_default_Get_affinity_body(
- scheduler,
- the_thread,
- cpusetsize,
- cpuset
- );
+ return _Scheduler_default_Get_affinity_body(
+ scheduler,
+ the_thread,
+ cpusetsize,
+ cpuset
+ );
#endif
- } else {
- ok = false;
- }
-
- return ok;
}
#endif /* defined(__RTEMS_HAVE_SYS_CPUSET_H__) */
--
1.7.7
More information about the devel
mailing list