summaryrefslogtreecommitdiff
path: root/drivers/dma-buf/dma-fence-array.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/dma-buf/dma-fence-array.c')
-rw-r--r--drivers/dma-buf/dma-fence-array.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/drivers/dma-buf/dma-fence-array.c b/drivers/dma-buf/dma-fence-array.c
index 37e2c6179d77..089f69469524 100644
--- a/drivers/dma-buf/dma-fence-array.c
+++ b/drivers/dma-buf/dma-fence-array.c
@@ -200,15 +200,28 @@ void dma_fence_array_init(struct dma_fence_array *array,
u64 context, unsigned seqno,
bool signal_on_any)
{
+ static struct lock_class_key dma_fence_array_lock_key;
+
WARN_ON(!num_fences || !fences);
array->num_fences = num_fences;
- spin_lock_init(&array->lock);
- dma_fence_init(&array->base, &dma_fence_array_ops, &array->lock,
- context, seqno);
+ dma_fence_init(&array->base, &dma_fence_array_ops, NULL, context,
+ seqno);
init_irq_work(&array->work, irq_dma_fence_array_work);
+ /*
+ * dma_fence_array_enable_signaling() is invoked while holding
+ * array->base.inline_lock and may call dma_fence_add_callback()
+ * on the underlying fences, which takes their inline_lock.
+ *
+ * Since both locks share the same lockdep class, this legitimate
+ * nesting confuses lockdep and triggers a recursive locking
+ * warning. Assign a separate lockdep class to the array lock
+ * to model this hierarchy correctly.
+ */
+ lockdep_set_class(&array->base.inline_lock, &dma_fence_array_lock_key);
+
atomic_set(&array->num_pending, signal_on_any ? 1 : num_fences);
array->fences = fences;