public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Boqun Feng <boqun.feng@gmail.com>
To: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>
Cc: "Daniel Almeida" <daniel.almeida@collabora.com>,
	"Liam Girdwood" <lgirdwood@gmail.com>,
	"Mark Brown" <broonie@kernel.org>,
	"Miguel Ojeda" <ojeda@kernel.org>,
	"Alex Gaynor" <alex.gaynor@gmail.com>,
	"Gary Guo" <gary@garyguo.net>,
	"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
	"Benno Lossin" <lossin@kernel.org>,
	"Andreas Hindborg" <a.hindborg@kernel.org>,
	"Alice Ryhl" <aliceryhl@google.com>,
	"Trevor Gross" <tmgross@umich.edu>,
	"Danilo Krummrich" <dakr@kernel.org>,
	linux-kernel@vger.kernel.org, rust-for-linux@vger.kernel.org
Subject: Re: [PATCH v2 2/2] rust: regulator: add devm_enable and devm_enable_optional
Date: Tue, 9 Sep 2025 09:27:46 -0700	[thread overview]
Message-ID: <aMBVgrVqX2w31GhV@tardis-2.local> (raw)
In-Reply-To: <CANiq72m18qUTjqjKKYgPfeEUh=vN+Jzz=ACFDcgA-JDLL_N5SA@mail.gmail.com>

On Tue, Sep 09, 2025 at 05:58:34PM +0200, Miguel Ojeda wrote:
> On Tue, Sep 9, 2025 at 5:38 PM Boqun Feng <boqun.feng@gmail.com> wrote:
> >
> > Well, then the question is why we want to compiler regulator.rs if
> > CONFIG_REGULATOR=n? Shouldn't we do:
> >
> > #[cfg(CONFIG_REGULATOR)]
> > pub mod regulator
> >
> > in rust/kernel/lib.rs?
> 
> It depends on what the C API does -- if the C API is supposed to
> "always work" (even if it is no-op or if it returns errors) even when
> disabled (so that callers are easier), then we likely need to
> replicate that on our side.
> 

While I don't disagree with the rule in general, but I do want to say
the cost is the binary size (at least without inlining helpers), so I
think we are allowed to apply this rule case by case, i.e. even if a C
API is supposed to "always work" but Rust can avoid exposing the API at
some configurations.

I of course don't have a strong opinion on what the regulator subsystem
should do ;-)

Regards,
Boqun

> We had a similar discussion for DebugFS.
> 
> Cheers,
> Miguel

  reply	other threads:[~2025-09-09 16:27 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-08 23:10 [PATCH v2 0/2] rust: regulator: improve the ergonomics of Rust regulators Daniel Almeida
2025-09-08 23:10 ` [PATCH v2 1/2] rust: regulator: remove Regulator<Dynamic> Daniel Almeida
2025-09-08 23:10 ` [PATCH v2 2/2] rust: regulator: add devm_enable and devm_enable_optional Daniel Almeida
2025-09-09  2:29   ` Alexandre Courbot
2025-09-09  6:57   ` Boqun Feng
2025-09-09 15:04     ` Daniel Almeida
2025-09-09 15:38       ` Boqun Feng
2025-09-09 15:58         ` Miguel Ojeda
2025-09-09 16:27           ` Boqun Feng [this message]
2025-09-09 17:11             ` Mark Brown
2025-09-09 17:15               ` Boqun Feng
2025-09-09 21:10                 ` Mark Brown
2025-09-09 17:16               ` Miguel Ojeda
2025-09-09 16:12         ` Daniel Almeida
2025-09-09 16:40           ` Boqun Feng
2025-09-09 17:02             ` Daniel Almeida
2025-09-09 17:03             ` Daniel Almeida
2025-09-09 16:17         ` Mark Brown
2025-09-09 16:29           ` Danilo Krummrich
2025-09-09 17:10             ` Mark Brown
2025-09-09  7:15   ` Danilo Krummrich
2025-09-10  5:26   ` Boqun Feng
2025-09-11 23:23 ` (subset) [PATCH v2 0/2] rust: regulator: improve the ergonomics of Rust regulators Mark Brown

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=aMBVgrVqX2w31GhV@tardis-2.local \
    --to=boqun.feng@gmail.com \
    --cc=a.hindborg@kernel.org \
    --cc=alex.gaynor@gmail.com \
    --cc=aliceryhl@google.com \
    --cc=bjorn3_gh@protonmail.com \
    --cc=broonie@kernel.org \
    --cc=dakr@kernel.org \
    --cc=daniel.almeida@collabora.com \
    --cc=gary@garyguo.net \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lossin@kernel.org \
    --cc=miguel.ojeda.sandonis@gmail.com \
    --cc=ojeda@kernel.org \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=tmgross@umich.edu \
    /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