linux/drivers/gpu/drm/v3d
Nathan Chancellor b27211db61
drm/v3d: 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:

  In file included from drivers/gpu/drm/v3d/v3d_debugfs.c:12:
  drivers/gpu/drm/v3d/v3d_drv.h:343:24: warning: use of logical '&&' with constant operand [-Wconstant-logical-operand]
    343 |         if (NSEC_PER_SEC % HZ &&
        |             ~~~~~~~~~~~~~~~~~ ^
  drivers/gpu/drm/v3d/v3d_drv.h:343:24: note: use '&' for a bitwise operation
    343 |         if (NSEC_PER_SEC % HZ &&
        |                               ^~
        |                               &
  drivers/gpu/drm/v3d/v3d_drv.h:343: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>
Reviewed-by: Maíra Canal <mcanal@igalia.com>
Reviewed-by: Nick Desaulniers <ndesaulniers@google.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-1-36ed8fc8faea@kernel.org
2023-07-27 13:01:27 -03:00
..
Kconfig drm/v3d: Add support for bcm2711 2022-06-12 22:10:50 -01:00
Makefile drm/v3d: Expose performance counters to userspace 2021-07-21 00:19:59 +01:00
v3d_bo.c drm/gem-shmem: Set vm_ops in static initializer 2022-02-14 09:42:01 +01:00
v3d_debugfs.c drm/v3d: use new debugfs device-centered functions 2022-12-22 14:59:23 -03:00
v3d_drv.c drm: Clear fd/handle callbacks in struct drm_driver 2023-06-26 11:08:41 +02:00
v3d_drv.h drm/v3d: Avoid -Wconstant-logical-operand in nsecs_to_jiffies_timeout() 2023-07-27 13:01:27 -03:00
v3d_fence.c
v3d_gem.c drm/v3d: Use drm_sched_job_add_syncobj_dependency() 2023-02-24 17:23:43 -03:00
v3d_irq.c drm/v3d: Don't clear MMU control bits on exception 2021-01-06 18:38:57 +01:00
v3d_mmu.c drm: v3d: fix common struct sg_table related issues 2020-09-10 08:18:35 +02:00
v3d_perfmon.c drm/v3d: add missing mutex_destroy 2022-11-10 11:49:40 -01:00
v3d_regs.h drm/v3d: Expose performance counters to userspace 2021-07-21 00:19:59 +01:00
v3d_sched.c drm/v3d: centralize error handling when init scheduler fails 2022-03-01 22:37:13 -01:00
v3d_trace_points.c
v3d_trace.h