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

"Maurice" <[email protected]>
Newsgroups org.kernel.vger.linux-pwm,org.freedesktop.lists.dri-devel,org.infradead.lists.linux-riscv,org.kernel.vger.linux-clk,org.kernel.vger.linux-kernel,org.kernel.vger.linux-pm,org.kernel.vger.rust-for-linux
Message-ID <[email protected]>
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.