summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--drivers/android/binder/rust_binder_main.rs3
-rw-r--r--rust/bindings/lib.rs13
-rw-r--r--rust/kernel/miscdevice.rs2
3 files changed, 15 insertions, 3 deletions
diff --git a/drivers/android/binder/rust_binder_main.rs b/drivers/android/binder/rust_binder_main.rs
index d84c3c360be0..30e4517f90a3 100644
--- a/drivers/android/binder/rust_binder_main.rs
+++ b/drivers/android/binder/rust_binder_main.rs
@@ -322,8 +322,7 @@ pub static rust_binder_fops: AssertSync<kernel::bindings::file_operations> = {
owner: THIS_MODULE.as_ptr(),
poll: Some(rust_binder_poll),
unlocked_ioctl: Some(rust_binder_ioctl),
- #[cfg(CONFIG_COMPAT)]
- compat_ioctl: Some(bindings::compat_ptr_ioctl),
+ compat_ioctl: bindings::compat_ptr_ioctl,
mmap: Some(rust_binder_mmap),
open: Some(rust_binder_open),
release: Some(rust_binder_release),
diff --git a/rust/bindings/lib.rs b/rust/bindings/lib.rs
index 0c57cf9b4004..19f57c5b2fa2 100644
--- a/rust/bindings/lib.rs
+++ b/rust/bindings/lib.rs
@@ -67,3 +67,16 @@ mod bindings_helper {
}
pub use bindings_raw::*;
+
+pub const compat_ptr_ioctl: Option<
+ unsafe extern "C" fn(*mut file, ffi::c_uint, ffi::c_ulong) -> ffi::c_long,
+> = {
+ #[cfg(CONFIG_COMPAT)]
+ {
+ Some(bindings_raw::compat_ptr_ioctl)
+ }
+ #[cfg(not(CONFIG_COMPAT))]
+ {
+ None
+ }
+};
diff --git a/rust/kernel/miscdevice.rs b/rust/kernel/miscdevice.rs
index ba64c8a858f0..c3c2052c9206 100644
--- a/rust/kernel/miscdevice.rs
+++ b/rust/kernel/miscdevice.rs
@@ -410,7 +410,7 @@ impl<T: MiscDevice> MiscdeviceVTable<T> {
compat_ioctl: if T::HAS_COMPAT_IOCTL {
Some(Self::compat_ioctl)
} else if T::HAS_IOCTL {
- Some(bindings::compat_ptr_ioctl)
+ bindings::compat_ptr_ioctl
} else {
None
},