aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Niklas Schnelle <schnelle@linux.ibm.com> 2024-04-04 13:49:17 +0200
committerGravatar Greg Kroah-Hartman <gregkh@linuxfoundation.org> 2024-04-11 15:26:55 +0200
commitf0a816fb12dadd21326a7c0e54e3253f69d895d5 (patch)
treea68de960d76e7d1143fc11a77b2f23009b0802e3
parentparport: mfc3: avoid empty-body warning (diff)
downloadlinux-f0a816fb12dadd21326a7c0e54e3253f69d895d5.tar.gz
linux-f0a816fb12dadd21326a7c0e54e3253f69d895d5.tar.bz2
linux-f0a816fb12dadd21326a7c0e54e3253f69d895d5.zip
/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@kernel.org> Signed-off-by: Arnd Bergmann <arnd@kernel.org> Signed-off-by: Niklas Schnelle <schnelle@linux.ibm.com> Link: https://lore.kernel.org/r/20240404114917.3627747-2-schnelle@linux.ibm.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/char/mem.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/char/mem.c b/drivers/char/mem.c
index 3c6670cf905f..7904e2bb6427 100644
--- a/drivers/char/mem.c
+++ b/drivers/char/mem.c
@@ -383,6 +383,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)
{
@@ -424,6 +425,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)
@@ -653,12 +655,14 @@ static const struct file_operations null_fops = {
.uring_cmd = uring_cmd_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,