Re: [PATCH v3] rust: device: change the from_raw() function
From: Greg KH
Date: Wed Oct 02 2024 - 12:07:33 EST
On Wed, Oct 02, 2024 at 03:58:29PM +0200, Danilo Krummrich wrote:
> On Tue, Oct 01, 2024 at 05:56:03PM -0300, Guilherme Giacomo Simoes wrote:
> > The function Device::from_raw() increments a refcount by a call to
> > bindings::get_device(ptr). This can be confused because usually
> > from_raw() functions don't increment a refcount.
> > Hence, rename Device::from_raw() to avoid confuion with other "from_raw"
> > semantics.
> >
> > The new name of function should be "get_device" to be consistent with
> > the function get_device() already exist in .c files.
> >
> > This function body also changed, because the `into()` will convert the
> > `&'a Device` into `ARef<Device>` and also call `inc_ref` from the
> > `AlwaysRefCounted` trait implemented for Device.
> >
> > Signed-off-by: Guilherme Giacomo Simoes <trintaeoitogc@xxxxxxxxx>
>
> Acked-by: Danilo Krummrich <dakr@xxxxxxxxxx>
Thanks for the review, and Guilherme, for all of the revisions. I'll
queue this up for this release soon so we don't get any code building on
the old api.
thanks,
greg k-h