From 523867de9d274d2bdc29ce649d764b42a9167c0e Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Tue, 11 May 2021 17:27:20 +0200 Subject: rtems: Constify rtems_task_wake_when() Add a parameter to _TOD_Validate() to disable the validation of the ticks member. There are two reasons for this change. Firstly, in rtems_task_wake_when() was a double check for time_buffer == NULL (one in rtems_task_wake_when() and one in _TOD_Validate()). Secondly, the ticks member is ignored by rtems_task_wake_when(). This was done with a write of zero to the ticks member and thus a modification of the user-provided structure. Now the structure is no longer modified. Using a mask parameter is quite efficient. You just have to load an immediate value and there are no additional branches in _TOD_Validate(). Close #4406. --- cpukit/rtems/src/taskwakewhen.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'cpukit/rtems/src/taskwakewhen.c') diff --git a/cpukit/rtems/src/taskwakewhen.c b/cpukit/rtems/src/taskwakewhen.c index a25204ad01..4dfa6dfef2 100644 --- a/cpukit/rtems/src/taskwakewhen.c +++ b/cpukit/rtems/src/taskwakewhen.c @@ -27,7 +27,7 @@ #include rtems_status_code rtems_task_wake_when( - rtems_time_of_day *time_buffer + const rtems_time_of_day *time_buffer ) { uint32_t seconds; @@ -38,11 +38,7 @@ rtems_status_code rtems_task_wake_when( if ( !_TOD_Is_set() ) return RTEMS_NOT_DEFINED; - if ( !time_buffer ) - return RTEMS_INVALID_ADDRESS; - - time_buffer->ticks = 0; - status = _TOD_Validate( time_buffer ); + status = _TOD_Validate( time_buffer, TOD_DISABLE_TICKS_VALIDATION ); if ( status != RTEMS_SUCCESSFUL ) { return status; -- cgit v1.2.3