From: Arnd Bergmann <arnd@arndb.de>
To: Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@kernel.org>, Borislav Petkov <bp@alien8.de>,
x86@kernel.org, Mike Travis <mike.travis@hpe.com>,
Steve Wahl <steve.wahl@hpe.com>,
Dimitri Sivanich <dimitri.sivanich@hpe.com>
Cc: Arnd Bergmann <arnd@arndb.de>,
Andrew Morton <akpm@linux-foundation.org>,
Christoph Hellwig <hch@infradead.org>,
"H. Peter Anvin" <hpa@zytor.com>,
Hedi Berriche <hedi.berriche@hpe.com>,
Justin Ernst <justin.ernst@hpe.com>,
Peter Zijlstra <peterz@infradead.org>,
Russ Anderson <russ.anderson@hpe.com>,
Anshuman Khandual <anshuman.khandual@arm.com>,
linux-kernel@vger.kernel.org
Subject: [PATCH] x86/platform/uv: avoid unused variable warning
Date: Thu, 12 Dec 2019 14:58:06 +0100 [thread overview]
Message-ID: <20191212135815.4176658-1-arnd@arndb.de> (raw)
When CONFIG_PROC_FS is disabled, the compiler warns about an
unused variable:
arch/x86/kernel/apic/x2apic_uv_x.c: In function 'uv_setup_proc_files':
arch/x86/kernel/apic/x2apic_uv_x.c:1546:8: error: unused variable 'name' [-Werror=unused-variable]
char *name = hubless ? "hubless" : "hubbed";
Simplify the code so this variable is no longer needed.
Fixes: 8785968bce1c ("x86/platform/uv: Add UV Hubbed/Hubless Proc FS Files")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
arch/x86/kernel/apic/x2apic_uv_x.c | 28 ++++------------------------
1 file changed, 4 insertions(+), 24 deletions(-)
diff --git a/arch/x86/kernel/apic/x2apic_uv_x.c b/arch/x86/kernel/apic/x2apic_uv_x.c
index d5b51a740524..1af416da1f87 100644
--- a/arch/x86/kernel/apic/x2apic_uv_x.c
+++ b/arch/x86/kernel/apic/x2apic_uv_x.c
@@ -1493,13 +1493,13 @@ static void check_efi_reboot(void)
}
/* Setup user proc fs files */
-static int proc_hubbed_show(struct seq_file *file, void *data)
+static int __maybe_unused proc_hubbed_show(struct seq_file *file, void *data)
{
seq_printf(file, "0x%x\n", uv_hubbed_system);
return 0;
}
-static int proc_hubless_show(struct seq_file *file, void *data)
+static int __maybe_unused proc_hubless_show(struct seq_file *file, void *data)
{
seq_printf(file, "0x%x\n", uv_hubless_system);
return 0;
@@ -1511,28 +1511,11 @@ static int proc_oemid_show(struct seq_file *file, void *data)
return 0;
}
-static int proc_hubbed_open(struct inode *inode, struct file *file)
-{
- return single_open(file, proc_hubbed_show, (void *)NULL);
-}
-
-static int proc_hubless_open(struct inode *inode, struct file *file)
-{
- return single_open(file, proc_hubless_show, (void *)NULL);
-}
-
static int proc_oemid_open(struct inode *inode, struct file *file)
{
return single_open(file, proc_oemid_show, (void *)NULL);
}
-/* (struct is "non-const" as open function is set at runtime) */
-static struct file_operations proc_version_fops = {
- .read = seq_read,
- .llseek = seq_lseek,
- .release = single_release,
-};
-
static const struct file_operations proc_oemid_fops = {
.open = proc_oemid_open,
.read = seq_read,
@@ -1543,15 +1526,12 @@ static const struct file_operations proc_oemid_fops = {
static __init void uv_setup_proc_files(int hubless)
{
struct proc_dir_entry *pde;
- char *name = hubless ? "hubless" : "hubbed";
pde = proc_mkdir(UV_PROC_NODE, NULL);
- proc_create("oemid", 0, pde, &proc_oemid_fops);
- proc_create(name, 0, pde, &proc_version_fops);
if (hubless)
- proc_version_fops.open = proc_hubless_open;
+ proc_create_single("hubless", 0, pde, proc_hubless_show);
else
- proc_version_fops.open = proc_hubbed_open;
+ proc_create_single("hubbed", 0, pde, proc_hubbed_show);
}
/* Initialize UV hubless systems */
--
2.20.0
next reply other threads:[~2019-12-12 13:59 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-12 13:58 Arnd Bergmann [this message]
2019-12-12 14:01 ` [PATCH] x86/platform/uv: avoid unused variable warning Arnd Bergmann
2019-12-12 14:54 ` Christoph Hellwig
2019-12-12 15:16 ` Mike Travis
2019-12-12 14:03 Arnd Bergmann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20191212135815.4176658-1-arnd@arndb.de \
--to=arnd@arndb.de \
--cc=akpm@linux-foundation.org \
--cc=anshuman.khandual@arm.com \
--cc=bp@alien8.de \
--cc=dimitri.sivanich@hpe.com \
--cc=hch@infradead.org \
--cc=hedi.berriche@hpe.com \
--cc=hpa@zytor.com \
--cc=justin.ernst@hpe.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mike.travis@hpe.com \
--cc=mingo@kernel.org \
--cc=peterz@infradead.org \
--cc=russ.anderson@hpe.com \
--cc=steve.wahl@hpe.com \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).