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

Maxime Ripard mripard at kernel.org
Thu Feb 12 08:50:15 PST 2026


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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 273 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-riscv/attachments/20260212/044870d8/attachment.sig>


More information about the linux-riscv mailing list