[PATCH v2 4/6] rtems: Move _Partition_Is_buffer_area_aligned()
Sebastian Huber
sebastian.huber at embedded-brains.de
Mon Nov 23 10:35:43 UTC 2020
It is only used by rtems_partition_create(). Move code directly to the
directive which called the inline function. Add a comment.
---
cpukit/include/rtems/rtems/partimpl.h | 7 -------
cpukit/rtems/src/partcreate.c | 7 ++++++-
2 files changed, 6 insertions(+), 8 deletions(-)
diff --git a/cpukit/include/rtems/rtems/partimpl.h b/cpukit/include/rtems/rtems/partimpl.h
index b9d57ae3c3..dcffe757c7 100644
--- a/cpukit/include/rtems/rtems/partimpl.h
+++ b/cpukit/include/rtems/rtems/partimpl.h
@@ -34,13 +34,6 @@ extern "C" {
* @{
*/
-RTEMS_INLINE_ROUTINE bool _Partition_Is_buffer_area_aligned(
- const void *starting_address
-)
-{
- return (((uintptr_t) starting_address) % CPU_SIZEOF_POINTER) == 0;
-}
-
/**
* @brief Allocates a partition control block from the
* inactive chain of free partition control blocks.
diff --git a/cpukit/rtems/src/partcreate.c b/cpukit/rtems/src/partcreate.c
index 1e471d3c0a..743405439c 100644
--- a/cpukit/rtems/src/partcreate.c
+++ b/cpukit/rtems/src/partcreate.c
@@ -69,8 +69,13 @@ rtems_status_code rtems_partition_create(
if ( buffer_size < sizeof( Chain_Node ) )
return RTEMS_INVALID_SIZE;
- if ( !_Partition_Is_buffer_area_aligned( starting_address ) )
+ /*
+ * Ensure that the buffer area starting address is aligned on a pointer
+ * boundary so that each buffer begin meets the chain node alignment.
+ */
+ if ( (uintptr_t) starting_address % CPU_SIZEOF_POINTER != 0 ) {
return RTEMS_INVALID_ADDRESS;
+ }
#if defined(RTEMS_MULTIPROCESSING)
if ( !_System_state_Is_multiprocessing ) {
--
2.26.2
More information about the devel
mailing list