msm: synx: fence callback fixes

Callbacks with the backing dma fences are not registered
for composite (merged) synx objects.
Hence added check to exclude dma fence removal for the
merged objects during cleanup.
Also, the check for the synx object status is moved prior
to dma fence callback removal as any attempts to re-signal
a signaled object does not attempt to remove dma fence
callback again.

Change-Id: Idbbdf1d813ed1099d35044d2e454d60017fe172a
Signed-off-by: Sumukh Hallymysore Ravindra <shallymy@codeaurora.org>
This commit is contained in:
Sumukh Hallymysore Ravindra 2020-06-05 15:45:04 +05:30 • committed by Gerrit - the friendly Code Review server
commit ec1d217932
2 changed files with 7 additions and 8 deletions

View file

@ -313,6 +313,10 @@ int synx_signal_fence(struct synx_coredata *synx_obj,
return -EINVAL;
}
if (synx_util_get_object_status(synx_obj) !=
SYNX_STATE_ACTIVE)
return -EALREADY;
/*
* remove registered callback for the fence
* so it does not invoke the signal through callback again
@ -324,12 +328,6 @@ int synx_signal_fence(struct synx_coredata *synx_obj,
}
spin_lock_irqsave(synx_obj->fence->lock, flags);
if (synx_util_get_object_status_locked(synx_obj) !=
SYNX_STATE_ACTIVE) {
spin_unlock_irqrestore(synx_obj->fence->lock, flags);
return -EALREADY;
}
/* set fence error to model {signal w/ error} */
if (status != SYNX_STATE_SIGNALED_SUCCESS)
dma_fence_set_error(synx_obj->fence, -status);

View file

@ -107,8 +107,9 @@ static void synx_util_destroy_coredata(struct kref *kref)
if (synx_obj->fence) {
/* need to release callback if unsignaled */
if (synx_util_get_object_status(synx_obj) ==
SYNX_STATE_ACTIVE)
if (!synx_util_is_merged_object(synx_obj) &&
(synx_util_get_object_status(synx_obj) ==
SYNX_STATE_ACTIVE))
if (!dma_fence_remove_callback(synx_obj->fence,
&synx_obj->fence_cb))
/* nothing much but logging the error */