From 72228266809f3fbc83bb5427d82ac3298075384a Mon Sep 17 00:00:00 2001 From: Alex Waterman Date: Mon, 29 Oct 2018 10:11:50 -0700 Subject: [PATCH] gpu: nvgpu: Return bool from nvgpu_log_mask_enabled This function returns a boolean describing if a given log mask is enabled for a given GPU. Previously this returned and int but the bool type is far better suited for this. Also implement this function in posix, as it may be useful to have implemented there if any common code chooses to use this function. Change-Id: I7382e73df83282763df1bdbccbbb219c9f3e6f1b Signed-off-by: Alex Waterman Reviewed-on: https://git-master.nvidia.com/r/1938341 Reviewed-by: svc-misra-checker GVS: Gerrit_Virtual_Submit Reviewed-by: Terje Bergstrom Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/include/nvgpu/log.h | 2 +- drivers/gpu/nvgpu/os/linux/log.c | 4 ++-- drivers/gpu/nvgpu/os/posix/log.c | 5 +++++ 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/nvgpu/include/nvgpu/log.h b/drivers/gpu/nvgpu/include/nvgpu/log.h index 41fa2a12d..354830159 100644 --- a/drivers/gpu/nvgpu/include/nvgpu/log.h +++ b/drivers/gpu/nvgpu/include/nvgpu/log.h @@ -93,7 +93,7 @@ void __nvgpu_log_dbg(struct gk20a *g, u64 log_mask, * said prints would not happen. For example for-loops of log statements in * critical paths. */ -int nvgpu_log_mask_enabled(struct gk20a *g, u64 log_mask); +bool nvgpu_log_mask_enabled(struct gk20a *g, u64 log_mask); /** * nvgpu_log - Print a debug message diff --git a/drivers/gpu/nvgpu/os/linux/log.c b/drivers/gpu/nvgpu/os/linux/log.c index d6122c300..df1fb139e 100644 --- a/drivers/gpu/nvgpu/os/linux/log.c +++ b/drivers/gpu/nvgpu/os/linux/log.c @@ -45,9 +45,9 @@ static const char *log_types[] = { "INFO", }; -int nvgpu_log_mask_enabled(struct gk20a *g, u64 log_mask) +bool nvgpu_log_mask_enabled(struct gk20a *g, u64 log_mask) { - return !!(g->log_mask & log_mask); + return (g->log_mask & log_mask) != 0ULL; } static inline const char *nvgpu_log_name(struct gk20a *g) diff --git a/drivers/gpu/nvgpu/os/posix/log.c b/drivers/gpu/nvgpu/os/posix/log.c index fb1e7858f..6dd79efee 100644 --- a/drivers/gpu/nvgpu/os/posix/log.c +++ b/drivers/gpu/nvgpu/os/posix/log.c @@ -50,6 +50,11 @@ static inline const char *nvgpu_log_name(struct gk20a *g) return "gpu.USS"; } +bool nvgpu_log_mask_enabled(struct gk20a *g, u64 log_mask) +{ + return (g->log_mask & log_mask) != 0ULL; +} + static void __nvgpu_really_print_log(const char *gpu_name, const char *func_name, int line, enum nvgpu_log_type type, const char *log)