Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp1992165pxb; Sun, 30 Jan 2022 01:47:15 -0800 (PST) X-Google-Smtp-Source: ABdhPJz8OEODhriksngkLTWfB8/tBBkQMWxrmFWYvNavGOd/jvhe5nj+a9QqB2oKjjwxxpQ/Bv26 X-Received: by 2002:a17:90a:d144:: with SMTP id t4mr28372614pjw.18.1643536035640; Sun, 30 Jan 2022 01:47:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643536035; cv=none; d=google.com; s=arc-20160816; b=cQ6DqomenH04Y2CNcVhX4/x+mQsW+pPfSniUQNkQw2DxYs0+aiyMWbMWzvQ3DZvIpE bHiPWzDg7Ac2deIgosPAVlyuLAJHXb0K6CELItpoYirVyLql5vpv3Z/nyVohWPbpPY/T 7wB+o/aql59u0wkyO7/j/ypLf0N6IFT8wSzGQ4b2Jx5pGw1X/U51ooF9xwEgZx33ryoB cVfRKjHZB44KL96af16Qw0whO0qXA8Eegj3O6DcKWQlPKvZzliRahxAS8vONcmQGOIB1 OKXL9COgkl96ZbiEngbaFhHY7jRSPdQkO6lJKjOm4DenG+MsGIIReNwwVaT7Fs9iT35P agkQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:robot-unsubscribe :robot-id:message-id:mime-version:references:in-reply-to:cc:subject :to:reply-to:sender:from:dkim-signature:dkim-signature:date; bh=Aml8tBFI+nLezrilw2evb9ESY9QnHpsuSOvRgZDwPrw=; b=CydYlSeqrCxWuoBg0VZZ+oFcBefX9MiOLJVTtbCLG7A0H54W+9RUnQr9X01QV92C4I E8KpJzaXrJ5vlnhfZDkDiEfhSY+jsce6s+Iy+po0ZQhCx2hhaUlzV+f2z+L8xLVoe/CQ ggwQ5WGLjAGwpvxS7TSceEaIbISSRqlLiEdEVJXz+x+DYisQtjP+mZzHmPD3pAQ+uOeE o0jnimYmzjV3pGdVMrnQoi4YChR/7ih262gdoCE9AsVskv50rMefwUyRAKZ31dZMTUwg /IelI+8FDc+bxcqA37rjbcQEnLJFkzmUIVQuOBsKiPMRQHNrHGFBguttJE2QVN49UDcQ nzuA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b="y07/33IH"; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=HgHQb7ku; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e7si10513038pgc.781.2022.01.30.01.47.04; Sun, 30 Jan 2022 01:47:15 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b="y07/33IH"; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=HgHQb7ku; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346931AbiA1HkU (ORCPT + 99 others); Fri, 28 Jan 2022 02:40:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60336 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346906AbiA1HkS (ORCPT ); Fri, 28 Jan 2022 02:40:18 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C9212C061714; Thu, 27 Jan 2022 23:40:17 -0800 (PST) Date: Fri, 28 Jan 2022 07:40:14 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1643355615; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Aml8tBFI+nLezrilw2evb9ESY9QnHpsuSOvRgZDwPrw=; b=y07/33IHWrtPd1eBNjrJ9em19qvyJYcATzrC7Qj5sENPfkFyZlEYOK3SsW249d4AM1TUGc +a1/Dt3xZI0ywpZsTmQacaJpMtzMhwcoxFLvmHyvUASi0Xph/vUesKzAIB9Q8Px0uCgS5O cOJT4NUm1cf8mjhdF2fqm1Y6vwOulqpNDMyBNNjCZ4AkAP8zfE3O3daA7oK6ROzXUQaHTT ltGh/v1B4kmWngGStJAgXymxHozEuBPUCAciSa5xRHipjSGpzqH3g7dze5rNnqtbr8p8uv jPQsGiXUlTlDf+s2Z0D7jscT5wZqFLDD+lA29NLhhb5SGYpy1vLw2D040laW2w== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1643355615; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Aml8tBFI+nLezrilw2evb9ESY9QnHpsuSOvRgZDwPrw=; b=HgHQb7kumXXBFprH/GSqbrCPRv0I7CdOCz+qDf65SeXmhNXFN0gxK60oCOvlMkAS0AZBf/ GsfAjl0lnrhnFBAA== From: "tip-bot2 for Suren Baghdasaryan" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: sched/core] psi: Fix "defined but not used" warnings when CONFIG_PROC_FS=n Cc: kernel test robot , Suren Baghdasaryan , "Peter Zijlstra (Intel)" , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20220119223940.787748-3-surenb@google.com> References: <20220119223940.787748-3-surenb@google.com> MIME-Version: 1.0 Message-ID: <164335561425.16921.13950988057345520817.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following commit has been merged into the sched/core branch of tip: Commit-ID: 5102bb1c9f82857a3164af9d7ab7ad628cb783ed Gitweb: https://git.kernel.org/tip/5102bb1c9f82857a3164af9d7ab7ad628cb783ed Author: Suren Baghdasaryan AuthorDate: Wed, 19 Jan 2022 14:39:40 -08:00 Committer: Peter Zijlstra CommitterDate: Thu, 27 Jan 2022 12:57:19 +01:00 psi: Fix "defined but not used" warnings when CONFIG_PROC_FS=n 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 Signed-off-by: Suren Baghdasaryan Signed-off-by: Peter Zijlstra (Intel) Link: https://lkml.kernel.org/r/20220119223940.787748-3-surenb@google.com --- kernel/sched/psi.c | 79 +++++++++++++++++++++++---------------------- 1 file changed, 41 insertions(+), 38 deletions(-) diff --git a/kernel/sched/psi.c b/kernel/sched/psi.c index a679613..cfe76f7 100644 --- a/kernel/sched/psi.c +++ b/kernel/sched/psi.c @@ -1082,44 +1082,6 @@ int psi_show(struct seq_file *m, struct psi_group *group, enum psi_res res) return 0; } -static int psi_io_show(struct seq_file *m, void *v) -{ - return psi_show(m, &psi_system, PSI_IO); -} - -static int psi_memory_show(struct seq_file *m, void *v) -{ - return psi_show(m, &psi_system, PSI_MEM); -} - -static int psi_cpu_show(struct seq_file *m, void *v) -{ - return psi_show(m, &psi_system, PSI_CPU); -} - -static int psi_open(struct file *file, int (*psi_show)(struct seq_file *, void *)) -{ - if (file->f_mode & FMODE_WRITE && !capable(CAP_SYS_RESOURCE)) - return -EPERM; - - return single_open(file, psi_show, NULL); -} - -static int psi_io_open(struct inode *inode, struct file *file) -{ - return psi_open(file, psi_io_show); -} - -static int psi_memory_open(struct inode *inode, struct file *file) -{ - return psi_open(file, psi_memory_show); -} - -static int psi_cpu_open(struct inode *inode, struct file *file) -{ - return psi_open(file, psi_cpu_show); -} - struct psi_trigger *psi_trigger_create(struct psi_group *group, char *buf, size_t nbytes, enum psi_res res) { @@ -1296,6 +1258,45 @@ __poll_t psi_trigger_poll(void **trigger_ptr, return ret; } +#ifdef CONFIG_PROC_FS +static int psi_io_show(struct seq_file *m, void *v) +{ + return psi_show(m, &psi_system, PSI_IO); +} + +static int psi_memory_show(struct seq_file *m, void *v) +{ + return psi_show(m, &psi_system, PSI_MEM); +} + +static int psi_cpu_show(struct seq_file *m, void *v) +{ + return psi_show(m, &psi_system, PSI_CPU); +} + +static int psi_open(struct file *file, int (*psi_show)(struct seq_file *, void *)) +{ + if (file->f_mode & FMODE_WRITE && !capable(CAP_SYS_RESOURCE)) + return -EPERM; + + return single_open(file, psi_show, NULL); +} + +static int psi_io_open(struct inode *inode, struct file *file) +{ + return psi_open(file, psi_io_show); +} + +static int psi_memory_open(struct inode *inode, struct file *file) +{ + return psi_open(file, psi_memory_show); +} + +static int psi_cpu_open(struct inode *inode, struct file *file) +{ + return psi_open(file, psi_cpu_show); +} + static ssize_t psi_write(struct file *file, const char __user *user_buf, size_t nbytes, enum psi_res res) { @@ -1400,3 +1401,5 @@ static int __init psi_proc_init(void) return 0; } module_init(psi_proc_init); + +#endif /* CONFIG_PROC_FS */