[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200817080941.19227-19-allen.lkml@gmail.com>
Date: Mon, 17 Aug 2020 13:39:40 +0530
From: Allen Pais <allen.lkml@...il.com>
To: nicolas.ferre@...rochip.com, alexandre.belloni@...tlin.com,
ludovic.desroches@...rochip.com, heiko@...ech.de,
matthias.bgg@...il.com
Cc: keescook@...omium.org, linux-kernel@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org,
linux-rockchip@...ts.infradead.org,
inux-mediatek@...ts.infradead.org,
Allen Pais <allen.lkml@...il.com>,
Romain Perier <romain.perier@...il.com>
Subject: [PATCH 18/19] crypto: talitos: convert tasklets to use new tasklet_setup() API
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@...il.com>
Signed-off-by: Allen Pais <allen.lkml@...il.com>
---
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 7c547352a862..6d729af1f8e4 100644
--- a/drivers/crypto/talitos.c
+++ b/drivers/crypto/talitos.c
@@ -402,10 +402,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) \
@@ -428,11 +429,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) \
@@ -452,10 +454,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
@@ -3385,23 +3387,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.17.1
Powered by blists - more mailing lists