Skip to contentSkip to conversation

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

DISCUSSION Stephen Rothwell 1 participant 2 messages Jul 18, 2025 Linux-next tree

lore
Share & tools
lore
#0 lore raw

Hi all,

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

rust/kernel/device_id.rs
rust/kernel/devres.rs

between commits:

8d84b32075fb ("rust: device_id: split out index support into a separate trait") f5d3ef25d238 ("rust: devres: get rid of Devres' inner Arc")

from the driver-core tree and various commits from the rust tree.

I fixed it up (see below - basically took the former version of devres.rs and I suspect I have not got device_id.rs right) 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.

Signature · 50 lines
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(T::DRIVER_DATA_OFFSET)
 +                        .cast::<usize>()
 +                        .write(i);
 +                }
              }
  
              // SAFETY: this is effectively a move: `infos[i] = ids[i].1`. We make a copy here but
diff --cc rust/kernel/devres.rs
index 152a89b78943,d0e6c6e162c2..000000000000
--- a/rust/kernel/devres.rs
+++ b/rust/kernel/devres.rs
@@@ -49,10 -44,10 +49,10 @@@ struct Inner<T: Send> 
  /// [`Devres`] users should make sure to simply free the corresponding backing resource in `T`'s
  /// [`Drop`] implementation.
  ///
- /// # Example
+ /// # Examples
  ///
  /// ```no_run
 -/// # use kernel::{bindings, c_str, device::{Bound, Device}, devres::Devres, io::{Io, IoRaw}};
 +/// # use kernel::{bindings, device::{Bound, Device}, devres::Devres, io::{Io, IoRaw}};
  /// # use core::ops::Deref;
  ///
  /// // See also [`pci::Bar`] for a real example.
#1 lore raw

Hi all,

Quoted 6 lines · On Fri, 18 Jul 2025 20:26:12 +1000 Stephen Rothwell <[email protected]>…

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

rust/kernel/device_id.rs
rust/kernel/devres.rs

Quoted 6 lines

between commits:

8d84b32075fb ("rust: device_id: split out index support into a separate trait") f5d3ef25d238 ("rust: devres: get rid of Devres' inner Arc")

from the driver-core tree and various commits from the rust tree.

Ignore this, I am redoing the merge ...

Signature · 2 lines
Cheers,
Stephen Rothwell