[PATCH] RTEMS 5.2: rtems: Allow RTEMS_PRIORITY for MrsP semaphores

Sebastian Huber sebastian.huber at embedded-brains.de
Tue Mar 16 14:00:54 UTC 2021


In order to improve the compatibility of RTEMS 5.2 with future version
of RTEMS which fixed #4346 allow MrsP semaphores to be created with
RTEMS_PRIORITY.

Close #4347.
---
 cpukit/rtems/src/semcreate.c       | 7 ++++++-
 testsuites/sptests/spmrsp01/init.c | 6 ------
 2 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/cpukit/rtems/src/semcreate.c b/cpukit/rtems/src/semcreate.c
index b57b635d85..ea89800685 100644
--- a/cpukit/rtems/src/semcreate.c
+++ b/cpukit/rtems/src/semcreate.c
@@ -92,9 +92,14 @@ rtems_status_code rtems_semaphore_create(
   ) {
     variant = SEMAPHORE_VARIANT_MUTEX_PRIORITY_CEILING;
   } else if (
-    mutex_with_protocol
+    ( mutex_with_protocol & ~RTEMS_PRIORITY )
       == ( RTEMS_BINARY_SEMAPHORE | RTEMS_MULTIPROCESSOR_RESOURCE_SHARING )
   ) {
+    /*
+     * In RTEMS 5.2 using RTEMS_FIFO and RTEMS_PRIORITY for MrsP semaphores is
+     * allowed.  In RTEMS 6, RTEMS_PRIORITY is required for MrsP semaphores
+     * analogous to priority ceiling semaphores.
+     */
 #if defined(RTEMS_SMP)
     variant = SEMAPHORE_VARIANT_MRSP;
 #else
diff --git a/testsuites/sptests/spmrsp01/init.c b/testsuites/sptests/spmrsp01/init.c
index a5f645d534..801b679ec9 100644
--- a/testsuites/sptests/spmrsp01/init.c
+++ b/testsuites/sptests/spmrsp01/init.c
@@ -70,12 +70,6 @@ static void test_mrsp_create_errors(void)
       | RTEMS_SIMPLE_BINARY_SEMAPHORE
   );
 
-  create_not_defined(
-    RTEMS_MULTIPROCESSOR_RESOURCE_SHARING
-      | RTEMS_BINARY_SEMAPHORE
-      | RTEMS_PRIORITY
-  );
-
   create_not_defined(
     RTEMS_MULTIPROCESSOR_RESOURCE_SHARING
       | RTEMS_INHERIT_PRIORITY
-- 
2.26.2



More information about the devel mailing list