[PATCH 11/19] crypto: mediatek: convert tasklets to use new tasklet_setup() API

From: Allen Pais
Date: Mon Aug 17 2020 - 04:11:09 EST


In preparation for unconditionally passing the
struct tasklet_struct pointer to all tasklet
callbacks, switch to using the new tasklet_setup()
and from_tasklet() to pass the tasklet pointer explicitly.

Signed-off-by: Romain Perier <romain.perier@xxxxxxxxx>
Signed-off-by: Allen Pais <allen.lkml@xxxxxxxxx>
---
drivers/crypto/mediatek/mtk-aes.c | 14 ++++++--------
drivers/crypto/mediatek/mtk-sha.c | 14 ++++++--------
2 files changed, 12 insertions(+), 16 deletions(-)

diff --git a/drivers/crypto/mediatek/mtk-aes.c b/drivers/crypto/mediatek/mtk-aes.c
index 4ad3571ab6af..5557359f105c 100644
--- a/drivers/crypto/mediatek/mtk-aes.c
+++ b/drivers/crypto/mediatek/mtk-aes.c
@@ -1089,16 +1089,16 @@ static struct aead_alg aes_gcm_alg = {
},
};

-static void mtk_aes_queue_task(unsigned long data)
+static void mtk_aes_queue_task(struct tasklet_struct *t)
{
- struct mtk_aes_rec *aes = (struct mtk_aes_rec *)data;
+ struct mtk_aes_rec *aes = from_tasklet(aes, t, queue_task);

mtk_aes_handle_queue(aes->cryp, aes->id, NULL);
}

-static void mtk_aes_done_task(unsigned long data)
+static void mtk_aes_done_task(struct tasklet_struct *t)
{
- struct mtk_aes_rec *aes = (struct mtk_aes_rec *)data;
+ struct mtk_aes_rec *aes = from_tasklet(aes, t, done_task);
struct mtk_cryp *cryp = aes->cryp;

mtk_aes_unmap(cryp, aes);
@@ -1151,10 +1151,8 @@ static int mtk_aes_record_init(struct mtk_cryp *cryp)
spin_lock_init(&aes[i]->lock);
crypto_init_queue(&aes[i]->queue, AES_QUEUE_SIZE);

- tasklet_init(&aes[i]->queue_task, mtk_aes_queue_task,
- (unsigned long)aes[i]);
- tasklet_init(&aes[i]->done_task, mtk_aes_done_task,
- (unsigned long)aes[i]);
+ tasklet_setup(&aes[i]->queue_task, mtk_aes_queue_task);
+ tasklet_setup(&aes[i]->done_task, mtk_aes_done_task);
}

/* Link to ring0 and ring1 respectively */
diff --git a/drivers/crypto/mediatek/mtk-sha.c b/drivers/crypto/mediatek/mtk-sha.c
index da3f0b8814aa..ea0ae45cde93 100644
--- a/drivers/crypto/mediatek/mtk-sha.c
+++ b/drivers/crypto/mediatek/mtk-sha.c
@@ -1163,16 +1163,16 @@ static struct ahash_alg algs_sha384_sha512[] = {
},
};

-static void mtk_sha_queue_task(unsigned long data)
+static void mtk_sha_queue_task(struct tasklet_struct *t)
{
- struct mtk_sha_rec *sha = (struct mtk_sha_rec *)data;
+ struct mtk_sha_rec *sha = from_tasklet(sha, t, queue_task);

mtk_sha_handle_queue(sha->cryp, sha->id - MTK_RING2, NULL);
}

-static void mtk_sha_done_task(unsigned long data)
+static void mtk_sha_done_task(struct tasklet_struct *t)
{
- struct mtk_sha_rec *sha = (struct mtk_sha_rec *)data;
+ struct mtk_sha_rec *sha = from_tasklet(sha, t, done_task);
struct mtk_cryp *cryp = sha->cryp;

mtk_sha_unmap(cryp, sha);
@@ -1218,10 +1218,8 @@ static int mtk_sha_record_init(struct mtk_cryp *cryp)
spin_lock_init(&sha[i]->lock);
crypto_init_queue(&sha[i]->queue, SHA_QUEUE_SIZE);

- tasklet_init(&sha[i]->queue_task, mtk_sha_queue_task,
- (unsigned long)sha[i]);
- tasklet_init(&sha[i]->done_task, mtk_sha_done_task,
- (unsigned long)sha[i]);
+ tasklet_setup(&sha[i]->queue_task, mtk_sha_queue_task);
+ tasklet_setup(&sha[i]->done_task, mtk_sha_done_task);
}

/* Link to ring2 and ring3 respectively */
--
2.17.1