Re: [PATCH v2 2/4] rust: devres: replace Devres::new_foreign_owned()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Jun 23, 2025 at 11:56:39AM +0000, Alice Ryhl wrote:
> On Sun, Jun 22, 2025 at 06:40:39PM +0200, Danilo Krummrich wrote:
> > +pub fn register<T, E>(dev: &Device<Bound>, data: impl PinInit<T, E>, flags: Flags) -> Result
> > +where
> > +    T: 'static,
> > +    Error: From<E>,
> > +{
> > +    let data = KBox::pin_init(data, flags)?;
> 
> Wouldn't we also want to expose the ForeignOwnable version? It seems
> likely someone would want to avoid the allocation.

Allowing other things than Box changes the semantics of the API. For instance,
if it'd be a reference counted thing (e.g. Arc), it would basically mean "please
make this object live *at least* as long as the device is bound".

Before considering to allow such things, I really want a potential user to
present a valid use-case for that.




[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux