[PATCH v4 1/3] rust: clk: use the type-state pattern
Maurice
mhi at mailbox.org
Sun Jun 28 13:15:02 PDT 2026
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
More information about the linux-riscv
mailing list