[rtems commit] score: _Scheduler_Get_affinity()

Sebastian Huber sebh at rtems.org
Mon Jun 2 08:02:58 UTC 2014


Module:    rtems
Branch:    master
Commit:    a92c4882bb070b139c9c5762c1888e1cff333e29
Changeset: http://git.rtems.org/rtems/commit/?id=a92c4882bb070b139c9c5762c1888e1cff333e29

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Wed May 28 17:56:45 2014 +0200

score: _Scheduler_Get_affinity()

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__) */




More information about the vc mailing list