Re: [PATCH v3 1/3] rust: add runtime PM support
From: Alice Ryhl
Date: Thu Sep 10 2026 - 04:43:59 EST
On Thu, Sep 10, 2026 at 10:28 AM Beata Michalska
<beata.michalska@xxxxxxx> wrote:
>
> On Wed, Sep 09, 2026 at 09:37:11AM +0000, Alice Ryhl wrote:
> > On Wed, Aug 26, 2026 at 03:10:55PM +0200, Beata Michalska wrote:
> > > +/// Result type returned by runtime PM callbacks.
> > > +pub type PMCallbackResult<T> = Result<Option<T>, (Option<T>, Error)>;
> >
> > So I think my number one feedback is that it would be really nice to get
> > rid of this Option.
> Guess this can be done. And I'm assuming that's for both Options here (?)
Yeah. I'm thinking that one approach could be to use the AtomicFlag to
track whether a value is stored in the container, and possible change
the Option to ManuallyDrop. Then in drop of that type, you check the
AtomicFlag and only if it's false you drop the value. That way, you
can take the value in/out of the ManuallyDrop so that you can transfer
ownership to/from the storage.
Alice