2021-01-07 12:32:35

by Allen

[permalink] [raw]
Subject: [PATCH v2 04/19] crypto: caam: convert tasklets to use new tasklet_setup() API

From: Allen Pais <[email protected]>

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ă <[email protected]>
Signed-off-by: Romain Perier <[email protected]>
Signed-off-by: Allen Pais <[email protected]>
---
drivers/crypto/caam/jr.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)

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,
--
2.25.1


2021-01-07 12:32:37

by Allen

[permalink] [raw]
Subject: [PATCH v2 05/19] crypto: cavium: convert tasklets to use new tasklet_setup() API

From: Allen Pais <[email protected]>

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 <[email protected]>
Signed-off-by: Allen Pais <[email protected]>
---
drivers/crypto/cavium/cpt/cptvf_main.c | 9 ++++-----
drivers/crypto/cavium/nitrox/nitrox_common.h | 2 +-
drivers/crypto/cavium/nitrox/nitrox_isr.c | 13 +++++--------
drivers/crypto/cavium/nitrox/nitrox_reqmgr.c | 4 ++--
4 files changed, 12 insertions(+), 16 deletions(-)

diff --git a/drivers/crypto/cavium/cpt/cptvf_main.c b/drivers/crypto/cavium/cpt/cptvf_main.c
index f016448e43bb..6424bcc74139 100644
--- a/drivers/crypto/cavium/cpt/cptvf_main.c
+++ b/drivers/crypto/cavium/cpt/cptvf_main.c
@@ -21,10 +21,10 @@ struct cptvf_wqe_info {
struct cptvf_wqe vq_wqe[CPT_NUM_QS_PER_VF];
};

-static void vq_work_handler(unsigned long data)
+static void vq_work_handler(struct tasklet_struct *t)
{
- struct cptvf_wqe_info *cwqe_info = (struct cptvf_wqe_info *)data;
- struct cptvf_wqe *cwqe = &cwqe_info->vq_wqe[0];
+ struct cptvf_wqe *cwqe = from_tasklet(cwqe, t, twork);
+ struct cptvf_wqe_info *cwqe_info = container_of(cwqe, typeof(*cwqe_info), vq_wqe[0]);

vq_post_process(cwqe->cptvf, cwqe->qno);
}
@@ -45,8 +45,7 @@ static int init_worker_threads(struct cpt_vf *cptvf)
}

for (i = 0; i < cptvf->nr_queues; i++) {
- tasklet_init(&cwqe_info->vq_wqe[i].twork, vq_work_handler,
- (u64)cwqe_info);
+ tasklet_setup(&cwqe_info->vq_wqe[i].twork, vq_work_handler);
cwqe_info->vq_wqe[i].qno = i;
cwqe_info->vq_wqe[i].cptvf = cptvf;
}
diff --git a/drivers/crypto/cavium/nitrox/nitrox_common.h b/drivers/crypto/cavium/nitrox/nitrox_common.h
index e4be69d7e6e5..f73ae8735272 100644
--- a/drivers/crypto/cavium/nitrox/nitrox_common.h
+++ b/drivers/crypto/cavium/nitrox/nitrox_common.h
@@ -19,7 +19,7 @@ void nitrox_put_device(struct nitrox_device *ndev);
int nitrox_common_sw_init(struct nitrox_device *ndev);
void nitrox_common_sw_cleanup(struct nitrox_device *ndev);

-void pkt_slc_resp_tasklet(unsigned long data);
+void pkt_slc_resp_tasklet(struct tasklet_struct *t);
int nitrox_process_se_request(struct nitrox_device *ndev,
struct se_crypto_request *req,
completion_t cb,
diff --git a/drivers/crypto/cavium/nitrox/nitrox_isr.c b/drivers/crypto/cavium/nitrox/nitrox_isr.c
index 99b053094f5a..c6fb8b3263e1 100644
--- a/drivers/crypto/cavium/nitrox/nitrox_isr.c
+++ b/drivers/crypto/cavium/nitrox/nitrox_isr.c
@@ -201,9 +201,9 @@ static void clear_bmi_err_intr(struct nitrox_device *ndev)
dev_err_ratelimited(DEV(ndev), "BMI_INT 0x%016llx\n", value);
}

-static void nps_core_int_tasklet(unsigned long data)
+static void nps_core_int_tasklet(struct tasklet_struct *t)
{
- struct nitrox_q_vector *qvec = (void *)(uintptr_t)(data);
+ struct nitrox_q_vector *qvec = from_tasklet(qvec, t, resp_tasklet);
struct nitrox_device *ndev = qvec->ndev;

/* if pf mode do queue recovery */
@@ -343,8 +343,7 @@ int nitrox_register_interrupts(struct nitrox_device *ndev)
cpu = qvec->ring % num_online_cpus();
irq_set_affinity_hint(vec, get_cpu_mask(cpu));

- tasklet_init(&qvec->resp_tasklet, pkt_slc_resp_tasklet,
- (unsigned long)qvec);
+ tasklet_setup(&qvec->resp_tasklet, pkt_slc_resp_tasklet);
qvec->valid = true;
}

@@ -364,8 +363,7 @@ int nitrox_register_interrupts(struct nitrox_device *ndev)
cpu = num_online_cpus();
irq_set_affinity_hint(vec, get_cpu_mask(cpu));

- tasklet_init(&qvec->resp_tasklet, nps_core_int_tasklet,
- (unsigned long)qvec);
+ tasklet_setup(&qvec->resp_tasklet, nps_core_int_tasklet);
qvec->valid = true;

return 0;
@@ -442,8 +440,7 @@ int nitrox_sriov_register_interupts(struct nitrox_device *ndev)
cpu = num_online_cpus();
irq_set_affinity_hint(vec, get_cpu_mask(cpu));

- tasklet_init(&qvec->resp_tasklet, nps_core_int_tasklet,
- (unsigned long)qvec);
+ tasklet_setup(&qvec->resp_tasklet, nps_core_int_tasklet);
qvec->valid = true;

