gpu: nvgpu: posix misra 12.1 fix

MISRA Advisory Rule states that the precedence of operators within
expressions should be made explicit.

This change removes the Advisory Rule 12.1 violations from the
implementation of the is_power_of_2() macro.

Jira NVGPU-3178

Change-Id: I75117e9ab6e47beddebeebaa23c6408b6ceb88ad
Signed-off-by: Scott Long <scottl@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2278574
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
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:
Scott Long
2020-01-13 13:21:37 -08:00
committed by Alex Waterman
parent 5ee9a446b5
commit d0f3529d10

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018-2019, NVIDIA CORPORATION. All rights reserved.
* Copyright (c) 2018-2020, NVIDIA CORPORATION. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -59,9 +59,9 @@
ret; \
})
#define is_power_of_2(x) \
(bool)({ \
typeof(x) __x__ = (x); \
(__x__ != 0U && ((__x__ & (__x__ - 1U)) == 0U));\
#define is_power_of_2(x) \
(bool)({ \
typeof(x) __x__ = (x); \
((__x__ != 0U) && ((__x__ & (__x__ - 1U)) == 0U)); \
})
#endif /* NVGPU_POSIX_LOG2_H */