Linux-KBuild Archive mirror
 help / color / mirror / Atom feed
From: Boqun Feng <boqun.feng@gmail.com>
To: Miguel Ojeda <ojeda@kernel.org>
Cc: "Masahiro Yamada" <masahiroy@kernel.org>,
	"Wedson Almeida Filho" <wedsonaf@gmail.com>,
	"Alex Gaynor" <alex.gaynor@gmail.com>,
	"Nathan Chancellor" <nathan@kernel.org>,
	"Nicolas Schier" <nicolas@fjasle.eu>,
	"Gary Guo" <gary@garyguo.net>,
	"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
	"Benno Lossin" <benno.lossin@proton.me>,
	"Andreas Hindborg" <a.hindborg@samsung.com>,
	"Alice Ryhl" <aliceryhl@google.com>,
	linux-kbuild@vger.kernel.org, rust-for-linux@vger.kernel.org,
	linux-kernel@vger.kernel.org, patches@lists.linux.dev,
	"Sergio González Collado" <sergio.collado@gmail.com>
Subject: Re: [PATCH v2] kbuild: rust: split up helpers.c
Date: Tue, 7 May 2024 15:09:00 -0700	[thread overview]
Message-ID: <ZjqmfIhRz99BqXtD@boqun-archlinux> (raw)
In-Reply-To: <20240507210818.672517-1-ojeda@kernel.org>

On Tue, May 07, 2024 at 11:08:18PM +0200, Miguel Ojeda wrote:
> From: Andreas Hindborg <a.hindborg@samsung.com>
> 
> 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@samsung.com>
> Reviewed-by: Sergio González Collado <sergio.collado@gmail.com>
> Tested-by: Sergio González Collado <sergio.collado@gmail.com>
> Link: https://lore.kernel.org/r/20240416074607.1395481-1-nmi@metaspace.dk
> [ 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@kernel.org>

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);
[...]

      reply	other threads:[~2024-05-07 22:08 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-07 21:08 [PATCH v2] kbuild: rust: split up helpers.c Miguel Ojeda
2024-05-07 22:09 ` Boqun Feng [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZjqmfIhRz99BqXtD@boqun-archlinux \
    --to=boqun.feng@gmail.com \
    --cc=a.hindborg@samsung.com \
    --cc=alex.gaynor@gmail.com \
    --cc=aliceryhl@google.com \
    --cc=benno.lossin@proton.me \
    --cc=bjorn3_gh@protonmail.com \
    --cc=gary@garyguo.net \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=masahiroy@kernel.org \
    --cc=nathan@kernel.org \
    --cc=nicolas@fjasle.eu \
    --cc=ojeda@kernel.org \
    --cc=patches@lists.linux.dev \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=sergio.collado@gmail.com \
    --cc=wedsonaf@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).