linux-next: manual merge of the rust tree with the driver-core tree

Stephen Rothwell
2025-07-18T10:46:55Z

[-- Attachment #1: Type: text/plain, Size: 2208 bytes --]

Hi all,

Today's linux-next merge of the rust tree got a conflict in:

rust/kernel/device_id.rs

between commit:

8d84b32075fb ("rust: device_id: split out index support into a separate trait")

from the driver-core tree and commit:

5e30550558b1 ("rust: enable `clippy::as_underscore` lint")

from the rust tree.

I fixed it up (see below) and can carry the fix as necessary. This
is now fixed as far as linux-next is concerned, but any non trivial
conflicts should be mentioned to your upstream maintainer when your tree
is submitted for merging. You may also want to consider cooperating
with the maintainer of the conflicting tree to minimise any particularly
complex conflicts.

--
Cheers,
Stephen Rothwell

diff --cc rust/kernel/device_id.rs
index 8ed2c946144c,3dc72ca8cfc2..000000000000
--- a/rust/kernel/device_id.rs
+++ b/rust/kernel/device_id.rs
@@@ -94,16 -77,14 +94,16 @@@ impl<T: RawDeviceId, U, const N: usize
// SAFETY: by the safety requirement of `RawDeviceId`, we're guaranteed that `T` is
// layout-wise compatible with `RawType`.
raw_ids[i] = unsafe { core::mem::transmute_copy(&ids[i].0) };
- // SAFETY: by the safety requirement of `RawDeviceId`, this would be effectively
- // `raw_ids[i].driver_data = i;`.
- unsafe {
- raw_ids[i]
- .as_mut_ptr()
- .byte_add(T::DRIVER_DATA_OFFSET)
- .cast::<usize>()
- .write(i);
+ if let Some(data_offset) = data_offset {
+ // SAFETY: by the safety requirement of this function, this would be effectively
+ // `raw_ids[i].driver_data = i;`.
+ unsafe {
+ raw_ids[i]
+ .as_mut_ptr()
- .byte_offset(data_offset as _)
++ .byte_add(data_offset)
+ .cast::<usize>()
+ .write(i);
+ }
}

// SAFETY: this is effectively a move: `infos[i] = ids[i].1`. We make a copy here but