Re: [PATCH v3 1/3] rust: clk: use the type-state pattern

Maxime Ripard
2026-02-12T16:50:18Z

[-- Attachment #1: Type: text/plain, Size: 1077 bytes --]

On Thu, Feb 12, 2026 at 03:01:31PM +0100, Danilo Krummrich wrote:
> On Thu Feb 12, 2026 at 10:23 AM CET, Danilo Krummrich wrote:
> > In particular, I don't think we need an unsafe API until we see a concrete
> > example where the proposed safe API does not work (and no other safe API would
> > work either).
>
> One additional note for clarification, I'm not saying that I'm against an unsafe
> API if it is necessary.
>
> In fact, I have added an unsafe API for drivers myself with the dma::Device
> trait [1]. This was not an easy decision and I discussed this back and forth
> with a lot of people and, unfortunately, we had to come to the conclusion that
> any attempt to make this safe from the Rust side of things would cause
> unreasonable overhead and can't be considered an overall improvement.
>
> But as I said, I am convinced that need clear evidence that an unsafe API is
> actually needed and that there is no reasonable alternative.
>
> [1] https://rust.docs.kernel.org/kernel/dma/trait.Device.html

Ok, it works for me then.

Maxime

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 273 bytes --]