Skip to content

Commit 36c9bfe

Browse files
committed
rust: helpers: Add bindings/wrappers for dma_resv
This is just for basic usage in the DRM shmem abstractions for implied locking, not intended as a full DMA Reservation abstraction yet. Signed-off-by: Asahi Lina <lina@asahilina.net>
1 parent 23a2ffd commit 36c9bfe

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

rust/bindings/bindings_helper.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include <linux/dma-fence.h>
2121
#include <linux/dma-fence-chain.h>
2222
#include <linux/dma-mapping.h>
23+
#include <linux/dma-resv.h>
2324
#include <linux/errname.h>
2425
#include <linux/slab.h>
2526
#include <linux/fs.h>

rust/helpers.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
#include <linux/dma-fence.h>
3131
#include <linux/dma-fence-chain.h>
3232
#include <linux/dma-mapping.h>
33+
#include <linux/dma-resv.h>
3334
#include <linux/err.h>
3435
#include <linux/errname.h>
3536
#include <linux/instruction_pointer.h>
@@ -488,6 +489,18 @@ void rust_helper_dma_fence_set_error(struct dma_fence *fence, int error)
488489
}
489490
EXPORT_SYMBOL_GPL(rust_helper_dma_fence_set_error);
490491

492+
int rust_helper_dma_resv_lock(struct dma_resv *obj, struct ww_acquire_ctx *ctx)
493+
{
494+
return dma_resv_lock(obj, ctx);
495+
}
496+
EXPORT_SYMBOL_GPL(rust_helper_dma_resv_lock);
497+
498+
void rust_helper_dma_resv_unlock(struct dma_resv *obj)
499+
{
500+
dma_resv_unlock(obj);
501+
}
502+
EXPORT_SYMBOL_GPL(rust_helper_dma_resv_unlock);
503+
491504
#endif
492505

493506
#ifdef CONFIG_DRM

0 commit comments

Comments
 (0)