[PATCH 2/2] score: Use constant for maximum count of CORE sema
Sebastian Huber
sebastian.huber at embedded-brains.de
Wed Mar 23 09:19:37 UTC 2016
---
cpukit/libmisc/monitor/mon-sema.c | 7 ++-----
cpukit/posix/src/semaphorecreatesupp.c | 1 -
cpukit/rtems/src/semcreate.c | 1 -
cpukit/score/include/rtems/score/coresem.h | 13 -------------
cpukit/score/include/rtems/score/coresemimpl.h | 4 +---
cpukit/score/src/coresem.c | 3 ---
cpukit/score/src/mpci.c | 1 -
7 files changed, 3 insertions(+), 27 deletions(-)
diff --git a/cpukit/libmisc/monitor/mon-sema.c b/cpukit/libmisc/monitor/mon-sema.c
index f7e35ed..5add7cf 100644
--- a/cpukit/libmisc/monitor/mon-sema.c
+++ b/cpukit/libmisc/monitor/mon-sema.c
@@ -28,11 +28,8 @@ rtems_monitor_sema_canonical(
if (_Attributes_Is_counting_semaphore(canonical_sema->attribute)) {
/* we have a counting semaphore */
- canonical_sema->cur_count =
- rtems_sema->Core_control.semaphore.count;
-
- canonical_sema->max_count =
- rtems_sema->Core_control.semaphore.Attributes.maximum_count;
+ canonical_sema->cur_count = rtems_sema->Core_control.semaphore.count;
+ canonical_sema->max_count = UINT32_MAX;
}
else {
/* we have a binary semaphore (mutex) */
diff --git a/cpukit/posix/src/semaphorecreatesupp.c b/cpukit/posix/src/semaphorecreatesupp.c
index c527a9b..9a24e0a 100644
--- a/cpukit/posix/src/semaphorecreatesupp.c
+++ b/cpukit/posix/src/semaphorecreatesupp.c
@@ -95,7 +95,6 @@ int _POSIX_Semaphore_Create_support(
_CORE_semaphore_Initialize(
&the_semaphore->Semaphore,
CORE_SEMAPHORE_DISCIPLINES_FIFO,
- 0xFFFFFFFF,
value
);
diff --git a/cpukit/rtems/src/semcreate.c b/cpukit/rtems/src/semcreate.c
index c8111fd..d289546 100644
--- a/cpukit/rtems/src/semcreate.c
+++ b/cpukit/rtems/src/semcreate.c
@@ -153,7 +153,6 @@ rtems_status_code rtems_semaphore_create(
_CORE_semaphore_Initialize(
&the_semaphore->Core_control.semaphore,
semaphore_discipline,
- 0xFFFFFFFF,
count
);
#if defined(RTEMS_SMP)
diff --git a/cpukit/score/include/rtems/score/coresem.h b/cpukit/score/include/rtems/score/coresem.h
index 44e17c3..84fde0b 100644
--- a/cpukit/score/include/rtems/score/coresem.h
+++ b/cpukit/score/include/rtems/score/coresem.h
@@ -50,15 +50,6 @@ typedef enum {
} CORE_semaphore_Disciplines;
/**
- * The following defines the control block used to manage the
- * attributes of each semaphore.
- */
-typedef struct {
- /** This element indicates the maximum count this semaphore may have. */
- uint32_t maximum_count;
-} CORE_semaphore_Attributes;
-
-/**
* The following defines the control block used to manage each
* counting semaphore.
*/
@@ -73,10 +64,6 @@ typedef struct {
*/
const Thread_queue_Operations *operations;
- /** This element is the set of attributes which define this instance's
- * behavior.
- */
- CORE_semaphore_Attributes Attributes;
/** This element contains the current count of this semaphore. */
uint32_t count;
} CORE_semaphore_Control;
diff --git a/cpukit/score/include/rtems/score/coresemimpl.h b/cpukit/score/include/rtems/score/coresemimpl.h
index 365345a..c70e54f 100644
--- a/cpukit/score/include/rtems/score/coresemimpl.h
+++ b/cpukit/score/include/rtems/score/coresemimpl.h
@@ -87,13 +87,11 @@ typedef void ( *CORE_semaphore_API_mp_support_callout )(
*
* @param[in] the_semaphore is the semaphore to initialize
* @param[in] discipline the blocking discipline
- * @param[in] maximum_count the maximum count
* @param[in] initial_value is the initial count of the semaphore
*/
void _CORE_semaphore_Initialize(
CORE_semaphore_Control *the_semaphore,
CORE_semaphore_Disciplines discipline,
- uint32_t maximum_count,
uint32_t initial_value
);
@@ -158,7 +156,7 @@ RTEMS_INLINE_ROUTINE CORE_semaphore_Status _CORE_semaphore_Surrender(
_Thread_Dispatch_enable( _Per_CPU_Get() );
#endif
} else {
- if ( the_semaphore->count < the_semaphore->Attributes.maximum_count )
+ if ( the_semaphore->count < UINT32_MAX )
the_semaphore->count += 1;
else
status = CORE_SEMAPHORE_MAXIMUM_COUNT_EXCEEDED;
diff --git a/cpukit/score/src/coresem.c b/cpukit/score/src/coresem.c
index db2d47f..2bdd81c 100644
--- a/cpukit/score/src/coresem.c
+++ b/cpukit/score/src/coresem.c
@@ -23,12 +23,9 @@
void _CORE_semaphore_Initialize(
CORE_semaphore_Control *the_semaphore,
CORE_semaphore_Disciplines discipline,
- uint32_t maximum_count,
uint32_t initial_value
)
{
-
- the_semaphore->Attributes.maximum_count = maximum_count;
the_semaphore->count = initial_value;
_Thread_queue_Initialize( &the_semaphore->Wait_queue );
diff --git a/cpukit/score/src/mpci.c b/cpukit/score/src/mpci.c
index 8e93d74..132d3e5 100644
--- a/cpukit/score/src/mpci.c
+++ b/cpukit/score/src/mpci.c
@@ -120,7 +120,6 @@ static void _MPCI_Handler_initialization( void )
_CORE_semaphore_Initialize(
&_MPCI_Semaphore,
CORE_SEMAPHORE_DISCIPLINES_FIFO,
- 0xffffffff,
0 /* initial_value */
);
}
--
1.8.4.5
More information about the devel
mailing list