@@ -79,6 +79,21 @@ static bool fence_array_signaled(struct fence *fence)
return atomic_read(&array->num_pending) <= 0;
}
+static void fence_array_teardown(struct fence *fence)
+{
+ struct fence_array *array = to_fence_array(fence);
+ struct fence_array_cb *cb = (void *)(&array[1]);
+ int i;
+
+ for (i = 0; i < array->num_fences; i++) {
+ if (fence_is_signaled(array->fences[i]))
+ continue;
+
+ fence_remove_callback(array->fences[i], &cb[i].cb);
+ fence_put(&array->base);
+ }
+}
+
static void fence_array_release(struct fence *fence)
{
struct fence_array *array = to_fence_array(fence);
@@ -97,6 +112,7 @@ const struct fence_ops fence_array_ops = {
.enable_signaling = fence_array_enable_signaling,
.signaled = fence_array_signaled,
.wait = fence_default_wait,
+ .teardown = fence_array_teardown,
.release = fence_array_release,
};