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(),
}}
}}
On Mon, Nov 11, 2024 at 05:34:59PM +1100, Stephen Rothwell wrote: > 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(), > }} > }} > Looks good to me, thanks! greg k-h
On Mon, Nov 11, 2024 at 3:54 PM Greg KH <greg@kroah.com> wrote: > > Looks good to me, thanks! +1 Stephen -- you will get the conflict in the upcoming round again, but this time without build failures, hopefully! The hash has not changed. Thanks! Cheers, Miguel
© 2016 - 2024 Red Hat, Inc.