Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

dma-buf: add reservation_object_lock_interruptible()

That's the only wrapper function missing and necessary to cleanup TTM.

Reviewed-and-Tested-by: Michel Dänzer <michel.daenzer@amd.com>
Signed-off-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20171109085909.1653-3-christian.koenig@amd.com

authored by

Christian König and committed by
Alex Deucher
5d276a1a b5e821bb

+23
+23
include/linux/reservation.h
··· 167 167 } 168 168 169 169 /** 170 + * reservation_object_lock_interruptible - lock the reservation object 171 + * @obj: the reservation object 172 + * @ctx: the locking context 173 + * 174 + * Locks the reservation object interruptible for exclusive access and 175 + * modification. Note, that the lock is only against other writers, readers 176 + * will run concurrently with a writer under RCU. The seqlock is used to 177 + * notify readers if they overlap with a writer. 178 + * 179 + * As the reservation object may be locked by multiple parties in an 180 + * undefined order, a #ww_acquire_ctx is passed to unwind if a cycle 181 + * is detected. See ww_mutex_lock() and ww_acquire_init(). A reservation 182 + * object may be locked by itself by passing NULL as @ctx. 183 + */ 184 + static inline int 185 + reservation_object_lock_interruptible(struct reservation_object *obj, 186 + struct ww_acquire_ctx *ctx) 187 + { 188 + return ww_mutex_lock_interruptible(&obj->lock, ctx); 189 + } 190 + 191 + 192 + /** 170 193 * reservation_object_trylock - trylock the reservation object 171 194 * @obj: the reservation object 172 195 *