Subject: linux-next: manual merge of the rust tree with the char-misc tree

From: Stephen Rothwell <[email-masked]>
Date: Mon, 11 Nov 2024 17:34:59 +1100

Hi all,

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

  rust/macros/module.rs

between commit:

  7f15c46a57c3 ("rust: introduce `InPlaceModule`")

from the char-misc tree and commit:

  d072acda4862 ("rust: use custom FFI integer types")

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/macros/module.rs
index a03266a78cfb,e7a087b7e884..000000000000
--- a/rust/macros/module.rs
+++ b/rust/macros/module.rs
@@@ -332,15 -330,21 +332,15 @@@ pub(crate) fn module(ts: TokenStream) -
                      /// # Safety
                      ///
                      /// This function must only be called once.
-                     unsafe fn __init() -> core::ffi::c_int {{
+                     unsafe fn __init() -> kernel::ffi::c_int {{
 -                        match <{type_} as kernel::Module>::init(&super::super::THIS_MODULE) {{
 -                            Ok(m) => {{
 -                                // SAFETY: No data race, since `__MOD` can only be accessed by this
 -                                // module and there only `__init` and `__exit` access it. These
 -                                // functions are only called once and `__exit` cannot be called
 -                                // before or during `__init`.
 -                                unsafe {{
 -                                    __MOD = Some(m);
 -                                }}
 -                                return 0;
 -                            }}
 -                            Err(e) => {{
 -                                return e.to_errno();
 -                            }}
 +                        let initer =
 +                            <{type_} as kernel::InPlaceModule>::init(&super::super::THIS_MODULE);
 +                        // SAFETY: No data race, since `__MOD` can only be accessed by this module
 +                        // and there only `__init` and `__exit` access it. These functions are only
 +                        // called once and `__exit` cannot be called before or during `__init`.
 +                        match unsafe {{ initer.__pinned_init(__MOD.as_mut_ptr()) }} {{
 +                            Ok(m) => 0,
 +                            Err(e) => e.to_errno(),
                          }}
                      }}