diff mbox series

[v2,04/19] crypto: caam: convert tasklets to use new tasklet_setup() API

Message ID 20210107122944.16363-1-allen.lkml@gmail.com
State Superseded
Headers show
Series [v2,01/19] crypto: amcc: convert tasklets to use new tasklet_setup() API | expand

Commit Message

Allen Pais Jan. 7, 2021, 12:29 p.m. UTC
From: Allen Pais <apais@linux.microsoft.com>

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.

Reviewed-by: Horia Geantă <horia.geanta@nxp.com>
Signed-off-by: Romain Perier <romain.perier@gmail.com>
Signed-off-by: Allen Pais <apais@linux.microsoft.com>
---
 drivers/crypto/caam/jr.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

Comments

Emil Renner Berthing Jan. 7, 2021, 12:40 p.m. UTC | #1
Hi Allen,

On Thu, 7 Jan 2021 at 13:32, Allen Pais <allen.lkml@gmail.com> wrote:
>
> From: Allen Pais <apais@linux.microsoft.com>
>
> 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@gmail.com>
> Signed-off-by: Allen Pais <apais@linux.microsoft.com>
> ---
>  drivers/crypto/rockchip/rk3288_crypto.c | 14 ++++++--------
>  1 file changed, 6 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/crypto/rockchip/rk3288_crypto.c b/drivers/crypto/rockchip/rk3288_crypto.c
> index 35d73061d156..af6ad9f49009 100644
> --- a/drivers/crypto/rockchip/rk3288_crypto.c
> +++ b/drivers/crypto/rockchip/rk3288_crypto.c
> @@ -201,9 +201,9 @@ static int rk_crypto_enqueue(struct rk_crypto_info *dev,
>         return ret;
>  }
>
> -static void rk_crypto_queue_task_cb(unsigned long data)
> +static void rk_crypto_queue_task_cb(struct tasklet_struct *T)
>  {
> -       struct rk_crypto_info *dev = (struct rk_crypto_info *)data;
> +       struct rk_crypto_info *dev = from_tasklet(dev, t, queue_task);

This doesn't look right. First it's called T and then t. I wonder how
this even compiles..

>         struct crypto_async_request *async_req, *backlog;
>         unsigned long flags;
>         int err = 0;
> @@ -231,9 +231,9 @@ static void rk_crypto_queue_task_cb(unsigned long data)
>                 dev->complete(dev->async_req, err);
>  }
>
> -static void rk_crypto_done_task_cb(unsigned long data)
> +static void rk_crypto_done_task_cb(struct tasklet_struct *t)
>  {
> -       struct rk_crypto_info *dev = (struct rk_crypto_info *)data;
> +       struct rk_crypto_info *dev = from_tasklet(dev, t, done_task);
>
>         if (dev->err) {
>                 dev->complete(dev->async_req, dev->err);
> @@ -389,10 +389,8 @@ static int rk_crypto_probe(struct platform_device *pdev)
>         crypto_info->dev = &pdev->dev;
>         platform_set_drvdata(pdev, crypto_info);
>
> -       tasklet_init(&crypto_info->queue_task,
> -                    rk_crypto_queue_task_cb, (unsigned long)crypto_info);
> -       tasklet_init(&crypto_info->done_task,
> -                    rk_crypto_done_task_cb, (unsigned long)crypto_info);
> +       tasklet_setup(&crypto_info->queue_task, rk_crypto_queue_task_cb);
> +       tasklet_setup(&crypto_info->done_task, rk_crypto_done_task_cb);
>         crypto_init_queue(&crypto_info->queue, 50);
>
>         crypto_info->enable_clk = rk_crypto_enable_clk;
> --
> 2.25.1
>
>
> _______________________________________________
> Linux-rockchip mailing list
> Linux-rockchip@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-rockchip
diff mbox series

Patch

diff --git a/drivers/crypto/caam/jr.c b/drivers/crypto/caam/jr.c
index 7f2b1101f567..2903e1af0a56 100644
--- a/drivers/crypto/caam/jr.c
+++ b/drivers/crypto/caam/jr.c
@@ -9,6 +9,7 @@ 
 
 #include <linux/of_irq.h>
 #include <linux/of_address.h>
+#include <linux/interrupt.h>
 
 #include "compat.h"
 #include "ctrl.h"
@@ -201,11 +202,11 @@  static irqreturn_t caam_jr_interrupt(int irq, void *st_dev)
 }
 
 /* Deferred service handler, run as interrupt-fired tasklet */
-static void caam_jr_dequeue(unsigned long devarg)
+static void caam_jr_dequeue(struct tasklet_struct *t)
 {
 	int hw_idx, sw_idx, i, head, tail;
-	struct device *dev = (struct device *)devarg;
-	struct caam_drv_private_jr *jrp = dev_get_drvdata(dev);
+	struct caam_drv_private_jr *jrp = from_tasklet(jrp, t, irqtask);
+	struct device *dev = jrp->dev;
 	void (*usercall)(struct device *dev, u32 *desc, u32 status, void *arg);
 	u32 *userdesc, userstatus;
 	void *userarg;
@@ -483,7 +484,7 @@  static int caam_jr_init(struct device *dev)
 		      (JOBR_INTC_COUNT_THLD << JRCFG_ICDCT_SHIFT) |
 		      (JOBR_INTC_TIME_THLD << JRCFG_ICTT_SHIFT));
 
-	tasklet_init(&jrp->irqtask, caam_jr_dequeue, (unsigned long)dev);
+	tasklet_setup(&jrp->irqtask, caam_jr_dequeue);
 
 	/* Connect job ring interrupt handler. */
 	error = devm_request_irq(dev, jrp->irq, caam_jr_interrupt, IRQF_SHARED,