Fix MISRA rule 8.3 in common code

Rule 8.3: All declarations of an object or function shall
          use the same names and type qualifiers.

Change-Id: Iff384187c74a598a4e73f350a1893b60e9d16cec
Signed-off-by: Roberto Vargas <roberto.vargas@arm.com>
This commit is contained in:
Roberto Vargas 2018-02-12 12:36:17 +00:00
parent 322a98b632
commit 9fb8af33c4
10 changed files with 31 additions and 30 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, ARM Limited and Contributors. All rights reserved.
* Copyright (c) 2015-2018, ARM Limited and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
@ -12,7 +12,7 @@
/***********************************************************
* The delay timer implementation
***********************************************************/
static const timer_ops_t *ops;
static const timer_ops_t *timer_ops;
/***********************************************************
* Delay for the given number of microseconds. The driver must
@ -20,26 +20,27 @@ static const timer_ops_t *ops;
***********************************************************/
void udelay(uint32_t usec)
{
assert(ops != NULL &&
(ops->clk_mult != 0) &&
(ops->clk_div != 0) &&
(ops->get_timer_value != NULL));
assert(timer_ops != NULL &&
(timer_ops->clk_mult != 0) &&
(timer_ops->clk_div != 0) &&
(timer_ops->get_timer_value != NULL));
uint32_t start, delta, total_delta;
assert(usec < UINT32_MAX / ops->clk_div);
assert(usec < UINT32_MAX / timer_ops->clk_div);
start = ops->get_timer_value();
start = timer_ops->get_timer_value();
/* Add an extra tick to avoid delaying less than requested. */
total_delta = div_round_up(usec * ops->clk_div, ops->clk_mult) + 1;
total_delta =
div_round_up(usec * timer_ops->clk_div, timer_ops->clk_mult) + 1;
do {
/*
* If the timer value wraps around, the subtraction will
* overflow and it will still give the correct result.
*/
delta = start - ops->get_timer_value(); /* Decreasing counter */
delta = start - timer_ops->get_timer_value(); /* Decreasing counter */
} while (delta < total_delta);
}
@ -64,5 +65,5 @@ void timer_init(const timer_ops_t *ops_ptr)
(ops_ptr->clk_div != 0) &&
(ops_ptr->get_timer_value != NULL));
ops = ops_ptr;
timer_ops = ops_ptr;
}