[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <DAWHP7292ZGD.2SQDBIZOUA4AB@kernel.org>
Date: Thu, 26 Jun 2025 15:13:06 +0200
From: "Benno Lossin" <lossin@...nel.org>
To: "Danilo Krummrich" <dakr@...nel.org>
Cc: <gregkh@...uxfoundation.org>, <rafael@...nel.org>, <ojeda@...nel.org>,
<alex.gaynor@...il.com>, <boqun.feng@...il.com>, <gary@...yguo.net>,
<bjorn3_gh@...tonmail.com>, <a.hindborg@...nel.org>,
<aliceryhl@...gle.com>, <tmgross@...ch.edu>, <david.m.ertman@...el.com>,
<ira.weiny@...el.com>, <leon@...nel.org>, <kwilczynski@...nel.org>,
<bhelgaas@...gle.com>, <rust-for-linux@...r.kernel.org>,
<linux-kernel@...r.kernel.org>, <linux-pci@...r.kernel.org>
Subject: Re: [PATCH v3 4/4] rust: devres: implement register_release()
On Thu Jun 26, 2025 at 1:15 PM CEST, Danilo Krummrich wrote:
> On Thu, Jun 26, 2025 at 12:36:23PM +0200, Benno Lossin wrote:
>> Or, we could change `Release` to be:
>>
>> pub trait Release {
>> type Ptr: ForeignOwnable;
>>
>> fn release(this: Self::Ptr);
>> }
>>
>> and then `register_release` is:
>>
>> pub fn register_release<T: Release>(dev: &Device<Bound>, data: T::Ptr) -> Result
>>
>> This way, one can store a `Box<T>` and get access to the `T` at the end.
>
> I think this was also the case before? Well, it was P::Borrowed instead.
Well you had access to a `&T`, but not the `T` directly.
>> Related questions:
>>
>> * should we implement `ForeignOwnable` for `&'static T`?
>
> There's already a patch on the list doing this in the context of DebugFS [1].
>
> [1] https://lore.kernel.org/lkml/20250624-debugfs-rust-v7-3-9c8835a7a20f@google.com/
Ah, I'm not following that series at the moment.
---
Cheers,
Benno
Powered by blists - more mailing lists