On Sat, Jun 28, 2025 at 02:13:08PM +0200, Benno Lossin wrote: > On Sat Jun 28, 2025 at 11:58 AM CEST, Danilo Krummrich wrote: > > On Sat, Jun 28, 2025 at 09:53:06AM +0200, Benno Lossin wrote: > >> Hmm @Danilo, do you have any use-cases in mind or already done? > > > > There may be other use-cases, but the one that I could forsee is very specific: > > > > A Registration type that carries additional reference-counted data, where the > > Registration should be released exactly when the device is unbound, independent > > of the lifetime of the data. > > > > Obviously, this implies that the ForeignOwnable is an Arc. > > > > With KBox, Release and Drop are pretty much identical, so using > > devres::release() instead, is much simpler and hence what we do for all simple > > class device registrations. > > > > Besides that, the use-case described above can also be covered by Devres with > > the pin-init rework, by having the Registration embed a Devres<Inner>, which > > is what irq::Registration does and I also do in the MiscDeviceRegistration > > patches. > > > > Hence, I already considered dropping this patch -- and I think we should do this > > for now. > > Sounds good! We can always pick it up again when needed. Exactly -- thanks Benno and Boqun! The discussion of the design of the Release trait seems also relevant for other use-cases with ForeignOwnable types where we require trait bounds for their target types.