> @@ -621,7 +629,7 @@ pub trait ObjectImpl: ObjectType + IsA<Object> { > /// We expect the FFI user of this function to pass a valid pointer that > /// can be downcasted to type `T`. We also expect the device is > /// readable/writeable from one thread at any time. > -unsafe extern "C" fn rust_unparent_fn<T: ObjectImpl>(dev: *mut Object) { > +unsafe extern "C" fn rust_unparent_fn<T: ObjectImpl>(dev: *mut > bindings::Object) { > let state = NonNull::new(dev).unwrap().cast::<T>(); > T::UNPARENT.unwrap()(unsafe { state.as_ref() }); > } > @@ -796,8 +804,9 @@ fn new() -> Owned<Self> { > // SAFETY: the object created by object_new is allocated on > // the heap and has a reference count of 1 > unsafe { > - let obj = &*object_new(Self::TYPE_NAME.as_ptr()); > - Owned::from_raw(obj.unsafe_cast::<Self>()) > + let obj = object_new(Self::TYPE_NAME.as_ptr());
Having the same name is always not ideal, so let's name the first one raw_obj. > + let obj = Object::from_raw(obj).unsafe_cast::<Self>(); > + Owned::from_raw(obj) > } > } > } Others look good to me, Reviewed-by: Zhao Liu <zhao1....@intel.com> >