[PATCH 1/3] fpga: stratix10-soc: always wait for svc buffer completion

From: Adrian Ng Ho Yin

Date: Tue Sep 22 2026 - 12:12:48 EST


Always call wait_for_completion_timeout() in s10_ops_write(). Skipping
the wait when priv->status is already set is unnecessary: if the
callback already ran, complete() raised the done counter and the wait
returns immediately.

Signed-off-by: Adrian Ng Ho Yin <adrian.ho.yin.ng@xxxxxxxxxx>
---
drivers/fpga/stratix10-soc.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/fpga/stratix10-soc.c b/drivers/fpga/stratix10-soc.c
index b8ec2e6f615f..3ba0ffa1d9e0 100644
--- a/drivers/fpga/stratix10-soc.c
+++ b/drivers/fpga/stratix10-soc.c
@@ -310,14 +310,14 @@ static int s10_ops_write(struct fpga_manager *mgr, const char *buf,
}

/*
- * If callback hasn't already happened, wait for buffers to be
- * returned from service layer
+ * Always wait for the completion rather than skipping it when
+ * priv->status is already set. The callback may have fired
+ * between the CLAIM/SUBMIT send and here; if so, complete()
+ * has already incremented the done counter and
+ * wait_for_completion_timeout() returns immediately.
*/
- wait_status = 1; /* not timed out */
- if (!priv->status)
- wait_status = wait_for_completion_timeout(
- &priv->status_return_completion,
- S10_BUFFER_TIMEOUT);
+ wait_status = wait_for_completion_timeout(
+ &priv->status_return_completion, S10_BUFFER_TIMEOUT);

if (test_and_clear_bit(SVC_STATUS_BUFFER_DONE, &priv->status) ||
test_and_clear_bit(SVC_STATUS_BUFFER_SUBMITTED,
--
2.49.GIT