Re: [PATCH 2/2] psi: Fix "defined but not used" warnings when CONFIG_PROC_FS=n

From: Johannes Weiner
Date: Thu Jan 20 2022 - 10:54:55 EST


On Wed, Jan 19, 2022 at 02:39:40PM -0800, Suren Baghdasaryan wrote:
> When CONFIG_PROC_FS is disabled psi code generates the following warnings:
>
> kernel/sched/psi.c:1364:30: warning: 'psi_cpu_proc_ops' defined but not used [-Wunused-const-variable=]
> 1364 | static const struct proc_ops psi_cpu_proc_ops = {
> | ^~~~~~~~~~~~~~~~
> kernel/sched/psi.c:1355:30: warning: 'psi_memory_proc_ops' defined but not used [-Wunused-const-variable=]
> 1355 | static const struct proc_ops psi_memory_proc_ops = {
> | ^~~~~~~~~~~~~~~~~~~
> kernel/sched/psi.c:1346:30: warning: 'psi_io_proc_ops' defined but not used [-Wunused-const-variable=]
> 1346 | static const struct proc_ops psi_io_proc_ops = {
> | ^~~~~~~~~~~~~~~
>
> Make definitions of these structures and related functions conditional on
> CONFIG_PROC_FS config.
>
> Fixes: 0e94682b73bf ("psi: introduce psi monitor")
> Reported-by: kernel test robot <lkp@xxxxxxxxx>
> Signed-off-by: Suren Baghdasaryan <surenb@xxxxxxxxxx>

Acked-by: Johannes Weiner <hannes@xxxxxxxxxxx>