Re: [PATCH v2 2/2] rust: clk: use the type-state pattern

Daniel Almeida
2025-09-20T10:36:24Z

Hi everyone, gentle ping for reviewing this patch :)

> On 10 Sep 2025, at 19:28, Daniel Almeida <daniel.almeida@collabora.com> wrote:
>
> The current Clk abstraction can still be improved on the following issues:
>
> a) It only keeps track of a count to clk_get(), which means that users have
> to manually call disable() and unprepare(), or a variation of those, like
> disable_unprepare().
>
> b) It allows repeated calls to prepare() or enable(), but it keeps no track
> of how often these were called, i.e., it's currently legal to write the
> following:
>
> clk.prepare();
> clk.prepare();
> clk.enable();
> clk.enable();
>
> And nothing gets undone on drop().

^ this really sucks so we should probably take in this change.

— Daniel