On Tue, May 07, 2024 at 11:08:18PM +0200, Miguel Ojeda wrote: > From: Andreas Hindborg <a.hindborg@xxxxxxxxxxx> > > When rebasing patch sets on top of upstream Linux, merge conflicts in > helpers.c are common and time consuming [1]. Thus, split the file so > that each kernel component can live in a separate file. > > Each helper file is listed explicitly and thus conflicts in the file > list are still likely. However, they should be simpler to resolve than > the conflicts usually seen in helpers.c. > > Link: https://rust-for-linux.zulipchat.com/#narrow/stream/288089-General/topic/Splitting.20up.20helpers.2Ec/near/426694012 [1] > Signed-off-by: Andreas Hindborg <a.hindborg@xxxxxxxxxxx> > Reviewed-by: Sergio González Collado <sergio.collado@xxxxxxxxx> > Tested-by: Sergio González Collado <sergio.collado@xxxxxxxxx> > Link: https://lore.kernel.org/r/20240416074607.1395481-1-nmi@xxxxxxxxxxxx > [ Reworded message slightly and fixed nits in it. Applied commit > 84373132b831 ("rust: helpers: Fix grammar in comment") here. Added > SPDX license identifier in new Makefile. Applied Markdown formatting. > Added `.gitignore`. Included `helpers_combined.c` in the `clean` > target. - Miguel ] > Signed-off-by: Miguel Ojeda <ojeda@xxxxxxxxxx> This overall looks good to me, one thing below I think should be changed.. > --- > This is a patch from Andreas that I was going to apply to `rust-next` > with the tweaks mentioned above, but I noticed Kbuild was not Cc'd, so > we decided to send this as a "v2" and thus give a chance to Kbuild to > take a look for next cycle. > > If something in the diff to v1 is wrong, it is my fault, not Andreas' :) > [...] > diff --git a/rust/helpers/build_bug.c b/rust/helpers/build_bug.c > new file mode 100644 > index 000000000000..f3106f248485 > --- /dev/null > +++ b/rust/helpers/build_bug.c > @@ -0,0 +1,10 @@ > +// SPDX-License-Identifier: GPL-2.0 > + > +#include <linux/export.h> > +#include <linux/errname.h> > + > +const char *rust_helper_errname(int err) > +{ > + return errname(err); > +} > +EXPORT_SYMBOL_GPL(rust_helper_errname); .. this build_bug.c should be avoided, but this function should go into err.c. Regards, Boqun > diff --git a/rust/helpers/err.c b/rust/helpers/err.c > new file mode 100644 > index 000000000000..fba4e0be64f5 > --- /dev/null > +++ b/rust/helpers/err.c > @@ -0,0 +1,22 @@ > +// SPDX-License-Identifier: GPL-2.0 > + > +#include <linux/err.h> > +#include <linux/export.h> > + > +__force void *rust_helper_ERR_PTR(long err) > +{ > + return ERR_PTR(err); > +} > +EXPORT_SYMBOL_GPL(rust_helper_ERR_PTR); > + > +bool rust_helper_IS_ERR(__force const void *ptr) > +{ > + return IS_ERR(ptr); > +} > +EXPORT_SYMBOL_GPL(rust_helper_IS_ERR); > + > +long rust_helper_PTR_ERR(__force const void *ptr) > +{ > + return PTR_ERR(ptr); > +} > +EXPORT_SYMBOL_GPL(rust_helper_PTR_ERR); [...]