Lines Matching defs:Devres

3 //! Devres abstraction
5 //! [`Devres`] represents an abstraction for the kernel devres (device resource management)
22 /// [`Devres`] inner data accessed from [`Devres::callback`].
27 /// Tracks whether [`Devres::callback`] has been completed.
43 /// To achieve that [`Devres`] registers a devres callback on creation, which is called once the
46 /// After the [`Devres`] has been unbound it is not possible to access the encapsulated resource
49 /// [`Devres`] users should make sure to simply free the corresponding backing resource in `T`'s
55 /// # use kernel::{bindings, device::{Bound, Device}, devres::Devres, io::{Io, IoRaw}};
96 /// let devres = KBox::pin_init(Devres::new(dev, iomem), GFP_KERNEL)?;
108 pub struct Devres<T: Send> {
118 // Subsequently, the `drop_in_place()` in `Devres::drop` and `Devres::new` as well as the
125 impl<T: Send> Devres<T> {
126 /// Creates a new [`Devres`] instance of the given `data`.
128 /// The `data` encapsulated within the returned `Devres` instance' `data` will be
193 // If `revoke()` returns false, it means that `Devres::drop` already started revoking
194 // `data` for us. Hence we have to wait until `Devres::drop` signals that it
214 /// Return a reference of the [`Device`] this [`Devres`] instance has been created with.
222 /// a `&'a Device<Bound>` of the same [`Device`] this [`Devres`] instance has been created with.
226 /// An error is returned if `dev` does not match the same [`Device`] this [`Devres`] instance
233 /// # use kernel::{device::Core, devres::Devres, pci};
235 /// fn from_core(dev: &pci::Device<Core>, devres: Devres<pci::Bar<0x4>>) -> Result {
252 // SAFETY: `dev` being the same device as the device this `Devres` has been created for
258 /// [`Devres`] accessor for [`Revocable::try_access`].
263 /// [`Devres`] accessor for [`Revocable::try_access_with`].
268 /// [`Devres`] accessor for [`Revocable::try_access_with_guard`].
274 // SAFETY: `Devres` can be send to any task, if `T: Send`.
275 unsafe impl<T: Send> Send for Devres<T> {}
277 // SAFETY: `Devres` can be shared with any task, if `T: Sync`.
278 unsafe impl<T: Send + Sync> Sync for Devres<T> {}
281 impl<T: Send> PinnedDrop for Devres<T> {