diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2016-05-20 13:24:11 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2016-05-20 16:16:59 +0200 |
commit | 0a00b2b5f6d115829f05bbac260ba7c9bc47c9e4 (patch) | |
tree | bc25332e7b0f84f2130cfe9163824d76c8037bed /cpukit/rtems/src/partreturnbuffer.c | |
parent | mpci: Delete unused region support (diff) | |
download | rtems-0a00b2b5f6d115829f05bbac260ba7c9bc47c9e4.tar.bz2 |
rtems: Remove location from _Partition_Get()
Use _Objects_Get_local() for _Partition_Get() to get rid of the location
parameter. Move remote object handling to partition MPCI support.
Diffstat (limited to '')
-rw-r--r-- | cpukit/rtems/src/partreturnbuffer.c | 40 |
1 files changed, 15 insertions, 25 deletions
diff --git a/cpukit/rtems/src/partreturnbuffer.c b/cpukit/rtems/src/partreturnbuffer.c index 641abed572..5d04c63b2a 100644 --- a/cpukit/rtems/src/partreturnbuffer.c +++ b/cpukit/rtems/src/partreturnbuffer.c @@ -22,37 +22,27 @@ rtems_status_code rtems_partition_return_buffer( ) { Partition_Control *the_partition; - Objects_Locations location; ISR_lock_Context lock_context; - the_partition = _Partition_Get( id, &location, &lock_context ); - switch ( location ) { - - case OBJECTS_LOCAL: - _Partition_Acquire_critical( the_partition, &lock_context ); - - if ( _Partition_Is_buffer_valid( buffer, the_partition ) ) { - _Partition_Free_buffer( the_partition, buffer ); - the_partition->number_of_used_blocks -= 1; - _Partition_Release( the_partition, &lock_context ); - return RTEMS_SUCCESSFUL; - } - - _Partition_Release( the_partition, &lock_context ); - return RTEMS_INVALID_ADDRESS; + the_partition = _Partition_Get( id, &lock_context ); + if ( the_partition == NULL ) { #if defined(RTEMS_MULTIPROCESSING) - case OBJECTS_REMOTE: - return _Partition_MP_Send_request_packet( - PARTITION_MP_RETURN_BUFFER_REQUEST, - id, - buffer - ); + return _Partition_MP_Return_buffer( id, buffer ); +#else + return RTEMS_INVALID_ID; #endif + } + + _Partition_Acquire_critical( the_partition, &lock_context ); - case OBJECTS_ERROR: - break; + if ( !_Partition_Is_buffer_valid( buffer, the_partition ) ) { + _Partition_Release( the_partition, &lock_context ); + return RTEMS_INVALID_ADDRESS; } - return RTEMS_INVALID_ID; + _Partition_Free_buffer( the_partition, buffer ); + the_partition->number_of_used_blocks -= 1; + _Partition_Release( the_partition, &lock_context ); + return RTEMS_SUCCESSFUL; } |