diff options
author | Rob Clark <robdclark@gmail.com> | 2016-03-31 16:23:51 -0400 |
---|---|---|
committer | Rob Clark <robdclark@gmail.com> | 2016-05-08 10:16:02 -0400 |
commit | 824815c4cd13e384ef5a4be725ec4b06e4ad2c2a (patch) | |
tree | ba1e68f32df845da41e8b8c9a0922713cca27111 /include/linux/reservation.h | |
parent | feb46f02c3fa70e6d3e5307cb105cc69c60a3fe3 (diff) | |
download | linux-stable-824815c4cd13e384ef5a4be725ec4b06e4ad2c2a.tar.gz linux-stable-824815c4cd13e384ef5a4be725ec4b06e4ad2c2a.tar.bz2 linux-stable-824815c4cd13e384ef5a4be725ec4b06e4ad2c2a.zip |
reservation: add reservation_object_get_excl_rcu()
In the atomic modesetting path, each driver simply wants to grab a ref
to the exclusive fence from a reservation object to store in the incoming
drm_plane_state, without doing the whole RCU dance. Since each driver
will need to do this, lets make a helper.
v2: rename to _rcu instead of _unlocked to be more consistent
Signed-off-by: Rob Clark <robdclark@gmail.com>
Acked-by: Sumit Semwal <sumit.semwal@linaro.org>
Diffstat (limited to 'include/linux/reservation.h')
-rw-r--r-- | include/linux/reservation.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/include/linux/reservation.h b/include/linux/reservation.h index 5a0b64cf68b4..49d057655d62 100644 --- a/include/linux/reservation.h +++ b/include/linux/reservation.h @@ -120,6 +120,24 @@ reservation_object_get_excl(struct reservation_object *obj) reservation_object_held(obj)); } +static inline struct fence * +reservation_object_get_excl_rcu(struct reservation_object *obj) +{ + struct fence *fence; + unsigned seq; +retry: + seq = read_seqcount_begin(&obj->seq); + rcu_read_lock(); + fence = rcu_dereference(obj->fence_excl); + if (read_seqcount_retry(&obj->seq, seq)) { + rcu_read_unlock(); + goto retry; + } + fence = fence_get(fence); + rcu_read_unlock(); + return fence; +} + int reservation_object_reserve_shared(struct reservation_object *obj); void reservation_object_add_shared_fence(struct reservation_object *obj, struct fence *fence); |