git: eb9e38e37c82 - main - linuxkpi: Add compat_ptr_ioctl

From: Ed Maste <emaste_at_FreeBSD.org>
Date: Fri, 11 Sep 2026 09:51:21 UTC
The branch main has been updated by emaste:

URL: https://cgit.FreeBSD.org/src/commit/?id=eb9e38e37c828473cb56705b45d7940b492e41a0

commit eb9e38e37c828473cb56705b45d7940b492e41a0
Author:     Sourojeet A <siri@racha.ca>
AuthorDate: 2026-09-11 09:49:16 +0000
Commit:     Ed Maste <emaste@FreeBSD.org>
CommitDate: 2026-09-11 09:50:47 +0000

    linuxkpi: Add compat_ptr_ioctl
    
    Adding the `compat_ptr_ioctl` function for amdkfd support it's called by
    kfd_chardev.c
    
    Reviewed by:    dumbbell
    Differential Revision:  https://reviews.freebsd.org/D58076
---
 sys/compat/linuxkpi/common/include/linux/fs.h | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/sys/compat/linuxkpi/common/include/linux/fs.h b/sys/compat/linuxkpi/common/include/linux/fs.h
index 65409bd775cd..2cfa31a4e325 100644
--- a/sys/compat/linuxkpi/common/include/linux/fs.h
+++ b/sys/compat/linuxkpi/common/include/linux/fs.h
@@ -432,4 +432,13 @@ ssize_t simple_attr_write(struct file *filp, const char __user *buf,
 ssize_t simple_attr_write_signed(struct file *filp, const char __user *buf,
 	    size_t write_size, loff_t *ppos);
 
+static inline long
+compat_ptr_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
+{
+	if (file->f_op->unlocked_ioctl == NULL) {
+		return (-ENOIOCTLCMD);
+	}
+	return (file->f_op->unlocked_ioctl(file, cmd, arg));
+}
+
 #endif /* _LINUXKPI_LINUX_FS_H_ */