gpu: nvgpu: posix: fix cmpxchg MISRA 17.3 bug

In the commit "gpu: nvgpu: unit: update misc atomics to use gcc
builtins" the cmpxchg macro used by the "POSIX" build changed and
introduced a MISRA 17.3 violation for a macro parameter that needed
parentheses. This updates the macro to resolve this violation.

Change-Id: I16927ecaa751964f8c397c95086c663a683f8241
Signed-off-by: Philip Elcan <pelcan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2070064
GVS: Gerrit_Virtual_Submit
Reviewed-by: Alex Waterman <alexw@nvidia.com>
Reviewed-by: Tejal Kudav <tkudav@nvidia.com>
Reviewed-by: Adeel Raza <araza@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Philip Elcan
2019-03-11 16:41:36 -04:00
committed by mobile promotions
parent 56219f7c10
commit f087ec0826

View File

@@ -261,7 +261,7 @@ static inline bool __nvgpu_atomic64_sub_and_test(long x, nvgpu_atomic64_t *v)
*/
#define cmpxchg(p, old, new) \
({ \
typeof(*p) tmp = old; \
typeof(*(p)) tmp = old; \
\
atomic_compare_exchange_strong(p, &tmp, new); \
tmp; \