Skip to content

Commit 6a516d0

Browse files
hoshinolinajannau
authored andcommitted
rust: helpers: Add bindings/wrappers for dma_resv_lock
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> Signed-off-by: Daniel Almeida <daniel.almeida@collabora.com> Reviewed-by: Alice Ryhl <aliceryhl@google.com> Signed-off-by: Lyude Paul <lyude@redhat.com>
1 parent e4b0895 commit 6a516d0

3 files changed

Lines changed: 15 additions & 0 deletions

File tree

rust/bindings/bindings_helper.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
#include <linux/device/faux.h>
5252
#include <linux/dma-direction.h>
5353
#include <linux/dma-mapping.h>
54+
#include <linux/dma-resv.h>
5455
#include <linux/errname.h>
5556
#include <linux/ethtool.h>
5657
#include <linux/fdtable.h>

rust/helpers/dma-resv.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// SPDX-License-Identifier: GPL-2.0
2+
3+
#include <linux/dma-resv.h>
4+
5+
int rust_helper_dma_resv_lock(struct dma_resv *obj, struct ww_acquire_ctx *ctx)
6+
{
7+
return dma_resv_lock(obj, ctx);
8+
}
9+
10+
void rust_helper_dma_resv_unlock(struct dma_resv *obj)
11+
{
12+
dma_resv_unlock(obj);
13+
}

rust/helpers/helpers.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
#include "device.c"
2727
#include "dma.c"
2828
#include "dma-mapping.c"
29+
#include "dma-resv.c"
2930
#include "drm.c"
3031
#include "err.c"
3132
#include "irq.c"

0 commit comments

Comments
 (0)