Remove redundant index parameter of async_pause_job(), as the value of the index has been saved in async_op type variable.
Signed-off-by: Zhiqi Song songzhiqi1@huawei.com --- src/uadk_async.c | 11 +++++++---- src/uadk_async.h | 2 +- src/uadk_cipher.c | 2 +- src/uadk_dh.c | 4 ++-- src/uadk_digest.c | 2 +- src/uadk_pkey.c | 2 +- src/uadk_rsa.c | 2 +- 7 files changed, 14 insertions(+), 11 deletions(-)
diff --git a/src/uadk_async.c b/src/uadk_async.c index ae53361..be5b314 100644 --- a/src/uadk_async.c +++ b/src/uadk_async.c @@ -236,14 +236,17 @@ out: return ret; }
-static int async_add_poll_task(void *ctx, struct async_op *op, enum task_type type, int id) +static int async_add_poll_task(void *ctx, struct async_op *op, enum task_type type) { struct async_poll_task *task_queue; struct async_poll_task *task; int ret;
task_queue = poll_queue.head; - task = &task_queue[id]; + task = &task_queue[op->idx]; + if (!task) + return UADK_E_FAIL; + task->ctx = ctx; task->type = type; task->op = op; @@ -255,7 +258,7 @@ static int async_add_poll_task(void *ctx, struct async_op *op, enum task_type ty return UADK_E_SUCCESS; }
-int async_pause_job(void *ctx, struct async_op *op, enum task_type type, int id) +int async_pause_job(void *ctx, struct async_op *op, enum task_type type) { ASYNC_WAIT_CTX *waitctx; OSSL_ASYNC_FD efd; @@ -263,7 +266,7 @@ int async_pause_job(void *ctx, struct async_op *op, enum task_type type, int id) uint64_t buf; int ret;
- ret = async_add_poll_task(ctx, op, type, id); + ret = async_add_poll_task(ctx, op, type); if (ret == UADK_E_FAIL) return ret;
diff --git a/src/uadk_async.h b/src/uadk_async.h index adb065f..ec41966 100644 --- a/src/uadk_async.h +++ b/src/uadk_async.h @@ -75,7 +75,7 @@ struct async_poll_queue {
int async_setup_async_event_notification(struct async_op *op); int async_clear_async_event_notification(void); -int async_pause_job(void *ctx, struct async_op *op, enum task_type type, int id); +int async_pause_job(void *ctx, struct async_op *op, enum task_type type); void async_register_poll_fn(int type, async_recv_t func); int async_module_init(void); int async_wake_job(ASYNC_JOB *job); diff --git a/src/uadk_cipher.c b/src/uadk_cipher.c index 26a345b..4febe9a 100644 --- a/src/uadk_cipher.c +++ b/src/uadk_cipher.c @@ -849,7 +849,7 @@ static int do_cipher_async(struct cipher_priv_ctx *priv, struct async_op *op) } } while (ret == -EBUSY);
- ret = async_pause_job(priv, op, ASYNC_TASK_CIPHER, idx); + ret = async_pause_job(priv, op, ASYNC_TASK_CIPHER);
free_cb_param: free(cb_param); diff --git a/src/uadk_dh.c b/src/uadk_dh.c index c0b58ef..e80ee58 100644 --- a/src/uadk_dh.c +++ b/src/uadk_dh.c @@ -728,13 +728,13 @@ static int dh_do_async(struct uadk_dh_sess *dh_sess, struct async_op *op) do { ret = wd_do_dh_async(dh_sess->sess, &dh_sess->req); if (ret < 0 && ret != -EBUSY) { - async_free_poll_task(idx, 0); + async_free_poll_task(op->idx, 0); ret = UADK_E_FAIL; goto free_cb_param; } } while (ret == -EBUSY);
- ret = async_pause_job(dh_sess, op, ASYNC_TASK_DH, idx); + ret = async_pause_job(dh_sess, op, ASYNC_TASK_DH); if (!ret) goto free_cb_param;
diff --git a/src/uadk_digest.c b/src/uadk_digest.c index d9b36e1..93da3de 100644 --- a/src/uadk_digest.c +++ b/src/uadk_digest.c @@ -751,7 +751,7 @@ static int do_digest_async(struct digest_priv_ctx *priv, struct async_op *op) } } while (ret == -EBUSY);
- ret = async_pause_job(priv, op, ASYNC_TASK_DIGEST, idx); + ret = async_pause_job(priv, op, ASYNC_TASK_DIGEST);
free_cb_param: free(cb_param); diff --git a/src/uadk_pkey.c b/src/uadk_pkey.c index 6319d61..dfa81d5 100644 --- a/src/uadk_pkey.c +++ b/src/uadk_pkey.c @@ -323,7 +323,7 @@ static int uadk_ecc_do_async(handle_t sess, struct wd_ecc_req *req, } } while (ret == -EBUSY);
- ret = async_pause_job((void *)usr, op, ASYNC_TASK_ECC, idx); + ret = async_pause_job((void *)usr, op, ASYNC_TASK_ECC); if (!ret) goto free_cb_param;
diff --git a/src/uadk_rsa.c b/src/uadk_rsa.c index 6424d9e..e05a82e 100644 --- a/src/uadk_rsa.c +++ b/src/uadk_rsa.c @@ -1122,7 +1122,7 @@ static int rsa_do_async(struct uadk_rsa_sess *rsa_sess, struct async_op *op) } } while (ret == -EBUSY);
- ret = async_pause_job(rsa_sess, op, ASYNC_TASK_RSA, idx); + ret = async_pause_job(rsa_sess, op, ASYNC_TASK_RSA); if (!ret) goto free_cb_param;