Commit 547c7138 authored by Lucas Stach's avatar Lucas Stach

dma-buf: add some lockdep asserts to the reservation object implementation

This adds lockdep asserts to the reservation functions which state in their
documentation that obj->lock must be held. Allows builds with PROVE_LOCKING
enabled to check that the locking requirements are met.
Signed-off-by: default avatarLucas Stach <l.stach@pengutronix.de>
Reviewed-by: default avatarChristian König <christian.koenig@amd.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180111165302.25556-1-l.stach@pengutronix.de
parent 60b80199
...@@ -73,6 +73,8 @@ int reservation_object_reserve_shared(struct reservation_object *obj, ...@@ -73,6 +73,8 @@ int reservation_object_reserve_shared(struct reservation_object *obj,
struct reservation_object_list *old, *new; struct reservation_object_list *old, *new;
unsigned int i, j, k, max; unsigned int i, j, k, max;
reservation_object_assert_held(obj);
old = reservation_object_get_list(obj); old = reservation_object_get_list(obj);
if (old && old->shared_max) { if (old && old->shared_max) {
...@@ -151,6 +153,8 @@ void reservation_object_add_shared_fence(struct reservation_object *obj, ...@@ -151,6 +153,8 @@ void reservation_object_add_shared_fence(struct reservation_object *obj,
dma_fence_get(fence); dma_fence_get(fence);
reservation_object_assert_held(obj);
fobj = reservation_object_get_list(obj); fobj = reservation_object_get_list(obj);
count = fobj->shared_count; count = fobj->shared_count;
...@@ -196,6 +200,8 @@ void reservation_object_add_excl_fence(struct reservation_object *obj, ...@@ -196,6 +200,8 @@ void reservation_object_add_excl_fence(struct reservation_object *obj,
struct reservation_object_list *old; struct reservation_object_list *old;
u32 i = 0; u32 i = 0;
reservation_object_assert_held(obj);
old = reservation_object_get_list(obj); old = reservation_object_get_list(obj);
if (old) if (old)
i = old->shared_count; i = old->shared_count;
...@@ -236,6 +242,8 @@ int reservation_object_copy_fences(struct reservation_object *dst, ...@@ -236,6 +242,8 @@ int reservation_object_copy_fences(struct reservation_object *dst,
size_t size; size_t size;
unsigned i; unsigned i;
reservation_object_assert_held(dst);
rcu_read_lock(); rcu_read_lock();
src_list = rcu_dereference(src->fence); src_list = rcu_dereference(src->fence);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment