Lines Matching defs:T

32 /// Inner type that embeds a `struct devres_node` and the `Revocable<T>`.
35 struct Inner<T> {
39 data: Revocable<T>,
56 /// [`Devres`] users should make sure to simply free the corresponding backing resource in `T`'s
125 pub struct Devres<T: Send> {
127 inner: Arc<Inner<T>>,
130 // Calling the FFI functions from the `base` module directly from the `Devres<T>` impl may result in
187 impl<T: Send> Devres<T> {
192 pub fn new<E>(dev: &Device<Bound>, data: impl PinInit<T, E>) -> Result<Self>
212 // TODO: Use `core::any::type_name::<T>()` once it is a `const fn`,
214 c"Devres<T>".as_char_ptr(),
215 core::mem::size_of::<Revocable<T>>(),
240 fn data(&self) -> &Revocable<T> {
252 let inner = unsafe { kernel::container_of!(node, Inner<T>, node) };
254 // SAFETY: `inner` is a valid `Inner<T>` pointer.
265 let inner = unsafe { kernel::container_of!(node, Inner<T>, node) };
267 // SAFETY: `inner` points to the entire `Inner<T>` allocation.
283 /// Obtain `&'a T`, bypassing the [`Revocable`].
285 /// This method allows to directly obtain a `&'a T`, bypassing the [`Revocable`], by presenting
319 pub fn access<'a>(&'a self, dev: &'a Device<Bound>) -> Result<&'a T> {
331 pub fn try_access(&self) -> Option<RevocableGuard<'_, T>> {
336 pub fn try_access_with<R, F: FnOnce(&T) -> R>(&self, f: F) -> Option<R> {
341 pub fn try_access_with_guard<'a>(&'a self, guard: &'a rcu::Guard) -> Option<&'a T> {
346 // SAFETY: `Devres` can be send to any task, if `T: Send`.
347 unsafe impl<T: Send> Send for Devres<T> {}
349 // SAFETY: `Devres` can be shared with any task, if `T: Sync`.
350 unsafe impl<T: Send + Sync> Sync for Devres<T> {}
352 impl<T: Send> Drop for Devres<T> {
425 pub fn register<T, E>(dev: &Device<Bound>, data: impl PinInit<T, E>, flags: Flags) -> Result
427 T: Send + 'static,