diff mbox series

[v4,01/19] crypto: amcc: convert tasklets to use new tasklet_setup() API

Message ID 20210121044126.152274-2-allen.lkml@gmail.com (mailing list archive)
State Not Applicable
Headers show
Series crypto: convert tasklets to use new tasklet_setup API() | expand

Commit Message

Allen Jan. 21, 2021, 4:41 a.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.

Signed-off-by: Romain Perier <romain.perier@gmail.com>
Signed-off-by: Allen Pais <apais@linux.microsoft.com>
---
 drivers/crypto/amcc/crypto4xx_core.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

Comments

Herbert Xu Jan. 29, 2021, 5:05 a.m. UTC | #1
On Thu, Jan 21, 2021 at 10:11:08AM +0530, Allen Pais 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/amcc/crypto4xx_core.c | 7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)

This doesn't even compile:

  CC [M]  drivers/crypto/amcc/crypto4xx_core.o
  CC [M]  drivers/crypto/amcc/crypto4xx_alg.o
  CC [M]  drivers/crypto/amcc/crypto4xx_trng.o
  CHECK   ../drivers/crypto/amcc/crypto4xx_trng.c
../drivers/crypto/amcc/crypto4xx_core.c: In function ‘crypto4xx_cipher_done’:
../drivers/crypto/amcc/crypto4xx_core.c:526:13: warning: variable ‘addr’ set but not used [-Wunused-but-set-variable]
  dma_addr_t addr;
             ^~~~
../drivers/crypto/amcc/crypto4xx_core.c: In function ‘crypto4xx_ahash_done’:
../drivers/crypto/amcc/crypto4xx_core.c:557:24: warning: variable ‘ctx’ set but not used [-Wunused-but-set-variable]
  struct crypto4xx_ctx *ctx;
                        ^~~
In file included from <command-line>:
../drivers/crypto/amcc/crypto4xx_core.c: In function ‘crypto4xx_bh_tasklet_cb’:
../include/linux/kernel.h:694:51: error: ‘struct device’ has no member named ‘tasklet’
  BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \
                                                   ^~
./../include/linux/compiler_types.h:306:9: note: in definition of macro ‘__compiletime_assert’
   if (!(condition))     \
         ^~~~~~~~~
./../include/linux/compiler_types.h:326:2: note: in expansion of macro ‘_compiletime_assert’
  _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
  ^~~~~~~~~~~~~~~~~~~
../include/linux/build_bug.h:39:37: note: in expansion of macro ‘compiletime_assert’
 #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
                                     ^~~~~~~~~~~~~~~~~~
../include/linux/kernel.h:694:2: note: in expansion of macro ‘BUILD_BUG_ON_MSG’
  BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \
  ^~~~~~~~~~~~~~~~
../include/linux/kernel.h:694:20: note: in expansion of macro ‘__same_type’
  BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \
                    ^~~~~~~~~~~
../include/linux/interrupt.h:646:2: note: in expansion of macro ‘container_of’
  container_of(callback_tasklet, typeof(*var), tasklet_fieldname)
  ^~~~~~~~~~~~
../drivers/crypto/amcc/crypto4xx_core.c:1078:23: note: in expansion of macro ‘from_tasklet’
  struct device *dev = from_tasklet(dev, t, tasklet);
                       ^~~~~~~~~~~~
./../include/linux/compiler_types.h:146:35: error: ‘struct device’ has no member named ‘tasklet’
 #define __compiler_offsetof(a, b) __builtin_offsetof(a, b)
                                   ^~~~~~~~~~~~~~~~~~
../include/linux/stddef.h:17:32: note: in expansion of macro ‘__compiler_offsetof’
 #define offsetof(TYPE, MEMBER) __compiler_offsetof(TYPE, MEMBER)
                                ^~~~~~~~~~~~~~~~~~~
../include/linux/kernel.h:697:21: note: in expansion of macro ‘offsetof’
  ((type *)(__mptr - offsetof(type, member))); })
                     ^~~~~~~~
../include/linux/interrupt.h:646:2: note: in expansion of macro ‘container_of’
  container_of(callback_tasklet, typeof(*var), tasklet_fieldname)
  ^~~~~~~~~~~~
../drivers/crypto/amcc/crypto4xx_core.c:1078:23: note: in expansion of macro ‘from_tasklet’
  struct device *dev = from_tasklet(dev, t, tasklet);
                       ^~~~~~~~~~~~

Thanks,
diff mbox series

Patch

diff --git a/drivers/crypto/amcc/crypto4xx_core.c b/drivers/crypto/amcc/crypto4xx_core.c
index 8d1b918a0533..0e13430a5b9b 100644
--- a/drivers/crypto/amcc/crypto4xx_core.c
+++ b/drivers/crypto/amcc/crypto4xx_core.c
@@ -1072,9 +1072,9 @@  static void crypto4xx_unregister_alg(struct crypto4xx_device *sec_dev)
 	}
 }
 
-static void crypto4xx_bh_tasklet_cb(unsigned long data)
+static void crypto4xx_bh_tasklet_cb(struct tasklet_struct *t)
 {
-	struct device *dev = (struct device *)data;
+	struct device *dev = from_tasklet(dev, t, tasklet);
 	struct crypto4xx_core_device *core_dev = dev_get_drvdata(dev);
 	struct pd_uinfo *pd_uinfo;
 	struct ce_pd *pd;
@@ -1452,8 +1452,7 @@  static int crypto4xx_probe(struct platform_device *ofdev)
 		goto err_build_sdr;
 
 	/* Init tasklet for bottom half processing */
-	tasklet_init(&core_dev->tasklet, crypto4xx_bh_tasklet_cb,
-		     (unsigned long) dev);
+	tasklet_setup(&core_dev->tasklet, crypto4xx_bh_tasklet_cb);
 
 	core_dev->dev->ce_base = of_iomap(ofdev->dev.of_node, 0);
 	if (!core_dev->dev->ce_base) {