[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20211227164317.4146918-31-schnelle@linux.ibm.com>
Date: Mon, 27 Dec 2021 17:43:15 +0100
From: Niklas Schnelle <schnelle@...ux.ibm.com>
To: Arnd Bergmann <arnd@...nel.org>,
Bjorn Helgaas <bhelgaas@...gle.com>,
John Garry <john.garry@...wei.com>,
Nick Hu <nickhu@...estech.com>,
Greentime Hu <green.hu@...il.com>,
Vincent Chen <deanbo422@...il.com>,
Paul Walmsley <paul.walmsley@...ive.com>,
Palmer Dabbelt <palmer@...belt.com>,
Albert Ou <aou@...s.berkeley.edu>, Guo Ren <guoren@...nel.org>,
Arnd Bergmann <arnd@...db.de>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc: linux-kernel@...r.kernel.org, linux-arch@...r.kernel.org,
linux-pci@...r.kernel.org, linux-riscv@...ts.infradead.org,
linux-csky@...r.kernel.org
Subject: [RFC 30/32] /dev/port: don't compile file operations without CONFIG_DEVPORT
In the future inb() and friends will not be available when compiling
with CONFIG_HAS_IOPORT=n so we must only try to access them here if
CONFIG_DEVPORT is set which depends on HAS_IOPORT.
Co-developed-by: Arnd Bergmann <arnd@...nel.org>
Signed-off-by: Arnd Bergmann <arnd@...nel.org>
Signed-off-by: Niklas Schnelle <schnelle@...ux.ibm.com>
---
drivers/char/mem.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/char/mem.c b/drivers/char/mem.c
index cc296f0823bd..c1373617153f 100644
--- a/drivers/char/mem.c
+++ b/drivers/char/mem.c
@@ -402,6 +402,7 @@ static int mmap_mem(struct file *file, struct vm_area_struct *vma)
return 0;
}
+#ifdef CONFIG_DEVPORT
static ssize_t read_port(struct file *file, char __user *buf,
size_t count, loff_t *ppos)
{
@@ -443,6 +444,7 @@ static ssize_t write_port(struct file *file, const char __user *buf,
*ppos = i;
return tmp-buf;
}
+#endif
static ssize_t read_null(struct file *file, char __user *buf,
size_t count, loff_t *ppos)
@@ -665,12 +667,14 @@ static const struct file_operations null_fops = {
.splice_write = splice_write_null,
};
-static const struct file_operations __maybe_unused port_fops = {
+#ifdef CONFIG_DEVPORT
+static const struct file_operations port_fops = {
.llseek = memory_lseek,
.read = read_port,
.write = write_port,
.open = open_port,
};
+#endif
static const struct file_operations zero_fops = {
.llseek = zero_lseek,
--
2.32.0
Powered by blists - more mailing lists