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

From: Maurice

Date: Sun Jun 28 2026 - 16:15:40 EST


On Thu Jun 18, 2026 at 5:46 AM CEST, Daniel Almeida wrote:

> + /// Behaves the same as [`Self::get`], except when there is no clock
> + /// producer. In this case, instead of returning [`ENOENT`], it returns
> + /// a dummy [`Clk`].
> + #[inline]
> + pub fn get_optional(dev: &Device<Bound>, name: Option<&CStr>) -> Result<Clk<Prepared>> {
> + Clk::<Unprepared>::get_optional(dev, name)?
> + .prepare()
> + .map_err(|error| error.error)
> + }
> +
> + /// Attempts to convert the [`Clk`] to an [`Unprepared`] state.
> ///
> - /// [`clk_disable`]: https://docs.kernel.org/core-api/kernel-api.html#c.clk_disable
> + /// Equivalent to the kernel's [`clk_unprepare`] API.
Missing definition of `clk_unprepare`.

Best,

Maurice