[rtems commit] mpci: Simplify _Objects_MP_Is_remote()

Sebastian Huber sebh at rtems.org
Fri May 20 14:18:16 UTC 2016


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

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Fri May 20 11:53:41 2016 +0200

mpci: Simplify _Objects_MP_Is_remote()

---

 cpukit/score/include/rtems/score/objectmp.h | 20 ++++++++++----------
 cpukit/score/include/rtems/score/threadmp.h |  2 +-
 cpukit/score/src/objectgetisr.c             |  8 +++++---
 cpukit/score/src/objectmp.c                 | 12 ++++--------
 4 files changed, 20 insertions(+), 22 deletions(-)

diff --git a/cpukit/score/include/rtems/score/objectmp.h b/cpukit/score/include/rtems/score/objectmp.h
index 4f73012..5c9f4f7 100644
--- a/cpukit/score/include/rtems/score/objectmp.h
+++ b/cpukit/score/include/rtems/score/objectmp.h
@@ -144,19 +144,19 @@ Objects_Name_or_id_lookup_errors _Objects_MP_Global_name_search (
 );
 
 /**
- *  @brief Searches the Global Object Table managed
- *  by information for the object indicated by ID.
+ * @brief Returns true, if the object identifier is in the global object
+ * identifier cache of the specified object information, otherwise false.
  *
- *  @param[in] information points to the object information table for this
- *             object class.
- *  @param[in] the_id is the Id of the object being opened.
+ * @param id The object identifier.
+ * @param information The object information.
  *
- *  @retval OBJECTS_REMOTE A remote objects with this object identifier exits.
- *  @retval OBJECTS_ERROR Otherwise.
+ * @retval true A remote objects with this object identifier exits in the
+ * global object identifier cache of the specified information.
+ * @retval false Otherwise.
  */
-Objects_Locations _Objects_MP_Is_remote(
-  Objects_Information *information,
-  Objects_Id           the_id
+bool _Objects_MP_Is_remote(
+  Objects_Id                 id,
+  const Objects_Information *information
 );
 
 /**
diff --git a/cpukit/score/include/rtems/score/threadmp.h b/cpukit/score/include/rtems/score/threadmp.h
index 46add28..9cde35b 100644
--- a/cpukit/score/include/rtems/score/threadmp.h
+++ b/cpukit/score/include/rtems/score/threadmp.h
@@ -100,7 +100,7 @@ RTEMS_INLINE_ROUTINE bool _Thread_MP_Is_remote( Objects_Id id )
     return false;
   }
 
-  return _Objects_MP_Is_remote( information, id ) == OBJECTS_REMOTE;
+  return _Objects_MP_Is_remote( id, information );
 }
 
 /**@}*/
diff --git a/cpukit/score/src/objectgetisr.c b/cpukit/score/src/objectgetisr.c
index 3a185ce..71f62fe 100644
--- a/cpukit/score/src/objectgetisr.c
+++ b/cpukit/score/src/objectgetisr.c
@@ -43,10 +43,12 @@ Objects_Control *_Objects_Get_isr_disable(
     return NULL;
   }
 
-#if defined(RTEMS_MULTIPROCESSING)
-  *location = _Objects_MP_Is_remote( information, id );
-#else
   *location = OBJECTS_ERROR;
+
+#if defined(RTEMS_MULTIPROCESSING)
+  if ( _Objects_MP_Is_remote( id, information ) ) {
+    *location = OBJECTS_REMOTE;
+  }
 #endif
 
   return NULL;
diff --git a/cpukit/score/src/objectmp.c b/cpukit/score/src/objectmp.c
index 0df9190..0628544 100644
--- a/cpukit/score/src/objectmp.c
+++ b/cpukit/score/src/objectmp.c
@@ -351,9 +351,9 @@ Objects_Name_or_id_lookup_errors _Objects_MP_Global_name_search(
   return status;
 }
 
-Objects_Locations _Objects_MP_Is_remote(
-  Objects_Information *information,
-  Objects_Id           the_id
+bool _Objects_MP_Is_remote(
+  Objects_Id                 the_id,
+  const Objects_Information *information
 )
 {
   Objects_MP_Control *the_global_object;
@@ -371,11 +371,7 @@ Objects_Locations _Objects_MP_Is_remote(
 
   _Objects_MP_Global_release( &lock_context );
 
-  if ( the_global_object != NULL ) {
-    return OBJECTS_REMOTE;
-  } else {
-    return OBJECTS_ERROR;
-  }
+  return the_global_object != NULL;
 }
 
 Objects_MP_Control *_Objects_MP_Allocate_global_object( void )




More information about the vc mailing list