Skip to contentSkip to conversation

rust: DmaFence: Implement Deref for FenceContext

PATCH In review Philipp Stanner 2 participants 2 messages Oct 22 – Oct 29

Subsystems (4)
lore
Share & tools
lore

Philipp Stanner

author maintainer
#0 lore raw

PATCH 1/1 rust: DmaFence: Implement Deref for FenceContext

A FenceContext carries data, which the user should be able to access.

Implement Deref for FenceContext.

---
 rust/kernel/dma_buf/dma_fence.rs | 9 +++++++++
 1 file changed, 9 insertions(+)
rust/kernel/dma_buf/dma_fence.rs +9 -0
index a1d851656562..5300448882e7 100644
@@ -86,6 +86,15 @@ pub struct FenceContext<T: FenceContextOps + Send + Sync> {
     data: T,
 }
 
+impl<T: Send + Sync + FenceContextOps> Deref for FenceContext<T> {
+    type Target = T;
+
+    #[inline]
+    fn deref(&self) -> &Self::Target {
+        &self.data
+    }
+}
+
 impl<'a, T: Send + Sync + FenceContextOps> FenceContext<T> {
     // This can later be extended as a vtable in case other parties need support
     // for the more "exotic" callbacks.

base-commit: 3497a403264b094ebd61b8b755165d56e7d9dc37

Signature · 1 line
2.56.0