[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <9746F6D6-488C-4562-8FB1-BE268C69BA97@collabora.com>
Date: Wed, 30 Jul 2025 09:27:18 -0300
From: Daniel Almeida <daniel.almeida@...labora.com>
To: Viresh Kumar <viresh.kumar@...aro.org>
Cc: Michael Turquette <mturquette@...libre.com>,
Stephen Boyd <sboyd@...nel.org>,
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 <lossin@...nel.org>,
Andreas Hindborg <a.hindborg@...nel.org>,
Alice Ryhl <aliceryhl@...gle.com>,
Trevor Gross <tmgross@...ch.edu>,
Danilo Krummrich <dakr@...nel.org>,
"Rafael J. Wysocki" <rafael@...nel.org>,
Alexandre Courbot <acourbot@...dia.com>,
linux-clk@...r.kernel.org,
rust-for-linux@...r.kernel.org,
linux-kernel@...r.kernel.org,
linux-pm@...r.kernel.org
Subject: Re: [PATCH] rust: clk: use the type-state pattern
Hi Viresh,
> On 30 Jul 2025, at 03:23, Viresh Kumar <viresh.kumar@...aro.org> wrote:
>
> On 29-07-25, 18:38, Daniel Almeida wrote:
>> diff --git a/rust/kernel/clk.rs b/rust/kernel/clk.rs
>> /// A reference-counted clock.
>> ///
>> /// Rust abstraction for the C [`struct clk`].
>> ///
>> + /// A [`Clk`] instance represents a clock that can be in one of several
>> + /// states: [`Unprepared`], [`Prepared`], or [`Enabled`].
>> + ///
>> + /// No action needs to be taken when a [`Clk`] is dropped. The calls to
>> + /// `clk_unprepare()` and `clk_disable()` will be placed as applicable.
>> + ///
>> + /// An optional [`Clk`] is treated just like a regular [`Clk`], but its
>> + /// inner `struct clk` pointer is `NULL`. This interfaces correctly with the
>> + /// C API and also exposes all the methods of a regular [`Clk`] to users.
>> + ///
>> /// # Invariants
>> ///
>> /// A [`Clk`] instance holds either a pointer to a valid [`struct clk`] created by the C
>> @@ -99,20 +160,39 @@ mod common_clk {
>> /// Instances of this type are reference-counted. Calling [`Clk::get`] ensures that the
>> /// allocation remains valid for the lifetime of the [`Clk`].
>> ///
>> - /// ## Examples
>> + /// The [`Prepared`] state is associated with a single count of
>> + /// `clk_prepare()`, and the [`Enabled`] state is associated with a single
>> + /// count of `clk_enable()`, and the [`Enabled`] state is associated with a
>> + /// single count of `clk_prepare` and `clk_enable()`.
>
> You have mentioned the `Enabled` state twice. Also clk_prepare() ?
Ah, thanks for catching that.
What’s the issue with clk_prepare? You mean that the parenthesis are missing?
>
> No objections from my side. Thanks.
>
> --
> viresh
— Daniel
Powered by blists - more mailing lists