return 0;
diff --git a/drivers/crypto/cavium/nitrox/nitrox_reqmgr.c b/drivers/crypto/cavium/nitrox/nitrox_reqmgr.c
index 53ef06792133..676f3d00bf61 100644
--- a/drivers/crypto/cavium/nitrox/nitrox_reqmgr.c
+++ b/drivers/crypto/cavium/nitrox/nitrox_reqmgr.c
@@ -580,9 +580,9 @@ static void process_response_list(struct nitrox_cmdq *cmdq)
/**
* pkt_slc_resp_tasklet - post processing of SE responses
*/
-void pkt_slc_resp_tasklet(unsigned long data)
+void pkt_slc_resp_tasklet(struct tasklet_struct *t)
{
- struct nitrox_q_vector *qvec = (void *)(uintptr_t)(data);
+ struct nitrox_q_vector *qvec = from_tasklet(qvec, t, resp_tasklet);
struct nitrox_cmdq *cmdq = qvec->cmdq;
union nps_pkt_slc_cnts slc_cnts;

--
2.25.1

2021-01-07 12:33:32

by Allen

[permalink] [raw]
Subject: [PATCH v2 06/19] crypto: ccp: convert tasklets to use new tasklet_setup() API

From: Allen Pais <[email protected]>

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 <[email protected]>
Signed-off-by: Allen Pais <[email protected]>
---
drivers/crypto/ccp/ccp-dev-v3.c | 9 ++++-----
drivers/crypto/ccp/ccp-dev-v5.c | 9 ++++-----
drivers/crypto/ccp/ccp-dmaengine.c | 7 +++----
3 files changed, 11 insertions(+), 14 deletions(-)

diff --git a/drivers/crypto/ccp/ccp-dev-v3.c b/drivers/crypto/ccp/ccp-dev-v3.c
index 0d5576f6ad21..858566867fa3 100644
--- a/drivers/crypto/ccp/ccp-dev-v3.c
+++ b/drivers/crypto/ccp/ccp-dev-v3.c
@@ -321,9 +321,9 @@ static void ccp_enable_queue_interrupts(struct ccp_device *ccp)
iowrite32(ccp->qim, ccp->io_regs + IRQ_MASK_REG);
}

-static void ccp_irq_bh(unsigned long data)
+static void ccp_irq_bh(struct tasklet_struct *t)
{
- struct ccp_device *ccp = (struct ccp_device *)data;
+ struct ccp_device *ccp = from_tasklet(ccp, t, irq_tasklet);
struct ccp_cmd_queue *cmd_q;
u32 q_int, status;
unsigned int i;
@@ -361,7 +361,7 @@ static irqreturn_t ccp_irq_handler(int irq, void *data)
if (ccp->use_tasklet)
tasklet_schedule(&ccp->irq_tasklet);
else
- ccp_irq_bh((unsigned long)ccp);
+ ccp_irq_bh(&ccp->irq_tasklet);

return IRQ_HANDLED;
}
@@ -457,8 +457,7 @@ static int ccp_init(struct ccp_device *ccp)

/* Initialize the ISR tasklet? */
if (ccp->use_tasklet)
- tasklet_init(&ccp->irq_tasklet, ccp_irq_bh,
- (unsigned long)ccp);
+ tasklet_setup(&ccp->irq_tasklet, ccp_irq_bh);

dev_dbg(dev, "Starting threads...\n");
/* Create a kthread for each queue */
diff --git a/drivers/crypto/ccp/ccp-dev-v5.c b/drivers/crypto/ccp/ccp-dev-v5.c
index 7838f63bab32..e68b05a3169b 100644
--- a/drivers/crypto/ccp/ccp-dev-v5.c
+++ b/drivers/crypto/ccp/ccp-dev-v5.c
@@ -733,9 +733,9 @@ static void ccp5_enable_queue_interrupts(struct ccp_device *ccp)
iowrite32(SUPPORTED_INTERRUPTS, ccp->cmd_q[i].reg_int_enable);
}

-static void ccp5_irq_bh(unsigned long data)
+static void ccp5_irq_bh(struct tasklet_struct *t)
{
- struct ccp_device *ccp = (struct ccp_device *)data;
+ struct ccp_device *ccp = from_tasklet(ccp, t, irq_tasklet);
u32 status;
unsigned int i;

@@ -772,7 +772,7 @@ static irqreturn_t ccp5_irq_handler(int irq, void *data)
if (ccp->use_tasklet)
tasklet_schedule(&ccp->irq_tasklet);
else
- ccp5_irq_bh((unsigned long)ccp);
+ ccp5_irq_bh(&ccp->irq_tasklet);
return IRQ_HANDLED;
}

@@ -894,8 +894,7 @@ static int ccp5_init(struct ccp_device *ccp)
}
/* Initialize the ISR tasklet */
if (ccp->use_tasklet)
- tasklet_init(&ccp->irq_tasklet, ccp5_irq_bh,
- (unsigned long)ccp);
+ tasklet_setup(&ccp->irq_tasklet, ccp5_irq_bh);

dev_dbg(dev, "Loading LSB map...\n");
/* Copy the private LSB mask to the public registers */
diff --git a/drivers/crypto/ccp/ccp-dmaengine.c b/drivers/crypto/ccp/ccp-dmaengine.c
index 0770a83bf1a5..a85690866b05 100644
--- a/drivers/crypto/ccp/ccp-dmaengine.c
+++ b/drivers/crypto/ccp/ccp-dmaengine.c
@@ -121,9 +121,9 @@ static void ccp_cleanup_desc_resources(struct ccp_device *ccp,
}
}

