From 88256dd9ccbe0202a869bd204e4205d218250aed Mon Sep 17 00:00:00 2001 From: Nicolas Benech Date: Fri, 29 Mar 2019 11:23:28 -0400 Subject: [PATCH] gpu: nvgpu: unit: add verbose_lvl function The verbose_lvl function allows a unit module to retrieve the current verbosity level (set by the -v args) and therefore use it to enable log masks as needed. JIRA NVGPU-2975 Change-Id: Ic41c9e962ca4fa9c0a6c130857f0df5b3b7215c7 Signed-off-by: Nicolas Benech Reviewed-on: https://git-master.nvidia.com/r/2085058 Reviewed-by: svc-mobile-coverity Reviewed-by: svc-mobile-misra Reviewed-by: Automatic_Commit_Validation_User GVS: Gerrit_Virtual_Submit Reviewed-by: Philip Elcan Reviewed-by: Alex Waterman Reviewed-by: mobile promotions Tested-by: mobile promotions --- userspace/include/unit/core.h | 4 ++-- userspace/libnvgpu-unit.export | 3 ++- userspace/src/module.c | 8 +++++++- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/userspace/include/unit/core.h b/userspace/include/unit/core.h index d9d119dbd..b47b64559 100644 --- a/userspace/include/unit/core.h +++ b/userspace/include/unit/core.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved. + * Copyright (c) 2018-2019, 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,5 +59,5 @@ struct unit_fw { int core_load_nvgpu(struct unit_fw *fw); int core_exec(struct unit_fw *fw); - +int verbose_lvl(struct unit_module *module); #endif diff --git a/userspace/libnvgpu-unit.export b/userspace/libnvgpu-unit.export index 4238b30ca..3344963d4 100644 --- a/userspace/libnvgpu-unit.export +++ b/userspace/libnvgpu-unit.export @@ -1,5 +1,6 @@ -# Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved. +# Copyright (c) 2018-2019, NVIDIA CORPORATION. All rights reserved. __core_print_stdout __core_print_stderr __unit_info_color +verbose_lvl diff --git a/userspace/src/module.c b/userspace/src/module.c index d88b392cd..110df949d 100644 --- a/userspace/src/module.c +++ b/userspace/src/module.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved. + * Copyright (c) 2018-2019, 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"), @@ -213,3 +213,9 @@ err: closedir(load_dir); return NULL; } + +/* Return the current verbosity level */ +int verbose_lvl(struct unit_module *module) +{ + return module->fw->args->verbose_lvl; +}