diff options
author | Nathan Chancellor <nathan@kernel.org> | 2023-07-19 00:44:20 +0300 |
---|---|---|
committer | Maíra Canal <mairacanal@riseup.net> | 2023-07-27 19:01:28 +0300 |
commit | aeedd3a82678d89627bdd020a28e0af35ff45552 (patch) | |
tree | e7067c1c6d8d19d5ac7bc43d3e87e14a13688b73 /drivers/gpu/drm/tegra | |
parent | b27211db61aed86f095e76aa61eaef3bf3e0b7c2 (diff) | |
download | linux-aeedd3a82678d89627bdd020a28e0af35ff45552.tar.xz |
drm/i915: Avoid -Wconstant-logical-operand in nsecs_to_jiffies_timeout()
A proposed update to clang's -Wconstant-logical-operand to warn when the
left hand side is a constant shows the following instance in
nsecs_to_jiffies_timeout() when NSEC_PER_SEC is not a multiple of HZ,
such as CONFIG_HZ=300:
drivers/gpu/drm/i915/gem/i915_gem_wait.c:189:24: warning: use of logical '&&' with constant operand [-Wconstant-logical-operand]
189 | if (NSEC_PER_SEC % HZ &&
| ~~~~~~~~~~~~~~~~~ ^
drivers/gpu/drm/i915/gem/i915_gem_wait.c:189:24: note: use '&' for a bitwise operation
189 | if (NSEC_PER_SEC % HZ &&
| ^~
| &
drivers/gpu/drm/i915/gem/i915_gem_wait.c:189:24: note: remove constant to silence this warning
1 warning generated.
Turn this into an explicit comparison against zero to make the
expression a boolean to make it clear this should be a logical check,
not a bitwise one.
Link: https://reviews.llvm.org/D142609
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Acked-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Signed-off-by: Maíra Canal <mairacanal@riseup.net>
Link: https://patchwork.freedesktop.org/patch/msgid/20230718-nsecs_to_jiffies_timeout-constant-logical-operand-v1-2-36ed8fc8faea@kernel.org
Diffstat (limited to 'drivers/gpu/drm/tegra')
0 files changed, 0 insertions, 0 deletions