diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2016-03-07 16:01:57 +0100 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2016-03-14 09:06:27 +0100 |
commit | 77e6eba7146ba2e2074b719eec01cc7c40bbe98b (patch) | |
tree | ec87c51ccd9c53cb65067a2a06a75d29b32387f3 /cpukit/rtems/src/timerdelete.c | |
parent | pc386: Fix linker usage issues with -r and function sections (diff) | |
download | rtems-77e6eba7146ba2e2074b719eec01cc7c40bbe98b.tar.bz2 |
score: Add and use _Objects_Get_local()
This simplifies the handling with local-only objects.
Update #2555.
Diffstat (limited to 'cpukit/rtems/src/timerdelete.c')
-rw-r--r-- | cpukit/rtems/src/timerdelete.c | 36 |
1 files changed, 14 insertions, 22 deletions
diff --git a/cpukit/rtems/src/timerdelete.c b/cpukit/rtems/src/timerdelete.c index 9c413976c4..8b23c31093 100644 --- a/cpukit/rtems/src/timerdelete.c +++ b/cpukit/rtems/src/timerdelete.c @@ -24,32 +24,24 @@ rtems_status_code rtems_timer_delete( rtems_id id ) { - Timer_Control *the_timer; - Objects_Locations location; - ISR_lock_Context lock_context; - Per_CPU_Control *cpu; + Timer_Control *the_timer; + ISR_lock_Context lock_context; _Objects_Allocator_lock(); - the_timer = _Timer_Get( id, &location, &lock_context ); - switch ( location ) { - - case OBJECTS_LOCAL: - _Objects_Close( &_Timer_Information, &the_timer->Object ); - cpu = _Timer_Acquire_critical( the_timer, &lock_context ); - _Timer_Cancel( cpu, the_timer ); - _Timer_Release( cpu, &lock_context ); - _Timer_Free( the_timer ); - _Objects_Allocator_unlock(); - return RTEMS_SUCCESSFUL; - -#if defined(RTEMS_MULTIPROCESSING) - case OBJECTS_REMOTE: /* should never return this */ -#endif - case OBJECTS_ERROR: - break; + + the_timer = _Timer_Get( id, &lock_context ); + if ( the_timer != NULL ) { + Per_CPU_Control *cpu; + + _Objects_Close( &_Timer_Information, &the_timer->Object ); + cpu = _Timer_Acquire_critical( the_timer, &lock_context ); + _Timer_Cancel( cpu, the_timer ); + _Timer_Release( cpu, &lock_context ); + _Timer_Free( the_timer ); + _Objects_Allocator_unlock(); + return RTEMS_SUCCESSFUL; } _Objects_Allocator_unlock(); - return RTEMS_INVALID_ID; } |