summaryrefslogtreecommitdiffstats
path: root/cpukit/rtems/src/regionextend.c
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2016-04-07 16:48:30 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2016-04-12 07:36:18 +0200
commit572cb6242969f96a5bf74dc107e3f845894b6b2b (patch)
treebe87de631165d9314f36ad6d48e15b8ca8fb9d7b /cpukit/rtems/src/regionextend.c
parentrtems: Ensure lock ownership for _Region_Get() (diff)
downloadrtems-572cb6242969f96a5bf74dc107e3f845894b6b2b.tar.bz2
score: Simplify _Objects_Get_no_protection()
This functions supports only local objects. Thus, drop the location parameter which was unused by all callers. Remove superfluous includes from Classic Region implementation.
Diffstat (limited to 'cpukit/rtems/src/regionextend.c')
-rw-r--r--cpukit/rtems/src/regionextend.c73
1 files changed, 28 insertions, 45 deletions
diff --git a/cpukit/rtems/src/regionextend.c b/cpukit/rtems/src/regionextend.c
index 2ee2b992e4..b1df066f25 100644
--- a/cpukit/rtems/src/regionextend.c
+++ b/cpukit/rtems/src/regionextend.c
@@ -18,13 +18,7 @@
#include "config.h"
#endif
-#include <rtems/system.h>
-#include <rtems/rtems/status.h>
-#include <rtems/rtems/support.h>
-#include <rtems/rtems/options.h>
#include <rtems/rtems/regionimpl.h>
-#include <rtems/score/thread.h>
-#include <rtems/score/apimutex.h>
rtems_status_code rtems_region_extend(
rtems_id id,
@@ -32,48 +26,37 @@ rtems_status_code rtems_region_extend(
uintptr_t length
)
{
- uintptr_t amount_extended;
- Objects_Locations location;
- rtems_status_code return_status;
- Region_Control *the_region;
+ rtems_status_code status;
+ Region_Control *the_region;
+ uintptr_t amount_extended;
- if ( !starting_address )
+ if ( starting_address == NULL ) {
return RTEMS_INVALID_ADDRESS;
-
- _RTEMS_Lock_allocator(); /* to prevent deletion */
-
- the_region = _Region_Get( id, &location );
- switch ( location ) {
-
- case OBJECTS_LOCAL:
-
- amount_extended = _Heap_Extend(
- &the_region->Memory,
- starting_address,
- length,
- 0
- );
-
- if ( amount_extended > 0 ) {
- the_region->length += amount_extended;
- the_region->maximum_segment_size += amount_extended;
- return_status = RTEMS_SUCCESSFUL;
- } else {
- return_status = RTEMS_INVALID_ADDRESS;
- }
- break;
-
-#if defined(RTEMS_MULTIPROCESSING)
- case OBJECTS_REMOTE: /* this error cannot be returned */
-#endif
-
- case OBJECTS_ERROR:
- default:
- return_status = RTEMS_INVALID_ID;
- break;
+ }
+
+ _RTEMS_Lock_allocator();
+
+ the_region = _Region_Get( id );
+
+ if ( the_region != NULL ) {
+ amount_extended = _Heap_Extend(
+ &the_region->Memory,
+ starting_address,
+ length,
+ 0
+ );
+
+ if ( amount_extended > 0 ) {
+ the_region->length += amount_extended;
+ the_region->maximum_segment_size += amount_extended;
+ status = RTEMS_SUCCESSFUL;
+ } else {
+ status = RTEMS_INVALID_ADDRESS;
}
+ } else {
+ status = RTEMS_INVALID_ID;
+ }
_RTEMS_Unlock_allocator();
-
- return return_status;
+ return status;
}