diff mbox series

[RFC,3/9] rust: dma_fence: add method to return an indication if the fence is signaled

Message ID 20230317121213.93991-4-mcanal@igalia.com (mailing list archive)
State New, archived
Headers show
Series Rust version of the VGEM driver | expand

Commit Message

Maíra Canal March 17, 2023, 12:12 p.m. UTC
To indicate the current status of the fence, there is a kernel function that
returns an indication if the fence is signaled yet. Therefore, add a method
in the Rust abstraction to return an indication if the fence is signaled.

Signed-off-by: Maíra Canal <mcanal@igalia.com>
---
 rust/helpers.c           | 6 ++++++
 rust/kernel/dma_fence.rs | 5 +++++
 2 files changed, 11 insertions(+)
diff mbox series

Patch

diff --git a/rust/helpers.c b/rust/helpers.c
index 18c0c434ad73..f77bfa10d5f5 100644
--- a/rust/helpers.c
+++ b/rust/helpers.c
@@ -420,6 +420,12 @@  void rust_helper_dma_fence_put(struct dma_fence *fence)
 }
 EXPORT_SYMBOL_GPL(rust_helper_dma_fence_put);
 
+bool rust_helper_dma_fence_is_signaled(struct dma_fence *fence)
+{
+	return dma_fence_is_signaled(fence);
+}
+EXPORT_SYMBOL_GPL(rust_helper_dma_fence_is_signaled);
+
 struct dma_fence_chain *rust_helper_dma_fence_chain_alloc(void)
 {
 	return dma_fence_chain_alloc();
diff --git a/rust/kernel/dma_fence.rs b/rust/kernel/dma_fence.rs
index ca93380d9da2..176e6d250e6c 100644
--- a/rust/kernel/dma_fence.rs
+++ b/rust/kernel/dma_fence.rs
@@ -65,6 +65,11 @@  pub trait RawDmaFence: crate::private::Sealed {
         to_result(unsafe { bindings::dma_fence_signal(self.raw()) })
     }
 
+    /// Return an indication if the fence is signaled yet.
+    fn is_signaled(&self) -> bool {
+        unsafe { bindings::dma_fence_is_signaled(self.raw()) }
+    }
+
     /// Set the error flag on this fence
     fn set_error(&self, err: Error) {
         unsafe { bindings::dma_fence_set_error(self.raw(), err.to_kernel_errno()) };