Lines Matching +full:embedded +full:- +full:sync

1 // SPDX-License-Identifier: GPL-2.0 OR MIT
14 sync::aref::{ARef, AlwaysRefCounted},
52 /// The device is always reference-counted.
98 pub fn new(dev: &device::Device, data: impl PinInit<T::Data, Error>) -> Result<ARef<Self>> {
104 // - `VTABLE`, as a `const` is pinned to the read-only section of the compilation,
105 // - `dev` is valid by its type invarants,
121 // - `raw_data` is a valid pointer to uninitialized memory.
122 // - `raw_data` will not move until it is dropped.
129 // refcount must be non-zero.
138 pub(crate) fn as_raw(&self) -> *mut bindings::drm_device {
144 /// `ptr` must be a valid pointer to a `struct device` embedded in `Self`.
145 unsafe fn from_drm_device(ptr: *const bindings::drm_device) -> *mut Self {
147 // `struct drm_device` embedded in `Self`.
154 unsafe fn into_drm_device(ptr: NonNull<Self>) -> *mut bindings::drm_device {
163 /// Callers must ensure that `ptr` is valid, non-null, and has a non-zero reference count,
169 /// embedded in `Self`.
171 pub unsafe fn from_raw<'a>(ptr: *const bindings::drm_device) -> &'a Self {
173 // `struct drm_device` embedded in `Self`.
181 // SAFETY: `ptr` is a valid pointer to a `struct drm_device` and embedded in `Self`.
185 // - When `release` runs it is guaranteed that there is no further access to `this`.
186 // - `this` is valid for dropping.
194 fn deref(&self) -> &Self::Target {
203 // SAFETY: The existence of a shared reference guarantees that the refcount is non-zero.
211 // SAFETY: The safety requirements guarantee that the refcount is non-zero.
217 fn as_ref(&self) -> &device::Device {
229 unsafe impl<T: drm::Driver> Sync for Device<T> {}