-static void ccp_do_cleanup(unsigned long data)
+static void ccp_do_cleanup(struct tasklet_struct *t)
{
- struct ccp_dma_chan *chan = (struct ccp_dma_chan *)data;
+ struct ccp_dma_chan *chan = from_tasklet(chan, t, cleanup_tasklet);
unsigned long flags;

dev_dbg(chan->ccp->dev, "%s - chan=%s\n", __func__,
@@ -712,8 +712,7 @@ int ccp_dmaengine_register(struct ccp_device *ccp)
INIT_LIST_HEAD(&chan->active);
INIT_LIST_HEAD(&chan->complete);

- tasklet_init(&chan->cleanup_tasklet, ccp_do_cleanup,
- (unsigned long)chan);
+ tasklet_setup(&chan->cleanup_tasklet, ccp_do_cleanup);

dma_chan->device = dma_dev;
dma_cookie_init(dma_chan);
--
2.25.1

2021-01-07 12:34:01

by Allen

[permalink] [raw]
Subject: [PATCH v2 07/19] crypto: ccree: convert tasklets to use new tasklet_setup() API

From: Allen Pais <[email protected]>

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 <[email protected]>
Signed-off-by: Allen Pais <[email protected]>
---
drivers/crypto/ccree/cc_fips.c | 8 ++++----
drivers/crypto/ccree/cc_request_mgr.c | 12 ++++++------
2 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/drivers/crypto/ccree/cc_fips.c b/drivers/crypto/ccree/cc_fips.c
index 702aefc21447..c1d03d99e3c3 100644
--- a/drivers/crypto/ccree/cc_fips.c
+++ b/drivers/crypto/ccree/cc_fips.c
@@ -8,7 +8,7 @@
#include "cc_driver.h"
#include "cc_fips.h"

-static void fips_dsr(unsigned long devarg);
+static void fips_dsr(struct tasklet_struct *tsk);

struct cc_fips_handle {
struct tasklet_struct tasklet;
@@ -109,9 +109,9 @@ void cc_tee_handle_fips_error(struct cc_drvdata *p_drvdata)
}

/* Deferred service handler, run as interrupt-fired tasklet */
-static void fips_dsr(unsigned long devarg)
+static void fips_dsr(struct tasklet_struct *tsk)
{
- struct cc_drvdata *drvdata = (struct cc_drvdata *)devarg;
+ struct cc_drvdata *drvdata = from_tasklet(drvdata, tsk, tasklet);
u32 irq, val;

irq = (drvdata->irq & (CC_GPR0_IRQ_MASK));
@@ -143,7 +143,7 @@ int cc_fips_init(struct cc_drvdata *p_drvdata)
p_drvdata->fips_handle = fips_h;

dev_dbg(dev, "Initializing fips tasklet\n");
- tasklet_init(&fips_h->tasklet, fips_dsr, (unsigned long)p_drvdata);
+ tasklet_setup(&fips_h->tasklet, fips_dsr);
fips_h->drvdata = p_drvdata;
fips_h->nb.notifier_call = cc_ree_fips_failure;
atomic_notifier_chain_register(&fips_fail_notif_chain, &fips_h->nb);
diff --git a/drivers/crypto/ccree/cc_request_mgr.c b/drivers/crypto/ccree/cc_request_mgr.c
index 33fb27745d52..ec0f3bf00d33 100644
--- a/drivers/crypto/ccree/cc_request_mgr.c
+++ b/drivers/crypto/ccree/cc_request_mgr.c
@@ -70,7 +70,7 @@ static const u32 cc_cpp_int_masks[CC_CPP_NUM_ALGS][CC_CPP_NUM_SLOTS] = {
BIT(CC_HOST_IRR_REE_OP_ABORTED_SM_7_INT_BIT_SHIFT) }
};

-static void comp_handler(unsigned long devarg);
+static void comp_handler(struct tasklet_struct *t);
#ifdef COMP_IN_WQ
static void comp_work_handler(struct work_struct *work);
#endif
@@ -140,8 +140,7 @@ int cc_req_mgr_init(struct cc_drvdata *drvdata)
INIT_DELAYED_WORK(&req_mgr_h->compwork, comp_work_handler);
#else
dev_dbg(dev, "Initializing completion tasklet\n");
- tasklet_init(&req_mgr_h->comptask, comp_handler,
- (unsigned long)drvdata);
+ tasklet_setup(&req_mgr_h->comptask, comp_handler);
#endif
req_mgr_h->hw_queue_size = cc_ioread(drvdata,
CC_REG(DSCRPTR_QUEUE_SRAM_SIZE));
@@ -611,11 +610,12 @@ static inline u32 cc_axi_comp_count(struct cc_drvdata *drvdata)
}

/* Deferred service handler, run as interrupt-fired tasklet */
-static void comp_handler(unsigned long devarg)
+static void comp_handler(struct tasklet_struct *t)
{
- struct cc_drvdata *drvdata = (struct cc_drvdata *)devarg;
struct cc_req_mgr_handle *request_mgr_handle =
- drvdata->request_mgr_handle;
+ from_tasklet(request_mgr_handle, t, comptask);
+ struct cc_drvdata *drvdata = container_of((void *)request_mgr_handle,
+ typeof(*drvdata), request_mgr_handle);
struct device *dev = drvdata_to_dev(drvdata);
u32 irq;

--
2.25.1

2021-01-07 12:34:07

by Allen

[permalink] [raw]
Subject: [PATCH v2 17/19] crypto: s5p: convert tasklets to use new tasklet_setup() API

From: Allen Pais <[email protected]>

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.

Acked-by: Krzysztof Kozlowski <[email protected]>
Signed-off-by: Romain Perier <[email protected]>
Signed-off-by: Allen Pais <[email protected]>
---
drivers/crypto/s5p-sss.c | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/drivers/crypto/s5p-sss.c b/drivers/crypto/s5p-sss.c
index 682c8a450a57..128512a365e1 100644
--- a/drivers/crypto/s5p-sss.c
+++ b/drivers/crypto/s5p-sss.c
@@ -1445,9 +1445,9 @@ static int s5p_hash_handle_queue(struct s5p_aes_dev *dd,
* s5p_hash_tasklet_cb() - hash tasklet
* @data: ptr to s5p_aes_dev
*/
-static void s5p_hash_tasklet_cb(unsigned long data)
+static void s5p_hash_tasklet_cb(struct tasklet_struct *t)
{
- struct s5p_aes_dev *dd = (struct s5p_aes_dev *)data;
+ struct s5p_aes_dev *dd = from_tasklet(dd, t, hash_tasklet);

if (!test_bit(HASH_FLAGS_BUSY, &dd->hash_flags)) {
s5p_hash_handle_queue(dd, NULL);
@@ -1975,9 +1975,9 @@ static void s5p_aes_crypt_start(struct s5p_aes_dev *dev, unsigned long mode)
s5p_aes_complete(req, err);
}

-static void s5p_tasklet_cb(unsigned long data)
+static void s5p_tasklet_cb(struct tasklet_struct *t)
{
- struct s5p_aes_dev *dev = (struct s5p_aes_dev *)data;
+ struct s5p_aes_dev *dev = from_tasklet(dev, t, tasklet);
struct crypto_async_request *async_req, *backlog;
struct s5p_aes_reqctx *reqctx;
unsigned long flags;
@@ -2258,7 +2258,7 @@ static int s5p_aes_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, pdata);
s5p_dev = pdata;

- tasklet_init(&pdata->tasklet, s5p_tasklet_cb, (unsigned long)pdata);
+ tasklet_setup(&pdata->tasklet, s5p_tasklet_cb);
crypto_init_queue(&pdata->queue, CRYPTO_QUEUE_LEN);

for (i = 0; i < ARRAY_SIZE(algs); i++) {
@@ -2268,8 +2268,7 @@ static int s5p_aes_probe(struct platform_device *pdev)
}

if (pdata->use_hash) {
- tasklet_init(&pdata->hash_tasklet, s5p_hash_tasklet_cb,
- (unsigned long)pdata);
+ tasklet_setup(&pdata->hash_tasklet, s5p_hash_tasklet_cb);
crypto_init_queue(&pdata->hash_queue, SSS_HASH_QUEUE_LENGTH);

for (hash_i = 0; hash_i < ARRAY_SIZE(algs_sha1_md5_sha256);
--
2.25.1

2021-01-07 12:34:10

by Allen

[permalink] [raw]
Subject: [PATCH v2 18/19] crypto: talitos: convert tasklets to use new tasklet_setup() API

From: Allen Pais <[email protected]>

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 <[email protected]>
Signed-off-by: Allen Pais <[email protected]>
---
drivers/crypto/talitos.c | 42 ++++++++++++++++++----------------------
1 file changed, 19 insertions(+), 23 deletions(-)

diff --git a/drivers/crypto/talitos.c b/drivers/crypto/talitos.c
index 4fd85f31630a..be4f7dd810fd 100644
--- a/drivers/crypto/talitos.c
+++ b/drivers/crypto/talitos.c
@@ -403,10 +403,11 @@ static void flush_channel(struct device *dev, int ch, int error, int reset_ch)
* process completed requests for channels that have done status
*/
#define DEF_TALITOS1_DONE(name, ch_done_mask) \
-static void talitos1_done_##name(unsigned long data) \
+static void talitos1_done_##name(struct tasklet_struct *t) \
{ \
- struct device *dev = (struct device *)data; \
- struct talitos_private *priv = dev_get_drvdata(dev); \
+ struct talitos_private *priv = from_tasklet(priv, t, \
+ done_task[0]); \
+ struct device *dev = priv->dev; \
unsigned long flags; \
\
if (ch_done_mask & 0x10000000) \
@@ -429,11 +430,12 @@ static void talitos1_done_##name(unsigned long data) \
DEF_TALITOS1_DONE(4ch, TALITOS1_ISR_4CHDONE)
DEF_TALITOS1_DONE(ch0, TALITOS1_ISR_CH_0_DONE)

-#define DEF_TALITOS2_DONE(name, ch_done_mask) \
-static void talitos2_done_##name(unsigned long data) \
+#define DEF_TALITOS2_DONE(name, ch_done_mask, tasklet_idx) \
+static void talitos2_done_##name(struct tasklet_struct *t) \
{ \
- struct device *dev = (struct device *)data; \
- struct talitos_private *priv = dev_get_drvdata(dev); \
+ struct talitos_private *priv = from_tasklet(priv, t, \
+ done_task[tasklet_idx]); \
+ struct device *dev = priv->dev; \
unsigned long flags; \
\
if (ch_done_mask & 1) \
@@ -453,10 +455,10 @@ static void talitos2_done_##name(unsigned long data) \
spin_unlock_irqrestore(&priv->reg_lock, flags); \
}

-DEF_TALITOS2_DONE(4ch, TALITOS2_ISR_4CHDONE)
-DEF_TALITOS2_DONE(ch0, TALITOS2_ISR_CH_0_DONE)
-DEF_TALITOS2_DONE(ch0_2, TALITOS2_ISR_CH_0_2_DONE)
-DEF_TALITOS2_DONE(ch1_3, TALITOS2_ISR_CH_1_3_DONE)
+DEF_TALITOS2_DONE(4ch, TALITOS2_ISR_4CHDONE, 0)
+DEF_TALITOS2_DONE(ch0, TALITOS2_ISR_CH_0_DONE, 0)
+DEF_TALITOS2_DONE(ch0_2, TALITOS2_ISR_CH_0_2_DONE, 0)
+DEF_TALITOS2_DONE(ch1_3, TALITOS2_ISR_CH_1_3_DONE, 1)

/*
* locate current (offending) descriptor
@@ -3386,23 +3388,17 @@ static int talitos_probe(struct platform_device *ofdev)

if (has_ftr_sec1(priv)) {
if (priv->num_channels == 1)
- tasklet_init(&priv->done_task[0], talitos1_done_ch0,
- (unsigned long)dev);
+ tasklet_setup(&priv->done_task[0], talitos1_done_ch0);
else
- tasklet_init(&priv->done_task[0], talitos1_done_4ch,
- (unsigned long)dev);
+ tasklet_setup(&priv->done_task[0], talitos1_done_4ch);
} else {
if (priv->irq[1]) {
- tasklet_init(&priv->done_task[0], talitos2_done_ch0_2,
- (unsigned long)dev);
- tasklet_init(&priv->done_task[1], talitos2_done_ch1_3,
- (unsigned long)dev);
+ tasklet_setup(&priv->done_task[0], talitos2_done_ch0_2);
+ tasklet_setup(&priv->done_task[1], talitos2_done_ch1_3);
} else if (priv->num_channels == 1) {
- tasklet_init(&priv->done_task[0], talitos2_done_ch0,
- (unsigned long)dev);
+ tasklet_setup(&priv->done_task[0], talitos2_done_ch0);
} else {
- tasklet_init(&priv->done_task[0], talitos2_done_4ch,
- (unsigned long)dev);
+ tasklet_setup(&priv->done_task[0], talitos2_done_4ch);
}
}

--
2.25.1

2021-01-07 12:34:10

by Allen

[permalink] [raw]
Subject: [PATCH v2 19/19] crypto: octeontx: convert tasklets to use new tasklet_setup() API

From: Allen Pais <[email protected]>

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: Allen Pais <[email protected]>
---
drivers/crypto/marvell/octeontx/otx_cptvf_main.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/crypto/marvell/octeontx/otx_cptvf_main.c b/drivers/crypto/marvell/octeontx/otx_cptvf_main.c
index c076d0b3ad5f..831550123719 100644
--- a/drivers/crypto/marvell/octeontx/otx_cptvf_main.c
+++ b/drivers/crypto/marvell/octeontx/otx_cptvf_main.c
@@ -17,11 +17,12 @@
#define DRV_NAME "octeontx-cptvf"
#define DRV_VERSION "1.0"

-static void vq_work_handler(unsigned long data)
+static void vq_work_handler(struct tasklet_struct *t)
{
- struct otx_cptvf_wqe_info *cwqe_info =
- (struct otx_cptvf_wqe_info *) data;
-
+ struct otx_cptvf_wqe *cwqe = from_tasklet(cwqe, t, twork);
+ struct otx_cptvf_wqe_info *cwqe_info = container_of(cwqe,
+ typeof(*cwqe_info),
+ vq_wqe[0]);
otx_cpt_post_process(&cwqe_info->vq_wqe[0]);
}

@@ -41,8 +42,7 @@ static int init_worker_threads(struct otx_cptvf *cptvf)
}

for (i = 0; i < cptvf->num_queues; i++) {
- tasklet_init(&cwqe_info->vq_wqe[i].twork, vq_work_handler,
- (u64)cwqe_info);
+ tasklet_setup(&cwqe_info->vq_wqe[i].twork, vq_work_handler);
cwqe_info->vq_wqe[i].cptvf = cptvf;
}
cptvf->wqe_info = cwqe_info;
--
2.25.1

2021-01-07 12:34:18

by Allen

[permalink] [raw]
Subject: [PATCH v2 08/19] crypto: hifn_795x: convert tasklets to use new tasklet_setup() API

From: Allen Pais <[email protected]>

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 <[email protected]>
Signed-off-by: Allen Pais <[email protected]>
---
drivers/crypto/hifn_795x.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/crypto/hifn_795x.c b/drivers/crypto/hifn_795x.c
index 7e7a8f01ea6b..47f7bb43477e 100644
--- a/drivers/crypto/hifn_795x.c
+++ b/drivers/crypto/hifn_795x.c
@@ -2445,9 +2445,9 @@ static int hifn_register_alg(struct hifn_device *dev)
return err;
}

-static void hifn_tasklet_callback(unsigned long data)
+static void hifn_tasklet_callback(struct tasklet_struct *t)
{
- struct hifn_device *dev = (struct hifn_device *)data;
+ struct hifn_device *dev = from_tasklet(dev, t, tasklet);

/*
* This is ok to call this without lock being held,
@@ -2533,7 +2533,7 @@ static int hifn_probe(struct pci_dev *pdev, const struct pci_device_id *id)

pci_set_drvdata(pdev, dev);

- tasklet_init(&dev->tasklet, hifn_tasklet_callback, (unsigned long)dev);
+ tasklet_setup(&dev->tasklet, hifn_tasklet_callback);

crypto_init_queue(&dev->queue, 1);

--
2.25.1

2021-01-07 12:34:19

by Allen

[permalink] [raw]
Subject: [PATCH v2 10/19] crypto: ixp4xx: convert tasklets to use new tasklet_setup() API

From: Allen Pais <[email protected]>

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 <[email protected]>
Signed-off-by: Allen Pais <[email protected]>
---
drivers/crypto/ixp4xx_crypto.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/crypto/ixp4xx_crypto.c b/drivers/crypto/ixp4xx_crypto.c
index 8b0f17fc09fb..b783ab58d718 100644
--- a/drivers/crypto/ixp4xx_crypto.c
+++ b/drivers/crypto/ixp4xx_crypto.c
@@ -414,7 +414,7 @@ static void irqhandler(void *_unused)
tasklet_schedule(&crypto_done_tasklet);
}

-static void crypto_done_action(unsigned long arg)
+static void crypto_done_action(struct tasklet_struct *unused)
{
int i;

@@ -497,7 +497,7 @@ static int init_ixp_crypto(struct device *dev)
goto err;
}
qmgr_set_irq(RECV_QID, QUEUE_IRQ_SRC_NOT_EMPTY, irqhandler, NULL);
- tasklet_init(&crypto_done_tasklet, crypto_done_action, 0);
+ tasklet_setup(&crypto_done_tasklet, crypto_done_action);

qmgr_enable_irq(RECV_QID);
return 0;
--
2.25.1

2021-01-07 12:34:19

by Allen

[permalink] [raw]
Subject: [PATCH v2 09/19] crypto: img-hash: convert tasklets to use new tasklet_setup() API

From: Allen Pais <[email protected]>

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 <[email protected]>
Signed-off-by: Allen Pais <[email protected]>
---
drivers/crypto/img-hash.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/crypto/img-hash.c b/drivers/crypto/img-hash.c
index e813115d5432..72b65cdff856 100644
--- a/drivers/crypto/img-hash.c
+++ b/drivers/crypto/img-hash.c
@@ -355,9 +355,9 @@ static int img_hash_dma_init(struct img_hash_dev *hdev)
return 0;
}

-static void img_hash_dma_task(unsigned long d)
+static void img_hash_dma_task(struct tasklet_struct *t)
{
- struct img_hash_dev *hdev = (struct img_hash_dev *)d;
+ struct img_hash_dev *hdev = from_tasklet(hdev, t, dma_task);
struct img_hash_request_ctx *ctx = ahash_request_ctx(hdev->req);
u8 *addr;
size_t nbytes, bleft, wsend, len, tbc;
@@ -887,9 +887,9 @@ static int img_unregister_algs(struct img_hash_dev *hdev)
return 0;
}

-static void img_hash_done_task(unsigned long data)
+static void img_hash_done_task(struct tasklet_struct *t)
{
- struct img_hash_dev *hdev = (struct img_hash_dev *)data;
+ struct img_hash_dev *hdev = from_tasklet(hdev, t, done_task);
int err = 0;

if (hdev->err == -EINVAL) {
@@ -954,8 +954,8 @@ static int img_hash_probe(struct platform_device *pdev)

INIT_LIST_HEAD(&hdev->list);

- tasklet_init(&hdev->done_task, img_hash_done_task, (unsigned long)hdev);
- tasklet_init(&hdev->dma_task, img_hash_dma_task, (unsigned long)hdev);
+ tasklet_setup(&hdev->done_task, img_hash_done_task);
+ tasklet_setup(&hdev->dma_task, img_hash_dma_task);

crypto_init_queue(&hdev->queue, IMG_HASH_QUEUE_LENGTH);

--
2.25.1

2021-01-07 12:34:22

by Allen

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

From: Allen Pais <[email protected]>

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 <[email protected]>
Signed-off-by: Allen Pais <[email protected]>
---
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 7323066724c3..fa49bb5b043b 100644
--- a/drivers/crypto/mediatek/mtk-aes.c
+++ b/drivers/crypto/mediatek/mtk-aes.c
@@ -1080,16 +1080,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);
@@ -1142,10 +1142,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 f55aacdafbef..c241762aa23b 100644
--- a/drivers/crypto/mediatek/mtk-sha.c
+++ b/drivers/crypto/mediatek/mtk-sha.c
@@ -1164,16 +1164,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);
@@ -1219,10 +1219,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.25.1

2021-01-07 12:34:24

by Allen

[permalink] [raw]
Subject: [PATCH v2 12/19] crypto: omap: convert tasklets to use new tasklet_setup() API

From: Allen Pais <[email protected]>

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 <[email protected]>
Signed-off-by: Allen Pais <[email protected]>
---
drivers/crypto/omap-aes.c | 6 +++---
drivers/crypto/omap-des.c | 6 +++---
drivers/crypto/omap-sham.c | 6 +++---
3 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/crypto/omap-aes.c b/drivers/crypto/omap-aes.c
index a45bdcf3026d..7e4223716620 100644
--- a/drivers/crypto/omap-aes.c
+++ b/drivers/crypto/omap-aes.c
@@ -503,9 +503,9 @@ static void omap_aes_copy_ivout(struct omap_aes_dev *dd, u8 *ivbuf)
((u32 *)ivbuf)[i] = omap_aes_read(dd, AES_REG_IV(dd, i));
}

-static void omap_aes_done_task(unsigned long data)
+static void omap_aes_done_task(struct tasklet_struct *t)
{
- struct omap_aes_dev *dd = (struct omap_aes_dev *)data;
+ struct omap_aes_dev *dd = from_tasklet(dd, t, done_task);

pr_debug("enter done_task\n");

@@ -1151,7 +1151,7 @@ static int omap_aes_probe(struct platform_device *pdev)
(reg & dd->pdata->major_mask) >> dd->pdata->major_shift,
(reg & dd->pdata->minor_mask) >> dd->pdata->minor_shift);

- tasklet_init(&dd->done_task, omap_aes_done_task, (unsigned long)dd);
+ tasklet_setup(&dd->done_task, omap_aes_done_task);

err = omap_aes_dma_init(dd);
if (err == -EPROBE_DEFER) {
diff --git a/drivers/crypto/omap-des.c b/drivers/crypto/omap-des.c
index c9d38bcfd1c7..fddcfc3ba57b 100644
--- a/drivers/crypto/omap-des.c
+++ b/drivers/crypto/omap-des.c
@@ -594,9 +594,9 @@ static int omap_des_crypt_req(struct crypto_engine *engine,
return omap_des_crypt_dma_start(dd);
}

-static void omap_des_done_task(unsigned long data)
+static void omap_des_done_task(struct tasklet_struct *t)
{
- struct omap_des_dev *dd = (struct omap_des_dev *)data;
+ struct omap_des_dev *dd = from_tasklet(dd, t, done_task);
int i;

pr_debug("enter done_task\n");
@@ -1011,7 +1011,7 @@ static int omap_des_probe(struct platform_device *pdev)
(reg & dd->pdata->major_mask) >> dd->pdata->major_shift,
(reg & dd->pdata->minor_mask) >> dd->pdata->minor_shift);

- tasklet_init(&dd->done_task, omap_des_done_task, (unsigned long)dd);
+ tasklet_setup(&dd->done_task, omap_des_done_task);

err = omap_des_dma_init(dd);
if (err == -EPROBE_DEFER) {
diff --git a/drivers/crypto/omap-sham.c b/drivers/crypto/omap-sham.c
index ae0d320d3c60..5dc7e23879a5 100644
--- a/drivers/crypto/omap-sham.c
+++ b/drivers/crypto/omap-sham.c
@@ -1725,9 +1725,9 @@ static struct ahash_alg algs_sha384_sha512[] = {
},
};

-static void omap_sham_done_task(unsigned long data)
+static void omap_sham_done_task(struct tasklet_struct *t)
{
- struct omap_sham_dev *dd = (struct omap_sham_dev *)data;
+ struct omap_sham_dev *dd = from_tasklet(dd, t, done_task);
int err = 0;

dev_dbg(dd->dev, "%s: flags=%lx\n", __func__, dd->flags);
@@ -2084,7 +2084,7 @@ static int omap_sham_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, dd);

INIT_LIST_HEAD(&dd->list);
- tasklet_init(&dd->done_task, omap_sham_done_task, (unsigned long)dd);
+ tasklet_setup(&dd->done_task, omap_sham_done_task);
crypto_init_queue(&dd->queue, OMAP_SHAM_QUEUE_LENGTH);

err = (dev->of_node) ? omap_sham_get_res_of(dd, dev, &res) :
--
2.25.1

2021-01-07 12:34:24

by Allen

[permalink] [raw]
Subject: [PATCH v2 13/19] crypto: picoxcell: convert tasklets to use new tasklet_setup() API

From: Allen Pais <[email protected]>

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 <[email protected]>
Signed-off-by: Allen Pais <[email protected]>
---
drivers/crypto/picoxcell_crypto.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/crypto/picoxcell_crypto.c b/drivers/crypto/picoxcell_crypto.c
index 84f9c16d984c..e64fa3e22521 100644
--- a/drivers/crypto/picoxcell_crypto.c
+++ b/drivers/crypto/picoxcell_crypto.c
@@ -1137,9 +1137,9 @@ static int spacc_req_submit(struct spacc_req *req)
return spacc_ablk_submit(req);
}

-static void spacc_spacc_complete(unsigned long data)
+static void spacc_spacc_complete(struct tasklet_struct *t)
{
- struct spacc_engine *engine = (struct spacc_engine *)data;
+ struct spacc_engine *engine = from_tasklet(engine, t, complete);
struct spacc_req *req, *tmp;
unsigned long flags;
LIST_HEAD(completed);
@@ -1649,8 +1649,7 @@ static int spacc_probe(struct platform_device *pdev)
return -ENXIO;
}

- tasklet_init(&engine->complete, spacc_spacc_complete,
- (unsigned long)engine);
+ tasklet_setup(&engine->complete, spacc_spacc_complete);

ret = devm_add_action(&pdev->dev, spacc_tasklet_kill,
&engine->complete);
--
2.25.1

2021-01-07 12:34:24

by Allen

[permalink] [raw]
Subject: [PATCH v2 15/19] crypto: qce: convert tasklets to use new tasklet_setup() API

From: Allen Pais <[email protected]>

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 <[email protected]>
Signed-off-by: Allen Pais <[email protected]>
---
drivers/crypto/qce/core.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/crypto/qce/core.c b/drivers/crypto/qce/core.c
index 80b75085c265..374281e9d6b9 100644
--- a/drivers/crypto/qce/core.c
+++ b/drivers/crypto/qce/core.c
@@ -116,9 +116,9 @@ static int qce_handle_queue(struct qce_device *qce,
return ret;
}

-static void qce_tasklet_req_done(unsigned long data)
+static void qce_tasklet_req_done(struct tasklet_struct *t)
{
- struct qce_device *qce = (struct qce_device *)data;
+ struct qce_device *qce = from_tasklet(qce, t, done_tasklet);
struct crypto_async_request *req;
unsigned long flags;

@@ -235,8 +235,7 @@ static int qce_crypto_probe(struct platform_device *pdev)
goto err_clks;

spin_lock_init(&qce->lock);
- tasklet_init(&qce->done_tasklet, qce_tasklet_req_done,
- (unsigned long)qce);
+ tasklet_setup(&qce->done_tasklet, qce_tasklet_req_done);
crypto_init_queue(&qce->queue, QCE_QUEUE_LENGTH);

qce->async_req_enqueue = qce_async_request_enqueue;
--
2.25.1

2021-01-07 12:34:25

by Allen

[permalink] [raw]
Subject: [PATCH v2 14/19] crypto: qat: convert tasklets to use new tasklet_setup() API

From: Allen Pais <[email protected]>

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 <[email protected]>
Signed-off-by: Allen Pais <[email protected]>
---
drivers/crypto/qat/qat_common/adf_isr.c | 5 ++---
drivers/crypto/qat/qat_common/adf_sriov.c | 10 +++++-----
drivers/crypto/qat/qat_common/adf_transport.c | 4 ++--
.../crypto/qat/qat_common/adf_transport_internal.h | 2 +-
drivers/crypto/qat/qat_common/adf_vf_isr.c | 11 +++++------
5 files changed, 15 insertions(+), 17 deletions(-)

diff --git a/drivers/crypto/qat/qat_common/adf_isr.c b/drivers/crypto/qat/qat_common/adf_isr.c
index c45853463530..bb5251d587eb 100644
--- a/drivers/crypto/qat/qat_common/adf_isr.c
+++ b/drivers/crypto/qat/qat_common/adf_isr.c
@@ -244,9 +244,8 @@ static int adf_setup_bh(struct adf_accel_dev *accel_dev)
int i;

for (i = 0; i < hw_data->num_banks; i++)
- tasklet_init(&priv_data->banks[i].resp_handler,
- adf_response_handler,
- (unsigned long)&priv_data->banks[i]);
+ tasklet_setup(&priv_data->banks[i].resp_handler,
+ adf_response_handler);
return 0;
}

diff --git a/drivers/crypto/qat/qat_common/adf_sriov.c b/drivers/crypto/qat/qat_common/adf_sriov.c
index 8c822c2861c2..591537399edb 100644
--- a/drivers/crypto/qat/qat_common/adf_sriov.c
+++ b/drivers/crypto/qat/qat_common/adf_sriov.c
@@ -24,9 +24,10 @@ static void adf_iov_send_resp(struct work_struct *work)
kfree(pf2vf_resp);
}

-static void adf_vf2pf_bh_handler(void *data)
+static void adf_vf2pf_bh_handler(struct tasklet_struct *t)
{
- struct adf_accel_vf_info *vf_info = (struct adf_accel_vf_info *)data;
+ struct adf_accel_vf_info *vf_info =
+ from_tasklet(vf_info, t, vf2pf_bh_tasklet);
struct adf_pf2vf_resp *pf2vf_resp;

pf2vf_resp = kzalloc(sizeof(*pf2vf_resp), GFP_ATOMIC);
@@ -52,9 +53,8 @@ static int adf_enable_sriov(struct adf_accel_dev *accel_dev)
vf_info->accel_dev = accel_dev;
vf_info->vf_nr = i;

- tasklet_init(&vf_info->vf2pf_bh_tasklet,
- (void *)adf_vf2pf_bh_handler,
- (unsigned long)vf_info);
+ tasklet_setup(&vf_info->vf2pf_bh_tasklet,
+ adf_vf2pf_bh_handler);
mutex_init(&vf_info->pf2vf_lock);
ratelimit_state_init(&vf_info->vf2pf_ratelimit,
DEFAULT_RATELIMIT_INTERVAL,
diff --git a/drivers/crypto/qat/qat_common/adf_transport.c b/drivers/crypto/qat/qat_common/adf_transport.c
index 5a7030acdc33..03dcbeac25d7 100644
--- a/drivers/crypto/qat/qat_common/adf_transport.c
+++ b/drivers/crypto/qat/qat_common/adf_transport.c
@@ -324,9 +324,9 @@ static void adf_ring_response_handler(struct adf_etr_bank_data *bank)
adf_handle_response(&bank->rings[i]);
}

-void adf_response_handler(uintptr_t bank_addr)
+void adf_response_handler(struct tasklet_struct *t)
{
- struct adf_etr_bank_data *bank = (void *)bank_addr;
+ struct adf_etr_bank_data *bank = from_tasklet(bank, t, resp_handler);
struct adf_hw_csr_ops *csr_ops = GET_CSR_OPS(bank->accel_dev);

/* Handle all the responses and reenable IRQs */
diff --git a/drivers/crypto/qat/qat_common/adf_transport_internal.h b/drivers/crypto/qat/qat_common/adf_transport_internal.h
index 501bcf0f1809..aaec7b2bc220 100644
--- a/drivers/crypto/qat/qat_common/adf_transport_internal.h
+++ b/drivers/crypto/qat/qat_common/adf_transport_internal.h
@@ -46,7 +46,7 @@ struct adf_etr_data {
struct dentry *debug;
};

-void adf_response_handler(uintptr_t bank_addr);
+void adf_response_handler(struct tasklet_struct *t);
#ifdef CONFIG_DEBUG_FS
#include <linux/debugfs.h>
int adf_bank_debugfs_add(struct adf_etr_bank_data *bank);
diff --git a/drivers/crypto/qat/qat_common/adf_vf_isr.c b/drivers/crypto/qat/qat_common/adf_vf_isr.c
index 38d316a42ba6..1d0ff58fd9b5 100644
--- a/drivers/crypto/qat/qat_common/adf_vf_isr.c
+++ b/drivers/crypto/qat/qat_common/adf_vf_isr.c
@@ -68,9 +68,10 @@ static void adf_dev_stop_async(struct work_struct *work)
kfree(stop_data);
}

-static void adf_pf2vf_bh_handler(void *data)
+static void adf_pf2vf_bh_handler(struct tasklet_struct *t)
{
- struct adf_accel_dev *accel_dev = data;
+ struct adf_accel_dev *accel_dev = from_tasklet(accel_dev, t,
+ vf.pf2vf_bh_tasklet);
struct adf_hw_device_data *hw_data = accel_dev->hw_device;
struct adf_bar *pmisc =
&GET_BARS(accel_dev)[hw_data->get_misc_bar_id(hw_data)];
@@ -138,8 +139,7 @@ static void adf_pf2vf_bh_handler(void *data)

static int adf_setup_pf2vf_bh(struct adf_accel_dev *accel_dev)
{
- tasklet_init(&accel_dev->vf.pf2vf_bh_tasklet,
- (void *)adf_pf2vf_bh_handler, (unsigned long)accel_dev);
+ tasklet_setup(&accel_dev->vf.pf2vf_bh_tasklet, adf_pf2vf_bh_handler);

mutex_init(&accel_dev->vf.vf2pf_lock);
return 0;
@@ -216,8 +216,7 @@ static int adf_setup_bh(struct adf_accel_dev *accel_dev)
{
struct adf_etr_data *priv_data = accel_dev->transport;

- tasklet_init(&priv_data->banks[0].resp_handler, adf_response_handler,
- (unsigned long)priv_data->banks);
+ tasklet_setup(&priv_data->banks[0].resp_handler, adf_response_handler);
return 0;
}

--
2.25.1

2021-01-07 12:34:33

by Allen

[permalink] [raw]
Subject: [PATCH v2 16/19] crypto: rockchip: convert tasklets to use new tasklet_setup() API

From: Allen Pais <[email protected]>

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 <[email protected]>
Signed-off-by: Allen Pais <[email protected]>
---
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);
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

2021-01-07 12:44:08

by Emil Renner Berthing

[permalink] [raw]
Subject: Re: [PATCH v2 16/19] crypto: rockchip: convert tasklets to use new tasklet_setup() API

Hi Allen,

On Thu, 7 Jan 2021 at 13:32, Allen Pais <[email protected]> wrote:
>
> From: Allen Pais <[email protected]>
>
> 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 <[email protected]>
> Signed-off-by: Allen Pais <[email protected]>
> ---
> 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
> [email protected]
> http://lists.infradead.org/mailman/listinfo/linux-rockchip

2021-01-07 12:47:48

by Allen Pais

[permalink] [raw]
Subject: Re: [PATCH v2 16/19] crypto: rockchip: convert tasklets to use new tasklet_setup() API



>
> On Thu, 7 Jan 2021 at 13:32, Allen Pais <[email protected]> wrote:
>>
>> From: Allen Pais <[email protected]>
>>
>> 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 <[email protected]>
>> Signed-off-by: Allen Pais <[email protected]>
>> ---
>> 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..
>

Thanks for catching it. I am not sure how I missed it and it even
compiled. I will fix it.

Thanks.

>> 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
>> [email protected]
>> http://lists.infradead.org/mailman/listinfo/linux-rockchip