HV:treewide:fix rest of violations related parameter changed

Misra c required parameter should not changed in the scope
of function,use local variable to replace it.

Signed-off-by: Huihuang Shi <huihuang.shi@intel.com>
Reviewed-by: Junjie Mao <junjie.mao@intel.com>
This commit is contained in:
Huihuang Shi
2018-07-27 15:08:24 +08:00
committed by lijinxia
parent 42c77e4cf4
commit 496e40072e
8 changed files with 35 additions and 21 deletions

View File

@@ -176,9 +176,10 @@ static inline uint16_t clz64(uint64_t value)
* If nr>=64, it will be truncated.
*/
#define build_bitmap_set(name, op_len, op_type, lock, nr, addr) \
static inline void name(uint16_t nr, volatile op_type *addr) \
static inline void name(uint16_t nr_arg, volatile op_type *addr) \
{ \
nr = nr & ((8U * sizeof(op_type)) - 1U); \
uint16_t nr; \
nr = nr_arg & ((8U * sizeof(op_type)) - 1U); \
asm volatile(lock "or" op_len " %1,%0" \
: "+m" (*addr) \
: "r" ((op_type)(1UL<<nr)) \
@@ -195,9 +196,10 @@ build_bitmap_set(bitmap32_set, "l", uint32_t, BUS_LOCK, nr, addr)
* If nr>=64, it will be truncated.
*/
#define build_bitmap_clear(name, op_len, op_type, lock, nr, addr) \
static inline void name(uint16_t nr, volatile op_type *addr) \
static inline void name(uint16_t nr_arg, volatile op_type *addr) \
{ \
nr = nr & ((8U * sizeof(op_type)) - 1U); \
uint16_t nr; \
nr = nr_arg & ((8U * sizeof(op_type)) - 1U); \
asm volatile(lock "and" op_len " %1,%0" \
: "+m" (*addr) \
: "r" ((op_type)(~(1UL<<(nr)))) \
@@ -213,10 +215,11 @@ build_bitmap_clear(bitmap32_clear, "l", uint32_t, BUS_LOCK, nr, addr)
* Note:Input parameter nr shall be less than 64. If nr>=64, it will
* be truncated.
*/
static inline bool bitmap_test(uint16_t nr, volatile uint64_t *addr)
static inline bool bitmap_test(uint16_t nr_arg, volatile uint64_t *addr)
{
uint16_t nr;
int32_t ret=0;
nr = nr & 0x3fU;
nr = nr_arg & 0x3fU;
asm volatile("btq %q2,%1\n\tsbbl %0, %0"
: "=r" (ret), "=m" (*addr)
: "r" ((uint64_t)nr)
@@ -224,10 +227,11 @@ static inline bool bitmap_test(uint16_t nr, volatile uint64_t *addr)
return (ret != 0);
}
static inline bool bitmap32_test(uint16_t nr, volatile uint32_t *addr)
static inline bool bitmap32_test(uint16_t nr_arg, volatile uint32_t *addr)
{
uint16_t nr;
int32_t ret=0;
nr = nr & 0x1fU;
nr = nr_arg & 0x1fU;
asm volatile("btl %2,%1\n\tsbbl %0, %0"
: "=r" (ret), "=m" (*addr)
: "r" ((uint32_t)nr)
@@ -243,10 +247,11 @@ static inline bool bitmap32_test(uint16_t nr, volatile uint32_t *addr)
* will be truncated.
*/
#define build_bitmap_testandset(name, op_len, op_type, lock, nr, addr) \
static inline bool name(uint16_t nr, volatile op_type *addr) \
static inline bool name(uint16_t nr_arg, volatile op_type *addr) \
{ \
uint16_t nr; \
int32_t ret=0; \
nr = nr & ((8U * sizeof(op_type)) - 1U); \
nr = nr_arg & ((8U * sizeof(op_type)) - 1U); \
asm volatile(lock "bts" op_len " %2,%1\n\tsbbl %0,%0" \
: "=r" (ret), "=m" (*addr) \
: "r" ((op_type)nr) \
@@ -266,10 +271,11 @@ build_bitmap_testandset(bitmap32_test_and_set, "l", uint32_t, BUS_LOCK, nr, addr
* it will be truncated.
*/
#define build_bitmap_testandclear(name, op_len, op_type, lock, nr, addr)\
static inline bool name(uint16_t nr, volatile op_type *addr) \
static inline bool name(uint16_t nr_arg, volatile op_type *addr) \
{ \
uint16_t nr; \
int32_t ret=0; \
nr = nr & ((8U * sizeof(op_type)) - 1U); \
nr = nr_arg & ((8U * sizeof(op_type)) - 1U); \
asm volatile(lock "btr" op_len " %2,%1\n\tsbbl %0,%0" \
: "=r" (ret), "=m" (*addr) \
: "r" ((op_type)nr) \