[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <42FAAE27-E6D0-4CA8-83EF-5E4F9199FA9C@collabora.com>
Date: Tue, 1 Jul 2025 13:09:55 -0300
From: Daniel Almeida <daniel.almeida@...labora.com>
To: Mark Brown <broonie@...nel.org>
Cc: Miguel Ojeda <ojeda@...nel.org>,
Alex Gaynor <alex.gaynor@...il.com>,
Boqun Feng <boqun.feng@...il.com>,
Gary Guo <gary@...yguo.net>,
Björn Roy Baron <bjorn3_gh@...tonmail.com>,
Benno Lossin <benno.lossin@...ton.me>,
Andreas Hindborg <a.hindborg@...nel.org>,
Alice Ryhl <aliceryhl@...gle.com>,
Trevor Gross <tmgross@...ch.edu>,
Danilo Krummrich <dakr@...nel.org>,
Boris Brezillon <boris.brezillon@...labora.com>,
Sebastian Reichel <sebastian.reichel@...labora.com>,
Liam Girdwood <lgirdwood@...il.com>,
linux-kernel@...r.kernel.org,
rust-for-linux@...r.kernel.org
Subject: Re: [PATCH v6 0/2] Add a bare-minimum Regulator abstraction
> On 1 Jul 2025, at 12:34, Mark Brown <broonie@...nel.org> wrote:
>
> On Tue, Jul 01, 2025 at 12:28:37PM -0300, Daniel Almeida wrote:
>
>> Is it ok for the abstraction to only be built when CONFIG_REGULATOR=y? This
>> means that any Rust drivers using it have to depend on CONFIG_REGULATOR too.
>
>> I thought this was acceptable, but apparently that is not the case? See this
>> comment from Rob Herring [0].
>
> The regulator API stubs itself out when disabled, but given that this is
> just wrappers it's not clear what the tasteful thing would be here - it
> should do the right thing because it will itself be built in terms of
> the C stubs. I don't know if Rust can sensibly stub things, or if
> there's much percentage in that for a thin wrapper which does basically
> nothing itself.
Well, if all functions in the regulator API have stubs, then perhaps a trivial
solution would be removing this #[cfg] from here:
+#[cfg(CONFIG_REGULATOR)] <---
+pub mod regulator;
This would build the abstractions unconditionally, and it would transparently
use the C stubs when calling the C functions.
Waiting for more comments from the other RFL folks.
-- Daniel
Powered by blists - more mailing lists