summaryrefslogtreecommitdiff
path: root/include/linux/reservation.h
diff options
context:
space:
mode:
authorChristian König <ckoenig.leichtzumerken@gmail.com>2017-11-09 11:59:05 +0300
committerAlex Deucher <alexander.deucher@amd.com>2017-11-13 22:50:49 +0300
commit5d276a1acaa80f4b7a76577510a2b1835ce01f4f (patch)
tree0b0c49c50fb4232f5ea8f1840b8f19b7bd38980b /include/linux/reservation.h
parentb5e821bb86071bb37624bafe9e4e8f345be89f45 (diff)
downloadlinux-5d276a1acaa80f4b7a76577510a2b1835ce01f4f.tar.xz
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
Diffstat (limited to 'include/linux/reservation.h')
-rw-r--r--include/linux/reservation.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/include/linux/reservation.h b/include/linux/reservation.h
index 21fc84d82d41..02166e815afb 100644
--- a/include/linux/reservation.h
+++ b/include/linux/reservation.h
@@ -167,6 +167,29 @@ reservation_object_lock(struct reservation_object *obj,
}
/**
+ * reservation_object_lock_interruptible - lock the reservation object
+ * @obj: the reservation object
+ * @ctx: the locking context
+ *
+ * Locks the reservation object interruptible for exclusive access and
+ * modification. Note, that the lock is only against other writers, readers
+ * will run concurrently with a writer under RCU. The seqlock is used to
+ * notify readers if they overlap with a writer.
+ *
+ * As the reservation object may be locked by multiple parties in an
+ * undefined order, a #ww_acquire_ctx is passed to unwind if a cycle
+ * is detected. See ww_mutex_lock() and ww_acquire_init(). A reservation
+ * object may be locked by itself by passing NULL as @ctx.
+ */
+static inline int
+reservation_object_lock_interruptible(struct reservation_object *obj,
+ struct ww_acquire_ctx *ctx)
+{
+ return ww_mutex_lock_interruptible(&obj->lock, ctx);
+}
+
+
+/**
* reservation_object_trylock - trylock the reservation object
* @obj: the reservation object
*