summaryrefslogtreecommitdiff
path: root/rust
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2026-02-17 09:11:04 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2026-02-17 09:11:04 -0800
commit505d195b0f96fd613a51b13dde37aa5ad301eb32 (patch)
tree4fe4c2acaf1acde2c49ac53c9634595063ca0c62 /rust
parent99dfe2d4da67d863ff8f185d1e8033cce28e4c49 (diff)
parent3c4ae63073d84abee5d81ce46d86a94e9dae9c89 (diff)
Merge tag 'char-misc-7.0-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc
Pull char/misc/IIO driver updates from Greg KH: "Here is the big set of char/misc/iio and other smaller driver subsystem changes for 7.0-rc1. Lots of little things in here, including: - Loads of iio driver changes and updates and additions - gpib driver updates - interconnect driver updates - i3c driver updates - hwtracing (coresight and intel) driver updates - deletion of the obsolete mwave driver - binder driver updates (rust and c versions) - mhi driver updates (causing a merge conflict, see below) - mei driver updates - fsi driver updates - eeprom driver updates - lots of other small char and misc driver updates and cleanups All of these have been in linux-next for a while, with no reported issues" * tag 'char-misc-7.0-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc: (297 commits) mux: mmio: fix regmap leak on probe failure rust_binder: return p from rust_binder_transaction_target_node() drivers: android: binder: Update ARef imports from sync::aref rust_binder: fix needless borrow in context.rs iio: magn: mmc5633: Fix Kconfig for combination of I3C as module and driver builtin iio: sca3000: Fix a resource leak in sca3000_probe() iio: proximity: rfd77402: Add interrupt handling support iio: proximity: rfd77402: Document device private data structure iio: proximity: rfd77402: Use devm-managed mutex initialization iio: proximity: rfd77402: Use kernel helper for result polling iio: proximity: rfd77402: Align polling timeout with datasheet iio: cros_ec: Allow enabling/disabling calibration mode iio: frequency: ad9523: correct kernel-doc bad line warning iio: buffer: buffer_impl.h: fix kernel-doc warnings iio: gyro: itg3200: Fix unchecked return value in read_raw MAINTAINERS: add entry for ADE9000 driver iio: accel: sca3000: remove unused last_timestamp field iio: accel: adxl372: remove unused int2_bitmask field iio: adc: ad7766: Use iio_trigger_generic_data_rdy_poll() iio: magnetometer: Remove IRQF_ONESHOT ...
Diffstat (limited to 'rust')
-rw-r--r--rust/bindings/lib.rs13
-rw-r--r--rust/helpers/binder.c13
-rw-r--r--rust/kernel/miscdevice.rs10
-rw-r--r--rust/kernel/sync/arc.rs3
4 files changed, 27 insertions, 12 deletions
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/helpers/binder.c b/rust/helpers/binder.c
index 224d38a92f1d..a2327f1b3c94 100644
--- a/rust/helpers/binder.c
+++ b/rust/helpers/binder.c
@@ -7,20 +7,21 @@
#include <linux/list_lru.h>
#include <linux/task_work.h>
-unsigned long rust_helper_list_lru_count(struct list_lru *lru)
+__rust_helper unsigned long rust_helper_list_lru_count(struct list_lru *lru)
{
return list_lru_count(lru);
}
-unsigned long rust_helper_list_lru_walk(struct list_lru *lru,
- list_lru_walk_cb isolate, void *cb_arg,
- unsigned long nr_to_walk)
+__rust_helper unsigned long rust_helper_list_lru_walk(struct list_lru *lru,
+ list_lru_walk_cb isolate,
+ void *cb_arg,
+ unsigned long nr_to_walk)
{
return list_lru_walk(lru, isolate, cb_arg, nr_to_walk);
}
-void rust_helper_init_task_work(struct callback_head *twork,
- task_work_func_t func)
+__rust_helper void rust_helper_init_task_work(struct callback_head *twork,
+ task_work_func_t func)
{
init_task_work(twork, func);
}
diff --git a/rust/kernel/miscdevice.rs b/rust/kernel/miscdevice.rs
index d698cddcb4a5..c3c2052c9206 100644
--- a/rust/kernel/miscdevice.rs
+++ b/rust/kernel/miscdevice.rs
@@ -20,7 +20,7 @@ use crate::{
seq_file::SeqFile,
types::{ForeignOwnable, Opaque},
};
-use core::{marker::PhantomData, mem::MaybeUninit, pin::Pin};
+use core::{marker::PhantomData, pin::Pin};
/// Options for creating a misc device.
#[derive(Copy, Clone)]
@@ -32,8 +32,7 @@ pub struct MiscDeviceOptions {
impl MiscDeviceOptions {
/// Create a raw `struct miscdev` ready for registration.
pub const fn into_raw<T: MiscDevice>(self) -> bindings::miscdevice {
- // SAFETY: All zeros is valid for this C type.
- let mut result: bindings::miscdevice = unsafe { MaybeUninit::zeroed().assume_init() };
+ let mut result: bindings::miscdevice = pin_init::zeroed();
result.minor = bindings::MISC_DYNAMIC_MINOR as ffi::c_int;
result.name = crate::str::as_char_ptr_in_const_context(self.name);
result.fops = MiscdeviceVTable::<T>::build();
@@ -411,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
},
@@ -420,8 +419,7 @@ impl<T: MiscDevice> MiscdeviceVTable<T> {
} else {
None
},
- // SAFETY: All zeros is a valid value for `bindings::file_operations`.
- ..unsafe { MaybeUninit::zeroed().assume_init() }
+ ..pin_init::zeroed()
};
const fn build() -> &'static bindings::file_operations {
diff --git a/rust/kernel/sync/arc.rs b/rust/kernel/sync/arc.rs
index 289f77abf415..921e19333b89 100644
--- a/rust/kernel/sync/arc.rs
+++ b/rust/kernel/sync/arc.rs
@@ -240,6 +240,9 @@ impl<T> Arc<T> {
// `Arc` object.
Ok(unsafe { Self::from_inner(inner) })
}
+
+ /// The offset that the value is stored at.
+ pub const DATA_OFFSET: usize = core::mem::offset_of!(ArcInner<T>, data);
}
impl<T: ?Sized> Arc<T> {