diff mbox series

[V2,04/19] selftests/resctrl: Declare global variables as extern

Message ID 5417736f2334c43098dd64733bd220dfe56a7c90.1589835155.git.sai.praneeth.prakhya@intel.com (mailing list archive)
State New
Headers show
Series Miscellaneous fixes for resctrl selftests | expand

Commit Message

Prakhya, Sai Praneeth May 18, 2020, 10:08 p.m. UTC
resctrl test suite uses global variables (E.g: bm_pid, ppid, llc_occup_path
and is_amd) that are used across .c files. Declare them as 'extern'
variables in resctrl.h file so that they are defined only in one .c file.
Otherwise sparse tool warns it as multiple definitions of the same
variable.

Sparse still complains about "bm_pid" variable name being used globally and
locally to a function in cache.c file. This issue will be addressed in a
later patch series.

Fixes: 591a6e8588fc ("selftests/resctrl: Add basic resctrl file system operations and data")
Reported-by: Reinette Chatre <reinette.chatre@intel.com>
Signed-off-by: Sai Praneeth Prakhya <sai.praneeth.prakhya@intel.com>
---
 tools/testing/selftests/resctrl/resctrl.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/tools/testing/selftests/resctrl/resctrl.h b/tools/testing/selftests/resctrl/resctrl.h
index 68522b19b235..814d0dd517a4 100644
--- a/tools/testing/selftests/resctrl/resctrl.h
+++ b/tools/testing/selftests/resctrl/resctrl.h
@@ -62,11 +62,11 @@  struct resctrl_val_param {
 	int		(*setup)(int num, ...);
 };
 
-pid_t bm_pid, ppid;
-int tests_run;
+extern pid_t bm_pid, ppid;
+extern int tests_run;
 
-char llc_occup_path[1024];
-bool is_amd;
+extern char llc_occup_path[1024];
+extern bool is_amd;
 
 bool check_resctrlfs_support(void);
 int filter_dmesg(void);