Re: [PATCH v2 1/2] optee: fix tee out of memory failure seen during kexec reboot

2021-03-22 Thread Allen Pais





[0.368428] tee_bnxt_fw optee-clnt0: tee_shm_alloc failed
[0.368461] tee_bnxt_fw: probe of optee-clnt0 failed with error -22

tee_shm_release() is not invoked on dma shm buffer.

Implement .shutdown() method to handle the release of the buffers
correctly.

More info:
https://github.com/OP-TEE/optee_os/issues/3637

Signed-off-by: Allen Pais 
---
   drivers/tee/optee/core.c | 20 
   1 file changed, 20 insertions(+)


This looks good to me. Do you have a practical way of testing this on
QEMU for instance?



Jens,

I could not reproduce nor create a setup using QEMU, I could only
do it on a real h/w.

I have extensively tested the fix and I don't see any issues.


I did a few test runs too, seems OK.


Thank you very much.


Re: [PATCH v2 1/2] optee: fix tee out of memory failure seen during kexec reboot

2021-03-16 Thread Allen Pais






[0.368428] tee_bnxt_fw optee-clnt0: tee_shm_alloc failed
[0.368461] tee_bnxt_fw: probe of optee-clnt0 failed with error -22

tee_shm_release() is not invoked on dma shm buffer.

Implement .shutdown() method to handle the release of the buffers
correctly.

More info:
https://github.com/OP-TEE/optee_os/issues/3637

Signed-off-by: Allen Pais 
---
  drivers/tee/optee/core.c | 20 
  1 file changed, 20 insertions(+)


This looks good to me. Do you have a practical way of testing this on
QEMU for instance?



Jens,

  I could not reproduce nor create a setup using QEMU, I could only
do it on a real h/w.

  I have extensively tested the fix and I don't see any issues.

Thanks.


Re: [PATCH v2 1/2] optee: fix tee out of memory failure seen during kexec reboot

2021-03-02 Thread Allen Pais


From: Allen Pais 

The following out of memory errors are seen on kexec reboot
from the optee core.

[0.368428] tee_bnxt_fw optee-clnt0: tee_shm_alloc failed
[0.368461] tee_bnxt_fw: probe of optee-clnt0 failed with error -22

tee_shm_release() is not invoked on dma shm buffer.

Implement .shutdown() method to handle the release of the buffers
correctly.

More info:
https://github.com/OP-TEE/optee_os/issues/3637

Signed-off-by: Allen Pais 
---
  drivers/tee/optee/core.c | 20 
  1 file changed, 20 insertions(+)


This looks good to me. Do you have a practical way of testing this on
QEMU for instance?


  I have not tried this on QEMU. I will give it a go today.

Thanks.



Thanks,
Jens



diff --git a/drivers/tee/optee/core.c b/drivers/tee/optee/core.c
index cf4718c6d35d..80e2774b5e2a 100644
--- a/drivers/tee/optee/core.c
+++ b/drivers/tee/optee/core.c
@@ -582,6 +582,13 @@ static optee_invoke_fn *get_invoke_func(struct device *dev)
 return ERR_PTR(-EINVAL);
  }

+/* optee_remove - Device Removal Routine
+ * @pdev: platform device information struct
+ *
+ * optee_remove is called by platform subsystem to alter the driver
+ * that it should release the device
+ */
+
  static int optee_remove(struct platform_device *pdev)
  {
 struct optee *optee = platform_get_drvdata(pdev);
@@ -612,6 +619,18 @@ static int optee_remove(struct platform_device *pdev)
 return 0;
  }

+/* optee_shutdown - Device Removal Routine
+ * @pdev: platform device information struct
+ *
+ * platform_shutdown is called by the platform subsystem to alter
+ * the driver that a shutdown/reboot(or kexec) is happening and
+ * device must be disabled.
+ */
+static void optee_shutdown(struct platform_device *pdev)
+{
+   optee_disable_shm_cache(platform_get_drvdata(pdev));
+}
+
  static int optee_probe(struct platform_device *pdev)
  {
 optee_invoke_fn *invoke_fn;
@@ -738,6 +757,7 @@ MODULE_DEVICE_TABLE(of, optee_dt_match);
  static struct platform_driver optee_driver = {
 .probe  = optee_probe,
 .remove = optee_remove,
+   .shutdown = optee_shutdown,
 .driver = {
 .name = "optee",
 .of_match_table = optee_dt_match,
--
2.25.1



[PATCH v2 2/2] firmware: tee_bnxt: implement shutdown method to handle kexec reboots

2021-02-25 Thread Allen Pais
From: Allen Pais 

 On kexec reboot the firmware driver fails to deallocate
shm memory leading to a memory leak. Implement .shutdown()
method to handle kexec reboots and to release shm buffers
correctly.

Signed-off-by: Allen Pais 
---
 drivers/firmware/broadcom/tee_bnxt_fw.c | 9 +
 1 file changed, 9 insertions(+)

diff --git a/drivers/firmware/broadcom/tee_bnxt_fw.c 
b/drivers/firmware/broadcom/tee_bnxt_fw.c
index ed10da5313e8..4c62e044a99f 100644
--- a/drivers/firmware/broadcom/tee_bnxt_fw.c
+++ b/drivers/firmware/broadcom/tee_bnxt_fw.c
@@ -242,6 +242,14 @@ static int tee_bnxt_fw_remove(struct device *dev)
return 0;
 }
 
+static void tee_bnxt_fw_shutdown(struct device *dev)
+{
+   tee_shm_free(pvt_data.fw_shm_pool);
+   tee_client_close_session(pvt_data.ctx, pvt_data.session_id);
+   tee_client_close_context(pvt_data.ctx);
+   pvt_data.ctx = NULL;
+}
+
 static const struct tee_client_device_id tee_bnxt_fw_id_table[] = {
{UUID_INIT(0x6272636D, 0x2019, 0x0716,
0x42, 0x43, 0x4D, 0x5F, 0x53, 0x43, 0x48, 0x49)},
@@ -257,6 +265,7 @@ static struct tee_client_driver tee_bnxt_fw_driver = {
.bus= _bus_type,
.probe  = tee_bnxt_fw_probe,
.remove = tee_bnxt_fw_remove,
+   .shutdown   = tee_bnxt_fw_shutdown,
},
 };
 
-- 
2.25.1



[PATCH v2 0/2] optee: fix OOM seen due to tee_shm_free()

2021-02-25 Thread Allen Pais
From: Allen Pais 

The following out of memory errors are seen on kexec reboot
from the optee core.

[0.368428] tee_bnxt_fw optee-clnt0: tee_shm_alloc failed
[0.368461] tee_bnxt_fw: probe of optee-clnt0 failed with error -22

tee_shm_release() is not invoked on dma shm buffer.

Implement .shutdown() in optee core as well as bnxt firmware driver
to handle the release of the buffers correctly.

More info:
https://github.com/OP-TEE/optee_os/issues/3637

v2:
  keep the .shutdown() method simple. [Jens Wiklander]

Allen Pais (2):
  optee: fix tee out of memory failure seen during kexec reboot
  firmware: tee_bnxt: implement shutdown method to handle kexec reboots

 drivers/firmware/broadcom/tee_bnxt_fw.c |  9 +
 drivers/tee/optee/core.c| 20 
 2 files changed, 29 insertions(+)

-- 
2.25.1



[PATCH v2 1/2] optee: fix tee out of memory failure seen during kexec reboot

2021-02-25 Thread Allen Pais
From: Allen Pais 

The following out of memory errors are seen on kexec reboot
from the optee core.

[0.368428] tee_bnxt_fw optee-clnt0: tee_shm_alloc failed
[0.368461] tee_bnxt_fw: probe of optee-clnt0 failed with error -22

tee_shm_release() is not invoked on dma shm buffer.

Implement .shutdown() method to handle the release of the buffers
correctly.

More info:
https://github.com/OP-TEE/optee_os/issues/3637

Signed-off-by: Allen Pais 
---
 drivers/tee/optee/core.c | 20 
 1 file changed, 20 insertions(+)

diff --git a/drivers/tee/optee/core.c b/drivers/tee/optee/core.c
index cf4718c6d35d..80e2774b5e2a 100644
--- a/drivers/tee/optee/core.c
+++ b/drivers/tee/optee/core.c
@@ -582,6 +582,13 @@ static optee_invoke_fn *get_invoke_func(struct device *dev)
return ERR_PTR(-EINVAL);
 }
 
+/* optee_remove - Device Removal Routine
+ * @pdev: platform device information struct
+ *
+ * optee_remove is called by platform subsystem to alter the driver
+ * that it should release the device
+ */
+
 static int optee_remove(struct platform_device *pdev)
 {
struct optee *optee = platform_get_drvdata(pdev);
@@ -612,6 +619,18 @@ static int optee_remove(struct platform_device *pdev)
return 0;
 }
 
+/* optee_shutdown - Device Removal Routine
+ * @pdev: platform device information struct
+ *
+ * platform_shutdown is called by the platform subsystem to alter
+ * the driver that a shutdown/reboot(or kexec) is happening and
+ * device must be disabled.
+ */
+static void optee_shutdown(struct platform_device *pdev)
+{
+   optee_disable_shm_cache(platform_get_drvdata(pdev));
+}
+
 static int optee_probe(struct platform_device *pdev)
 {
optee_invoke_fn *invoke_fn;
@@ -738,6 +757,7 @@ MODULE_DEVICE_TABLE(of, optee_dt_match);
 static struct platform_driver optee_driver = {
.probe  = optee_probe,
.remove = optee_remove,
+   .shutdown = optee_shutdown,
.driver = {
.name = "optee",
.of_match_table = optee_dt_match,
-- 
2.25.1



Re: [PATCH 1/2] optee: fix tee out of memory failure seen during kexec reboot

2021-02-24 Thread Allen Pais




-   /*
-* Ask OP-TEE to free all cached shared memory objects to decrease
-* reference counters and also avoid wild pointers in secure world
-* into the old shared memory range.
-*/
-   optee_disable_shm_cache(optee);
+   if (shutdown) {
+   optee_disable_shm_cache(optee);
+   } else {
+   /*
+* Ask OP-TEE to free all cached shared memory
+* objects to decrease reference counters and
+* also avoid wild pointers in secure world
+* into the old shared memory range.
+*/
+   optee_disable_shm_cache(optee);

Calling optee_disable_shm_cache() in both if and else. It could be
put in front of if().



Ideally, I could just use optee_remove for shutdown() too.
But it would not look good. Hence this approach.


What is the problem with using optee_remove() for shutdown()?



  There is no problem, I just thought it would be more cleaner/readable
with this approach. If you'd like to keep it simple by just calling
optee_remove() for shutdown() too, I could quickly send out V2.


In the patch you posted it looks like you'd like to call
only optee_disable_shm_cache() in the case of shutdown. Like:

static void optee_shutdown(struct platform_device *pdev)
{
 optee_disable_shm_cache(platform_get_drvdata(pdev));
}

and optee_remove() kept as it was before this patch.



 Sure, Will have it fixed and send out V2.

Thanks.


Re: [PATCH 1/2] optee: fix tee out of memory failure seen during kexec reboot

2021-02-23 Thread Allen Pais





-   /*
-* Ask OP-TEE to free all cached shared memory objects to decrease
-* reference counters and also avoid wild pointers in secure world
-* into the old shared memory range.
-*/
-   optee_disable_shm_cache(optee);
+   if (shutdown) {
+   optee_disable_shm_cache(optee);
+   } else {
+   /*
+* Ask OP-TEE to free all cached shared memory
+* objects to decrease reference counters and
+* also avoid wild pointers in secure world
+* into the old shared memory range.
+*/
+   optee_disable_shm_cache(optee);

Calling optee_disable_shm_cache() in both if and else. It could be
put in front of if().



   Ideally, I could just use optee_remove for shutdown() too.
But it would not look good. Hence this approach.


What is the problem with using optee_remove() for shutdown()?



 There is no problem, I just thought it would be more cleaner/readable
with this approach. If you'd like to keep it simple by just calling
optee_remove() for shutdown() too, I could quickly send out V2.

Thanks for the review.

- Allen


Re: [PATCH 0/2] optee: fix OOM seen due to tee_shm_free()

2021-02-22 Thread Allen Pais





The following out of memory errors are seen on kexec reboot
from the optee core.
 
[0.368428] tee_bnxt_fw optee-clnt0: tee_shm_alloc failed

[0.368461] tee_bnxt_fw: probe of optee-clnt0 failed with error -22
 
tee_shm_release() is not invoked on dma shm buffer.
 
Implement .shutdown() in optee core as well as bnxt firmware driver

to handle the release of the buffers correctly.
 
More info:

https://github.com/OP-TEE/optee_os/issues/3637


Jens,

  Could you please take sometime out and review the series.

Thanks.



Allen Pais (2):
   optee: fix tee out of memory failure seen during kexec reboot
   firmware: tee_bnxt: implement shutdown method to handle kexec reboots

  drivers/firmware/broadcom/tee_bnxt_fw.c |  9 
  drivers/tee/optee/core.c| 69 ++---
  2 files changed, 58 insertions(+), 20 deletions(-)



Re: [PATCH 1/2] optee: fix tee out of memory failure seen during kexec reboot

2021-02-22 Thread Allen Pais




On Wed, 17 Feb 2021 14:57:12 +0530, Allen Pais wrote:

-   /*
-* Ask OP-TEE to free all cached shared memory objects to decrease
-* reference counters and also avoid wild pointers in secure world
-* into the old shared memory range.
-*/
-   optee_disable_shm_cache(optee);
+   if (shutdown) {
+   optee_disable_shm_cache(optee);
+   } else {
+   /*
+* Ask OP-TEE to free all cached shared memory
+* objects to decrease reference counters and
+* also avoid wild pointers in secure world
+* into the old shared memory range.
+*/
+   optee_disable_shm_cache(optee);
  
Calling optee_disable_shm_cache() in both if and else. It could be

put in front of if().



  Ideally, I could just use optee_remove for shutdown() too.
But it would not look good. Hence this approach.

- Allen


[PATCH 2/2] firmware: tee_bnxt: implement shutdown method to handle kexec reboots

2021-02-17 Thread Allen Pais
From: Allen Pais 

 On kexec reboot the firmware driver fails to deallocate
shm memory leading to a memory leak. Implement .shutdown()
method to handle kexec reboots and to release shm buffers
correctly.

Signed-off-by: Allen Pais 
---
 drivers/firmware/broadcom/tee_bnxt_fw.c | 9 +
 1 file changed, 9 insertions(+)

diff --git a/drivers/firmware/broadcom/tee_bnxt_fw.c 
b/drivers/firmware/broadcom/tee_bnxt_fw.c
index ed10da5313e8..4c62e044a99f 100644
--- a/drivers/firmware/broadcom/tee_bnxt_fw.c
+++ b/drivers/firmware/broadcom/tee_bnxt_fw.c
@@ -242,6 +242,14 @@ static int tee_bnxt_fw_remove(struct device *dev)
return 0;
 }
 
+static void tee_bnxt_fw_shutdown(struct device *dev)
+{
+   tee_shm_free(pvt_data.fw_shm_pool);
+   tee_client_close_session(pvt_data.ctx, pvt_data.session_id);
+   tee_client_close_context(pvt_data.ctx);
+   pvt_data.ctx = NULL;
+}
+
 static const struct tee_client_device_id tee_bnxt_fw_id_table[] = {
{UUID_INIT(0x6272636D, 0x2019, 0x0716,
0x42, 0x43, 0x4D, 0x5F, 0x53, 0x43, 0x48, 0x49)},
@@ -257,6 +265,7 @@ static struct tee_client_driver tee_bnxt_fw_driver = {
.bus= _bus_type,
.probe  = tee_bnxt_fw_probe,
.remove = tee_bnxt_fw_remove,
+   .shutdown   = tee_bnxt_fw_shutdown,
},
 };
 
-- 
2.25.1



[PATCH 1/2] optee: fix tee out of memory failure seen during kexec reboot

2021-02-17 Thread Allen Pais
From: Allen Pais 

The following out of memory errors are seen on kexec reboot
from the optee core.

[0.368428] tee_bnxt_fw optee-clnt0: tee_shm_alloc failed
[0.368461] tee_bnxt_fw: probe of optee-clnt0 failed with error -22

tee_shm_release() is not invoked on dma shm buffer.

Implement .shutdown() method to handle the release of the buffers
correctly.

More info:
https://github.com/OP-TEE/optee_os/issues/3637

Signed-off-by: Allen Pais 
---
 drivers/tee/optee/core.c | 69 
 1 file changed, 49 insertions(+), 20 deletions(-)

diff --git a/drivers/tee/optee/core.c b/drivers/tee/optee/core.c
index cf4718c6d35d..b402e5eace7b 100644
--- a/drivers/tee/optee/core.c
+++ b/drivers/tee/optee/core.c
@@ -582,36 +582,64 @@ static optee_invoke_fn *get_invoke_func(struct device 
*dev)
return ERR_PTR(-EINVAL);
 }
 
-static int optee_remove(struct platform_device *pdev)
+static int __optee_shutoff(struct platform_device *pdev, bool shutdown)
 {
struct optee *optee = platform_get_drvdata(pdev);
 
-   /*
-* Ask OP-TEE to free all cached shared memory objects to decrease
-* reference counters and also avoid wild pointers in secure world
-* into the old shared memory range.
-*/
-   optee_disable_shm_cache(optee);
+   if (shutdown) {
+   optee_disable_shm_cache(optee);
+   } else {
+   /*
+* Ask OP-TEE to free all cached shared memory
+* objects to decrease reference counters and
+* also avoid wild pointers in secure world
+* into the old shared memory range.
+*/
+   optee_disable_shm_cache(optee);
 
-   /*
-* The two devices have to be unregistered before we can free the
-* other resources.
-*/
-   tee_device_unregister(optee->supp_teedev);
-   tee_device_unregister(optee->teedev);
+   /*
+* The two devices have to be unregistered before
+* we can free the other resources.
+*/
+   tee_device_unregister(optee->supp_teedev);
+   tee_device_unregister(optee->teedev);
 
-   tee_shm_pool_free(optee->pool);
-   if (optee->memremaped_shm)
-   memunmap(optee->memremaped_shm);
-   optee_wait_queue_exit(>wait_queue);
-   optee_supp_uninit(>supp);
-   mutex_destroy(>call_queue.mutex);
+   tee_shm_pool_free(optee->pool);
+   if (optee->memremaped_shm)
+   memunmap(optee->memremaped_shm);
+   optee_wait_queue_exit(>wait_queue);
+   optee_supp_uninit(>supp);
+   mutex_destroy(>call_queue.mutex);
 
-   kfree(optee);
+   kfree(optee);
+   }
 
return 0;
 }
 
+/* optee_remove - Device Removal Routine
+ * @pdev: platform device information struct
+ *
+ * optee_remove is called by platform subsystem to alter the driver
+ * that it should release the device
+ */
+static int optee_remove(struct platform_device *pdev)
+{
+   return __optee_shutoff(pdev, false);
+}
+
+/* optee_shutdown - Device Removal Routine
+ * @pdev: platform device information struct
+ *
+ * platform_shutdown is called by the platform subsystem to alter
+ * the driver that a shutdown/reboot(or kexec) is happening and
+ * device must be disabled.
+ */
+static void optee_shutdown(struct platform_device *pdev)
+{
+   __optee_shutoff(pdev, true);
+}
+
 static int optee_probe(struct platform_device *pdev)
 {
optee_invoke_fn *invoke_fn;
@@ -738,6 +766,7 @@ MODULE_DEVICE_TABLE(of, optee_dt_match);
 static struct platform_driver optee_driver = {
.probe  = optee_probe,
.remove = optee_remove,
+   .shutdown = optee_shutdown,
.driver = {
.name = "optee",
.of_match_table = optee_dt_match,
-- 
2.25.1



[PATCH 0/2] optee: fix OOM seen due to tee_shm_free()

2021-02-17 Thread Allen Pais
From: Allen Pais 

The following out of memory errors are seen on kexec reboot
from the optee core.

[0.368428] tee_bnxt_fw optee-clnt0: tee_shm_alloc failed
[0.368461] tee_bnxt_fw: probe of optee-clnt0 failed with error -22

tee_shm_release() is not invoked on dma shm buffer.

Implement .shutdown() in optee core as well as bnxt firmware driver
to handle the release of the buffers correctly.

More info:
https://github.com/OP-TEE/optee_os/issues/3637

Allen Pais (2):
  optee: fix tee out of memory failure seen during kexec reboot
  firmware: tee_bnxt: implement shutdown method to handle kexec reboots

 drivers/firmware/broadcom/tee_bnxt_fw.c |  9 
 drivers/tee/optee/core.c| 69 ++---
 2 files changed, 58 insertions(+), 20 deletions(-)

-- 
2.25.1



[RFC] PCI: allow sysfs file owner to read the config space with CAP_SYS_RAWIO

2020-10-15 Thread Allen Pais
From: Allen Pais 

 Access to pci config space is explictly checked with CAP_SYS_ADMIN
in order to read configuration space past the frist 64B.

 Since the path is only for reading, could we use CAP_SYS_RAWIO?
This patch contains a simpler fix, I would love to hear from the
Maintainers on the approach.

 The other approach that I considered was to introduce and API
which would check for multiple capabilities, something similar to
perfmon_capable()/bpf_capable(). But I could not find more users
for the API and hence dropped it.

 The problem I am trying to solve is to avoid handing out
CAP_SYS_ADMIN for extended reads of the PCI config space.

Signed-off-by: Allen Pais 
---
 drivers/pci/pci-sysfs.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c
index 6d78df981d41..6574c0203475 100644
--- a/drivers/pci/pci-sysfs.c
+++ b/drivers/pci/pci-sysfs.c
@@ -666,7 +666,8 @@ static ssize_t pci_read_config(struct file *filp, struct 
kobject *kobj,
u8 *data = (u8 *) buf;
 
/* Several chips lock up trying to read undefined config space */
-   if (file_ns_capable(filp, _user_ns, CAP_SYS_ADMIN))
+   if (file_ns_capable(filp, _user_ns, CAP_SYS_ADMIN) ||
+   file_ns_capable(filp, _user_ns, CAP_SYS_RAWIO))
size = dev->cfg_size;
else if (dev->hdr_type == PCI_HEADER_TYPE_CARDBUS)
size = 128;
-- 
2.25.1



Re: [PATCH 01/16] wireless: ath5k: convert tasklets to use new tasklet_setup() API

2020-08-27 Thread Allen Pais
Hi,
>
> Allen Pais  wrote:
>
> > 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 
> > Signed-off-by: Allen Pais 
> > Signed-off-by: Kalle Valo 
>
> Patch applied to ath-next branch of ath.git, thanks.
>
> c068a9ec3c94 ath5k: convert tasklets to use new tasklet_setup() API
>
> --
> https://patchwork.kernel.org/patch/11717393/
>
> https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

Could you please drop these and wait for V2. A change was proposed
for from_tasklet() api. The new API should be picked shortly. I will send out
the updated version early next week.

Thanks,
- Allen


[PATCH] linux/kernel.h: add container_from()

2020-08-26 Thread Allen Pais
Introduce container_from() as a generic helper instead of
sub-systems defining a private from_* API
(Eg: from_tasklets recently introduced in
12cc923f1ccc: Tasklet: Introduce new initialization API)

The helper is similar to container_of() in argument order
with the difference of naming the containing structure instead
of having to specify its type.

Suggested-by: James E.J. Bottomley 
Suggested-by: Greg Kroah-Hartman 
Suggested-by: Jens Axboe 
Signed-off-by: Allen Pais 
---
 include/linux/kernel.h | 9 +
 1 file changed, 9 insertions(+)

diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index 500def620d8f..9d446324a8be 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -1019,6 +1019,15 @@ static inline void ftrace_dump(enum ftrace_dump_mode 
oops_dump_mode) { }
 "pointer type mismatch in container_of()");\
IS_ERR_OR_NULL(__mptr) ? ERR_CAST(__mptr) : \
((type *)(__mptr - offsetof(type, member))); })
+/**
+ * container_from - cast a member of a structure out to the containing 
structure
+ * @ptr:   the pointer to the member.
+ * @container: the type of the container struct.
+ * @member:the name of the member within the struct.
+ *
+ */
+#define container_from(ptr, container, member) \
+   container_of(ptr, typeof(*container), member)
 
 /* Rebuild everything on CONFIG_FTRACE_MCOUNT_RECORD */
 #ifdef CONFIG_FTRACE_MCOUNT_RECORD
-- 
2.25.1



Re: [PATCH] block: convert tasklets to use new tasklet_setup() API

2020-08-25 Thread Allen Pais
On Thu, Aug 20, 2020 at 3:09 AM James Bottomley
 wrote:
>
> On Wed, 2020-08-19 at 21:54 +0530, Allen wrote:
> > > [...]
> > > > > Since both threads seem to have petered out, let me suggest in
> > > > > kernel.h:
> > > > >
> > > > > #define cast_out(ptr, container, member) \
> > > > > container_of(ptr, typeof(*container), member)
> > > > >
> > > > > It does what you want, the argument order is the same as
> > > > > container_of with the only difference being you name the
> > > > > containing structure instead of having to specify its type.
> > > >
> > > > Not to incessantly bike shed on the naming, but I don't like
> > > > cast_out, it's not very descriptive. And it has connotations of
> > > > getting rid of something, which isn't really true.
> > >
> > > Um, I thought it was exactly descriptive: you're casting to the
> > > outer container.  I thought about following the C++ dynamic casting
> > > style, so out_cast(), but that seemed a bit pejorative.  What about
> > > outer_cast()?
> > >
> > > > FWIW, I like the from_ part of the original naming, as it has
> > > > some clues as to what is being done here. Why not just
> > > > from_container()? That should immediately tell people what it
> > > > does without having to look up the implementation, even before
> > > > this becomes a part of the accepted coding norm.
> > >
> > > I'm not opposed to container_from() but it seems a little less
> > > descriptive than outer_cast() but I don't really care.  I always
> > > have to look up container_of() when I'm using it so this would just
> > > be another macro of that type ...
> > >
> >
> >  So far we have a few which have been suggested as replacement
> > for from_tasklet()
> >
> > - out_cast() or outer_cast()
> > - from_member().
> > - container_from() or from_container()
> >
> > from_container() sounds fine, would trimming it a bit work? like
> > from_cont().
>
> I'm fine with container_from().  It's the same form as container_of()
> and I think we need urgent agreement to not stall everything else so
> the most innocuous name is likely to get the widest acceptance.

Kees,

  Will you be  sending the newly proposed API to Linus? I have V2
which uses container_from()
ready to be sent out.

Thanks.


[PATCH] platform: goldfish: convert tasklets to use new tasklet_setup() API

2020-08-17 Thread Allen Pais
From: Allen Pais 

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 
Signed-off-by: Allen Pais 
---
 drivers/platform/goldfish/goldfish_pipe.c | 7 +++
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/platform/goldfish/goldfish_pipe.c 
b/drivers/platform/goldfish/goldfish_pipe.c
index 1ab207ec9c94..b9bead07760c 100644
--- a/drivers/platform/goldfish/goldfish_pipe.c
+++ b/drivers/platform/goldfish/goldfish_pipe.c
@@ -577,10 +577,10 @@ static struct goldfish_pipe *signalled_pipes_pop_front(
return pipe;
 }
 
-static void goldfish_interrupt_task(unsigned long dev_addr)
+static void goldfish_interrupt_task(struct tasklet_struct *t)
 {
/* Iterate over the signalled pipes and wake them one by one */
-   struct goldfish_pipe_dev *dev = (struct goldfish_pipe_dev *)dev_addr;
+   struct goldfish_pipe_dev *dev = from_tasklet(dev, t, irq_tasklet);
struct goldfish_pipe *pipe;
int wakes;
 
@@ -811,8 +811,7 @@ static int goldfish_pipe_device_init(struct platform_device 
*pdev,
 {
int err;
 
-   tasklet_init(>irq_tasklet, _interrupt_task,
-(unsigned long)dev);
+   tasklet_setup(>irq_tasklet, _interrupt_task);
 
err = devm_request_irq(>dev, dev->irq,
   goldfish_pipe_interrupt,
-- 
2.17.1



[PATCH] net: atm: convert tasklets callbacks to use from_tasklet()

2020-08-17 Thread Allen Pais
From: Allen Pais 

Update all the callbacks of all tasklets by using
from_tasklet() and remove .data field.

Signed-off-by: Romain Perier 
Signed-off-by: Allen Pais 
---
 net/atm/pppoatm.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/net/atm/pppoatm.c b/net/atm/pppoatm.c
index 579b66da1d95..3803be8470f7 100644
--- a/net/atm/pppoatm.c
+++ b/net/atm/pppoatm.c
@@ -416,7 +416,6 @@ static int pppoatm_assign_vcc(struct atm_vcc *atmvcc, void 
__user *arg)
pvcc->chan.mtu = atmvcc->qos.txtp.max_sdu - PPP_HDRLEN -
(be.encaps == e_vc ? 0 : LLC_LEN);
pvcc->wakeup_tasklet = tasklet_proto;
-   pvcc->wakeup_tasklet.data = (unsigned long) >chan;
err = ppp_register_channel(>chan);
if (err != 0) {
kfree(pvcc);
-- 
2.17.1



[PATCH 1/2] misc: ibmvmc: convert tasklets to use new tasklet_setup() API

2020-08-17 Thread Allen Pais
From: Allen Pais 

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 
Signed-off-by: Allen Pais 
---
 drivers/misc/ibmvmc.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/misc/ibmvmc.c b/drivers/misc/ibmvmc.c
index 2d778d0f011e..347278c1a5e4 100644
--- a/drivers/misc/ibmvmc.c
+++ b/drivers/misc/ibmvmc.c
@@ -2064,10 +2064,10 @@ static void ibmvmc_handle_crq(struct ibmvmc_crq_msg 
*crq,
}
 }
 
-static void ibmvmc_task(unsigned long data)
+static void ibmvmc_task(struct tasklet_struct *t)
 {
-   struct crq_server_adapter *adapter =
-   (struct crq_server_adapter *)data;
+   struct crq_server_adapter *adapter = from_tasklet(adapter, t,
+ work_task);
struct vio_dev *vdev = to_vio_dev(adapter->dev);
struct ibmvmc_crq_msg *crq;
int done = 0;
@@ -2150,7 +2150,7 @@ static int ibmvmc_init_crq_queue(struct 
crq_server_adapter *adapter)
queue->cur = 0;
spin_lock_init(>lock);
 
-   tasklet_init(>work_task, ibmvmc_task, (unsigned long)adapter);
+   tasklet_setup(>work_task, ibmvmc_task);
 
if (request_irq(vdev->irq,
ibmvmc_handle_event,
-- 
2.17.1



[PATCH 1/2] memstick: jmb38x: convert tasklets to use new tasklet_setup() API

2020-08-17 Thread Allen Pais
From: Allen Pais 

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 
Signed-off-by: Allen Pais 
---
 drivers/memstick/host/jmb38x_ms.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/memstick/host/jmb38x_ms.c 
b/drivers/memstick/host/jmb38x_ms.c
index 4a6b866b0291..2bcf5ce113bd 100644
--- a/drivers/memstick/host/jmb38x_ms.c
+++ b/drivers/memstick/host/jmb38x_ms.c
@@ -603,10 +603,10 @@ static void jmb38x_ms_abort(struct timer_list *t)
spin_unlock_irqrestore(>lock, flags);
 }
 
-static void jmb38x_ms_req_tasklet(unsigned long data)
+static void jmb38x_ms_req_tasklet(struct tasklet_struct *t)
 {
-   struct memstick_host *msh = (struct memstick_host *)data;
-   struct jmb38x_ms_host *host = memstick_priv(msh);
+   struct jmb38x_ms_host *host = from_tasklet(host, t, notify);
+   struct memstick_host *msh = host->msh;
unsigned long flags;
int rc;
 
@@ -868,7 +868,7 @@ static struct memstick_host *jmb38x_ms_alloc_host(struct 
jmb38x_ms *jm, int cnt)
host->irq = jm->pdev->irq;
host->timeout_jiffies = msecs_to_jiffies(1000);
 
-   tasklet_init(>notify, jmb38x_ms_req_tasklet, (unsigned long)msh);
+   tasklet_setup(>notify, jmb38x_ms_req_tasklet);
msh->request = jmb38x_ms_submit_req;
msh->set_param = jmb38x_ms_set_param;
 
-- 
2.17.1



Re: [PATCH 00/10] sound: convert tasklets to use new tasklet_setup()

2020-08-17 Thread Allen Pais
>
> Is this targeted for 5.9 or 5.10?

This is targeted for 5.9.

> I have a patch set to drop the whole tasklet usage in sound/*
> (destined for 5.10, to be submitted soon), so if that's for 5.10,
> it'll be likely superfluous.

 I have picked patches from your tree to adapt to this new API.
Those can be picked in 5.10 I suppose.

Thanks.


[PATCH 1/2] hsi: nokia-modem: convert tasklets to use new tasklet_setup() API

2020-08-17 Thread Allen Pais
From: Allen Pais 

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 
Signed-off-by: Allen Pais 
---
 drivers/hsi/clients/nokia-modem.c | 9 +
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/hsi/clients/nokia-modem.c 
b/drivers/hsi/clients/nokia-modem.c
index cd7ebf4c2e2f..36d373f089ce 100644
--- a/drivers/hsi/clients/nokia-modem.c
+++ b/drivers/hsi/clients/nokia-modem.c
@@ -36,9 +36,10 @@ struct nokia_modem_device {
struct hsi_client   *cmt_speech;
 };
 
-static void do_nokia_modem_rst_ind_tasklet(unsigned long data)
+static void do_nokia_modem_rst_ind_tasklet(struct tasklet_struct *t)
 {
-   struct nokia_modem_device *modem = (struct nokia_modem_device *)data;
+   struct nokia_modem_device *modem = from_tasklet(modem, t,
+   nokia_modem_rst_ind_tasklet);
 
if (!modem)
return;
@@ -155,8 +156,8 @@ static int nokia_modem_probe(struct device *dev)
modem->nokia_modem_rst_ind_irq = irq;
pflags = irq_get_trigger_type(irq);
 
-   tasklet_init(>nokia_modem_rst_ind_tasklet,
-   do_nokia_modem_rst_ind_tasklet, (unsigned long)modem);
+   tasklet_setup(>nokia_modem_rst_ind_tasklet,
+   do_nokia_modem_rst_ind_tasklet);
err = devm_request_irq(dev, irq, nokia_modem_rst_ind_isr,
pflags, "modem_rst_ind", modem);
if (err < 0) {
-- 
2.17.1



[PATCH] firewire: ohci: convert tasklets to use new tasklet_setup() API

2020-08-17 Thread Allen Pais
From: Allen Pais 

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 
Signed-off-by: Allen Pais 
---
 drivers/firewire/ohci.c | 16 
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/firewire/ohci.c b/drivers/firewire/ohci.c
index 7dde21b18b04..6298ff03796e 100644
--- a/drivers/firewire/ohci.c
+++ b/drivers/firewire/ohci.c
@@ -921,9 +921,9 @@ static void ar_recycle_buffers(struct ar_context *ctx, 
unsigned int end_buffer)
}
 }
 
-static void ar_context_tasklet(unsigned long data)
+static void ar_context_tasklet(struct tasklet_struct *t)
 {
-   struct ar_context *ctx = (struct ar_context *)data;
+   struct ar_context *ctx = from_tasklet(ctx, t, tasklet);
unsigned int end_buffer_index, end_buffer_offset;
void *p, *end;
 
@@ -977,7 +977,7 @@ static int ar_context_init(struct ar_context *ctx, struct 
fw_ohci *ohci,
 
ctx->regs= regs;
ctx->ohci= ohci;
-   tasklet_init(>tasklet, ar_context_tasklet, (unsigned long)ctx);
+   tasklet_setup(>tasklet, ar_context_tasklet);
 
for (i = 0; i < AR_BUFFERS; i++) {
ctx->pages[i] = alloc_page(GFP_KERNEL | GFP_DMA32);
@@ -1049,9 +1049,9 @@ static struct descriptor *find_branch_descriptor(struct 
descriptor *d, int z)
return d + z - 1;
 }
 
-static void context_tasklet(unsigned long data)
+static void context_tasklet(struct tasklet_struct *t)
 {
-   struct context *ctx = (struct context *) data;
+   struct context *ctx = from_tasklet(ctx, t, tasklet);
struct descriptor *d, *last;
u32 address;
int z;
@@ -1145,7 +1145,7 @@ static int context_init(struct context *ctx, struct 
fw_ohci *ohci,
ctx->buffer_tail = list_entry(ctx->buffer_list.next,
struct descriptor_buffer, list);
 
-   tasklet_init(>tasklet, context_tasklet, (unsigned long)ctx);
+   tasklet_setup(>tasklet, context_tasklet);
ctx->callback = callback;
 
/*
@@ -1420,7 +1420,7 @@ static void at_context_flush(struct context *ctx)
tasklet_disable(>tasklet);
 
ctx->flushing = true;
-   context_tasklet((unsigned long)ctx);
+   context_tasklet(>tasklet);
ctx->flushing = false;
 
tasklet_enable(>tasklet);
@@ -3472,7 +3472,7 @@ static int ohci_flush_iso_completions(struct 
fw_iso_context *base)
tasklet_disable(>context.tasklet);
 
if (!test_and_set_bit_lock(0, >flushing_completions)) {
-   context_tasklet((unsigned long)>context);
+   context_tasklet(>context.tasklet);
 
switch (base->type) {
case FW_ISO_CONTEXT_TRANSMIT:
-- 
2.17.1



[PATCH 1/2] mailbox: bcm: convert tasklets to use new tasklet_setup() API

2020-08-17 Thread Allen Pais
From: Allen Pais 

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 
Signed-off-by: Allen Pais 
---
 drivers/mailbox/bcm-pdc-mailbox.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/mailbox/bcm-pdc-mailbox.c 
b/drivers/mailbox/bcm-pdc-mailbox.c
index 53945ca5d785..5b375985f7b8 100644
--- a/drivers/mailbox/bcm-pdc-mailbox.c
+++ b/drivers/mailbox/bcm-pdc-mailbox.c
@@ -962,9 +962,9 @@ static irqreturn_t pdc_irq_handler(int irq, void *data)
  * a DMA receive interrupt. Reenables the receive interrupt.
  * @data: PDC state structure
  */
-static void pdc_tasklet_cb(unsigned long data)
+static void pdc_tasklet_cb(struct tasklet_struct *t)
 {
-   struct pdc_state *pdcs = (struct pdc_state *)data;
+   struct pdc_state *pdcs = from_tasklet(pdcs, t, rx_tasklet);
 
pdc_receive(pdcs);
 
@@ -1589,7 +1589,7 @@ static int pdc_probe(struct platform_device *pdev)
pdc_hw_init(pdcs);
 
/* Init tasklet for deferred DMA rx processing */
-   tasklet_init(>rx_tasklet, pdc_tasklet_cb, (unsigned long)pdcs);
+   tasklet_setup(>rx_tasklet, pdc_tasklet_cb);
 
err = pdc_interrupts_init(pdcs);
if (err)
-- 
2.17.1



[PATCH] drm: i915: convert tasklets to use new tasklet_setup() API

2020-08-17 Thread Allen Pais
From: Allen Pais 

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
and remove the .data field.

Signed-off-by: Romain Perier 
Signed-off-by: Allen Pais 
---
 drivers/gpu/drm/i915/gt/intel_lrc.c   | 31 ++-
 .../gpu/drm/i915/gt/uc/intel_guc_submission.c |  8 +++--
 2 files changed, 22 insertions(+), 17 deletions(-)

diff --git a/drivers/gpu/drm/i915/gt/intel_lrc.c 
b/drivers/gpu/drm/i915/gt/intel_lrc.c
index 24322ef08aa4..c45e42b9f239 100644
--- a/drivers/gpu/drm/i915/gt/intel_lrc.c
+++ b/drivers/gpu/drm/i915/gt/intel_lrc.c
@@ -3130,9 +3130,10 @@ static bool preempt_timeout(const struct intel_engine_cs 
*const engine)
  * Check the unread Context Status Buffers and manage the submission of new
  * contexts to the ELSP accordingly.
  */
-static void execlists_submission_tasklet(unsigned long data)
+static void execlists_submission_tasklet(struct tasklet_struct *t)
 {
-   struct intel_engine_cs * const engine = (struct intel_engine_cs *)data;
+   struct intel_engine_cs * const engine = from_tasklet(engine, t,
+execlists.tasklet);
bool timeout = preempt_timeout(engine);
 
process_csb(engine);
@@ -4306,9 +4307,10 @@ static void execlists_reset_rewind(struct 
intel_engine_cs *engine, bool stalled)
spin_unlock_irqrestore(>active.lock, flags);
 }
 
-static void nop_submission_tasklet(unsigned long data)
+static void nop_submission_tasklet(struct tasklet_struct *t)
 {
-   struct intel_engine_cs * const engine = (struct intel_engine_cs *)data;
+   struct intel_engine_cs * const engine = from_tasklet(engine, t,
+execlists.tasklet);
 
/* The driver is wedged; don't process any more events. */
WRITE_ONCE(engine->execlists.queue_priority_hint, INT_MIN);
@@ -4391,7 +4393,8 @@ static void execlists_reset_cancel(struct intel_engine_cs 
*engine)
execlists->queue = RB_ROOT_CACHED;
 
GEM_BUG_ON(__tasklet_is_enabled(>tasklet));
-   execlists->tasklet.func = nop_submission_tasklet;
+   execlists->tasklet.func = (void (*)(unsigned long))
+ nop_submission_tasklet;
 
spin_unlock_irqrestore(>active.lock, flags);
 }
@@ -4986,7 +4989,8 @@ void intel_execlists_set_default_submission(struct 
intel_engine_cs *engine)
 {
engine->submit_request = execlists_submit_request;
engine->schedule = i915_schedule;
-   engine->execlists.tasklet.func = execlists_submission_tasklet;
+   engine->execlists.tasklet.func = (void (*)(unsigned long))
+   execlists_submission_tasklet;
 
engine->reset.prepare = execlists_reset_prepare;
engine->reset.rewind = execlists_reset_rewind;
@@ -5113,8 +5117,7 @@ int intel_execlists_submission_setup(struct 
intel_engine_cs *engine)
struct intel_uncore *uncore = engine->uncore;
u32 base = engine->mmio_base;
 
-   tasklet_init(>execlists.tasklet,
-execlists_submission_tasklet, (unsigned long)engine);
+   tasklet_setup(>execlists.tasklet, execlists_submission_tasklet);
timer_setup(>execlists.timer, execlists_timeslice, 0);
timer_setup(>execlists.preempt, execlists_preempt, 0);
 
@@ -5509,9 +5512,10 @@ static intel_engine_mask_t 
virtual_submission_mask(struct virtual_engine *ve)
return mask;
 }
 
-static void virtual_submission_tasklet(unsigned long data)
+static void virtual_submission_tasklet(struct tasklet_struct *t)
 {
-   struct virtual_engine * const ve = (struct virtual_engine *)data;
+   struct virtual_engine *  ve = from_tasklet(ve, t,
+  base.execlists.tasklet);
const int prio = READ_ONCE(ve->base.execlists.queue_priority_hint);
intel_engine_mask_t mask;
unsigned int n;
@@ -5724,9 +5728,8 @@ intel_execlists_create_virtual(struct intel_engine_cs 
**siblings,
 
INIT_LIST_HEAD(virtual_queue(ve));
ve->base.execlists.queue_priority_hint = INT_MIN;
-   tasklet_init(>base.execlists.tasklet,
-virtual_submission_tasklet,
-(unsigned long)ve);
+   tasklet_setup(>base.execlists.tasklet,
+virtual_submission_tasklet);
 
intel_context_init(>context, >base);
 
@@ -5748,7 +5751,7 @@ intel_execlists_create_virtual(struct intel_engine_cs 
**siblings,
 * layering if we handle cloning of the requests and
 * submitting a copy into each backend.
 */
-   if (sibling->execlists.tasklet.func !=
+   if (sibling->execlists.tasklet.func != (void (*)(unsigned long))
execlists_submissi

[PATCH] input: serio: convert tasklets to use new tasklet_setup() API

2020-08-17 Thread Allen Pais
From: Allen Pais 

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 
Signed-off-by: Allen Pais 
---
 drivers/input/serio/hp_sdc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/input/serio/hp_sdc.c b/drivers/input/serio/hp_sdc.c
index 13eacf6ab431..91f8253ac66a 100644
--- a/drivers/input/serio/hp_sdc.c
+++ b/drivers/input/serio/hp_sdc.c
@@ -301,7 +301,7 @@ static irqreturn_t hp_sdc_nmisr(int irq, void *dev_id)
 
 unsigned long hp_sdc_put(void);
 
-static void hp_sdc_tasklet(unsigned long foo)
+static void hp_sdc_tasklet(struct tasklet_struct *unused)
 {
write_lock_irq(_sdc.rtq_lock);
 
@@ -890,7 +890,7 @@ static int __init hp_sdc_init(void)
hp_sdc_status_in8();
hp_sdc_data_in8();
 
-   tasklet_init(_sdc.task, hp_sdc_tasklet, 0);
+   tasklet_setup(_sdc.task, hp_sdc_tasklet, 0);
 
/* Sync the output buffer registers, thus scheduling hp_sdc_tasklet. */
t_sync.actidx   = 0;
-- 
2.17.1



[PATCH] drivers: vme: convert tasklets to use new tasklet_setup() API

2020-08-17 Thread Allen Pais
From: Allen Pais 

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 
Signed-off-by: Allen Pais 
---
 drivers/vme/bridges/vme_fake.c | 9 -
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/vme/bridges/vme_fake.c b/drivers/vme/bridges/vme_fake.c
index 6a1bc284f297..38dd5f949cd0 100644
--- a/drivers/vme/bridges/vme_fake.c
+++ b/drivers/vme/bridges/vme_fake.c
@@ -90,13 +90,13 @@ static struct device *vme_root;
 /*
  * Calling VME bus interrupt callback if provided.
  */
-static void fake_VIRQ_tasklet(unsigned long data)
+static void fake_VIRQ_tasklet(struct tasklet_struct *t)
 {
struct vme_bridge *fake_bridge;
struct fake_driver *bridge;
 
-   fake_bridge = (struct vme_bridge *) data;
-   bridge = fake_bridge->driver_priv;
+   bridge = from_tasklet(bridge, t, int_tasklet);
+   fake_bridge = bridge->parent;
 
vme_irq_handler(fake_bridge, bridge->int_level, bridge->int_statid);
 }
@@ -1098,8 +1098,7 @@ static int __init fake_init(void)
/* Initialize wait queues & mutual exclusion flags */
mutex_init(_device->vme_int);
mutex_init(_bridge->irq_mtx);
-   tasklet_init(_device->int_tasklet, fake_VIRQ_tasklet,
-   (unsigned long) fake_bridge);
+   tasklet_setup(_device->int_tasklet, fake_VIRQ_tasklet);
 
strcpy(fake_bridge->name, driver_name);
 
-- 
2.17.1



[PATCH] drivers: s390: convert tasklets to use new tasklet_setup() API

2020-08-17 Thread Allen Pais
From: Allen Pais 

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 
Signed-off-by: Allen Pais 
---
 drivers/s390/block/dasd.c | 18 --
 drivers/s390/char/con3215.c   |  6 +++---
 drivers/s390/char/con3270.c   |  7 +++
 drivers/s390/char/tty3270.c   | 15 +++
 drivers/s390/cio/qdio.h   |  6 +++---
 drivers/s390/cio/qdio_main.c  | 12 ++--
 drivers/s390/cio/qdio_setup.c |  9 +++--
 drivers/s390/net/ctcm_main.c  |  8 +++-
 drivers/s390/net/ctcm_mpc.c   | 16 
 drivers/s390/net/ctcm_mpc.h   |  6 +++---
 10 files changed, 47 insertions(+), 56 deletions(-)

diff --git a/drivers/s390/block/dasd.c b/drivers/s390/block/dasd.c
index eb17fea8075c..ec0d8a4ed05f 100644
--- a/drivers/s390/block/dasd.c
+++ b/drivers/s390/block/dasd.c
@@ -72,8 +72,8 @@ MODULE_LICENSE("GPL");
 static int  dasd_alloc_queue(struct dasd_block *);
 static void dasd_free_queue(struct dasd_block *);
 static int dasd_flush_block_queue(struct dasd_block *);
-static void dasd_device_tasklet(unsigned long);
-static void dasd_block_tasklet(unsigned long);
+static void dasd_device_tasklet(struct tasklet_struct *);
+static void dasd_block_tasklet(struct tasklet_struct *);
 static void do_kick_device(struct work_struct *);
 static void do_restore_device(struct work_struct *);
 static void do_reload_device(struct work_struct *);
@@ -133,8 +133,7 @@ struct dasd_device *dasd_alloc_device(void)
dasd_init_chunklist(>ese_chunks, device->ese_mem, PAGE_SIZE * 
2);
spin_lock_init(>mem_lock);
atomic_set(>tasklet_scheduled, 0);
-   tasklet_init(>tasklet, dasd_device_tasklet,
-(unsigned long) device);
+   tasklet_setup(>tasklet, dasd_device_tasklet);
INIT_LIST_HEAD(>ccw_queue);
timer_setup(>timer, dasd_device_timeout, 0);
INIT_WORK(>kick_work, do_kick_device);
@@ -174,8 +173,7 @@ struct dasd_block *dasd_alloc_block(void)
atomic_set(>open_count, -1);
 
atomic_set(>tasklet_scheduled, 0);
-   tasklet_init(>tasklet, dasd_block_tasklet,
-(unsigned long) block);
+   tasklet_setup(>tasklet, dasd_block_tasklet);
INIT_LIST_HEAD(>ccw_queue);
spin_lock_init(>queue_lock);
INIT_LIST_HEAD(>format_list);
@@ -2187,9 +2185,9 @@ EXPORT_SYMBOL_GPL(dasd_flush_device_queue);
 /*
  * Acquire the device lock and process queues for the device.
  */
-static void dasd_device_tasklet(unsigned long data)
+static void dasd_device_tasklet(struct tasklet_struct *t)
 {
-   struct dasd_device *device = (struct dasd_device *) data;
+   struct dasd_device *device = from_tasklet(device, t, tasklet);
struct list_head final_queue;
 
atomic_set (>tasklet_scheduled, 0);
@@ -2929,9 +2927,9 @@ static void __dasd_block_start_head(struct dasd_block 
*block)
  * block layer request queue, creates ccw requests, enqueues them on
  * a dasd_device and processes ccw requests that have been returned.
  */
-static void dasd_block_tasklet(unsigned long data)
+static void dasd_block_tasklet(struct tasklet_struct *t)
 {
-   struct dasd_block *block = (struct dasd_block *) data;
+   struct dasd_block *block = from_tasklet(block, t, tasklet);
struct list_head final_queue;
struct list_head *l, *n;
struct dasd_ccw_req *cqr;
diff --git a/drivers/s390/char/con3215.c b/drivers/s390/char/con3215.c
index 92757f9bd010..ab5964cffb91 100644
--- a/drivers/s390/char/con3215.c
+++ b/drivers/s390/char/con3215.c
@@ -334,9 +334,9 @@ static inline void raw3215_try_io(struct raw3215_info *raw)
 /*
  * Call tty_wakeup from tasklet context
  */
-static void raw3215_wakeup(unsigned long data)
+static void raw3215_wakeup(struct tasklet_struct *t)
 {
-   struct raw3215_info *raw = (struct raw3215_info *) data;
+   struct raw3215_info *raw = from_tasklet(raw, t, tlet);
struct tty_struct *tty;
 
tty = tty_port_tty_get(>port);
@@ -673,7 +673,7 @@ static struct raw3215_info *raw3215_alloc_info(void)
 
timer_setup(>timer, raw3215_timeout, 0);
init_waitqueue_head(>empty_wait);
-   tasklet_init(>tlet, raw3215_wakeup, (unsigned long)info);
+   tasklet_setup(>tlet, raw3215_wakeup);
tty_port_init(>port);
 
return info;
diff --git a/drivers/s390/char/con3270.c b/drivers/s390/char/con3270.c
index e17364e13d2f..02de4281d5b7 100644
--- a/drivers/s390/char/con3270.c
+++ b/drivers/s390/char/con3270.c
@@ -291,8 +291,9 @@ con3270_update(struct timer_list *t)
  * Read tasklet.
  */
 static void
-con3270_read_tasklet(struct raw3270_request *rrq)
+con3270_read_tasklet(struct tasklet_struct *t)
 {
+   struct raw3270_request *rrq = condev->read;
static char krese

[PATCH] drivers: rapidio: convert tasklets to use new tasklet_setup() API

2020-08-17 Thread Allen Pais
From: Allen Pais 

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 
Signed-off-by: Allen Pais 
---
 drivers/rapidio/devices/tsi721_dma.c | 7 +++
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/rapidio/devices/tsi721_dma.c 
b/drivers/rapidio/devices/tsi721_dma.c
index d375c02059f3..4a2bb6d7c692 100644
--- a/drivers/rapidio/devices/tsi721_dma.c
+++ b/drivers/rapidio/devices/tsi721_dma.c
@@ -566,9 +566,9 @@ static void tsi721_advance_work(struct tsi721_bdma_chan 
*bdma_chan,
  bdma_chan->id);
 }
 
-static void tsi721_dma_tasklet(unsigned long data)
+static void tsi721_dma_tasklet(struct tasklet_struct *t)
 {
-   struct tsi721_bdma_chan *bdma_chan = (struct tsi721_bdma_chan *)data;
+   struct tsi721_bdma_chan *bdma_chan = from_tasklet(bdma_chan, t, 
tasklet);
u32 dmac_int, dmac_sts;
 
dmac_int = ioread32(bdma_chan->regs + TSI721_DMAC_INT);
@@ -988,8 +988,7 @@ int tsi721_register_dma(struct tsi721_device *priv)
INIT_LIST_HEAD(_chan->queue);
INIT_LIST_HEAD(_chan->free_list);
 
-   tasklet_init(_chan->tasklet, tsi721_dma_tasklet,
-(unsigned long)bdma_chan);
+   tasklet_setup(_chan->tasklet, tsi721_dma_tasklet);
list_add_tail(_chan->dchan.device_node,
  >dma.channels);
nr_channels++;
-- 
2.17.1



[PATCH] block: convert tasklets to use new tasklet_setup() API

2020-08-17 Thread Allen Pais
From: Allen Pais 

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 
Signed-off-by: Allen Pais 
---
 drivers/block/umem.c| 6 +++---
 drivers/block/xsysace.c | 6 +++---
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/block/umem.c b/drivers/block/umem.c
index 2b95d7b33b91..320781d5d156 100644
--- a/drivers/block/umem.c
+++ b/drivers/block/umem.c
@@ -405,7 +405,7 @@ static int add_bio(struct cardinfo *card)
return 1;
 }
 
-static void process_page(unsigned long data)
+static void process_page(struct tasklet_struct *t)
 {
/* check if any of the requests in the page are DMA_COMPLETE,
 * and deal with them appropriately.
@@ -415,7 +415,7 @@ static void process_page(unsigned long data)
 */
struct mm_page *page;
struct bio *return_bio = NULL;
-   struct cardinfo *card = (struct cardinfo *)data;
+   struct cardinfo *card = from_tasklet(card, t, tasklet);
unsigned int dma_status = card->dma_status;
 
spin_lock(>lock);
@@ -891,7 +891,7 @@ static int mm_pci_probe(struct pci_dev *dev, const struct 
pci_device_id *id)
if (!card->queue)
goto failed_alloc;
 
-   tasklet_init(>tasklet, process_page, (unsigned long)card);
+   tasklet_setup(>tasklet, process_page);
 
card->check_batteries = 0;
 
diff --git a/drivers/block/xsysace.c b/drivers/block/xsysace.c
index 5d8e0ab3f054..bdd50a87d10f 100644
--- a/drivers/block/xsysace.c
+++ b/drivers/block/xsysace.c
@@ -762,9 +762,9 @@ static void ace_fsm_dostate(struct ace_device *ace)
}
 }
 
-static void ace_fsm_tasklet(unsigned long data)
+static void ace_fsm_tasklet(struct tasklet_struct *t)
 {
-   struct ace_device *ace = (void *)data;
+   struct ace_device *ace = from_tasklet(ace, t, fsm_tasklet);
unsigned long flags;
 
spin_lock_irqsave(>lock, flags);
@@ -1001,7 +1001,7 @@ static int ace_setup(struct ace_device *ace)
/*
 * Initialize the state machine tasklet and stall timer
 */
-   tasklet_init(>fsm_tasklet, ace_fsm_tasklet, (unsigned long)ace);
+   tasklet_setup(>fsm_tasklet, ace_fsm_tasklet);
timer_setup(>stall_timer, ace_stall_timer, 0);
 
/*
-- 
2.17.1



[PATCH] drivers: ntb: convert tasklets to use new tasklet_setup() API

2020-08-17 Thread Allen Pais
From: Allen Pais 

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 
Signed-off-by: Allen Pais 
---
 drivers/ntb/ntb_transport.c | 9 -
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/ntb/ntb_transport.c b/drivers/ntb/ntb_transport.c
index e6d1f5b298f3..ab3bee2fc803 100644
--- a/drivers/ntb/ntb_transport.c
+++ b/drivers/ntb/ntb_transport.c
@@ -273,7 +273,7 @@ enum {
 #define NTB_QP_DEF_NUM_ENTRIES 100
 #define NTB_LINK_DOWN_TIMEOUT  10
 
-static void ntb_transport_rxc_db(unsigned long data);
+static void ntb_transport_rxc_db(struct tasklet_struct *t);
 static const struct ntb_ctx_ops ntb_transport_ops;
 static struct ntb_client ntb_transport_client;
 static int ntb_async_tx_submit(struct ntb_transport_qp *qp,
@@ -1234,8 +1234,7 @@ static int ntb_transport_init_queue(struct 
ntb_transport_ctx *nt,
INIT_LIST_HEAD(>rx_free_q);
INIT_LIST_HEAD(>tx_free_q);
 
-   tasklet_init(>rxc_db_work, ntb_transport_rxc_db,
-(unsigned long)qp);
+   tasklet_setup(>rxc_db_work, ntb_transport_rxc_db);
 
return 0;
 }
@@ -1685,9 +1684,9 @@ static int ntb_process_rxc(struct ntb_transport_qp *qp)
return 0;
 }
 
-static void ntb_transport_rxc_db(unsigned long data)
+static void ntb_transport_rxc_db(struct tasklet_struct *t)
 {
-   struct ntb_transport_qp *qp = (void *)data;
+   struct ntb_transport_qp *qp = from_tasklet(qp, t, rxc_db_work);
int rc, i;
 
dev_dbg(>ndev->pdev->dev, "%s: doorbell %d received\n",
-- 
2.17.1



[PATCH] driver: hv: convert tasklets to use new tasklet_setup() API

2020-08-17 Thread Allen Pais
From: Allen Pais 

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 
Signed-off-by: Allen Pais 
---
 drivers/hv/channel_mgmt.c | 3 +--
 drivers/hv/connection.c   | 4 ++--
 drivers/hv/hv.c   | 3 +--
 drivers/hv/hyperv_vmbus.h | 4 ++--
 drivers/hv/vmbus_drv.c| 4 ++--
 5 files changed, 8 insertions(+), 10 deletions(-)

diff --git a/drivers/hv/channel_mgmt.c b/drivers/hv/channel_mgmt.c
index 591106cf58fc..640fc1688d49 100644
--- a/drivers/hv/channel_mgmt.c
+++ b/drivers/hv/channel_mgmt.c
@@ -321,8 +321,7 @@ static struct vmbus_channel *alloc_channel(void)
 
INIT_LIST_HEAD(>sc_list);
 
-   tasklet_init(>callback_event,
-vmbus_on_event, (unsigned long)channel);
+   tasklet_setup(>callback_event, vmbus_on_event);
 
hv_ringbuffer_pre_init(channel);
 
diff --git a/drivers/hv/connection.c b/drivers/hv/connection.c
index 11170d9a2e1a..23e10ebecf5c 100644
--- a/drivers/hv/connection.c
+++ b/drivers/hv/connection.c
@@ -322,9 +322,9 @@ struct vmbus_channel *relid2channel(u32 relid)
  *If this tasklet has been running for a long time
  *then reschedule ourselves.
  */
-void vmbus_on_event(unsigned long data)
+void vmbus_on_event(struct tasklet_struct *t)
 {
-   struct vmbus_channel *channel = (void *) data;
+   struct vmbus_channel *channel = from_tasklet(channel, t, 
callback_event);
unsigned long time_limit = jiffies + 2;
 
trace_vmbus_on_event(channel);
diff --git a/drivers/hv/hv.c b/drivers/hv/hv.c
index da69338f92f5..91a0582387d6 100644
--- a/drivers/hv/hv.c
+++ b/drivers/hv/hv.c
@@ -96,8 +96,7 @@ int hv_synic_alloc(void)
for_each_present_cpu(cpu) {
hv_cpu = per_cpu_ptr(hv_context.cpu_context, cpu);
 
-   tasklet_init(_cpu->msg_dpc,
-vmbus_on_msg_dpc, (unsigned long) hv_cpu);
+   tasklet_setup(_cpu->msg_dpc, vmbus_on_msg_dpc);
 
hv_cpu->synic_message_page =
(void *)get_zeroed_page(GFP_ATOMIC);
diff --git a/drivers/hv/hyperv_vmbus.h b/drivers/hv/hyperv_vmbus.h
index 40e2b9f91163..36199d8ea8c3 100644
--- a/drivers/hv/hyperv_vmbus.h
+++ b/drivers/hv/hyperv_vmbus.h
@@ -351,8 +351,8 @@ void vmbus_disconnect(void);
 
 int vmbus_post_msg(void *buffer, size_t buflen, bool can_sleep);
 
-void vmbus_on_event(unsigned long data);
-void vmbus_on_msg_dpc(unsigned long data);
+void vmbus_on_event(struct tasklet_struct *t);
+void vmbus_on_msg_dpc(struct tasklet_struct *t);
 
 int hv_kvp_init(struct hv_util_service *srv);
 void hv_kvp_deinit(void);
diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c
index 910b6e90866c..6b7987dac97a 100644
--- a/drivers/hv/vmbus_drv.c
+++ b/drivers/hv/vmbus_drv.c
@@ -1043,9 +1043,9 @@ static void vmbus_onmessage_work(struct work_struct *work)
kfree(ctx);
 }
 
-void vmbus_on_msg_dpc(unsigned long data)
+void vmbus_on_msg_dpc(struct tasklet_struct *t)
 {
-   struct hv_per_cpu_context *hv_cpu = (void *)data;
+   struct hv_per_cpu_context *hv_cpu = from_tasklet(hv_cpu, t, msg_dpc);
void *page_addr = hv_cpu->synic_message_page;
struct hv_message *msg = (struct hv_message *)page_addr +
  VMBUS_MESSAGE_SINT;
-- 
2.17.1



[PATCH] drivers: atm: convert tasklets to use new tasklet_setup() API

2020-08-17 Thread Allen Pais
From: Allen Pais 

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 
Signed-off-by: Allen Pais 
---
 drivers/atm/eni.c   |  9 +
 drivers/atm/fore200e.c  | 14 +++---
 drivers/atm/he.c|  8 
 drivers/atm/solos-pci.c |  8 
 4 files changed, 20 insertions(+), 19 deletions(-)

diff --git a/drivers/atm/eni.c b/drivers/atm/eni.c
index 39be444534d0..540edea0ad7a 100644
--- a/drivers/atm/eni.c
+++ b/drivers/atm/eni.c
@@ -1521,10 +1521,11 @@ static irqreturn_t eni_int(int irq,void *dev_id)
 }
 
 
-static void eni_tasklet(unsigned long data)
+static void eni_tasklet(struct tasklet_struct *t)
 {
-   struct atm_dev *dev = (struct atm_dev *) data;
-   struct eni_dev *eni_dev = ENI_DEV(dev);
+   struct eni_dev *eni_dev = from_tasklet(eni_dev, t, task);
+   struct atm_dev *dev = container_of((void *)eni_dev, typeof(*dev),
+ dev_data);
unsigned long flags;
u32 events;
 
@@ -1838,7 +1839,7 @@ static int eni_start(struct atm_dev *dev)
 eni_dev->vci,eni_dev->rx_dma,eni_dev->tx_dma,
 eni_dev->service,buf);
spin_lock_init(_dev->lock);
-   tasklet_init(_dev->task,eni_tasklet,(unsigned long) dev);
+   tasklet_setup(_dev->task,eni_tasklet);
eni_dev->events = 0;
/* initialize memory management */
buffer_mem = eni_dev->mem - (buf - eni_dev->ram);
diff --git a/drivers/atm/fore200e.c b/drivers/atm/fore200e.c
index a81bc49c14ac..8c6226b50e4d 100644
--- a/drivers/atm/fore200e.c
+++ b/drivers/atm/fore200e.c
@@ -1180,9 +1180,9 @@ fore200e_interrupt(int irq, void* dev)
 
 #ifdef FORE200E_USE_TASKLET
 static void
-fore200e_tx_tasklet(unsigned long data)
+fore200e_tx_tasklet(struct tasklet_struct *t)
 {
-struct fore200e* fore200e = (struct fore200e*) data;
+struct fore200e* fore200e = from_tasklet(fore200e, t, tx_tasklet);
 unsigned long flags;
 
 DPRINTK(3, "tx tasklet scheduled for device %d\n", 
fore200e->atm_dev->number);
@@ -1194,15 +1194,15 @@ fore200e_tx_tasklet(unsigned long data)
 
 
 static void
-fore200e_rx_tasklet(unsigned long data)
+fore200e_rx_tasklet(struct tasklet_struct *t)
 {
-struct fore200e* fore200e = (struct fore200e*) data;
+struct fore200e* fore200e = from_tasklet(fore200e, t, rx_tasklet);
 unsigned longflags;
 
 DPRINTK(3, "rx tasklet scheduled for device %d\n", 
fore200e->atm_dev->number);
 
 spin_lock_irqsave(>q_lock, flags);
-fore200e_rx_irq((struct fore200e*) data);
+fore200e_rx_irq(fore200e);
 spin_unlock_irqrestore(>q_lock, flags);
 }
 #endif
@@ -1943,8 +1943,8 @@ static int fore200e_irq_request(struct fore200e *fore200e)
   fore200e_irq_itoa(fore200e->irq), fore200e->name);
 
 #ifdef FORE200E_USE_TASKLET
-tasklet_init(>tx_tasklet, fore200e_tx_tasklet, (unsigned 
long)fore200e);
-tasklet_init(>rx_tasklet, fore200e_rx_tasklet, (unsigned 
long)fore200e);
+tasklet_setup(>tx_tasklet, fore200e_tx_tasklet);
+tasklet_setup(>rx_tasklet, fore200e_rx_tasklet);
 #endif
 
 fore200e->state = FORE200E_STATE_IRQ;
diff --git a/drivers/atm/he.c b/drivers/atm/he.c
index 8af793f5e811..9c36fea4336f 100644
--- a/drivers/atm/he.c
+++ b/drivers/atm/he.c
@@ -100,7 +100,7 @@ static void he_close(struct atm_vcc *vcc);
 static int he_send(struct atm_vcc *vcc, struct sk_buff *skb);
 static int he_ioctl(struct atm_dev *dev, unsigned int cmd, void __user *arg);
 static irqreturn_t he_irq_handler(int irq, void *dev_id);
-static void he_tasklet(unsigned long data);
+static void he_tasklet(struct tasklet_struct *t);
 static int he_proc_read(struct atm_dev *dev,loff_t *pos,char *page);
 static int he_start(struct atm_dev *dev);
 static void he_stop(struct he_dev *dev);
@@ -383,7 +383,7 @@ static int he_init_one(struct pci_dev *pci_dev,
he_dev->atm_dev->dev_data = he_dev;
atm_dev->dev_data = he_dev;
he_dev->number = atm_dev->number;
-   tasklet_init(_dev->tasklet, he_tasklet, (unsigned long) he_dev);
+   tasklet_setup(_dev->tasklet, he_tasklet);
spin_lock_init(_dev->global_lock);
 
if (he_start(atm_dev)) {
@@ -1925,10 +1925,10 @@ he_service_rbpl(struct he_dev *he_dev, int group)
 }
 
 static void
-he_tasklet(unsigned long data)
+he_tasklet(struct tasklet_struct *t)
 {
unsigned long flags;
-   struct he_dev *he_dev = (struct he_dev *) data;
+   struct he_dev *he_dev = from_tasklet(he_dev, t, tasklet);
int group, type;
int updated = 0;
 
diff --git a/drivers/atm/solos-pci.c b/drivers/atm/solos-pci.c
index 94fbc3abe60e..f44e1880cb74 100644
--- a/drivers/atm/solos-pci.c
+++ b/drivers/atm/solos-pci.c
@@ -167,7 +167,7 @@ 

[PATCH] char: ipmi: convert tasklets to use new tasklet_setup() API

2020-08-17 Thread Allen Pais
From: Allen Pais 

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 
Signed-off-by: Allen Pais 
---
 drivers/char/ipmi/ipmi_msghandler.c | 13 ++---
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/drivers/char/ipmi/ipmi_msghandler.c 
b/drivers/char/ipmi/ipmi_msghandler.c
index 737c0b6b24ea..e1814b6a1225 100644
--- a/drivers/char/ipmi/ipmi_msghandler.c
+++ b/drivers/char/ipmi/ipmi_msghandler.c
@@ -39,7 +39,7 @@
 
 static struct ipmi_recv_msg *ipmi_alloc_recv_msg(void);
 static int ipmi_init_msghandler(void);
-static void smi_recv_tasklet(unsigned long);
+static void smi_recv_tasklet(struct tasklet_struct *t);
 static void handle_new_recv_msgs(struct ipmi_smi *intf);
 static void need_waiter(struct ipmi_smi *intf);
 static int handle_one_recv_msg(struct ipmi_smi *intf,
@@ -3430,9 +3430,8 @@ int ipmi_add_smi(struct module *owner,
intf->curr_seq = 0;
spin_lock_init(>waiting_rcv_msgs_lock);
INIT_LIST_HEAD(>waiting_rcv_msgs);
-   tasklet_init(>recv_tasklet,
-smi_recv_tasklet,
-(unsigned long) intf);
+   tasklet_setup(>recv_tasklet,
+smi_recv_tasklet);
atomic_set(>watchdog_pretimeouts_to_deliver, 0);
spin_lock_init(>xmit_msgs_lock);
INIT_LIST_HEAD(>xmit_msgs);
@@ -4467,10 +4466,10 @@ static void handle_new_recv_msgs(struct ipmi_smi *intf)
}
 }
 
-static void smi_recv_tasklet(unsigned long val)
+static void smi_recv_tasklet(struct tasklet_struct *t)
 {
unsigned long flags = 0; /* keep us warning-free. */
-   struct ipmi_smi *intf = (struct ipmi_smi *) val;
+   struct ipmi_smi *intf = from_tasklet(intf, t, recv_tasklet);
int run_to_completion = intf->run_to_completion;
struct ipmi_smi_msg *newmsg = NULL;
 
@@ -4542,7 +4541,7 @@ void ipmi_smi_msg_received(struct ipmi_smi *intf,
spin_unlock_irqrestore(>xmit_msgs_lock, flags);
 
if (run_to_completion)
-   smi_recv_tasklet((unsigned long) intf);
+   smi_recv_tasklet(>recv_tasklet);
else
tasklet_schedule(>recv_tasklet);
 }
-- 
2.17.1



[PATCH] arch: um: convert tasklets to use new tasklet_setup() API

2020-08-17 Thread Allen Pais
From: Allen Pais 

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 
Signed-off-by: Allen Pais 
---
 arch/um/drivers/vector_kern.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/um/drivers/vector_kern.c b/arch/um/drivers/vector_kern.c
index 8735c468230a..06980870ae23 100644
--- a/arch/um/drivers/vector_kern.c
+++ b/arch/um/drivers/vector_kern.c
@@ -1196,9 +1196,9 @@ static int vector_net_close(struct net_device *dev)
 
 /* TX tasklet */
 
-static void vector_tx_poll(unsigned long data)
+static void vector_tx_poll(struct tasklet_struct *t)
 {
-   struct vector_private *vp = (struct vector_private *)data;
+   struct vector_private *vp = from_tasklet(vp, t, tx_poll);
 
vp->estats.tx_kicks++;
vector_send(vp->tx_queue);
@@ -1629,7 +1629,7 @@ static void vector_eth_configure(
});
 
dev->features = dev->hw_features = (NETIF_F_SG | NETIF_F_FRAGLIST);
-   tasklet_init(>tx_poll, vector_tx_poll, (unsigned long)vp);
+   tasklet_setup(>tx_poll, vector_tx_poll);
INIT_WORK(>reset_tx, vector_reset_tx);
 
timer_setup(>tl, vector_timer_expire, 0);
-- 
2.17.1



[PATCH 05/16] wireless: atmel: convert tasklets to use new tasklet_setup() API

2020-08-17 Thread Allen Pais
From: Allen Pais 

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
and remove .data field.

Signed-off-by: Romain Perier 
Signed-off-by: Allen Pais 
---
 drivers/net/wireless/atmel/at76c50x-usb.c | 9 -
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/net/wireless/atmel/at76c50x-usb.c 
b/drivers/net/wireless/atmel/at76c50x-usb.c
index a63b5c2f1e17..365c2ee19d03 100644
--- a/drivers/net/wireless/atmel/at76c50x-usb.c
+++ b/drivers/net/wireless/atmel/at76c50x-usb.c
@@ -1199,7 +1199,6 @@ static void at76_rx_callback(struct urb *urb)
 {
struct at76_priv *priv = urb->context;
 
-   priv->rx_tasklet.data = (unsigned long)urb;
tasklet_schedule(>rx_tasklet);
 }
 
@@ -1545,10 +1544,10 @@ static inline int at76_guess_freq(struct at76_priv 
*priv)
return ieee80211_channel_to_frequency(channel, NL80211_BAND_2GHZ);
 }
 
-static void at76_rx_tasklet(unsigned long param)
+static void at76_rx_tasklet(struct tasklet_struct *t)
 {
-   struct urb *urb = (struct urb *)param;
-   struct at76_priv *priv = urb->context;
+   struct at76_priv *priv = from_tasklet(priv, t, rx_tasklet);
+   struct urb *urb = priv->rx_urb;
struct at76_rx_buffer *buf;
struct ieee80211_rx_status rx_status = { 0 };
 
@@ -2215,7 +2214,7 @@ static struct at76_priv *at76_alloc_new_device(struct 
usb_device *udev)
INIT_WORK(>work_join_bssid, at76_work_join_bssid);
INIT_DELAYED_WORK(>dwork_hw_scan, at76_dwork_hw_scan);
 
-   tasklet_init(>rx_tasklet, at76_rx_tasklet, 0);
+   tasklet_setup(>rx_tasklet, at76_rx_tasklet);
 
priv->pm_mode = AT76_PM_OFF;
priv->pm_period = 0;
-- 
2.17.1



[PATCH 07/16] wireless: brcm80211: convert tasklets to use new tasklet_setup() API

2020-08-17 Thread Allen Pais
From: Allen Pais 

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 
Signed-off-by: Allen Pais 
---
 .../net/wireless/broadcom/brcm80211/brcmsmac/mac80211_if.c  | 6 +++---
 .../net/wireless/broadcom/brcm80211/brcmsmac/mac80211_if.h  | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmsmac/mac80211_if.c 
b/drivers/net/wireless/broadcom/brcm80211/brcmsmac/mac80211_if.c
index 648efcbc819f..521abe5ce5b8 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmsmac/mac80211_if.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmsmac/mac80211_if.c
@@ -982,11 +982,11 @@ static const struct ieee80211_ops brcms_ops = {
.set_tim = brcms_ops_beacon_set_tim,
 };
 
-void brcms_dpc(unsigned long data)
+void brcms_dpc(struct tasklet_struct *t)
 {
struct brcms_info *wl;
 
-   wl = (struct brcms_info *) data;
+   wl = from_tasklet(wl, t, tasklet);
 
spin_lock_bh(>lock);
 
@@ -1149,7 +1149,7 @@ static struct brcms_info *brcms_attach(struct bcma_device 
*pdev)
init_waitqueue_head(>tx_flush_wq);
 
/* setup the bottom half handler */
-   tasklet_init(>tasklet, brcms_dpc, (unsigned long) wl);
+   tasklet_setup(>tasklet, brcms_dpc);
 
spin_lock_init(>lock);
spin_lock_init(>isr_lock);
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmsmac/mac80211_if.h 
b/drivers/net/wireless/broadcom/brcm80211/brcmsmac/mac80211_if.h
index 198053dfc310..eaf926a96a88 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmsmac/mac80211_if.h
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmsmac/mac80211_if.h
@@ -106,7 +106,7 @@ struct brcms_timer *brcms_init_timer(struct brcms_info *wl,
 void brcms_free_timer(struct brcms_timer *timer);
 void brcms_add_timer(struct brcms_timer *timer, uint ms, int periodic);
 bool brcms_del_timer(struct brcms_timer *timer);
-void brcms_dpc(unsigned long data);
+void brcms_dpc(struct tasklet_struct *t);
 void brcms_timer(struct brcms_timer *t);
 void brcms_fatal_error(struct brcms_info *wl);
 
-- 
2.17.1



[PATCH 06/16] wireless: b43legacy: convert tasklets to use new tasklet_setup() API

2020-08-17 Thread Allen Pais
From: Allen Pais 

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 
Signed-off-by: Allen Pais 
---
 drivers/net/wireless/broadcom/b43legacy/main.c | 8 +++-
 drivers/net/wireless/broadcom/b43legacy/pio.c  | 7 +++
 2 files changed, 6 insertions(+), 9 deletions(-)

diff --git a/drivers/net/wireless/broadcom/b43legacy/main.c 
b/drivers/net/wireless/broadcom/b43legacy/main.c
index 2eaf481f03f1..15d592cf056c 100644
--- a/drivers/net/wireless/broadcom/b43legacy/main.c
+++ b/drivers/net/wireless/broadcom/b43legacy/main.c
@@ -1275,9 +1275,9 @@ static void handle_irq_ucode_debug(struct b43legacy_wldev 
*dev)
 }
 
 /* Interrupt handler bottom-half */
-static void b43legacy_interrupt_tasklet(unsigned long data)
+static void b43legacy_interrupt_tasklet(struct tasklet_struct *t)
 {
-   struct b43legacy_wldev *dev = (struct b43legacy_wldev *)data;
+   struct b43legacy_wldev *dev = from_tasklet(dev, t, isr_tasklet);
u32 reason;
u32 dma_reason[ARRAY_SIZE(dev->dma_reason)];
u32 merged_dma_reason = 0;
@@ -3741,9 +3741,7 @@ static int b43legacy_one_core_attach(struct ssb_device 
*dev,
wldev->wl = wl;
b43legacy_set_status(wldev, B43legacy_STAT_UNINIT);
wldev->bad_frames_preempt = modparam_bad_frames_preempt;
-   tasklet_init(>isr_tasklet,
-b43legacy_interrupt_tasklet,
-(unsigned long)wldev);
+   tasklet_setup(>isr_tasklet, b43legacy_interrupt_tasklet);
if (modparam_pio)
wldev->__using_pio = true;
INIT_LIST_HEAD(>list);
diff --git a/drivers/net/wireless/broadcom/b43legacy/pio.c 
b/drivers/net/wireless/broadcom/b43legacy/pio.c
index cbb761378619..aac413d0f629 100644
--- a/drivers/net/wireless/broadcom/b43legacy/pio.c
+++ b/drivers/net/wireless/broadcom/b43legacy/pio.c
@@ -264,9 +264,9 @@ static int pio_tx_packet(struct b43legacy_pio_txpacket 
*packet)
return 0;
 }
 
-static void tx_tasklet(unsigned long d)
+static void tx_tasklet(struct tasklet_struct *t)
 {
-   struct b43legacy_pioqueue *queue = (struct b43legacy_pioqueue *)d;
+   struct b43legacy_pioqueue *queue = from_tasklet(queue, t, txtask);
struct b43legacy_wldev *dev = queue->dev;
unsigned long flags;
struct b43legacy_pio_txpacket *packet, *tmp_packet;
@@ -331,8 +331,7 @@ struct b43legacy_pioqueue *b43legacy_setup_pioqueue(struct 
b43legacy_wldev *dev,
INIT_LIST_HEAD(>txfree);
INIT_LIST_HEAD(>txqueue);
INIT_LIST_HEAD(>txrunning);
-   tasklet_init(>txtask, tx_tasklet,
-(unsigned long)queue);
+   tasklet_setup(>txtask, tx_tasklet);
 
value = b43legacy_read32(dev, B43legacy_MMIO_MACCTL);
value &= ~B43legacy_MACCTL_BE;
-- 
2.17.1



[PATCH 10/16] wireless: intersil: convert tasklets to use new tasklet_setup() API

2020-08-17 Thread Allen Pais
From: Allen Pais 

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
and remove .data field.

Signed-off-by: Romain Perier 
Signed-off-by: Allen Pais 
---
 .../net/wireless/intersil/hostap/hostap_hw.c   | 18 +-
 drivers/net/wireless/intersil/orinoco/main.c   |  7 +++
 drivers/net/wireless/intersil/p54/p54pci.c |  8 
 3 files changed, 16 insertions(+), 17 deletions(-)

diff --git a/drivers/net/wireless/intersil/hostap/hostap_hw.c 
b/drivers/net/wireless/intersil/hostap/hostap_hw.c
index b6c497ce12e1..ba00a4d8a26f 100644
--- a/drivers/net/wireless/intersil/hostap/hostap_hw.c
+++ b/drivers/net/wireless/intersil/hostap/hostap_hw.c
@@ -2083,9 +2083,9 @@ static void hostap_rx_skb(local_info_t *local, struct 
sk_buff *skb)
 
 
 /* Called only as a tasklet (software IRQ) */
-static void hostap_rx_tasklet(unsigned long data)
+static void hostap_rx_tasklet(struct tasklet_struct *t)
 {
-   local_info_t *local = (local_info_t *) data;
+   local_info_t *local = from_tasklet(local, t, rx_tasklet);
struct sk_buff *skb;
 
while ((skb = skb_dequeue(>rx_list)) != NULL)
@@ -2288,9 +2288,9 @@ static void prism2_tx_ev(local_info_t *local)
 
 
 /* Called only as a tasklet (software IRQ) */
-static void hostap_sta_tx_exc_tasklet(unsigned long data)
+static void hostap_sta_tx_exc_tasklet(struct tasklet_struct *t)
 {
-   local_info_t *local = (local_info_t *) data;
+   local_info_t *local = from_tasklet(local, t, sta_tx_exc_tasklet);
struct sk_buff *skb;
 
while ((skb = skb_dequeue(>sta_tx_exc_list)) != NULL) {
@@ -2390,9 +2390,9 @@ static void prism2_txexc(local_info_t *local)
 
 
 /* Called only as a tasklet (software IRQ) */
-static void hostap_info_tasklet(unsigned long data)
+static void hostap_info_tasklet(struct tasklet_struct *t)
 {
-   local_info_t *local = (local_info_t *) data;
+   local_info_t *local = from_tasklet(local, t, info_tasklet);
struct sk_buff *skb;
 
while ((skb = skb_dequeue(>info_list)) != NULL) {
@@ -2469,9 +2469,9 @@ static void prism2_info(local_info_t *local)
 
 
 /* Called only as a tasklet (software IRQ) */
-static void hostap_bap_tasklet(unsigned long data)
+static void hostap_bap_tasklet(struct tasklet_struct *t)
 {
-   local_info_t *local = (local_info_t *) data;
+   local_info_t *local = from_tasklet(local, t, bap_tasklet);
struct net_device *dev = local->dev;
u16 ev;
int frames = 30;
@@ -3183,7 +3183,7 @@ prism2_init_local_data(struct prism2_helper_functions 
*funcs, int card_idx,
/* Initialize tasklets for handling hardware IRQ related operations
 * outside hw IRQ handler */
 #define HOSTAP_TASKLET_INIT(q, f, d) \
-do { memset((q), 0, sizeof(*(q))); (q)->func = (f); (q)->data = (d); } \
+do { memset((q), 0, sizeof(*(q))); (q)->func = (void(*)(unsigned long))(f); } \
 while (0)
HOSTAP_TASKLET_INIT(>bap_tasklet, hostap_bap_tasklet,
(unsigned long) local);
diff --git a/drivers/net/wireless/intersil/orinoco/main.c 
b/drivers/net/wireless/intersil/orinoco/main.c
index 00264a14e52c..78d3cb986c19 100644
--- a/drivers/net/wireless/intersil/orinoco/main.c
+++ b/drivers/net/wireless/intersil/orinoco/main.c
@@ -1062,9 +1062,9 @@ static void orinoco_rx(struct net_device *dev,
stats->rx_dropped++;
 }
 
-static void orinoco_rx_isr_tasklet(unsigned long data)
+static void orinoco_rx_isr_tasklet(struct tasklet_struct *t)
 {
-   struct orinoco_private *priv = (struct orinoco_private *) data;
+   struct orinoco_private *priv = from_tasklet(priv, t, rx_tasklet);
struct net_device *dev = priv->ndev;
struct orinoco_rx_data *rx_data, *temp;
struct hermes_rx_descriptor *desc;
@@ -2198,8 +2198,7 @@ struct orinoco_private
INIT_WORK(>wevent_work, orinoco_send_wevents);
 
INIT_LIST_HEAD(>rx_list);
-   tasklet_init(>rx_tasklet, orinoco_rx_isr_tasklet,
-(unsigned long) priv);
+   tasklet_setup(>rx_tasklet, orinoco_rx_isr_tasklet);
 
spin_lock_init(>scan_lock);
INIT_LIST_HEAD(>scan_list);
diff --git a/drivers/net/wireless/intersil/p54/p54pci.c 
b/drivers/net/wireless/intersil/p54/p54pci.c
index 9d96c8b8409d..94064d7cff52 100644
--- a/drivers/net/wireless/intersil/p54/p54pci.c
+++ b/drivers/net/wireless/intersil/p54/p54pci.c
@@ -278,10 +278,10 @@ static void p54p_check_tx_ring(struct ieee80211_hw *dev, 
u32 *index,
}
 }
 
-static void p54p_tasklet(unsigned long dev_id)
+static void p54p_tasklet(struct tasklet_struct *t)
 {
-   struct ieee80211_hw *dev = (struct ieee80211_hw *)dev_id;
-   struct p54p_priv *priv = dev->priv;
+   struct p54p_priv *priv = from_tasklet(priv, t, tasklet);
+   struct ieee80211_hw

[PATCH 16/16] wireless: zydas: convert tasklets to use new tasklet_setup() API

2020-08-17 Thread Allen Pais
From: Allen Pais 

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
and remove .data fieldd

Signed-off-by: Romain Perier 
Signed-off-by: Allen Pais 
---
 drivers/net/wireless/zydas/zd1211rw/zd_usb.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/wireless/zydas/zd1211rw/zd_usb.c 
b/drivers/net/wireless/zydas/zd1211rw/zd_usb.c
index 65b5985ad402..8b3d248bac6e 100644
--- a/drivers/net/wireless/zydas/zd1211rw/zd_usb.c
+++ b/drivers/net/wireless/zydas/zd1211rw/zd_usb.c
@@ -1140,9 +1140,9 @@ static void zd_rx_idle_timer_handler(struct work_struct 
*work)
zd_usb_reset_rx(usb);
 }
 
-static void zd_usb_reset_rx_idle_timer_tasklet(unsigned long param)
+static void zd_usb_reset_rx_idle_timer_tasklet(struct tasklet_struct *t)
 {
-   struct zd_usb *usb = (struct zd_usb *)param;
+   struct zd_usb *usb = from_tasklet(usb, t, rx.reset_timer_tasklet);
 
zd_usb_reset_rx_idle_timer(usb);
 }
@@ -1178,8 +1178,8 @@ static inline void init_usb_rx(struct zd_usb *usb)
}
ZD_ASSERT(rx->fragment_length == 0);
INIT_DELAYED_WORK(>idle_work, zd_rx_idle_timer_handler);
-   rx->reset_timer_tasklet.func = zd_usb_reset_rx_idle_timer_tasklet;
-   rx->reset_timer_tasklet.data = (unsigned long)usb;
+   rx->reset_timer_tasklet.func = (void (*)(unsigned long))
+   zd_usb_reset_rx_idle_timer_tasklet;
 }
 
 static inline void init_usb_tx(struct zd_usb *usb)
-- 
2.17.1



[PATCH 15/16] wireless: realtek: convert tasklets to use new tasklet_setup() API

2020-08-17 Thread Allen Pais
From: Allen Pais 

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
and remove .data field.

Signed-off-by: Romain Perier 
Signed-off-by: Allen Pais 
---
 drivers/net/wireless/realtek/rtlwifi/pci.c | 21 ++---
 drivers/net/wireless/realtek/rtlwifi/usb.c |  9 -
 drivers/net/wireless/realtek/rtw88/main.c  |  3 +--
 drivers/net/wireless/realtek/rtw88/tx.c|  4 ++--
 drivers/net/wireless/realtek/rtw88/tx.h|  2 +-
 5 files changed, 18 insertions(+), 21 deletions(-)

diff --git a/drivers/net/wireless/realtek/rtlwifi/pci.c 
b/drivers/net/wireless/realtek/rtlwifi/pci.c
index 25335bd2873b..42099369fa35 100644
--- a/drivers/net/wireless/realtek/rtlwifi/pci.c
+++ b/drivers/net/wireless/realtek/rtlwifi/pci.c
@@ -1061,16 +1061,18 @@ static irqreturn_t _rtl_pci_interrupt(int irq, void 
*dev_id)
return ret;
 }
 
-static void _rtl_pci_irq_tasklet(unsigned long data)
+static void _rtl_pci_irq_tasklet(struct tasklet_struct *t)
 {
-   struct ieee80211_hw *hw = (struct ieee80211_hw *)data;
+   struct rtl_priv *rtlpriv = from_tasklet(rtlpriv, t, works.irq_tasklet);
+   struct ieee80211_hw *hw = rtlpriv->hw;
_rtl_pci_tx_chk_waitq(hw);
 }
 
-static void _rtl_pci_prepare_bcn_tasklet(unsigned long data)
+static void _rtl_pci_prepare_bcn_tasklet(struct tasklet_struct *t)
 {
-   struct ieee80211_hw *hw = (struct ieee80211_hw *)data;
-   struct rtl_priv *rtlpriv = rtl_priv(hw);
+   struct rtl_priv *rtlpriv = from_tasklet(rtlpriv, t,
+   works.irq_prepare_bcn_tasklet);
+   struct ieee80211_hw *hw = rtlpriv->hw;
struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw));
struct rtl_mac *mac = rtl_mac(rtl_priv(hw));
struct rtl8192_tx_ring *ring = NULL;
@@ -1194,12 +1196,9 @@ static void _rtl_pci_init_struct(struct ieee80211_hw *hw,
rtlpci->acm_method = EACMWAY2_SW;
 
/*task */
-   tasklet_init(>works.irq_tasklet,
-_rtl_pci_irq_tasklet,
-(unsigned long)hw);
-   tasklet_init(>works.irq_prepare_bcn_tasklet,
-_rtl_pci_prepare_bcn_tasklet,
-(unsigned long)hw);
+   tasklet_setup(>works.irq_tasklet, _rtl_pci_irq_tasklet);
+   tasklet_setup(>works.irq_prepare_bcn_tasklet,
+_rtl_pci_prepare_bcn_tasklet);
INIT_WORK(>works.lps_change_work,
  rtl_lps_change_work_callback);
 }
diff --git a/drivers/net/wireless/realtek/rtlwifi/usb.c 
b/drivers/net/wireless/realtek/rtlwifi/usb.c
index d05e709536ea..8740818e8d87 100644
--- a/drivers/net/wireless/realtek/rtlwifi/usb.c
+++ b/drivers/net/wireless/realtek/rtlwifi/usb.c
@@ -289,7 +289,7 @@ static int _rtl_usb_init_tx(struct ieee80211_hw *hw)
return 0;
 }
 
-static void _rtl_rx_work(unsigned long param);
+static void _rtl_rx_work(struct tasklet_struct *t);
 
 static int _rtl_usb_init_rx(struct ieee80211_hw *hw)
 {
@@ -310,8 +310,7 @@ static int _rtl_usb_init_rx(struct ieee80211_hw *hw)
init_usb_anchor(>rx_cleanup_urbs);
 
skb_queue_head_init(>rx_queue);
-   rtlusb->rx_work_tasklet.func = _rtl_rx_work;
-   rtlusb->rx_work_tasklet.data = (unsigned long)rtlusb;
+   rtlusb->rx_work_tasklet.func = (void(*)(unsigned long))_rtl_rx_work;
 
return 0;
 }
@@ -528,9 +527,9 @@ static void _rtl_rx_pre_process(struct ieee80211_hw *hw, 
struct sk_buff *skb)
 
 #define __RX_SKB_MAX_QUEUED64
 
-static void _rtl_rx_work(unsigned long param)
+static void _rtl_rx_work(struct tasklet_struct *t)
 {
-   struct rtl_usb *rtlusb = (struct rtl_usb *)param;
+   struct rtl_usb *rtlusb = from_tasklet(rtlusb, t, rx_work_tasklet);
struct ieee80211_hw *hw = usb_get_intfdata(rtlusb->intf);
struct sk_buff *skb;
 
diff --git a/drivers/net/wireless/realtek/rtw88/main.c 
b/drivers/net/wireless/realtek/rtw88/main.c
index 54044abf30d7..6719c687a322 100644
--- a/drivers/net/wireless/realtek/rtw88/main.c
+++ b/drivers/net/wireless/realtek/rtw88/main.c
@@ -1422,8 +1422,7 @@ int rtw_core_init(struct rtw_dev *rtwdev)
 
timer_setup(>tx_report.purge_timer,
rtw_tx_report_purge_timer, 0);
-   tasklet_init(>tx_tasklet, rtw_tx_tasklet,
-(unsigned long)rtwdev);
+   tasklet_setup(>tx_tasklet, rtw_tx_tasklet);
 
INIT_DELAYED_WORK(>watch_dog_work, rtw_watch_dog_work);
INIT_DELAYED_WORK(>bt_relink_work, rtw_coex_bt_relink_work);
diff --git a/drivers/net/wireless/realtek/rtw88/tx.c 
b/drivers/net/wireless/realtek/rtw88/tx.c
index 7fcc992b01a8..ca8072177ae3 100644
--- a/drivers/net/wireless/realtek/rtw88/tx.c
+++ b/drivers/net/wireless/realtek/rtw88/tx.c
@@ -587,9 +587,9 @@ static void rtw_txq_push(struct rtw_dev *rtwdev,
r

[PATCH 12/16] wireless: mediatek: convert tasklets to use new tasklet_setup() API

2020-08-17 Thread Allen Pais
From: Allen Pais 

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 
Signed-off-by: Allen Pais 
---
 drivers/net/wireless/mediatek/mt76/mac80211.c  |  2 +-
 drivers/net/wireless/mediatek/mt76/mt76.h  |  2 +-
 drivers/net/wireless/mediatek/mt76/mt7603/beacon.c |  4 ++--
 drivers/net/wireless/mediatek/mt76/mt7603/init.c   |  3 +--
 drivers/net/wireless/mediatek/mt76/mt7603/mt7603.h |  2 +-
 drivers/net/wireless/mediatek/mt76/mt7615/mmio.c   |  6 +++---
 drivers/net/wireless/mediatek/mt76/mt76x02_dfs.c   | 10 +-
 drivers/net/wireless/mediatek/mt76/mt76x02_mmio.c  | 14 ++
 drivers/net/wireless/mediatek/mt76/tx.c|  4 ++--
 drivers/net/wireless/mediatek/mt76/usb.c   | 12 ++--
 drivers/net/wireless/mediatek/mt7601u/dma.c| 12 ++--
 11 files changed, 34 insertions(+), 37 deletions(-)

diff --git a/drivers/net/wireless/mediatek/mt76/mac80211.c 
b/drivers/net/wireless/mediatek/mt76/mac80211.c
index 3d4bf72700a5..1f62f069a0dc 100644
--- a/drivers/net/wireless/mediatek/mt76/mac80211.c
+++ b/drivers/net/wireless/mediatek/mt76/mac80211.c
@@ -439,7 +439,7 @@ mt76_alloc_device(struct device *pdev, unsigned int size,
for (i = 0; i < ARRAY_SIZE(dev->q_rx); i++)
skb_queue_head_init(>rx_skb[i]);
 
-   tasklet_init(>tx_tasklet, mt76_tx_tasklet, (unsigned long)dev);
+   tasklet_setup(>tx_tasklet, mt76_tx_tasklet);
 
dev->wq = alloc_ordered_workqueue("mt76", 0);
if (!dev->wq) {
diff --git a/drivers/net/wireless/mediatek/mt76/mt76.h 
b/drivers/net/wireless/mediatek/mt76/mt76.h
index af35bc388ae2..1ab52fc37a1c 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76.h
+++ b/drivers/net/wireless/mediatek/mt76/mt76.h
@@ -899,7 +899,7 @@ void mt76_stop_tx_queues(struct mt76_dev *dev, struct 
ieee80211_sta *sta,
 bool send_bar);
 void mt76_txq_schedule(struct mt76_phy *phy, enum mt76_txq_id qid);
 void mt76_txq_schedule_all(struct mt76_phy *phy);
-void mt76_tx_tasklet(unsigned long data);
+void mt76_tx_tasklet(struct tasklet_struct *t);
 void mt76_release_buffered_frames(struct ieee80211_hw *hw,
  struct ieee80211_sta *sta,
  u16 tids, int nframes,
diff --git a/drivers/net/wireless/mediatek/mt76/mt7603/beacon.c 
b/drivers/net/wireless/mediatek/mt76/mt7603/beacon.c
index 7a41cdf1c4ae..ab6771c6d2a6 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7603/beacon.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7603/beacon.c
@@ -64,9 +64,9 @@ mt7603_add_buffered_bc(void *priv, u8 *mac, struct 
ieee80211_vif *vif)
data->count[mvif->idx]++;
 }
 
-void mt7603_pre_tbtt_tasklet(unsigned long arg)
+void mt7603_pre_tbtt_tasklet(struct tasklet_struct *t)
 {
-   struct mt7603_dev *dev = (struct mt7603_dev *)arg;
+   struct mt7603_dev *dev = from_tasklet(dev, t, mt76.pre_tbtt_tasklet);
struct mt76_queue *q;
struct beacon_bc_data data = {};
struct sk_buff *skb;
diff --git a/drivers/net/wireless/mediatek/mt76/mt7603/init.c 
b/drivers/net/wireless/mediatek/mt76/mt7603/init.c
index 94196599797e..a5aaa790692a 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7603/init.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7603/init.c
@@ -533,8 +533,7 @@ int mt7603_register_device(struct mt7603_dev *dev)
spin_lock_init(>ps_lock);
 
INIT_DELAYED_WORK(>mt76.mac_work, mt7603_mac_work);
-   tasklet_init(>mt76.pre_tbtt_tasklet, mt7603_pre_tbtt_tasklet,
-(unsigned long)dev);
+   tasklet_setup(>mt76.pre_tbtt_tasklet, mt7603_pre_tbtt_tasklet);
 
/* Check for 7688, which only has 1SS */
dev->mphy.antenna_mask = 3;
diff --git a/drivers/net/wireless/mediatek/mt76/mt7603/mt7603.h 
b/drivers/net/wireless/mediatek/mt76/mt7603/mt7603.h
index c86305241e66..582d356382ed 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7603/mt7603.h
+++ b/drivers/net/wireless/mediatek/mt76/mt7603/mt7603.h
@@ -255,7 +255,7 @@ void mt7603_sta_assoc(struct mt76_dev *mdev, struct 
ieee80211_vif *vif,
 void mt7603_sta_remove(struct mt76_dev *mdev, struct ieee80211_vif *vif,
   struct ieee80211_sta *sta);
 
-void mt7603_pre_tbtt_tasklet(unsigned long arg);
+void mt7603_pre_tbtt_tasklet(struct tasklet_struct *t);
 
 void mt7603_update_channel(struct mt76_dev *mdev);
 
diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/mmio.c 
b/drivers/net/wireless/mediatek/mt76/mt7615/mmio.c
index 133f93a6ed1b..c081a1c0449c 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7615/mmio.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7615/mmio.c
@@ -98,9 +98,9 @@ static irqreturn_t mt7615_irq_handler(int irq, void 
*dev_instance)
return IRQ_HANDLED;
 }
 
-static void

[PATCH 14/16] wireless: ralink: convert tasklets to use new tasklet_setup() API

2020-08-17 Thread Allen Pais
From: Allen Pais 

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 
Signed-off-by: Allen Pais 
---
 .../net/wireless/ralink/rt2x00/rt2400pci.c| 14 ++-
 .../net/wireless/ralink/rt2x00/rt2500pci.c| 14 ++-
 .../net/wireless/ralink/rt2x00/rt2800mmio.c   | 24 +++
 .../net/wireless/ralink/rt2x00/rt2800mmio.h   | 10 
 drivers/net/wireless/ralink/rt2x00/rt2x00.h   | 10 
 .../net/wireless/ralink/rt2x00/rt2x00dev.c|  5 ++--
 drivers/net/wireless/ralink/rt2x00/rt61pci.c  | 20 +---
 7 files changed, 54 insertions(+), 43 deletions(-)

diff --git a/drivers/net/wireless/ralink/rt2x00/rt2400pci.c 
b/drivers/net/wireless/ralink/rt2x00/rt2400pci.c
index c1ac933349d1..687a4686f3ae 100644
--- a/drivers/net/wireless/ralink/rt2x00/rt2400pci.c
+++ b/drivers/net/wireless/ralink/rt2x00/rt2400pci.c
@@ -1319,9 +1319,10 @@ static inline void rt2400pci_enable_interrupt(struct 
rt2x00_dev *rt2x00dev,
spin_unlock_irq(>irqmask_lock);
 }
 
-static void rt2400pci_txstatus_tasklet(unsigned long data)
+static void rt2400pci_txstatus_tasklet(struct tasklet_struct *t)
 {
-   struct rt2x00_dev *rt2x00dev = (struct rt2x00_dev *)data;
+   struct rt2x00_dev *rt2x00dev = from_tasklet(rt2x00dev, t,
+   txstatus_tasklet);
u32 reg;
 
/*
@@ -1347,17 +1348,18 @@ static void rt2400pci_txstatus_tasklet(unsigned long 
data)
}
 }
 
-static void rt2400pci_tbtt_tasklet(unsigned long data)
+static void rt2400pci_tbtt_tasklet(struct tasklet_struct *t)
 {
-   struct rt2x00_dev *rt2x00dev = (struct rt2x00_dev *)data;
+   struct rt2x00_dev *rt2x00dev = from_tasklet(rt2x00dev, t, tbtt_tasklet);
rt2x00lib_beacondone(rt2x00dev);
if (test_bit(DEVICE_STATE_ENABLED_RADIO, >flags))
rt2400pci_enable_interrupt(rt2x00dev, CSR8_TBCN_EXPIRE);
 }
 
-static void rt2400pci_rxdone_tasklet(unsigned long data)
+static void rt2400pci_rxdone_tasklet(struct tasklet_struct *t)
 {
-   struct rt2x00_dev *rt2x00dev = (struct rt2x00_dev *)data;
+   struct rt2x00_dev *rt2x00dev = from_tasklet(rt2x00dev, t,
+   rxdone_tasklet);
if (rt2x00mmio_rxdone(rt2x00dev))
tasklet_schedule(>rxdone_tasklet);
else if (test_bit(DEVICE_STATE_ENABLED_RADIO, >flags))
diff --git a/drivers/net/wireless/ralink/rt2x00/rt2500pci.c 
b/drivers/net/wireless/ralink/rt2x00/rt2500pci.c
index 0859adebd860..ea06041f594a 100644
--- a/drivers/net/wireless/ralink/rt2x00/rt2500pci.c
+++ b/drivers/net/wireless/ralink/rt2x00/rt2500pci.c
@@ -1447,9 +1447,10 @@ static inline void rt2500pci_enable_interrupt(struct 
rt2x00_dev *rt2x00dev,
spin_unlock_irq(>irqmask_lock);
 }
 
-static void rt2500pci_txstatus_tasklet(unsigned long data)
+static void rt2500pci_txstatus_tasklet(struct tasklet_struct *t)
 {
-   struct rt2x00_dev *rt2x00dev = (struct rt2x00_dev *)data;
+   struct rt2x00_dev *rt2x00dev = from_tasklet(rt2x00dev, t,
+   txstatus_tasklet);
u32 reg;
 
/*
@@ -1475,17 +1476,18 @@ static void rt2500pci_txstatus_tasklet(unsigned long 
data)
}
 }
 
-static void rt2500pci_tbtt_tasklet(unsigned long data)
+static void rt2500pci_tbtt_tasklet(struct tasklet_struct *t)
 {
-   struct rt2x00_dev *rt2x00dev = (struct rt2x00_dev *)data;
+   struct rt2x00_dev *rt2x00dev = from_tasklet(rt2x00dev, t, tbtt_tasklet);
rt2x00lib_beacondone(rt2x00dev);
if (test_bit(DEVICE_STATE_ENABLED_RADIO, >flags))
rt2500pci_enable_interrupt(rt2x00dev, CSR8_TBCN_EXPIRE);
 }
 
-static void rt2500pci_rxdone_tasklet(unsigned long data)
+static void rt2500pci_rxdone_tasklet(struct tasklet_struct *t)
 {
-   struct rt2x00_dev *rt2x00dev = (struct rt2x00_dev *)data;
+   struct rt2x00_dev *rt2x00dev = from_tasklet(rt2x00dev, t,
+   rxdone_tasklet);
if (rt2x00mmio_rxdone(rt2x00dev))
tasklet_schedule(>rxdone_tasklet);
else if (test_bit(DEVICE_STATE_ENABLED_RADIO, >flags))
diff --git a/drivers/net/wireless/ralink/rt2x00/rt2800mmio.c 
b/drivers/net/wireless/ralink/rt2x00/rt2800mmio.c
index 110bb391c372..d4fb3cc6d6a3 100644
--- a/drivers/net/wireless/ralink/rt2x00/rt2800mmio.c
+++ b/drivers/net/wireless/ralink/rt2x00/rt2800mmio.c
@@ -210,18 +210,19 @@ static inline void rt2800mmio_enable_interrupt(struct 
rt2x00_dev *rt2x00dev,
spin_unlock_irq(>irqmask_lock);
 }
 
-void rt2800mmio_pretbtt_tasklet(unsigned long data)
+void rt2800mmio_pretbtt_tasklet(struct tasklet_struct *t)
 {
-   struct rt2x00_dev *rt2x00dev = (struct rt2x00_dev *)data;
+   s

[PATCH 13/16] wireless: quantenna: convert tasklets to use new tasklet_setup() API

2020-08-17 Thread Allen Pais
From: Allen Pais 

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 
Signed-off-by: Allen Pais 
---
 drivers/net/wireless/quantenna/qtnfmac/pcie/pearl_pcie.c | 7 +++
 drivers/net/wireless/quantenna/qtnfmac/pcie/topaz_pcie.c | 7 +++
 2 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/drivers/net/wireless/quantenna/qtnfmac/pcie/pearl_pcie.c 
b/drivers/net/wireless/quantenna/qtnfmac/pcie/pearl_pcie.c
index eb67b66b846b..9a20c0f29078 100644
--- a/drivers/net/wireless/quantenna/qtnfmac/pcie/pearl_pcie.c
+++ b/drivers/net/wireless/quantenna/qtnfmac/pcie/pearl_pcie.c
@@ -1091,9 +1091,9 @@ static void qtnf_pearl_fw_work_handler(struct work_struct 
*work)
put_device(>dev);
 }
 
-static void qtnf_pearl_reclaim_tasklet_fn(unsigned long data)
+static void qtnf_pearl_reclaim_tasklet_fn(struct tasklet_struct *t)
 {
-   struct qtnf_pcie_pearl_state *ps = (void *)data;
+   struct qtnf_pcie_pearl_state *ps = from_tasklet(ps, t, base.reclaim_tq);
 
qtnf_pearl_data_tx_reclaim(ps);
qtnf_en_txdone_irq(ps);
@@ -1145,8 +1145,7 @@ static int qtnf_pcie_pearl_probe(struct qtnf_bus *bus, 
unsigned int tx_bd_size,
return ret;
}
 
-   tasklet_init(>base.reclaim_tq, qtnf_pearl_reclaim_tasklet_fn,
-(unsigned long)ps);
+   tasklet_setup(>base.reclaim_tq, qtnf_pearl_reclaim_tasklet_fn);
netif_napi_add(>mux_dev, >mux_napi,
   qtnf_pcie_pearl_rx_poll, 10);
 
diff --git a/drivers/net/wireless/quantenna/qtnfmac/pcie/topaz_pcie.c 
b/drivers/net/wireless/quantenna/qtnfmac/pcie/topaz_pcie.c
index d1b850aa4657..4b87d3151017 100644
--- a/drivers/net/wireless/quantenna/qtnfmac/pcie/topaz_pcie.c
+++ b/drivers/net/wireless/quantenna/qtnfmac/pcie/topaz_pcie.c
@@ -1105,9 +1105,9 @@ static void qtnf_topaz_fw_work_handler(struct work_struct 
*work)
put_device(>dev);
 }
 
-static void qtnf_reclaim_tasklet_fn(unsigned long data)
+static void qtnf_reclaim_tasklet_fn(struct tasklet_struct *t)
 {
-   struct qtnf_pcie_topaz_state *ts = (void *)data;
+   struct qtnf_pcie_topaz_state *ts = from_tasklet(ts, t, base.reclaim_tq);
 
qtnf_topaz_data_tx_reclaim(ts);
 }
@@ -1158,8 +1158,7 @@ static int qtnf_pcie_topaz_probe(struct qtnf_bus *bus,
return ret;
}
 
-   tasklet_init(>base.reclaim_tq, qtnf_reclaim_tasklet_fn,
-(unsigned long)ts);
+   tasklet_setup(>base.reclaim_tq, qtnf_reclaim_tasklet_fn);
netif_napi_add(>mux_dev, >mux_napi,
   qtnf_topaz_rx_poll, 10);
 
-- 
2.17.1



[PATCH 09/16] wireless: iwlegacy: convert tasklets to use new tasklet_setup() API

2020-08-17 Thread Allen Pais
From: Allen Pais 

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 
Signed-off-by: Allen Pais 
---
 drivers/net/wireless/intel/iwlegacy/3945-mac.c | 8 +++-
 drivers/net/wireless/intel/iwlegacy/4965-mac.c | 8 +++-
 2 files changed, 6 insertions(+), 10 deletions(-)

diff --git a/drivers/net/wireless/intel/iwlegacy/3945-mac.c 
b/drivers/net/wireless/intel/iwlegacy/3945-mac.c
index 9167c3d2711d..5fe98bbefc56 100644
--- a/drivers/net/wireless/intel/iwlegacy/3945-mac.c
+++ b/drivers/net/wireless/intel/iwlegacy/3945-mac.c
@@ -1374,9 +1374,9 @@ il3945_dump_nic_error_log(struct il_priv *il)
 }
 
 static void
-il3945_irq_tasklet(unsigned long data)
+il3945_irq_tasklet(struct tasklet_struct *t)
 {
-   struct il_priv *il = (struct il_priv *)data;
+   struct il_priv *il = from_tasklet(il, t, irq_tasklet);
u32 inta, handled = 0;
u32 inta_fh;
unsigned long flags;
@@ -3399,9 +3399,7 @@ il3945_setup_deferred_work(struct il_priv *il)
 
timer_setup(>watchdog, il_bg_watchdog, 0);
 
-   tasklet_init(>irq_tasklet,
-il3945_irq_tasklet,
-(unsigned long)il);
+   tasklet_setup(>irq_tasklet, il3945_irq_tasklet);
 }
 
 static void
diff --git a/drivers/net/wireless/intel/iwlegacy/4965-mac.c 
b/drivers/net/wireless/intel/iwlegacy/4965-mac.c
index e73c223a7d28..afc54c63c4c6 100644
--- a/drivers/net/wireless/intel/iwlegacy/4965-mac.c
+++ b/drivers/net/wireless/intel/iwlegacy/4965-mac.c
@@ -4344,9 +4344,9 @@ il4965_synchronize_irq(struct il_priv *il)
 }
 
 static void
-il4965_irq_tasklet(unsigned long data)
+il4965_irq_tasklet(struct tasklet_struct *t)
 {
-   struct il_priv *il = (struct il_priv *)data;
+   struct il_priv *il = from_tasklet(il, t, irq_tasklet);
u32 inta, handled = 0;
u32 inta_fh;
unsigned long flags;
@@ -6238,9 +6238,7 @@ il4965_setup_deferred_work(struct il_priv *il)
 
timer_setup(>watchdog, il_bg_watchdog, 0);
 
-   tasklet_init(>irq_tasklet,
-il4965_irq_tasklet,
-(unsigned long)il);
+   tasklet_setup(>irq_tasklet, il4965_irq_tasklet);
 }
 
 static void
-- 
2.17.1



[PATCH 04/16] wireless: ath11k: convert tasklets to use new tasklet_setup() API

2020-08-17 Thread Allen Pais
From: Allen Pais 

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 
---
 drivers/net/wireless/ath/ath11k/ahb.c | 7 +++
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/net/wireless/ath/ath11k/ahb.c 
b/drivers/net/wireless/ath/ath11k/ahb.c
index 30092841ac46..28d7e833e27f 100644
--- a/drivers/net/wireless/ath/ath11k/ahb.c
+++ b/drivers/net/wireless/ath/ath11k/ahb.c
@@ -675,9 +675,9 @@ static void ath11k_ahb_free_irq(struct ath11k_base *ab)
ath11k_ahb_free_ext_irq(ab);
 }
 
-static void ath11k_ahb_ce_tasklet(unsigned long data)
+static void ath11k_ahb_ce_tasklet(struct tasklet_struct *t)
 {
-   struct ath11k_ce_pipe *ce_pipe = (struct ath11k_ce_pipe *)data;
+   struct ath11k_ce_pipe *ce_pipe = from_tasklet(ce_pipe, t, intr_tq);
 
ath11k_ce_per_engine_service(ce_pipe->ab, ce_pipe->pipe_num);
 
@@ -827,8 +827,7 @@ static int ath11k_ahb_config_irq(struct ath11k_base *ab)
 
irq_idx = ATH11K_IRQ_CE0_OFFSET + i;
 
-   tasklet_init(_pipe->intr_tq, ath11k_ahb_ce_tasklet,
-(unsigned long)ce_pipe);
+   tasklet_setup(_pipe->intr_tq, ath11k_ahb_ce_tasklet);
irq = platform_get_irq_byname(ab->pdev, irq_name[irq_idx]);
ret = request_irq(irq, ath11k_ahb_ce_interrupt_handler,
  IRQF_TRIGGER_RISING, irq_name[irq_idx],
-- 
2.17.1



[PATCH 08/16] wireless: ipw2x00: convert tasklets to use new tasklet_setup() API

2020-08-17 Thread Allen Pais
From: Allen Pais 

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 
Signed-off-by: Allen Pais 
---
 drivers/net/wireless/intel/ipw2x00/ipw2100.c | 9 -
 drivers/net/wireless/intel/ipw2x00/ipw2200.c | 7 +++
 2 files changed, 7 insertions(+), 9 deletions(-)

diff --git a/drivers/net/wireless/intel/ipw2x00/ipw2100.c 
b/drivers/net/wireless/intel/ipw2x00/ipw2100.c
index 461e955aa259..b7fbfc77b612 100644
--- a/drivers/net/wireless/intel/ipw2x00/ipw2100.c
+++ b/drivers/net/wireless/intel/ipw2x00/ipw2100.c
@@ -3204,9 +3204,9 @@ static void ipw2100_tx_send_data(struct ipw2100_priv 
*priv)
}
 }
 
-static void ipw2100_irq_tasklet(unsigned long data)
+static void ipw2100_irq_tasklet(struct tasklet_struct *t)
 {
-   struct ipw2100_priv *priv = (struct ipw2100_priv *)data;
+   struct ipw2100_priv *priv = from_tasklet(priv, t, irq_tasklet);
struct net_device *dev = priv->net_dev;
unsigned long flags;
u32 inta, tmp;
@@ -6005,7 +6005,7 @@ static void ipw2100_rf_kill(struct work_struct *work)
spin_unlock_irqrestore(>low_lock, flags);
 }
 
-static void ipw2100_irq_tasklet(unsigned long data);
+static void ipw2100_irq_tasklet(struct tasklet_struct *t);
 
 static const struct net_device_ops ipw2100_netdev_ops = {
.ndo_open   = ipw2100_open,
@@ -6135,8 +6135,7 @@ static struct net_device *ipw2100_alloc_device(struct 
pci_dev *pci_dev,
INIT_DELAYED_WORK(>rf_kill, ipw2100_rf_kill);
INIT_DELAYED_WORK(>scan_event, ipw2100_scan_event);
 
-   tasklet_init(>irq_tasklet,
-ipw2100_irq_tasklet, (unsigned long)priv);
+   tasklet_setup(>irq_tasklet, ipw2100_irq_tasklet);
 
/* NOTE:  We do not start the deferred work for status checks yet */
priv->stop_rf_kill = 1;
diff --git a/drivers/net/wireless/intel/ipw2x00/ipw2200.c 
b/drivers/net/wireless/intel/ipw2x00/ipw2200.c
index 129ef2f6248a..5af1c548a564 100644
--- a/drivers/net/wireless/intel/ipw2x00/ipw2200.c
+++ b/drivers/net/wireless/intel/ipw2x00/ipw2200.c
@@ -1945,9 +1945,9 @@ static void notify_wx_assoc_event(struct ipw_priv *priv)
wireless_send_event(priv->net_dev, SIOCGIWAP, , NULL);
 }
 
-static void ipw_irq_tasklet(unsigned long data)
+static void ipw_irq_tasklet(struct tasklet_struct *t)
 {
-   struct ipw_priv *priv = (struct ipw_priv *)data;
+   struct ipw_priv *priv = from_tasklet(priv, t, irq_tasklet);
u32 inta, inta_mask, handled = 0;
unsigned long flags;
int rc = 0;
@@ -10673,8 +10673,7 @@ static void ipw_setup_deferred_work(struct ipw_priv 
*priv)
INIT_WORK(>qos_activate, ipw_bg_qos_activate);
 #endif /* CONFIG_IPW2200_QOS */
 
-   tasklet_init(>irq_tasklet,
-ipw_irq_tasklet, (unsigned long)priv);
+   tasklet_setup(>irq_tasklet, ipw_irq_tasklet);
 }
 
 static void shim__set_security(struct net_device *dev,
-- 
2.17.1



[PATCH 11/16] wireless: marvell: convert tasklets to use new tasklet_setup() API

2020-08-17 Thread Allen Pais
From: Allen Pais 

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 
Signed-off-by: Allen Pais 
---
 drivers/net/wireless/marvell/mwl8k.c | 16 
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/net/wireless/marvell/mwl8k.c 
b/drivers/net/wireless/marvell/mwl8k.c
index 97f23f93f6e7..23efd7075df6 100644
--- a/drivers/net/wireless/marvell/mwl8k.c
+++ b/drivers/net/wireless/marvell/mwl8k.c
@@ -4630,10 +4630,10 @@ static irqreturn_t mwl8k_interrupt(int irq, void 
*dev_id)
return IRQ_HANDLED;
 }
 
-static void mwl8k_tx_poll(unsigned long data)
+static void mwl8k_tx_poll(struct tasklet_struct *t)
 {
-   struct ieee80211_hw *hw = (struct ieee80211_hw *)data;
-   struct mwl8k_priv *priv = hw->priv;
+   struct mwl8k_priv *priv = from_tasklet(priv, t, poll_tx_task);
+   struct ieee80211_hw *hw = pci_get_drvdata(priv->pdev);
int limit;
int i;
 
@@ -4659,10 +4659,10 @@ static void mwl8k_tx_poll(unsigned long data)
}
 }
 
-static void mwl8k_rx_poll(unsigned long data)
+static void mwl8k_rx_poll(struct tasklet_struct *t)
 {
-   struct ieee80211_hw *hw = (struct ieee80211_hw *)data;
-   struct mwl8k_priv *priv = hw->priv;
+   struct mwl8k_priv *priv = from_tasklet(priv, t, poll_rx_task);
+   struct ieee80211_hw *hw = pci_get_drvdata(priv->pdev);
int limit;
 
limit = 32;
@@ -6120,9 +6120,9 @@ static int mwl8k_firmware_load_success(struct mwl8k_priv 
*priv)
INIT_WORK(>fw_reload, mwl8k_hw_restart_work);
 
/* TX reclaim and RX tasklets.  */
-   tasklet_init(>poll_tx_task, mwl8k_tx_poll, (unsigned long)hw);
+   tasklet_setup(>poll_tx_task, mwl8k_tx_poll);
tasklet_disable(>poll_tx_task);
-   tasklet_init(>poll_rx_task, mwl8k_rx_poll, (unsigned long)hw);
+   tasklet_setup(>poll_rx_task, mwl8k_rx_poll);
tasklet_disable(>poll_rx_task);
 
/* Power management cookie */
-- 
2.17.1



[PATCH 02/16] wireless: ath9k: convert tasklets to use new tasklet_setup() API

2020-08-17 Thread Allen Pais
From: Allen Pais 

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 
Signed-off-by: Allen Pais 
---
 drivers/net/wireless/ath/ath9k/ath9k.h| 4 ++--
 drivers/net/wireless/ath/ath9k/beacon.c   | 4 ++--
 drivers/net/wireless/ath/ath9k/htc.h  | 4 ++--
 drivers/net/wireless/ath/ath9k/htc_drv_init.c | 6 ++
 drivers/net/wireless/ath/ath9k/htc_drv_txrx.c | 8 
 drivers/net/wireless/ath/ath9k/init.c | 5 ++---
 drivers/net/wireless/ath/ath9k/main.c | 4 ++--
 drivers/net/wireless/ath/ath9k/wmi.c  | 7 +++
 drivers/net/wireless/ath/ath9k/wmi.h  | 2 +-
 9 files changed, 20 insertions(+), 24 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/ath9k.h 
b/drivers/net/wireless/ath/ath9k/ath9k.h
index a412b352182c..e06b74a54a69 100644
--- a/drivers/net/wireless/ath/ath9k/ath9k.h
+++ b/drivers/net/wireless/ath/ath9k/ath9k.h
@@ -713,7 +713,7 @@ struct ath_beacon {
bool tx_last;
 };
 
-void ath9k_beacon_tasklet(unsigned long data);
+void ath9k_beacon_tasklet(struct tasklet_struct *t);
 void ath9k_beacon_config(struct ath_softc *sc, struct ieee80211_vif *main_vif,
 bool beacons);
 void ath9k_beacon_assign_slot(struct ath_softc *sc, struct ieee80211_vif *vif);
@@ -1117,7 +1117,7 @@ static inline void ath_read_cachesize(struct ath_common 
*common, int *csz)
common->bus_ops->read_cachesize(common, csz);
 }
 
-void ath9k_tasklet(unsigned long data);
+void ath9k_tasklet(struct tasklet_struct *t);
 int ath_cabq_update(struct ath_softc *);
 u8 ath9k_parse_mpdudensity(u8 mpdudensity);
 irqreturn_t ath_isr(int irq, void *dev);
diff --git a/drivers/net/wireless/ath/ath9k/beacon.c 
b/drivers/net/wireless/ath/ath9k/beacon.c
index e36f947e19fc..4876bff2dc2c 100644
--- a/drivers/net/wireless/ath/ath9k/beacon.c
+++ b/drivers/net/wireless/ath/ath9k/beacon.c
@@ -385,9 +385,9 @@ void ath9k_csa_update(struct ath_softc *sc)
   ath9k_csa_update_vif, sc);
 }
 
-void ath9k_beacon_tasklet(unsigned long data)
+void ath9k_beacon_tasklet(struct tasklet_struct *t)
 {
-   struct ath_softc *sc = (struct ath_softc *)data;
+   struct ath_softc *sc = from_tasklet(sc, t, bcon_tasklet);
struct ath_hw *ah = sc->sc_ah;
struct ath_common *common = ath9k_hw_common(ah);
struct ath_buf *bf = NULL;
diff --git a/drivers/net/wireless/ath/ath9k/htc.h 
b/drivers/net/wireless/ath/ath9k/htc.h
index 9f64e32381f9..0a1634238e67 100644
--- a/drivers/net/wireless/ath/ath9k/htc.h
+++ b/drivers/net/wireless/ath/ath9k/htc.h
@@ -583,14 +583,14 @@ int ath9k_htc_tx_get_slot(struct ath9k_htc_priv *priv);
 void ath9k_htc_tx_clear_slot(struct ath9k_htc_priv *priv, int slot);
 void ath9k_htc_tx_drain(struct ath9k_htc_priv *priv);
 void ath9k_htc_txstatus(struct ath9k_htc_priv *priv, void *wmi_event);
-void ath9k_tx_failed_tasklet(unsigned long data);
+void ath9k_tx_failed_tasklet(struct tasklet_struct *t);
 void ath9k_htc_tx_cleanup_timer(struct timer_list *t);
 bool ath9k_htc_csa_is_finished(struct ath9k_htc_priv *priv);
 
 int ath9k_rx_init(struct ath9k_htc_priv *priv);
 void ath9k_rx_cleanup(struct ath9k_htc_priv *priv);
 void ath9k_host_rx_init(struct ath9k_htc_priv *priv);
-void ath9k_rx_tasklet(unsigned long data);
+void ath9k_rx_tasklet(struct tasklet_struct *t);
 u32 ath9k_htc_calcrxfilter(struct ath9k_htc_priv *priv);
 
 void ath9k_htc_ps_wakeup(struct ath9k_htc_priv *priv);
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_init.c 
b/drivers/net/wireless/ath/ath9k/htc_drv_init.c
index 1d6ad8d46607..8136291791d6 100644
--- a/drivers/net/wireless/ath/ath9k/htc_drv_init.c
+++ b/drivers/net/wireless/ath/ath9k/htc_drv_init.c
@@ -645,10 +645,8 @@ static int ath9k_init_priv(struct ath9k_htc_priv *priv,
spin_lock_init(>tx.tx_lock);
mutex_init(>mutex);
mutex_init(>htc_pm_lock);
-   tasklet_init(>rx_tasklet, ath9k_rx_tasklet,
-(unsigned long)priv);
-   tasklet_init(>tx_failed_tasklet, ath9k_tx_failed_tasklet,
-(unsigned long)priv);
+   tasklet_setup(>rx_tasklet, ath9k_rx_tasklet);
+   tasklet_setup(>tx_failed_tasklet, ath9k_tx_failed_tasklet);
INIT_DELAYED_WORK(>ani_work, ath9k_htc_ani_work);
INIT_WORK(>ps_work, ath9k_ps_work);
INIT_WORK(>fatal_work, ath9k_fatal_work);
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c 
b/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c
index b353995bdd45..bdfa22fdc867 100644
--- a/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c
+++ b/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c
@@ -570,9 +570,9 @@ void ath9k_htc_tx_drain(struct ath9k_htc_priv *priv)
spin_unlock_bh(>tx.tx_lock);
 }
 
-void ath9k_tx_failed_tasklet(unsigned long 

[PATCH 03/16] wireless: ath: convert tasklets to use new tasklet_setup() API

2020-08-17 Thread Allen Pais
From: Allen Pais 

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 
Signed-off-by: Allen Pais 
---
 drivers/net/wireless/ath/carl9170/usb.c | 7 +++
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/net/wireless/ath/carl9170/usb.c 
b/drivers/net/wireless/ath/carl9170/usb.c
index ead79335823a..e4eb666c6eea 100644
--- a/drivers/net/wireless/ath/carl9170/usb.c
+++ b/drivers/net/wireless/ath/carl9170/usb.c
@@ -377,9 +377,9 @@ void carl9170_usb_handle_tx_err(struct ar9170 *ar)
}
 }
 
-static void carl9170_usb_tasklet(unsigned long data)
+static void carl9170_usb_tasklet(struct tasklet_struct *t)
 {
-   struct ar9170 *ar = (struct ar9170 *) data;
+   struct ar9170 *ar = from_tasklet(ar, t, usb_tasklet);
 
if (!IS_INITIALIZED(ar))
return;
@@ -1082,8 +1082,7 @@ static int carl9170_usb_probe(struct usb_interface *intf,
init_completion(>cmd_wait);
init_completion(>fw_boot_wait);
init_completion(>fw_load_wait);
-   tasklet_init(>usb_tasklet, carl9170_usb_tasklet,
-(unsigned long)ar);
+   tasklet_setup(>usb_tasklet, carl9170_usb_tasklet);
 
atomic_set(>tx_cmd_urbs, 0);
atomic_set(>tx_anch_urbs, 0);
-- 
2.17.1



[PATCH 01/16] wireless: ath5k: convert tasklets to use new tasklet_setup() API

2020-08-17 Thread Allen Pais
From: Allen Pais 

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 
Signed-off-by: Allen Pais 
---
 drivers/net/wireless/ath/ath5k/base.c   | 24 
 drivers/net/wireless/ath/ath5k/rfkill.c |  7 +++
 2 files changed, 15 insertions(+), 16 deletions(-)

diff --git a/drivers/net/wireless/ath/ath5k/base.c 
b/drivers/net/wireless/ath/ath5k/base.c
index 65a4c142640d..2781dcd534a9 100644
--- a/drivers/net/wireless/ath/ath5k/base.c
+++ b/drivers/net/wireless/ath/ath5k/base.c
@@ -1536,12 +1536,12 @@ ath5k_set_current_imask(struct ath5k_hw *ah)
 }
 
 static void
-ath5k_tasklet_rx(unsigned long data)
+ath5k_tasklet_rx(struct tasklet_struct *t)
 {
struct ath5k_rx_status rs = {};
struct sk_buff *skb, *next_skb;
dma_addr_t next_skb_addr;
-   struct ath5k_hw *ah = (void *)data;
+   struct ath5k_hw *ah = from_tasklet(ah, t, rxtq);
struct ath_common *common = ath5k_hw_common(ah);
struct ath5k_buf *bf;
struct ath5k_desc *ds;
@@ -1784,10 +1784,10 @@ ath5k_tx_processq(struct ath5k_hw *ah, struct ath5k_txq 
*txq)
 }
 
 static void
-ath5k_tasklet_tx(unsigned long data)
+ath5k_tasklet_tx(struct tasklet_struct *t)
 {
int i;
-   struct ath5k_hw *ah = (void *)data;
+   struct ath5k_hw *ah = from_tasklet(ah, t, txtq);
 
for (i = 0; i < AR5K_NUM_TX_QUEUES; i++)
if (ah->txqs[i].setup && (ah->ah_txq_isr_txok_all & BIT(i)))
@@ -2176,9 +2176,9 @@ ath5k_beacon_config(struct ath5k_hw *ah)
spin_unlock_bh(>block);
 }
 
-static void ath5k_tasklet_beacon(unsigned long data)
+static void ath5k_tasklet_beacon(struct tasklet_struct *t)
 {
-   struct ath5k_hw *ah = (struct ath5k_hw *) data;
+   struct ath5k_hw *ah = from_tasklet(ah, t, beacontq);
 
/*
 * Software beacon alert--time to send a beacon.
@@ -2447,9 +2447,9 @@ ath5k_calibrate_work(struct work_struct *work)
 
 
 static void
-ath5k_tasklet_ani(unsigned long data)
+ath5k_tasklet_ani(struct tasklet_struct *t)
 {
-   struct ath5k_hw *ah = (void *)data;
+   struct ath5k_hw *ah = from_tasklet(ah, t, ani_tasklet);
 
ah->ah_cal_mask |= AR5K_CALIBRATION_ANI;
ath5k_ani_calibration(ah);
@@ -3069,10 +3069,10 @@ ath5k_init(struct ieee80211_hw *hw)
hw->queues = 1;
}
 
-   tasklet_init(>rxtq, ath5k_tasklet_rx, (unsigned long)ah);
-   tasklet_init(>txtq, ath5k_tasklet_tx, (unsigned long)ah);
-   tasklet_init(>beacontq, ath5k_tasklet_beacon, (unsigned long)ah);
-   tasklet_init(>ani_tasklet, ath5k_tasklet_ani, (unsigned long)ah);
+   tasklet_setup(>rxtq, ath5k_tasklet_rx);
+   tasklet_setup(>txtq, ath5k_tasklet_tx);
+   tasklet_setup(>beacontq, ath5k_tasklet_beacon);
+   tasklet_setup(>ani_tasklet, ath5k_tasklet_ani);
 
INIT_WORK(>reset_work, ath5k_reset_work);
INIT_WORK(>calib_work, ath5k_calibrate_work);
diff --git a/drivers/net/wireless/ath/ath5k/rfkill.c 
b/drivers/net/wireless/ath/ath5k/rfkill.c
index 270a319f3aeb..855ed7fc720d 100644
--- a/drivers/net/wireless/ath/ath5k/rfkill.c
+++ b/drivers/net/wireless/ath/ath5k/rfkill.c
@@ -73,9 +73,9 @@ ath5k_is_rfkill_set(struct ath5k_hw *ah)
 }
 
 static void
-ath5k_tasklet_rfkill_toggle(unsigned long data)
+ath5k_tasklet_rfkill_toggle(struct tasklet_struct *t)
 {
-   struct ath5k_hw *ah = (void *)data;
+   struct ath5k_hw *ah = from_tasklet(ah, t, rf_kill.toggleq);
bool blocked;
 
blocked = ath5k_is_rfkill_set(ah);
@@ -90,8 +90,7 @@ ath5k_rfkill_hw_start(struct ath5k_hw *ah)
ah->rf_kill.gpio = ah->ah_capabilities.cap_eeprom.ee_rfkill_pin;
ah->rf_kill.polarity = ah->ah_capabilities.cap_eeprom.ee_rfkill_pol;
 
-   tasklet_init(>rf_kill.toggleq, ath5k_tasklet_rfkill_toggle,
-   (unsigned long)ah);
+   tasklet_setup(>rf_kill.toggleq, ath5k_tasklet_rfkill_toggle);
 
ath5k_rfkill_disable(ah);
 
-- 
2.17.1



[PATCH 00/16] wirless: convert tasklets to use new tasklet_setup()

2020-08-17 Thread Allen Pais
From: Allen Pais 

Commit 12cc923f1ccc ("tasklet: Introduce new initialization API")'
introduced a new tasklet initialization API. This series converts 
all the wireless drivers to use the new tasklet_setup() API

Allen Pais (16):
  wireless: ath5k: convert tasklets to use new tasklet_setup() API
  wireless: ath9k: convert tasklets to use new tasklet_setup() API
  wireless: ath: convert tasklets to use new tasklet_setup() API
  wireless: ath11k: convert tasklets to use new tasklet_setup() API
  wireless: atmel: convert tasklets to use new tasklet_setup() API
  wireless: b43legacy: convert tasklets to use new tasklet_setup() API
  wireless: brcm80211: convert tasklets to use new tasklet_setup() API
  wireless: ipw2x00: convert tasklets to use new tasklet_setup() API
  wireless: iwlegacy: convert tasklets to use new tasklet_setup() API
  wireless: intersil: convert tasklets to use new tasklet_setup() API
  wireless: marvell: convert tasklets to use new tasklet_setup() API
  wireless: mediatek: convert tasklets to use new tasklet_setup() API
  wireless: quantenna: convert tasklets to use new tasklet_setup() API
  wireless: ralink: convert tasklets to use new tasklet_setup() API
  wireless: realtek: convert tasklets to use new tasklet_setup() API
  wireless: zydas: convert tasklets to use new tasklet_setup() API

 drivers/net/wireless/ath/ath11k/ahb.c |  7 +++---
 drivers/net/wireless/ath/ath5k/base.c | 24 +--
 drivers/net/wireless/ath/ath5k/rfkill.c   |  7 +++---
 drivers/net/wireless/ath/ath9k/ath9k.h|  4 ++--
 drivers/net/wireless/ath/ath9k/beacon.c   |  4 ++--
 drivers/net/wireless/ath/ath9k/htc.h  |  4 ++--
 drivers/net/wireless/ath/ath9k/htc_drv_init.c |  6 ++---
 drivers/net/wireless/ath/ath9k/htc_drv_txrx.c |  8 +++
 drivers/net/wireless/ath/ath9k/init.c |  5 ++--
 drivers/net/wireless/ath/ath9k/main.c |  4 ++--
 drivers/net/wireless/ath/ath9k/wmi.c  |  7 +++---
 drivers/net/wireless/ath/ath9k/wmi.h  |  2 +-
 drivers/net/wireless/ath/carl9170/usb.c   |  7 +++---
 drivers/net/wireless/atmel/at76c50x-usb.c |  9 ---
 .../net/wireless/broadcom/b43legacy/main.c|  8 +++
 drivers/net/wireless/broadcom/b43legacy/pio.c |  7 +++---
 .../broadcom/brcm80211/brcmsmac/mac80211_if.c |  6 ++---
 .../broadcom/brcm80211/brcmsmac/mac80211_if.h |  2 +-
 drivers/net/wireless/intel/ipw2x00/ipw2100.c  |  9 ---
 drivers/net/wireless/intel/ipw2x00/ipw2200.c  |  7 +++---
 .../net/wireless/intel/iwlegacy/3945-mac.c|  8 +++
 .../net/wireless/intel/iwlegacy/4965-mac.c|  8 +++
 .../net/wireless/intersil/hostap/hostap_hw.c  | 18 +++---
 drivers/net/wireless/intersil/orinoco/main.c  |  7 +++---
 drivers/net/wireless/intersil/p54/p54pci.c|  8 +++
 drivers/net/wireless/marvell/mwl8k.c  | 16 ++---
 drivers/net/wireless/mediatek/mt76/mac80211.c |  2 +-
 drivers/net/wireless/mediatek/mt76/mt76.h |  2 +-
 .../wireless/mediatek/mt76/mt7603/beacon.c|  4 ++--
 .../net/wireless/mediatek/mt76/mt7603/init.c  |  3 +--
 .../wireless/mediatek/mt76/mt7603/mt7603.h|  2 +-
 .../net/wireless/mediatek/mt76/mt7615/mmio.c  |  6 ++---
 .../net/wireless/mediatek/mt76/mt76x02_dfs.c  | 10 
 .../net/wireless/mediatek/mt76/mt76x02_mmio.c | 14 +--
 drivers/net/wireless/mediatek/mt76/tx.c   |  4 ++--
 drivers/net/wireless/mediatek/mt76/usb.c  | 12 +-
 drivers/net/wireless/mediatek/mt7601u/dma.c   | 12 +-
 .../quantenna/qtnfmac/pcie/pearl_pcie.c   |  7 +++---
 .../quantenna/qtnfmac/pcie/topaz_pcie.c   |  7 +++---
 .../net/wireless/ralink/rt2x00/rt2400pci.c| 14 ++-
 .../net/wireless/ralink/rt2x00/rt2500pci.c| 14 ++-
 .../net/wireless/ralink/rt2x00/rt2800mmio.c   | 24 +++
 .../net/wireless/ralink/rt2x00/rt2800mmio.h   | 10 
 drivers/net/wireless/ralink/rt2x00/rt2x00.h   | 10 
 .../net/wireless/ralink/rt2x00/rt2x00dev.c|  5 ++--
 drivers/net/wireless/ralink/rt2x00/rt61pci.c  | 20 +---
 drivers/net/wireless/realtek/rtlwifi/pci.c| 21 
 drivers/net/wireless/realtek/rtlwifi/usb.c|  9 ---
 drivers/net/wireless/realtek/rtw88/main.c |  3 +--
 drivers/net/wireless/realtek/rtw88/tx.c   |  4 ++--
 drivers/net/wireless/realtek/rtw88/tx.h   |  2 +-
 drivers/net/wireless/zydas/zd1211rw/zd_usb.c  |  8 +++
 52 files changed, 208 insertions(+), 223 deletions(-)

-- 
2.17.1



[PATCH 5/7] usb/gadget: fsl_qe_udc: convert tasklets to use new tasklet_setup() API

2020-08-17 Thread Allen Pais
From: Allen Pais 

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 
Signed-off-by: Allen Pais 
---
 drivers/usb/gadget/udc/fsl_qe_udc.c | 7 +++
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/usb/gadget/udc/fsl_qe_udc.c 
b/drivers/usb/gadget/udc/fsl_qe_udc.c
index 2707be628298..fa66449b3907 100644
--- a/drivers/usb/gadget/udc/fsl_qe_udc.c
+++ b/drivers/usb/gadget/udc/fsl_qe_udc.c
@@ -923,9 +923,9 @@ static int qe_ep_rxframe_handle(struct qe_ep *ep)
return 0;
 }
 
-static void ep_rx_tasklet(unsigned long data)
+static void ep_rx_tasklet(struct tasklet_struct *t)
 {
-   struct qe_udc *udc = (struct qe_udc *)data;
+   struct qe_udc *udc = from_tasklet(udc, t, rx_tasklet);
struct qe_ep *ep;
struct qe_frame *pframe;
struct qe_bd __iomem *bd;
@@ -2553,8 +2553,7 @@ static int qe_udc_probe(struct platform_device *ofdev)
DMA_TO_DEVICE);
}
 
-   tasklet_init(>rx_tasklet, ep_rx_tasklet,
-   (unsigned long)udc);
+   tasklet_setup(>rx_tasklet, ep_rx_tasklet);
/* request irq and disable DR  */
udc->usb_irq = irq_of_parse_and_map(np, 0);
if (!udc->usb_irq) {
-- 
2.17.1



[PATCH 7/7] usb: mos7720: convert tasklets to use new tasklet_setup() API

2020-08-17 Thread Allen Pais
From: Allen Pais 

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 
Signed-off-by: Allen Pais 
---
 drivers/usb/serial/mos7720.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/usb/serial/mos7720.c b/drivers/usb/serial/mos7720.c
index 2ec4eeacebc7..5eed1078fac8 100644
--- a/drivers/usb/serial/mos7720.c
+++ b/drivers/usb/serial/mos7720.c
@@ -282,11 +282,12 @@ static void destroy_urbtracker(struct kref *kref)
  * port callback had to be deferred because the disconnect mutex could not be
  * obtained at the time.
  */
-static void send_deferred_urbs(unsigned long _mos_parport)
+static void send_deferred_urbs(struct tasklet_struct *t)
 {
int ret_val;
unsigned long flags;
-   struct mos7715_parport *mos_parport = (void *)_mos_parport;
+   struct mos7715_parport *mos_parport = from_tasklet(mos_parport, t,
+  urb_tasklet);
struct urbtracker *urbtrack, *tmp;
struct list_head *cursor, *next;
struct device *dev;
@@ -716,8 +717,7 @@ static int mos7715_parport_init(struct usb_serial *serial)
INIT_LIST_HEAD(_parport->deferred_urbs);
usb_set_serial_data(serial, mos_parport); /* hijack private pointer */
mos_parport->serial = serial;
-   tasklet_init(_parport->urb_tasklet, send_deferred_urbs,
-(unsigned long) mos_parport);
+   tasklet_setup(_parport->urb_tasklet, send_deferred_urbs);
init_completion(_parport->syncmsg_compl);
 
/* cycle parallel port reset bit */
-- 
2.17.1



[PATCH 6/7] usb: xhci: convert tasklets to use new tasklet_setup() API

2020-08-17 Thread Allen Pais
From: Allen Pais 

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 
Signed-off-by: Allen Pais 
---
 drivers/usb/host/xhci-dbgtty.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/host/xhci-dbgtty.c b/drivers/usb/host/xhci-dbgtty.c
index b8918f73a432..ae4e4ab638b5 100644
--- a/drivers/usb/host/xhci-dbgtty.c
+++ b/drivers/usb/host/xhci-dbgtty.c
@@ -288,14 +288,14 @@ static const struct tty_operations dbc_tty_ops = {
.unthrottle = dbc_tty_unthrottle,
 };
 
-static void dbc_rx_push(unsigned long _port)
+static void dbc_rx_push(struct tasklet_struct *t)
 {
struct dbc_request  *req;
struct tty_struct   *tty;
unsigned long   flags;
booldo_push = false;
booldisconnect = false;
-   struct dbc_port *port = (void *)_port;
+   struct dbc_port *port = from_tasklet(port, t, push);
struct list_head*queue = >read_queue;
 
spin_lock_irqsave(>port_lock, flags);
@@ -382,7 +382,7 @@ xhci_dbc_tty_init_port(struct xhci_dbc *dbc, struct 
dbc_port *port)
 {
tty_port_init(>port);
spin_lock_init(>port_lock);
-   tasklet_init(>push, dbc_rx_push, (unsigned long)port);
+   tasklet_setup(>push, dbc_rx_push);
INIT_LIST_HEAD(>read_pool);
INIT_LIST_HEAD(>read_queue);
INIT_LIST_HEAD(>write_pool);
-- 
2.17.1



[PATCH 2/7] usb: c67x00: convert tasklets to use new tasklet_setup() API

2020-08-17 Thread Allen Pais
From: Allen Pais 

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 
Signed-off-by: Allen Pais 
---
 drivers/usb/c67x00/c67x00-sched.c | 7 +++
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/usb/c67x00/c67x00-sched.c 
b/drivers/usb/c67x00/c67x00-sched.c
index f7f6229082ca..6275cb77a15b 100644
--- a/drivers/usb/c67x00/c67x00-sched.c
+++ b/drivers/usb/c67x00/c67x00-sched.c
@@ -1122,9 +1122,9 @@ static void c67x00_do_work(struct c67x00_hcd *c67x00)
 
 /* -- 
*/
 
-static void c67x00_sched_tasklet(unsigned long __c67x00)
+static void c67x00_sched_tasklet(struct tasklet_struct *t)
 {
-   struct c67x00_hcd *c67x00 = (struct c67x00_hcd *)__c67x00;
+   struct c67x00_hcd *c67x00 = from_tasklet(c67x00, t, tasklet);
c67x00_do_work(c67x00);
 }
 
@@ -1135,8 +1135,7 @@ void c67x00_sched_kick(struct c67x00_hcd *c67x00)
 
 int c67x00_sched_start_scheduler(struct c67x00_hcd *c67x00)
 {
-   tasklet_init(>tasklet, c67x00_sched_tasklet,
-(unsigned long)c67x00);
+   tasklet_setup(>tasklet, c67x00_sched_tasklet);
return 0;
 }
 
-- 
2.17.1



[PATCH 4/7] usb/gadget: f_midi: convert tasklets to use new tasklet_setup() API

2020-08-17 Thread Allen Pais
From: Allen Pais 

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 
Signed-off-by: Allen Pais 
---
 drivers/usb/gadget/function/f_midi.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/gadget/function/f_midi.c 
b/drivers/usb/gadget/function/f_midi.c
index 46af0aa07e2e..85cb15734aa8 100644
--- a/drivers/usb/gadget/function/f_midi.c
+++ b/drivers/usb/gadget/function/f_midi.c
@@ -698,9 +698,9 @@ static void f_midi_transmit(struct f_midi *midi)
f_midi_drop_out_substreams(midi);
 }
 
-static void f_midi_in_tasklet(unsigned long data)
+static void f_midi_in_tasklet(struct tasklet_struct *t)
 {
-   struct f_midi *midi = (struct f_midi *) data;
+   struct f_midi *midi = from_tasklet(midi, t, tasklet);
f_midi_transmit(midi);
 }
 
@@ -875,7 +875,7 @@ static int f_midi_bind(struct usb_configuration *c, struct 
usb_function *f)
int status, n, jack = 1, i = 0, endpoint_descriptor_index = 0;
 
midi->gadget = cdev->gadget;
-   tasklet_init(>tasklet, f_midi_in_tasklet, (unsigned long) midi);
+   tasklet_setup(>tasklet, f_midi_in_tasklet);
status = f_midi_register_card(midi);
if (status < 0)
goto fail_register;
-- 
2.17.1



[PATCH 0/7] usb: convert tasklets to use new tasklet_setup()

2020-08-17 Thread Allen Pais
From: Allen Pais 

Commit 12cc923f1ccc ("tasklet: Introduce new initialization API")'
introduced a new tasklet initialization API. This series converts 
all the usb drivers to use the new tasklet_setup() API

Allen Pais (7):
  usb: atm: convert tasklets to use new tasklet_setup() API
  usb: c67x00: convert tasklets to use new tasklet_setup() API
  usb: hcd: convert tasklets to use new tasklet_setup() API
  usb/gadget: f_midi: convert tasklets to use new tasklet_setup() API
  usb/gadget: fsl_qe_udc: convert tasklets to use new tasklet_setup()
API
  usb: xhci: convert tasklets to use new tasklet_setup() API
  usb: mos7720: convert tasklets to use new tasklet_setup() API

 drivers/usb/atm/usbatm.c | 14 --
 drivers/usb/c67x00/c67x00-sched.c|  7 +++
 drivers/usb/core/hcd.c   |  6 +++---
 drivers/usb/gadget/function/f_midi.c |  6 +++---
 drivers/usb/gadget/udc/fsl_qe_udc.c  |  7 +++
 drivers/usb/host/xhci-dbgtty.c   |  6 +++---
 drivers/usb/serial/mos7720.c |  8 
 7 files changed, 27 insertions(+), 27 deletions(-)

-- 
2.17.1



[PATCH 1/7] usb: atm: convert tasklets to use new tasklet_setup() API

2020-08-17 Thread Allen Pais
From: Allen Pais 

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 
Signed-off-by: Allen Pais 
---
 drivers/usb/atm/usbatm.c | 14 --
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/drivers/usb/atm/usbatm.c b/drivers/usb/atm/usbatm.c
index 4e12a32ca392..56fe30d247da 100644
--- a/drivers/usb/atm/usbatm.c
+++ b/drivers/usb/atm/usbatm.c
@@ -511,9 +511,10 @@ static unsigned int usbatm_write_cells(struct usbatm_data 
*instance,
 **  receive  **
 **/
 
-static void usbatm_rx_process(unsigned long data)
+static void usbatm_rx_process(struct tasklet_struct *t)
 {
-   struct usbatm_data *instance = (struct usbatm_data *)data;
+   struct usbatm_data *instance = from_tasklet(instance, t,
+   rx_channel.tasklet);
struct urb *urb;
 
while ((urb = usbatm_pop_urb(>rx_channel))) {
@@ -564,9 +565,10 @@ static void usbatm_rx_process(unsigned long data)
 **  send  **
 ***/
 
-static void usbatm_tx_process(unsigned long data)
+static void usbatm_tx_process(struct tasklet_struct *t)
 {
-   struct usbatm_data *instance = (struct usbatm_data *)data;
+   struct usbatm_data *instance = from_tasklet(instance, t,
+   tx_channel.tasklet);
struct sk_buff *skb = instance->current_skb;
struct urb *urb = NULL;
const unsigned int buf_size = instance->tx_channel.buf_size;
@@ -1069,8 +1071,8 @@ int usbatm_usb_probe(struct usb_interface *intf, const 
struct usb_device_id *id,
 
usbatm_init_channel(>rx_channel);
usbatm_init_channel(>tx_channel);
-   tasklet_init(>rx_channel.tasklet, usbatm_rx_process, 
(unsigned long)instance);
-   tasklet_init(>tx_channel.tasklet, usbatm_tx_process, 
(unsigned long)instance);
+   tasklet_setup(>rx_channel.tasklet, usbatm_rx_process);
+   tasklet_setup(>tx_channel.tasklet, usbatm_tx_process);
instance->rx_channel.stride = ATM_CELL_SIZE + driver->rx_padding;
instance->tx_channel.stride = ATM_CELL_SIZE + driver->tx_padding;
instance->rx_channel.usbatm = instance->tx_channel.usbatm = instance;
-- 
2.17.1



[PATCH 3/7] usb: hcd: convert tasklets to use new tasklet_setup() API

2020-08-17 Thread Allen Pais
From: Allen Pais 

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 
Signed-off-by: Allen Pais 
---
 drivers/usb/core/hcd.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c
index a33b849e8beb..2c6b9578a7d3 100644
--- a/drivers/usb/core/hcd.c
+++ b/drivers/usb/core/hcd.c
@@ -1657,9 +1657,9 @@ static void __usb_hcd_giveback_urb(struct urb *urb)
usb_put_urb(urb);
 }
 
-static void usb_giveback_urb_bh(unsigned long param)
+static void usb_giveback_urb_bh(struct tasklet_struct *t)
 {
-   struct giveback_urb_bh *bh = (struct giveback_urb_bh *)param;
+   struct giveback_urb_bh *bh = from_tasklet(bh, t, bh);
struct list_head local_list;
 
spin_lock_irq(>lock);
@@ -2403,7 +2403,7 @@ static void init_giveback_urb_bh(struct giveback_urb_bh 
*bh)
 
spin_lock_init(>lock);
INIT_LIST_HEAD(>head);
-   tasklet_init(>bh, usb_giveback_urb_bh, (unsigned long)bh);
+   tasklet_setup(>bh, usb_giveback_urb_bh);
 }
 
 struct usb_hcd *__usb_create_hcd(const struct hc_driver *driver,
-- 
2.17.1



[PATCH 4/4] tty: timbuart: convert tasklets to use new tasklet_setup() API

2020-08-17 Thread Allen Pais
From: Allen Pais 

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 
Signed-off-by: Allen Pais 
---
 drivers/tty/serial/timbuart.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/tty/serial/timbuart.c b/drivers/tty/serial/timbuart.c
index 19d38b504e27..2126e6e6dfd1 100644
--- a/drivers/tty/serial/timbuart.c
+++ b/drivers/tty/serial/timbuart.c
@@ -172,9 +172,9 @@ static void timbuart_handle_rx_port(struct uart_port *port, 
u32 isr, u32 *ier)
dev_dbg(port->dev, "%s - leaving\n", __func__);
 }
 
-static void timbuart_tasklet(unsigned long arg)
+static void timbuart_tasklet(struct tasklet_struct *t)
 {
-   struct timbuart_port *uart = (struct timbuart_port *)arg;
+   struct timbuart_port *uart = from_tasklet(uart, t, tasklet);
u32 isr, ier = 0;
 
spin_lock(>port.lock);
@@ -451,7 +451,7 @@ static int timbuart_probe(struct platform_device *dev)
}
uart->port.irq = irq;
 
-   tasklet_init(>tasklet, timbuart_tasklet, (unsigned long)uart);
+   tasklet_setup(>tasklet, timbuart_tasklet);
 
err = uart_register_driver(_driver);
if (err)
-- 
2.17.1



[PATCH 3/4] tty: ifx6x60: convert tasklets to use new tasklet_setup() API

2020-08-17 Thread Allen Pais
From: Allen Pais 

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 
Signed-off-by: Allen Pais 
---
 drivers/tty/serial/ifx6x60.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/tty/serial/ifx6x60.c b/drivers/tty/serial/ifx6x60.c
index 7d16fe41932f..37d5b8516880 100644
--- a/drivers/tty/serial/ifx6x60.c
+++ b/drivers/tty/serial/ifx6x60.c
@@ -725,10 +725,11 @@ static void ifx_spi_complete(void *ctx)
  * Queue data for transmission if possible and then kick off the
  * transfer.
  */
-static void ifx_spi_io(unsigned long data)
+static void ifx_spi_io(struct tasklet_struct *t)
 {
int retval;
-   struct ifx_spi_device *ifx_dev = (struct ifx_spi_device *) data;
+   struct ifx_spi_device *ifx_dev = from_tasklet(ifx_dev, t,
+ io_work_tasklet);
 
if (!test_and_set_bit(IFX_SPI_STATE_IO_IN_PROGRESS, _dev->flags) &&
test_bit(IFX_SPI_STATE_IO_AVAILABLE, _dev->flags)) {
@@ -1067,8 +1068,7 @@ static int ifx_spi_spi_probe(struct spi_device *spi)
init_waitqueue_head(_dev->mdm_reset_wait);
 
spi_set_drvdata(spi, ifx_dev);
-   tasklet_init(_dev->io_work_tasklet, ifx_spi_io,
-   (unsigned long)ifx_dev);
+   tasklet_setup(_dev->io_work_tasklet, ifx_spi_io);
 
set_bit(IFX_SPI_STATE_PRESENT, _dev->flags);
 
-- 
2.17.1



[PATCH 2/4] tty: atmel_serial: convert tasklets to use new tasklet_setup() API

2020-08-17 Thread Allen Pais
From: Allen Pais 

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 
Signed-off-by: Allen Pais 
---
 drivers/tty/serial/atmel_serial.c | 20 ++--
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/drivers/tty/serial/atmel_serial.c 
b/drivers/tty/serial/atmel_serial.c
index e43471b33710..a9c47f56e994 100644
--- a/drivers/tty/serial/atmel_serial.c
+++ b/drivers/tty/serial/atmel_serial.c
@@ -1722,10 +1722,11 @@ static int atmel_prepare_rx_pdc(struct uart_port *port)
 /*
  * tasklet handling tty stuff outside the interrupt handler.
  */
-static void atmel_tasklet_rx_func(unsigned long data)
+static void atmel_tasklet_rx_func(struct tasklet_struct *t)
 {
-   struct uart_port *port = (struct uart_port *)data;
-   struct atmel_uart_port *atmel_port = to_atmel_uart_port(port);
+   struct atmel_uart_port *atmel_port = from_tasklet(atmel_port, t,
+ tasklet_rx);
+   struct uart_port *port = _port->uart;
 
/* The interrupt handler does not take the lock */
spin_lock(>lock);
@@ -1733,10 +1734,11 @@ static void atmel_tasklet_rx_func(unsigned long data)
spin_unlock(>lock);
 }
 
-static void atmel_tasklet_tx_func(unsigned long data)
+static void atmel_tasklet_tx_func(struct tasklet_struct *t)
 {
-   struct uart_port *port = (struct uart_port *)data;
-   struct atmel_uart_port *atmel_port = to_atmel_uart_port(port);
+   struct atmel_uart_port *atmel_port = from_tasklet(atmel_port, t,
+ tasklet_tx);
+   struct uart_port *port = _port->uart;
 
/* The interrupt handler does not take the lock */
spin_lock(>lock);
@@ -1911,10 +1913,8 @@ static int atmel_startup(struct uart_port *port)
}
 
atomic_set(_port->tasklet_shutdown, 0);
-   tasklet_init(_port->tasklet_rx, atmel_tasklet_rx_func,
-   (unsigned long)port);
-   tasklet_init(_port->tasklet_tx, atmel_tasklet_tx_func,
-   (unsigned long)port);
+   tasklet_setup(_port->tasklet_rx, atmel_tasklet_rx_func);
+   tasklet_setup(_port->tasklet_tx, atmel_tasklet_tx_func);
 
/*
 * Initialize DMA (if necessary)
-- 
2.17.1



[PATCH 1/4] tty: ipwireless: convert tasklets to use new tasklet_setup() API

2020-08-17 Thread Allen Pais
From: Allen Pais 

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 
Signed-off-by: Allen Pais 
---
 drivers/tty/ipwireless/hardware.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/tty/ipwireless/hardware.c 
b/drivers/tty/ipwireless/hardware.c
index 6bbf35682d53..f5d3e68f5750 100644
--- a/drivers/tty/ipwireless/hardware.c
+++ b/drivers/tty/ipwireless/hardware.c
@@ -1006,9 +1006,9 @@ static int send_pending_packet(struct ipw_hardware *hw, 
int priority_limit)
 /*
  * Send and receive all queued packets.
  */
-static void ipwireless_do_tasklet(unsigned long hw_)
+static void ipwireless_do_tasklet(struct tasklet_struct *t)
 {
-   struct ipw_hardware *hw = (struct ipw_hardware *) hw_;
+   struct ipw_hardware *hw = from_tasklet(hw, t, tasklet);
unsigned long flags;
 
spin_lock_irqsave(>lock, flags);
@@ -1635,7 +1635,7 @@ struct ipw_hardware *ipwireless_hardware_create(void)
INIT_LIST_HEAD(>rx_queue);
INIT_LIST_HEAD(>rx_pool);
spin_lock_init(>lock);
-   tasklet_init(>tasklet, ipwireless_do_tasklet, (unsigned long) hw);
+   tasklet_setup(>tasklet, ipwireless_do_tasklet);
INIT_WORK(>work_rx, ipw_receive_data_work);
timer_setup(>setup_timer, ipwireless_setup_timer, 0);
 
-- 
2.17.1



[PATCH 0/4] tty: convert tasklets to use new tasklet_setup()

2020-08-17 Thread Allen Pais
From: Allen Pais 

Commit 12cc923f1ccc ("tasklet: Introduce new initialization API")'
introduced a new tasklet initialization API. This series converts 
all the tty drivers to use the new tasklet_setup() API

Allen Pais (4):
  tty: ipwireless: convert tasklets to use new tasklet_setup() API
  tty: atmel_serial: convert tasklets to use new tasklet_setup() API
  tty: ifx6x60: convert tasklets to use new tasklet_setup() API
  tty: timbuart: convert tasklets to use new tasklet_setup() API

 drivers/tty/ipwireless/hardware.c |  6 +++---
 drivers/tty/serial/atmel_serial.c | 20 ++--
 drivers/tty/serial/ifx6x60.c  |  8 
 drivers/tty/serial/timbuart.c |  6 +++---
 4 files changed, 20 insertions(+), 20 deletions(-)

-- 
2.17.1



[PATCH 10/10] sound: ua101: convert tasklets to use new tasklet_setup() API

2020-08-17 Thread Allen Pais
From: Allen Pais 

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 
Signed-off-by: Allen Pais 
---
 sound/usb/misc/ua101.c | 7 +++
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/sound/usb/misc/ua101.c b/sound/usb/misc/ua101.c
index 884e740a785c..3b2dce1043f5 100644
--- a/sound/usb/misc/ua101.c
+++ b/sound/usb/misc/ua101.c
@@ -247,9 +247,9 @@ static inline void add_with_wraparound(struct ua101 *ua,
*value -= ua->playback.queue_length;
 }
 
-static void playback_tasklet(unsigned long data)
+static void playback_tasklet(struct tasklet_struct *t)
 {
-   struct ua101 *ua = (void *)data;
+   struct ua101 *ua = from_tasklet(ua, t, playback_tasklet);
unsigned long flags;
unsigned int frames;
struct ua101_urb *urb;
@@ -1218,8 +1218,7 @@ static int ua101_probe(struct usb_interface *interface,
spin_lock_init(>lock);
mutex_init(>mutex);
INIT_LIST_HEAD(>ready_playback_urbs);
-   tasklet_init(>playback_tasklet,
-playback_tasklet, (unsigned long)ua);
+   tasklet_setup(>playback_tasklet, playback_tasklet);
init_waitqueue_head(>alsa_capture_wait);
init_waitqueue_head(>rate_feedback_wait);
init_waitqueue_head(>alsa_playback_wait);
-- 
2.17.1



[PATCH 09/10] sound: midi: convert tasklets to use new tasklet_setup() API

2020-08-17 Thread Allen Pais
From: Allen Pais 

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 
Signed-off-by: Allen Pais 
---
 sound/usb/midi.c | 7 +++
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/sound/usb/midi.c b/sound/usb/midi.c
index df639fe03118..e8287a05e36b 100644
--- a/sound/usb/midi.c
+++ b/sound/usb/midi.c
@@ -344,10 +344,9 @@ static void snd_usbmidi_do_output(struct 
snd_usb_midi_out_endpoint *ep)
spin_unlock_irqrestore(>buffer_lock, flags);
 }
 
-static void snd_usbmidi_out_tasklet(unsigned long data)
+static void snd_usbmidi_out_tasklet(struct tasklet_struct *t)
 {
-   struct snd_usb_midi_out_endpoint *ep =
-   (struct snd_usb_midi_out_endpoint *) data;
+   struct snd_usb_midi_out_endpoint *ep = from_tasklet(ep, t, tasklet);
 
snd_usbmidi_do_output(ep);
 }
@@ -1441,7 +1440,7 @@ static int snd_usbmidi_out_endpoint_create(struct 
snd_usb_midi *umidi,
}
 
spin_lock_init(>buffer_lock);
-   tasklet_init(>tasklet, snd_usbmidi_out_tasklet, (unsigned long)ep);
+   tasklet_setup(>tasklet, snd_usbmidi_out_tasklet);
init_waitqueue_head(>drain_wait);
 
for (i = 0; i < 0x10; ++i)
-- 
2.17.1



[PATCH 06/10] sound/soc: fsl_esai: convert tasklets to use new tasklet_setup() API

2020-08-17 Thread Allen Pais
From: Allen Pais 

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 
Signed-off-by: Allen Pais 
---
 sound/soc/fsl/fsl_esai.c | 7 +++
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/sound/soc/fsl/fsl_esai.c b/sound/soc/fsl/fsl_esai.c
index 4ae36099ae82..79b861afd986 100644
--- a/sound/soc/fsl/fsl_esai.c
+++ b/sound/soc/fsl/fsl_esai.c
@@ -708,9 +708,9 @@ static void fsl_esai_trigger_stop(struct fsl_esai 
*esai_priv, bool tx)
   ESAI_xFCR_xFR, 0);
 }
 
-static void fsl_esai_hw_reset(unsigned long arg)
+static void fsl_esai_hw_reset(struct tasklet_struct *t)
 {
-   struct fsl_esai *esai_priv = (struct fsl_esai *)arg;
+   struct fsl_esai *esai_priv = from_tasklet(esai_priv, t, task);
bool tx = true, rx = false, enabled[2];
unsigned long lock_flags;
u32 tfcr, rfcr;
@@ -1070,8 +1070,7 @@ static int fsl_esai_probe(struct platform_device *pdev)
return ret;
}
 
-   tasklet_init(_priv->task, fsl_esai_hw_reset,
-(unsigned long)esai_priv);
+   tasklet_setup(_priv->task, fsl_esai_hw_reset);
 
pm_runtime_enable(>dev);
 
-- 
2.17.1



[PATCH 08/10] sound/soc: txx9: convert tasklets to use new tasklet_setup() API

2020-08-17 Thread Allen Pais
From: Allen Pais 

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 
Signed-off-by: Allen Pais 
---
 sound/soc/txx9/txx9aclc.c | 7 +++
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/sound/soc/txx9/txx9aclc.c b/sound/soc/txx9/txx9aclc.c
index 4b1cd4da3e36..939b33ec39f5 100644
--- a/sound/soc/txx9/txx9aclc.c
+++ b/sound/soc/txx9/txx9aclc.c
@@ -134,9 +134,9 @@ txx9aclc_dma_submit(struct txx9aclc_dmadata *dmadata, 
dma_addr_t buf_dma_addr)
 
 #define NR_DMA_CHAIN   2
 
-static void txx9aclc_dma_tasklet(unsigned long data)
+static void txx9aclc_dma_tasklet(struct tasklet_struct *t)
 {
-   struct txx9aclc_dmadata *dmadata = (struct txx9aclc_dmadata *)data;
+   struct txx9aclc_dmadata *dmadata = from_tasklet(dmadata, t, tasklet);
struct dma_chan *chan = dmadata->dma_chan;
struct dma_async_tx_descriptor *desc;
struct snd_pcm_substream *substream = dmadata->substream;
@@ -352,8 +352,7 @@ static int txx9aclc_dma_init(struct txx9aclc_soc_device 
*dev,
"playback" : "capture");
return -EBUSY;
}
-   tasklet_init(>tasklet, txx9aclc_dma_tasklet,
-(unsigned long)dmadata);
+   tasklet_setup(>tasklet, txx9aclc_dma_tasklet);
return 0;
 }
 
-- 
2.17.1



[PATCH 07/10] sound/soc: sh: convert tasklets to use new tasklet_setup() API

2020-08-17 Thread Allen Pais
From: Allen Pais 

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 
Signed-off-by: Allen Pais 
---
 sound/soc/sh/siu_pcm.c | 10 --
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/sound/soc/sh/siu_pcm.c b/sound/soc/sh/siu_pcm.c
index bd9de77c35f3..50fc7810723e 100644
--- a/sound/soc/sh/siu_pcm.c
+++ b/sound/soc/sh/siu_pcm.c
@@ -198,9 +198,9 @@ static int siu_pcm_rd_set(struct siu_port *port_info,
return 0;
 }
 
-static void siu_io_tasklet(unsigned long data)
+static void siu_io_tasklet(struct tasklet_struct *t)
 {
-   struct siu_stream *siu_stream = (struct siu_stream *)data;
+   struct siu_stream *siu_stream = from_tasklet(siu_stream, t, tasklet);
struct snd_pcm_substream *substream = siu_stream->substream;
struct device *dev = substream->pcm->card->dev;
struct snd_pcm_runtime *rt = substream->runtime;
@@ -520,10 +520,8 @@ static int siu_pcm_new(struct snd_soc_component *component,
(*port_info)->pcm = pcm;
 
/* IO tasklets */
-   tasklet_init(&(*port_info)->playback.tasklet, siu_io_tasklet,
-(unsigned long)&(*port_info)->playback);
-   tasklet_init(&(*port_info)->capture.tasklet, siu_io_tasklet,
-(unsigned long)&(*port_info)->capture);
+   tasklet_setup(&(*port_info)->playback.tasklet, siu_io_tasklet);
+   tasklet_setup(&(*port_info)->capture.tasklet, siu_io_tasklet);
}
 
dev_info(card->dev, "SuperH SIU driver initialized.\n");
-- 
2.17.1



[PATCH 05/10] sound: rm9652: convert tasklets to use new tasklet_setup() API

2020-08-17 Thread Allen Pais
From: Allen Pais 

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 
Signed-off-by: Allen Pais 
---
 sound/pci/rme9652/hdsp.c  | 6 +++---
 sound/pci/rme9652/hdspm.c | 7 +++
 2 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/sound/pci/rme9652/hdsp.c b/sound/pci/rme9652/hdsp.c
index 227aece17e39..dda56ecfd33b 100644
--- a/sound/pci/rme9652/hdsp.c
+++ b/sound/pci/rme9652/hdsp.c
@@ -3791,9 +3791,9 @@ static int snd_hdsp_set_defaults(struct hdsp *hdsp)
return 0;
 }
 
-static void hdsp_midi_tasklet(unsigned long arg)
+static void hdsp_midi_tasklet(struct tasklet_struct *t)
 {
-   struct hdsp *hdsp = (struct hdsp *)arg;
+   struct hdsp *hdsp = from_tasklet(hdsp, t, midi_tasklet);
 
if (hdsp->midi[0].pending)
snd_hdsp_midi_input_read (>midi[0]);
@@ -5182,7 +5182,7 @@ static int snd_hdsp_create(struct snd_card *card,
 
spin_lock_init(>lock);
 
-   tasklet_init(>midi_tasklet, hdsp_midi_tasklet, (unsigned 
long)hdsp);
+   tasklet_setup(>midi_tasklet, hdsp_midi_tasklet);
 
pci_read_config_word(hdsp->pci, PCI_CLASS_REVISION, 
>firmware_rev);
hdsp->firmware_rev &= 0xff;
diff --git a/sound/pci/rme9652/hdspm.c b/sound/pci/rme9652/hdspm.c
index 0fa49f4d15cf..572350aaf18d 100644
--- a/sound/pci/rme9652/hdspm.c
+++ b/sound/pci/rme9652/hdspm.c
@@ -2169,9 +2169,9 @@ static int snd_hdspm_create_midi(struct snd_card *card,
 }
 
 
-static void hdspm_midi_tasklet(unsigned long arg)
+static void hdspm_midi_tasklet(struct tasklet_struct *t)
 {
-   struct hdspm *hdspm = (struct hdspm *)arg;
+   struct hdspm *hdspm = from_tasklet(hdspm, t, midi_tasklet);
int i = 0;
 
while (i < hdspm->midiPorts) {
@@ -6836,8 +6836,7 @@ static int snd_hdspm_create(struct snd_card *card,
 
}
 
-   tasklet_init(>midi_tasklet,
-   hdspm_midi_tasklet, (unsigned long) hdspm);
+   tasklet_setup(>midi_tasklet, hdspm_midi_tasklet);
 
 
if (hdspm->io_type != MADIface) {
-- 
2.17.1



[PATCH 04/10] sound: riptide: convert tasklets to use new tasklet_setup() API

2020-08-17 Thread Allen Pais
From: Allen Pais 

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 
Signed-off-by: Allen Pais 
---
 sound/pci/riptide/riptide.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/sound/pci/riptide/riptide.c b/sound/pci/riptide/riptide.c
index b4f300281822..098c69b3b7aa 100644
--- a/sound/pci/riptide/riptide.c
+++ b/sound/pci/riptide/riptide.c
@@ -1070,9 +1070,9 @@ getmixer(struct cmdif *cif, short num, unsigned short 
*rval,
return 0;
 }
 
-static void riptide_handleirq(unsigned long dev_id)
+static void riptide_handleirq(struct tasklet_struct *t)
 {
-   struct snd_riptide *chip = (void *)dev_id;
+   struct snd_riptide *chip = from_tasklet(chip, t, riptide_tq);
struct cmdif *cif = chip->cif;
struct snd_pcm_substream *substream[PLAYBACK_SUBSTREAMS + 1];
struct snd_pcm_runtime *runtime;
@@ -1843,7 +1843,7 @@ snd_riptide_create(struct snd_card *card, struct pci_dev 
*pci,
chip->received_irqs = 0;
chip->handled_irqs = 0;
chip->cif = NULL;
-   tasklet_init(>riptide_tq, riptide_handleirq, (unsigned long)chip);
+   tasklet_setup(>riptide_tq, riptide_handleirq);
 
if ((chip->res_port =
 request_region(chip->port, 64, "RIPTIDE")) == NULL) {
-- 
2.17.1



[PATCH 02/10] sound: firewire: convert tasklets to use new tasklet_setup() API

2020-08-17 Thread Allen Pais
From: Allen Pais 

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 
Signed-off-by: Allen Pais 
---
 sound/firewire/amdtp-stream.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/sound/firewire/amdtp-stream.c b/sound/firewire/amdtp-stream.c
index f8586f75441d..ee1c428b1fd3 100644
--- a/sound/firewire/amdtp-stream.c
+++ b/sound/firewire/amdtp-stream.c
@@ -64,7 +64,7 @@
 #define IT_PKT_HEADER_SIZE_CIP 8 // For 2 CIP header.
 #define IT_PKT_HEADER_SIZE_NO_CIP  0 // Nothing.
 
-static void pcm_period_tasklet(unsigned long data);
+static void pcm_period_tasklet(struct tasklet_struct *t);
 
 /**
  * amdtp_stream_init - initialize an AMDTP stream structure
@@ -94,7 +94,7 @@ int amdtp_stream_init(struct amdtp_stream *s, struct fw_unit 
*unit,
s->flags = flags;
s->context = ERR_PTR(-1);
mutex_init(>mutex);
-   tasklet_init(>period_tasklet, pcm_period_tasklet, (unsigned long)s);
+   tasklet_setup(>period_tasklet, pcm_period_tasklet);
s->packet_index = 0;
 
init_waitqueue_head(>callback_wait);
@@ -441,9 +441,9 @@ static void update_pcm_pointers(struct amdtp_stream *s,
}
 }
 
-static void pcm_period_tasklet(unsigned long data)
+static void pcm_period_tasklet(struct tasklet_struct *t)
 {
-   struct amdtp_stream *s = (void *)data;
+   struct amdtp_stream *s = from_tasklet(s, t, period_tasklet);
struct snd_pcm_substream *pcm = READ_ONCE(s->pcm);
 
if (pcm)
-- 
2.17.1



[PATCH 03/10] sound: asihpi: convert tasklets to use new tasklet_setup() API

2020-08-17 Thread Allen Pais
From: Allen Pais 

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 
Signed-off-by: Allen Pais 
---
 sound/pci/asihpi/asihpi.c | 9 -
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/sound/pci/asihpi/asihpi.c b/sound/pci/asihpi/asihpi.c
index 023c35a2a951..35e76480306e 100644
--- a/sound/pci/asihpi/asihpi.c
+++ b/sound/pci/asihpi/asihpi.c
@@ -921,10 +921,10 @@ static void snd_card_asihpi_timer_function(struct 
timer_list *t)
add_timer(>timer);
 }
 
-static void snd_card_asihpi_int_task(unsigned long data)
+static void snd_card_asihpi_int_task(struct tasklet_struct *t)
 {
-   struct hpi_adapter *a = (struct hpi_adapter *)data;
-   struct snd_card_asihpi *asihpi;
+   struct snd_card_asihpi *asihpi = from_tasklet(asihpi, t, t);
+   struct hpi_adapter *a = asihpi->hpi;
 
WARN_ON(!a || !a->snd_card || !a->snd_card->private_data);
asihpi = (struct snd_card_asihpi *)a->snd_card->private_data;
@@ -2871,8 +2871,7 @@ static int snd_asihpi_probe(struct pci_dev *pci_dev,
if (hpi->interrupt_mode) {
asihpi->pcm_start = snd_card_asihpi_pcm_int_start;
asihpi->pcm_stop = snd_card_asihpi_pcm_int_stop;
-   tasklet_init(>t, snd_card_asihpi_int_task,
-   (unsigned long)hpi);
+   tasklet_setup(>t, snd_card_asihpi_int_task);
hpi->interrupt_callback = snd_card_asihpi_isr;
} else {
asihpi->pcm_start = snd_card_asihpi_pcm_timer_start;
-- 
2.17.1



[PATCH 00/10] sound: convert tasklets to use new tasklet_setup()

2020-08-17 Thread Allen Pais
From: Allen Pais 

Commit 12cc923f1ccc ("tasklet: Introduce new initialization API")'
introduced a new tasklet initialization API. This series converts 
all the sound drivers to use the new tasklet_setup() API

Allen Pais (10):
  sound: core: convert tasklets to use new tasklet_setup() API
  sound: firewire: convert tasklets to use new tasklet_setup() API
  sound: asihpi: convert tasklets to use new tasklet_setup() API
  sound: riptide: convert tasklets to use new tasklet_setup() API
  sound: rm9652: convert tasklets to use new tasklet_setup() API
  sound/soc: fsl_esai: convert tasklets to use new tasklet_setup() API
  sound/soc: sh: convert tasklets to use new tasklet_setup() API
  sound/soc: txx9: convert tasklets to use new tasklet_setup() API
  sound: midi: convert tasklets to use new tasklet_setup() API
  sound: ua101: convert tasklets to use new tasklet_setup() API

 sound/core/timer.c|  7 +++
 sound/firewire/amdtp-stream.c |  8 
 sound/pci/asihpi/asihpi.c |  9 -
 sound/pci/riptide/riptide.c   |  6 +++---
 sound/pci/rme9652/hdsp.c  |  6 +++---
 sound/pci/rme9652/hdspm.c |  7 +++
 sound/soc/fsl/fsl_esai.c  |  7 +++
 sound/soc/sh/siu_pcm.c| 10 --
 sound/soc/txx9/txx9aclc.c |  7 +++
 sound/usb/midi.c  |  7 +++
 sound/usb/misc/ua101.c|  7 +++
 11 files changed, 36 insertions(+), 45 deletions(-)

-- 
2.17.1



[PATCH 01/10] sound: core: convert tasklets to use new tasklet_setup() API

2020-08-17 Thread Allen Pais
From: Allen Pais 

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 
Signed-off-by: Allen Pais 
---
 sound/core/timer.c | 7 +++
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/sound/core/timer.c b/sound/core/timer.c
index d9f85f2d66a3..6e27d87b18ed 100644
--- a/sound/core/timer.c
+++ b/sound/core/timer.c
@@ -816,9 +816,9 @@ static void snd_timer_clear_callbacks(struct snd_timer 
*timer,
  * timer tasklet
  *
  */
-static void snd_timer_tasklet(unsigned long arg)
+static void snd_timer_tasklet(struct tasklet_struct *t)
 {
-   struct snd_timer *timer = (struct snd_timer *) arg;
+   struct snd_timer *timer = from_tasklet(timer, t, task_queue);
unsigned long flags;
 
if (timer->card && timer->card->shutdown) {
@@ -967,8 +967,7 @@ int snd_timer_new(struct snd_card *card, char *id, struct 
snd_timer_id *tid,
INIT_LIST_HEAD(>ack_list_head);
INIT_LIST_HEAD(>sack_list_head);
spin_lock_init(>lock);
-   tasklet_init(>task_queue, snd_timer_tasklet,
-(unsigned long)timer);
+   tasklet_setup(>task_queue, snd_timer_tasklet);
timer->max_instances = 1000; /* default limit per timer */
if (card != NULL) {
timer->module = card->module;
-- 
2.17.1



[PATCH 8/8] scsi: pmcraid: convert tasklets to use new tasklet_setup() API

2020-08-17 Thread Allen Pais
From: Allen Pais 

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 
Signed-off-by: Allen Pais 
---
 drivers/scsi/pmcraid.c | 29 +++--
 drivers/scsi/pmcraid.h |  9 +++--
 2 files changed, 22 insertions(+), 16 deletions(-)

diff --git a/drivers/scsi/pmcraid.c b/drivers/scsi/pmcraid.c
index aa9ae2ae8579..b7bbefcbb11d 100644
--- a/drivers/scsi/pmcraid.c
+++ b/drivers/scsi/pmcraid.c
@@ -4198,7 +4198,7 @@ static irqreturn_t pmcraid_isr_msix(int irq, void *dev_id)
}
}
 
-   tasklet_schedule(&(pinstance->isr_tasklet[hrrq_id]));
+   tasklet_schedule(&(pinstance->isr_tasklet[hrrq_id]).tasklet);
 
return IRQ_HANDLED;
 }
@@ -4267,7 +4267,7 @@ static irqreturn_t pmcraid_isr(int irq, void *dev_id)
pinstance->int_regs.ioa_host_interrupt_clr_reg);
 
tasklet_schedule(
-   &(pinstance->isr_tasklet[hrrq_id]));
+   &(pinstance->isr_tasklet[hrrq_id].tasklet));
}
}
 
@@ -4380,20 +4380,20 @@ static void pmcraid_worker_function(struct work_struct 
*workp)
  * Return Value
  * None
  */
-static void pmcraid_tasklet_function(unsigned long instance)
+static void pmcraid_tasklet_function(struct tasklet_struct *t)
 {
-   struct pmcraid_isr_param *hrrq_vector;
-   struct pmcraid_instance *pinstance;
+   struct pmcraid_tsk_param *tsk_param = from_tasklet(tsk_param, t,
+  tasklet);
+   int id = tsk_param->isr_tasklet_id;
+   struct pmcraid_instance *pinstance = container_of(tsk_param,
+ typeof(*pinstance),
+ isr_tasklet[id]);
unsigned long hrrq_lock_flags;
unsigned long pending_lock_flags;
unsigned long host_lock_flags;
spinlock_t *lockp; /* hrrq buffer lock */
-   int id;
u32 resp;
 
-   hrrq_vector = (struct pmcraid_isr_param *)instance;
-   pinstance = hrrq_vector->drv_inst;
-   id = hrrq_vector->hrrq_id;
lockp = &(pinstance->hrrq_lock[id]);
 
/* loop through each of the commands responded by IOA. Each HRRQ buf is
@@ -4882,10 +4882,11 @@ static int pmcraid_allocate_config_buffers(struct 
pmcraid_instance *pinstance)
 static void pmcraid_init_tasklets(struct pmcraid_instance *pinstance)
 {
int i;
-   for (i = 0; i < pinstance->num_hrrq; i++)
-   tasklet_init(>isr_tasklet[i],
-pmcraid_tasklet_function,
-(unsigned long)>hrrq_vector[i]);
+   for (i = 0; i < pinstance->num_hrrq; i++) {
+   pinstance->isr_tasklet[i].isr_tasklet_id = i;
+   tasklet_setup(>isr_tasklet[i].tasklet,
+pmcraid_tasklet_function);
+   }
 }
 
 /**
@@ -4900,7 +4901,7 @@ static void pmcraid_kill_tasklets(struct pmcraid_instance 
*pinstance)
 {
int i;
for (i = 0; i < pinstance->num_hrrq; i++)
-   tasklet_kill(>isr_tasklet[i]);
+   tasklet_kill(>isr_tasklet[i].tasklet);
 }
 
 /**
diff --git a/drivers/scsi/pmcraid.h b/drivers/scsi/pmcraid.h
index 15c962108075..68dab849d4c1 100644
--- a/drivers/scsi/pmcraid.h
+++ b/drivers/scsi/pmcraid.h
@@ -617,6 +617,11 @@ struct pmcraid_isr_param {
u8 hrrq_id; /* hrrq entry index */
 };
 
+/* Tasklet parameters (one for each enabled tasklet) */
+struct pmcraid_tsk_param {
+   struct tasklet_struct tasklet;
+   u8 isr_tasklet_id;  /* isr_tasklet entry index */
+};
 
 /* AEN message header sent as part of event data to applications */
 struct pmcraid_aen_msg {
@@ -752,8 +757,8 @@ struct pmcraid_instance {
spinlock_t free_pool_lock;  /* free pool lock */
spinlock_t pending_pool_lock;   /* pending pool lock */
 
-   /* Tasklet to handle deferred processing */
-   struct tasklet_struct isr_tasklet[PMCRAID_NUM_MSIX_VECTORS];
+   /* Tasklet parameters and tasklets to handle deferred processing */
+   struct pmcraid_tsk_param isr_tasklet[PMCRAID_NUM_MSIX_VECTORS];
 
/* Work-queue (Shared) for deferred reset processing */
struct work_struct worker_q;
-- 
2.17.1



[PATCH 5/8] scsi: megaraid: convert tasklets to use new tasklet_setup() API

2020-08-17 Thread Allen Pais
From: Allen Pais 

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 
Signed-off-by: Allen Pais 
---
 drivers/scsi/megaraid/megaraid_mbox.c   |  9 -
 drivers/scsi/megaraid/megaraid_sas.h|  2 +-
 drivers/scsi/megaraid/megaraid_sas_base.c   | 16 +++-
 drivers/scsi/megaraid/megaraid_sas_fusion.c | 14 +++---
 4 files changed, 19 insertions(+), 22 deletions(-)

diff --git a/drivers/scsi/megaraid/megaraid_mbox.c 
b/drivers/scsi/megaraid/megaraid_mbox.c
index 19469a2c0ea3..47b2d8045c9d 100644
--- a/drivers/scsi/megaraid/megaraid_mbox.c
+++ b/drivers/scsi/megaraid/megaraid_mbox.c
@@ -119,7 +119,7 @@ static void megaraid_mbox_prepare_epthru(adapter_t *, scb_t 
*,
 
 static irqreturn_t megaraid_isr(int, void *);
 
-static void megaraid_mbox_dpc(unsigned long);
+static void megaraid_mbox_dpc(struct tasklet_struct *t);
 
 static ssize_t megaraid_sysfs_show_app_hndl(struct device *, struct 
device_attribute *attr, char *);
 static ssize_t megaraid_sysfs_show_ldnum(struct device *, struct 
device_attribute *attr, char *);
@@ -878,8 +878,7 @@ megaraid_init_mbox(adapter_t *adapter)
}
 
// setup tasklet for DPC
-   tasklet_init(>dpc_h, megaraid_mbox_dpc,
-   (unsigned long)adapter);
+   tasklet_setup(>dpc_h, megaraid_mbox_dpc);
 
con_log(CL_DLEVEL1, (KERN_INFO
"megaraid mbox hba successfully initialized\n"));
@@ -2168,9 +2167,9 @@ megaraid_isr(int irq, void *devp)
  * it is being called.
  */
 static void
-megaraid_mbox_dpc(unsigned long devp)
+megaraid_mbox_dpc(struct tasklet_struct *t)
 {
-   adapter_t   *adapter = (adapter_t *)devp;
+   adapter_t   *adapter = from_tasklet(adapter, t, dpc_h);
mraid_device_t  *raid_dev;
struct list_headclist;
struct scatterlist  *sgl;
diff --git a/drivers/scsi/megaraid/megaraid_sas.h 
b/drivers/scsi/megaraid/megaraid_sas.h
index 5e4137f10e0e..ce361b2b9f14 100644
--- a/drivers/scsi/megaraid/megaraid_sas.h
+++ b/drivers/scsi/megaraid/megaraid_sas.h
@@ -2531,7 +2531,7 @@ struct megasas_instance_template {
int (*check_reset)(struct megasas_instance *, \
struct megasas_register_set __iomem *);
irqreturn_t (*service_isr)(int irq, void *devp);
-   void (*tasklet)(unsigned long);
+   void (*tasklet)(struct tasklet_struct *t);
u32 (*init_adapter)(struct megasas_instance *);
u32 (*build_and_issue_cmd) (struct megasas_instance *,
struct scsi_cmnd *);
diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c 
b/drivers/scsi/megaraid/megaraid_sas_base.c
index 861f7140f52e..dba60cc1cf41 100644
--- a/drivers/scsi/megaraid/megaraid_sas_base.c
+++ b/drivers/scsi/megaraid/megaraid_sas_base.c
@@ -217,7 +217,7 @@ megasas_init_adapter_mfi(struct megasas_instance *instance);
 u32
 megasas_build_and_issue_cmd(struct megasas_instance *instance,
struct scsi_cmnd *scmd);
-static void megasas_complete_cmd_dpc(unsigned long instance_addr);
+static void megasas_complete_cmd_dpc(struct tasklet_struct *t);
 int
 wait_and_poll(struct megasas_instance *instance, struct megasas_cmd *cmd,
int seconds);
@@ -2217,14 +2217,14 @@ megasas_check_and_restore_queue_depth(struct 
megasas_instance *instance)
  *
  * Tasklet to complete cmds
  */
-static void megasas_complete_cmd_dpc(unsigned long instance_addr)
+static void megasas_complete_cmd_dpc(struct tasklet_struct *t)
 {
u32 producer;
u32 consumer;
u32 context;
struct megasas_cmd *cmd;
-   struct megasas_instance *instance =
-   (struct megasas_instance *)instance_addr;
+   struct megasas_instance *instance = from_tasklet(instance, t,
+isr_tasklet);
unsigned long flags;
 
/* If we have already declared adapter dead, donot complete cmds */
@@ -2769,7 +2769,7 @@ static int megasas_wait_for_outstanding(struct 
megasas_instance *instance)
 * Call cmd completion routine. Cmd to be
 * be completed directly without depending on isr.
 */
-   megasas_complete_cmd_dpc((unsigned long)instance);
+   megasas_complete_cmd_dpc(>isr_tasklet);
}
 
msleep(1000);
@@ -6180,8 +6180,7 @@ static int megasas_init_fw(struct megasas_instance 
*instance)
dev_info(>pdev->dev,
"RDPQ mode\t: (%s)\n", instance->is_rdpq ? "enabled" : 
"disabled");
 
-   tasklet_init(>isr_tasklet, instance->instancet->tasklet,
-   (unsigned long)instance

[PATCH 6/8] scsi: mvsas: convert tasklets to use new tasklet_setup() API

2020-08-17 Thread Allen Pais
From: Allen Pais 

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 
Signed-off-by: Allen Pais 
---
 drivers/scsi/mvsas/mv_init.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/scsi/mvsas/mv_init.c b/drivers/scsi/mvsas/mv_init.c
index 978f5283c883..53b2d463fa13 100644
--- a/drivers/scsi/mvsas/mv_init.c
+++ b/drivers/scsi/mvsas/mv_init.c
@@ -147,13 +147,14 @@ static void mvs_free(struct mvs_info *mvi)
 }
 
 #ifdef CONFIG_SCSI_MVSAS_TASKLET
-static void mvs_tasklet(unsigned long opaque)
+static void mvs_tasklet(struct tasklet_struct *t)
 {
u32 stat;
u16 core_nr, i = 0;
 
struct mvs_info *mvi;
-   struct sas_ha_struct *sha = (struct sas_ha_struct *)opaque;
+   struct mvs_prv_info *mpi = from_tasklet(mpi, t, mv_tasklet);
+   struct sas_ha_struct *sha = pci_get_drvdata(mpi->mvi[0]->pdev);
 
core_nr = ((struct mvs_prv_info *)sha->lldd_ha)->n_host;
mvi = ((struct mvs_prv_info *)sha->lldd_ha)->mvi[0];
@@ -564,8 +565,7 @@ static int mvs_pci_init(struct pci_dev *pdev, const struct 
pci_device_id *ent)
} while (nhost < chip->n_host);
mpi = (struct mvs_prv_info *)(SHOST_TO_SAS_HA(shost)->lldd_ha);
 #ifdef CONFIG_SCSI_MVSAS_TASKLET
-   tasklet_init(&(mpi->mv_tasklet), mvs_tasklet,
-(unsigned long)SHOST_TO_SAS_HA(shost));
+   tasklet_setup(&(mpi->mv_tasklet), mvs_tasklet);
 #endif
 
mvs_post_sas_ha_init(shost, chip);
-- 
2.17.1



[PATCH 2/8] scsi: esas2r: convert tasklets to use new tasklet_setup() API

2020-08-17 Thread Allen Pais
From: Allen Pais 

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 
Signed-off-by: Allen Pais 
---
 drivers/scsi/esas2r/esas2r.h  | 2 +-
 drivers/scsi/esas2r/esas2r_init.c | 4 +---
 drivers/scsi/esas2r/esas2r_main.c | 4 ++--
 3 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/drivers/scsi/esas2r/esas2r.h b/drivers/scsi/esas2r/esas2r.h
index e30d2f1f5368..b99434e24868 100644
--- a/drivers/scsi/esas2r/esas2r.h
+++ b/drivers/scsi/esas2r/esas2r.h
@@ -992,7 +992,7 @@ int esas2r_write_vda(struct esas2r_adapter *a, const char 
*buf, long off,
 int esas2r_read_fs(struct esas2r_adapter *a, char *buf, long off, int count);
 int esas2r_write_fs(struct esas2r_adapter *a, const char *buf, long off,
int count);
-void esas2r_adapter_tasklet(unsigned long context);
+void esas2r_adapter_tasklet(struct tasklet_struct *t);
 irqreturn_t esas2r_interrupt(int irq, void *dev_id);
 irqreturn_t esas2r_msi_interrupt(int irq, void *dev_id);
 void esas2r_kickoff_timer(struct esas2r_adapter *a);
diff --git a/drivers/scsi/esas2r/esas2r_init.c 
b/drivers/scsi/esas2r/esas2r_init.c
index eb7d139ffc00..55387c14fb8d 100644
--- a/drivers/scsi/esas2r/esas2r_init.c
+++ b/drivers/scsi/esas2r/esas2r_init.c
@@ -401,9 +401,7 @@ int esas2r_init_adapter(struct Scsi_Host *host, struct 
pci_dev *pcid,
return 0;
}
 
-   tasklet_init(>tasklet,
-esas2r_adapter_tasklet,
-(unsigned long)a);
+   tasklet_setup(>tasklet, esas2r_adapter_tasklet);
 
/*
 * Disable chip interrupts to prevent spurious interrupts
diff --git a/drivers/scsi/esas2r/esas2r_main.c 
b/drivers/scsi/esas2r/esas2r_main.c
index 7b49e2e9fcde..7ffa9406ab4d 100644
--- a/drivers/scsi/esas2r/esas2r_main.c
+++ b/drivers/scsi/esas2r/esas2r_main.c
@@ -1546,9 +1546,9 @@ void esas2r_complete_request_cb(struct esas2r_adapter *a,
 }
 
 /* Run tasklet to handle stuff outside of interrupt context. */
-void esas2r_adapter_tasklet(unsigned long context)
+void esas2r_adapter_tasklet(struct tasklet_struct *t)
 {
-   struct esas2r_adapter *a = (struct esas2r_adapter *)context;
+   struct esas2r_adapter *a = from_tasklet(a, t, tasklet);
 
if (unlikely(test_bit(AF2_TIMER_TICK, >flags2))) {
clear_bit(AF2_TIMER_TICK, >flags2);
-- 
2.17.1



[PATCH 7/8] scsi: pm8001: convert tasklets to use new tasklet_setup() API

2020-08-17 Thread Allen Pais
From: Allen Pais 

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 
Signed-off-by: Allen Pais 
---
 drivers/scsi/pm8001/pm8001_init.c | 55 ++-
 drivers/scsi/pm8001/pm8001_sas.h  |  6 +++-
 2 files changed, 37 insertions(+), 24 deletions(-)

diff --git a/drivers/scsi/pm8001/pm8001_init.c 
b/drivers/scsi/pm8001/pm8001_init.c
index 20fa96cbc9d3..818816c8b295 100644
--- a/drivers/scsi/pm8001/pm8001_init.c
+++ b/drivers/scsi/pm8001/pm8001_init.c
@@ -187,12 +187,15 @@ static void pm8001_free(struct pm8001_hba_info *pm8001_ha)
  * @opaque: the passed general host adapter struct
  * Note: pm8001_tasklet is common for pm8001 & pm80xx
  */
-static void pm8001_tasklet(unsigned long opaque)
+static void pm8001_tasklet(struct tasklet_struct *t)
 {
-   struct pm8001_hba_info *pm8001_ha;
+   struct tsk_param *tsk_param = from_tasklet(tsk_param, t, tasklet);
+   struct pm8001_hba_info *pm8001_ha = container_of(tsk_param,
+   typeof(*pm8001_ha),
+   tasklet[tsk_param->irq_id]);
struct isr_param *irq_vector;
 
-   irq_vector = (struct isr_param *)opaque;
+   irq_vector = _ha->irq_vector[tsk_param->irq_id];
pm8001_ha = irq_vector->drv_inst;
if (unlikely(!pm8001_ha))
BUG_ON(1);
@@ -221,7 +224,7 @@ static irqreturn_t pm8001_interrupt_handler_msix(int irq, 
void *opaque)
if (!PM8001_CHIP_DISP->is_our_interrupt(pm8001_ha))
return IRQ_NONE;
 #ifdef PM8001_USE_TASKLET
-   tasklet_schedule(_ha->tasklet[irq_vector->irq_id]);
+   tasklet_schedule(_ha->tasklet[irq_vector->irq_id].tasklet);
 #else
ret = PM8001_CHIP_DISP->isr(pm8001_ha, irq_vector->irq_id);
 #endif
@@ -246,7 +249,7 @@ static irqreturn_t pm8001_interrupt_handler_intx(int irq, 
void *dev_id)
return IRQ_NONE;
 
 #ifdef PM8001_USE_TASKLET
-   tasklet_schedule(_ha->tasklet[0]);
+   tasklet_schedule(_ha->tasklet[0].tasklet);
 #else
ret = PM8001_CHIP_DISP->isr(pm8001_ha, 0);
 #endif
@@ -507,13 +510,16 @@ static struct pm8001_hba_info *pm8001_pci_alloc(struct 
pci_dev *pdev,
 #ifdef PM8001_USE_TASKLET
/* Tasklet for non msi-x interrupt handler */
if ((!pdev->msix_cap || !pci_msi_enabled())
-   || (pm8001_ha->chip_id == chip_8001))
-   tasklet_init(_ha->tasklet[0], pm8001_tasklet,
-   (unsigned long)&(pm8001_ha->irq_vector[0]));
-   else
-   for (j = 0; j < PM8001_MAX_MSIX_VEC; j++)
-   tasklet_init(_ha->tasklet[j], pm8001_tasklet,
-   (unsigned long)&(pm8001_ha->irq_vector[j]));
+   || (pm8001_ha->chip_id == chip_8001)) {
+   pm8001_ha->tasklet[0].irq_id = 0;
+   tasklet_setup(_ha->tasklet[0].tasklet, pm8001_tasklet);
+   } else {
+   for (j = 0; j < PM8001_MAX_MSIX_VEC; j++) {
+   pm8001_ha->tasklet[j].irq_id = j;
+   tasklet_setup(_ha->tasklet[j].tasklet,
+ pm8001_tasklet);
+   }
+   }
 #endif
pm8001_ioremap(pm8001_ha);
if (!pm8001_alloc(pm8001_ha, ent))
@@ -1162,10 +1168,10 @@ static void pm8001_pci_remove(struct pci_dev *pdev)
/* For non-msix and msix interrupts */
if ((!pdev->msix_cap || !pci_msi_enabled()) ||
(pm8001_ha->chip_id == chip_8001))
-   tasklet_kill(_ha->tasklet[0]);
+   tasklet_kill(_ha->tasklet[0].tasklet);
else
for (j = 0; j < PM8001_MAX_MSIX_VEC; j++)
-   tasklet_kill(_ha->tasklet[j]);
+   tasklet_kill(_ha->tasklet[j].tasklet);
 #endif
scsi_host_put(pm8001_ha->shost);
pm8001_free(pm8001_ha);
@@ -1212,10 +1218,10 @@ static int pm8001_pci_suspend(struct pci_dev *pdev, 
pm_message_t state)
/* For non-msix and msix interrupts */
if ((!pdev->msix_cap || !pci_msi_enabled()) ||
(pm8001_ha->chip_id == chip_8001))
-   tasklet_kill(_ha->tasklet[0]);
+   tasklet_kill(_ha->tasklet[0].tasklet);
else
for (j = 0; j < PM8001_MAX_MSIX_VEC; j++)
-   tasklet_kill(_ha->tasklet[j]);
+   tasklet_kill(_ha->tasklet[j].tasklet);
 #endif
device_state = pci_choose_state(pdev, state);
pm8001_printk("pdev=0x%p, slot=%s, entering "
@@ -1281,13 +1287,16 @@ static int pm8001_pci_resume(struct pci_dev *pdev)
 #ifdef PM8001_USE_TASKLET
/*  Tasklet for non msi-x interrupt handler 

[PATCH 4/8] scsi: isci: convert tasklets to use new tasklet_setup() API

2020-08-17 Thread Allen Pais
From: Allen Pais 

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 
Signed-off-by: Allen Pais 
---
 drivers/scsi/isci/host.c | 4 ++--
 drivers/scsi/isci/host.h | 2 +-
 drivers/scsi/isci/init.c | 3 +--
 3 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/scsi/isci/host.c b/drivers/scsi/isci/host.c
index 7b5deae68d33..599adebd039e 100644
--- a/drivers/scsi/isci/host.c
+++ b/drivers/scsi/isci/host.c
@@ -1113,9 +1113,9 @@ void ireq_done(struct isci_host *ihost, struct 
isci_request *ireq, struct sas_ta
  * @data: This parameter specifies the ISCI host object
  *
  */
-void isci_host_completion_routine(unsigned long data)
+void isci_host_completion_routine(struct tasklet_struct *t)
 {
-   struct isci_host *ihost = (struct isci_host *)data;
+   struct isci_host *ihost = from_tasklet(ihost, t, completion_tasklet);
u16 active;
 
spin_lock_irq(>scic_lock);
diff --git a/drivers/scsi/isci/host.h b/drivers/scsi/isci/host.h
index 6bc3f022630a..6abe23682d9b 100644
--- a/drivers/scsi/isci/host.h
+++ b/drivers/scsi/isci/host.h
@@ -478,7 +478,7 @@ void isci_tci_free(struct isci_host *ihost, u16 tci);
 void ireq_done(struct isci_host *ihost, struct isci_request *ireq, struct 
sas_task *task);
 
 int isci_host_init(struct isci_host *);
-void isci_host_completion_routine(unsigned long data);
+void isci_host_completion_routine(struct tasklet_struct *t);
 void isci_host_deinit(struct isci_host *);
 void sci_controller_disable_interrupts(struct isci_host *ihost);
 bool sci_controller_has_remote_devices_stopping(struct isci_host *ihost);
diff --git a/drivers/scsi/isci/init.c b/drivers/scsi/isci/init.c
index 085e285f427d..32a0117b5ff4 100644
--- a/drivers/scsi/isci/init.c
+++ b/drivers/scsi/isci/init.c
@@ -511,8 +511,7 @@ static struct isci_host *isci_host_alloc(struct pci_dev 
*pdev, int id)
init_waitqueue_head(>eventq);
ihost->sas_ha.dev = >pdev->dev;
ihost->sas_ha.lldd_ha = ihost;
-   tasklet_init(>completion_tasklet,
-isci_host_completion_routine, (unsigned long)ihost);
+   tasklet_setup(>completion_tasklet, isci_host_completion_routine);
 
/* validate module parameters */
/* TODO: kill struct sci_user_parameters and reference directly */
-- 
2.17.1



[PATCH 3/8] scsi: ibmvscsi: convert tasklets to use new tasklet_setup() API

2020-08-17 Thread Allen Pais
From: Allen Pais 

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 
Signed-off-by: Allen Pais 
---
 drivers/scsi/ibmvscsi/ibmvfc.c   | 6 +++---
 drivers/scsi/ibmvscsi/ibmvscsi.c | 8 
 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c | 7 +++
 3 files changed, 10 insertions(+), 11 deletions(-)

diff --git a/drivers/scsi/ibmvscsi/ibmvfc.c b/drivers/scsi/ibmvscsi/ibmvfc.c
index 77f4d37d5bd6..50f025cdabbd 100644
--- a/drivers/scsi/ibmvscsi/ibmvfc.c
+++ b/drivers/scsi/ibmvscsi/ibmvfc.c
@@ -3204,9 +3204,9 @@ static irqreturn_t ibmvfc_interrupt(int irq, void 
*dev_instance)
  * Returns:
  * Nothing
  **/
-static void ibmvfc_tasklet(void *data)
+static void ibmvfc_tasklet(struct tasklet_struct *t)
 {
-   struct ibmvfc_host *vhost = data;
+   struct ibmvfc_host *vhost = from_tasklet(vhost, t, tasklet);
struct vio_dev *vdev = to_vio_dev(vhost->dev);
struct ibmvfc_crq *crq;
struct ibmvfc_async_crq *async;
@@ -4676,7 +4676,7 @@ static int ibmvfc_init_crq(struct ibmvfc_host *vhost)
 
retrc = 0;
 
-   tasklet_init(>tasklet, (void *)ibmvfc_tasklet, (unsigned 
long)vhost);
+   tasklet_setup(>tasklet, (void *)ibmvfc_tasklet);
 
if ((rc = request_irq(vdev->irq, ibmvfc_interrupt, 0, IBMVFC_NAME, 
vhost))) {
dev_err(dev, "Couldn't register irq 0x%x. rc=%d\n", vdev->irq, 
rc);
diff --git a/drivers/scsi/ibmvscsi/ibmvscsi.c b/drivers/scsi/ibmvscsi/ibmvscsi.c
index b1f3017b6547..46b818daa957 100644
--- a/drivers/scsi/ibmvscsi/ibmvscsi.c
+++ b/drivers/scsi/ibmvscsi/ibmvscsi.c
@@ -208,9 +208,10 @@ static int ibmvscsi_send_crq(struct ibmvscsi_host_data 
*hostdata,
  * ibmvscsi_task: - Process srps asynchronously
  * @data:  ibmvscsi_host_data of host
  */
-static void ibmvscsi_task(void *data)
+static void ibmvscsi_task(struct tasklet_struct *t)
 {
-   struct ibmvscsi_host_data *hostdata = (struct ibmvscsi_host_data *)data;
+   struct ibmvscsi_host_data *hostdata = from_tasklet(hostdata, t,
+  srp_task);
struct vio_dev *vdev = to_vio_dev(hostdata->dev);
struct viosrp_crq *crq;
int done = 0;
@@ -366,8 +367,7 @@ static int ibmvscsi_init_crq_queue(struct crq_queue *queue,
queue->cur = 0;
spin_lock_init(>lock);
 
-   tasklet_init(>srp_task, (void *)ibmvscsi_task,
-(unsigned long)hostdata);
+   tasklet_setup(>srp_task, ibmvscsi_task);
 
if (request_irq(vdev->irq,
ibmvscsi_handle_event,
diff --git a/drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c 
b/drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c
index d9e94e81da01..e62fd6c67001 100644
--- a/drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c
+++ b/drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c
@@ -3328,9 +3328,9 @@ static int ibmvscsis_rdma(struct ibmvscsis_cmd *cmd, 
struct scatterlist *sg,
  *
  * Note: this is an edge triggered interrupt. It can not be shared.
  */
-static void ibmvscsis_handle_crq(unsigned long data)
+static void ibmvscsis_handle_crq(struct tasklet_struct *t)
 {
-   struct scsi_info *vscsi = (struct scsi_info *)data;
+   struct scsi_info *vscsi = from_tasklet(vscsi, t, work_task);
struct viosrp_crq *crq;
long rc;
bool ack = true;
@@ -3541,8 +3541,7 @@ static int ibmvscsis_probe(struct vio_dev *vdev,
dev_dbg(>dev, "probe hrc %ld, client partition num %d\n",
hrc, vscsi->client_data.partition_number);
 
-   tasklet_init(>work_task, ibmvscsis_handle_crq,
-(unsigned long)vscsi);
+   tasklet_setup(>work_task, ibmvscsis_handle_crq);
 
init_completion(>wait_idle);
init_completion(>unconfig);
-- 
2.17.1



[PATCH 0/8] scsi: convert tasklets to use new tasklet_setup()

2020-08-17 Thread Allen Pais
From: Allen Pais 

Commit 12cc923f1ccc ("tasklet: Introduce new initialization API")'
introduced a new tasklet initialization API. This series converts 
all the scsi drivers to use the new tasklet_setup() API

Allen Pais (8):
  scsi: aic94xx: convert tasklets to use new tasklet_setup() API
  scsi: esas2r: convert tasklets to use new tasklet_setup() API
  scsi: ibmvscsi: convert tasklets to use new tasklet_setup() API
  scsi: isci: convert tasklets to use new tasklet_setup() API
  scsi: megaraid: convert tasklets to use new tasklet_setup() API
  scsi: mvsas: convert tasklets to use new tasklet_setup() API
  scsi: pm8001: convert tasklets to use new tasklet_setup() API
  scsi: pmcraid: convert tasklets to use new tasklet_setup() API

 drivers/scsi/aic94xx/aic94xx_hwi.c  |  9 ++--
 drivers/scsi/esas2r/esas2r.h|  2 +-
 drivers/scsi/esas2r/esas2r_init.c   |  4 +-
 drivers/scsi/esas2r/esas2r_main.c   |  4 +-
 drivers/scsi/ibmvscsi/ibmvfc.c  |  6 +--
 drivers/scsi/ibmvscsi/ibmvscsi.c|  8 +--
 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c|  7 ++-
 drivers/scsi/isci/host.c|  4 +-
 drivers/scsi/isci/host.h|  2 +-
 drivers/scsi/isci/init.c|  3 +-
 drivers/scsi/megaraid/megaraid_mbox.c   |  9 ++--
 drivers/scsi/megaraid/megaraid_sas.h|  2 +-
 drivers/scsi/megaraid/megaraid_sas_base.c   | 16 +++---
 drivers/scsi/megaraid/megaraid_sas_fusion.c | 14 +++---
 drivers/scsi/mvsas/mv_init.c|  8 +--
 drivers/scsi/pm8001/pm8001_init.c   | 55 -
 drivers/scsi/pm8001/pm8001_sas.h|  6 ++-
 drivers/scsi/pmcraid.c  | 29 +--
 drivers/scsi/pmcraid.h  |  9 +++-
 19 files changed, 104 insertions(+), 93 deletions(-)

-- 
2.17.1



[PATCH 1/8] scsi: aic94xx: convert tasklets to use new tasklet_setup() API

2020-08-17 Thread Allen Pais
From: Allen Pais 

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 
Signed-off-by: Allen Pais 
---
 drivers/scsi/aic94xx/aic94xx_hwi.c | 9 -
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/scsi/aic94xx/aic94xx_hwi.c 
b/drivers/scsi/aic94xx/aic94xx_hwi.c
index 9256ab7b2522..1e4d32246cb9 100644
--- a/drivers/scsi/aic94xx/aic94xx_hwi.c
+++ b/drivers/scsi/aic94xx/aic94xx_hwi.c
@@ -248,7 +248,7 @@ static void asd_get_max_scb_ddb(struct asd_ha_struct 
*asd_ha)
 
 /* -- Done List initialization -- */
 
-static void asd_dl_tasklet_handler(unsigned long);
+static void asd_dl_tasklet_handler(struct tasklet_struct *t);
 
 static int asd_init_dl(struct asd_ha_struct *asd_ha)
 {
@@ -261,8 +261,7 @@ static int asd_init_dl(struct asd_ha_struct *asd_ha)
asd_ha->seq.dl = asd_ha->seq.actual_dl->vaddr;
asd_ha->seq.dl_toggle = ASD_DEF_DL_TOGGLE;
asd_ha->seq.dl_next = 0;
-   tasklet_init(_ha->seq.dl_tasklet, asd_dl_tasklet_handler,
-(unsigned long) asd_ha);
+   tasklet_setup(_ha->seq.dl_tasklet, asd_dl_tasklet_handler);
 
return 0;
 }
@@ -711,9 +710,9 @@ static void asd_chip_reset(struct asd_ha_struct *asd_ha)
 
 /* -- Done List Routines -- */
 
-static void asd_dl_tasklet_handler(unsigned long data)
+static void asd_dl_tasklet_handler(struct tasklet_struct *t)
 {
-   struct asd_ha_struct *asd_ha = (struct asd_ha_struct *) data;
+   struct asd_ha_struct *asd_ha = from_tasklet(asd_ha, t, seq.dl_tasklet);
struct asd_seq_data *seq = _ha->seq;
unsigned long flags;
 
-- 
2.17.1



[PATCH 7/8] net: smc: convert tasklets to use new tasklet_setup() API

2020-08-17 Thread Allen Pais
From: Allen Pais 

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 
Signed-off-by: Allen Pais 
---
 net/smc/smc_cdc.c |  6 +++---
 net/smc/smc_wr.c  | 14 ++
 2 files changed, 9 insertions(+), 11 deletions(-)

diff --git a/net/smc/smc_cdc.c b/net/smc/smc_cdc.c
index ce468ff62a19..5db2166197d3 100644
--- a/net/smc/smc_cdc.c
+++ b/net/smc/smc_cdc.c
@@ -389,9 +389,9 @@ static void smc_cdc_msg_recv(struct smc_sock *smc, struct 
smc_cdc_msg *cdc)
  * Context:
  * - tasklet context
  */
-static void smcd_cdc_rx_tsklet(unsigned long data)
+static void smcd_cdc_rx_tsklet(struct tasklet_struct *t)
 {
-   struct smc_connection *conn = (struct smc_connection *)data;
+   struct smc_connection *conn = from_tasklet(conn, t, rx_tsklet);
struct smcd_cdc_msg *data_cdc;
struct smcd_cdc_msg cdc;
struct smc_sock *smc;
@@ -411,7 +411,7 @@ static void smcd_cdc_rx_tsklet(unsigned long data)
  */
 void smcd_cdc_rx_init(struct smc_connection *conn)
 {
-   tasklet_init(>rx_tsklet, smcd_cdc_rx_tsklet, (unsigned long)conn);
+   tasklet_setup(>rx_tsklet, smcd_cdc_rx_tsklet);
 }
 
 /* init, exit, misc **/
diff --git a/net/smc/smc_wr.c b/net/smc/smc_wr.c
index 1e23cdd41eb1..cbc73a7e4d59 100644
--- a/net/smc/smc_wr.c
+++ b/net/smc/smc_wr.c
@@ -131,9 +131,9 @@ static inline void smc_wr_tx_process_cqe(struct ib_wc *wc)
wake_up(>wr_tx_wait);
 }
 
-static void smc_wr_tx_tasklet_fn(unsigned long data)
+static void smc_wr_tx_tasklet_fn(struct tasklet_struct *t)
 {
-   struct smc_ib_device *dev = (struct smc_ib_device *)data;
+   struct smc_ib_device *dev = from_tasklet(dev, t, send_tasklet);
struct ib_wc wc[SMC_WR_MAX_POLL_CQE];
int i = 0, rc;
int polled = 0;
@@ -435,9 +435,9 @@ static inline void smc_wr_rx_process_cqes(struct ib_wc 
wc[], int num)
}
 }
 
-static void smc_wr_rx_tasklet_fn(unsigned long data)
+static void smc_wr_rx_tasklet_fn(struct tasklet_struct *t)
 {
-   struct smc_ib_device *dev = (struct smc_ib_device *)data;
+   struct smc_ib_device *dev = from_tasklet(dev, t, recv_tasklet);
struct ib_wc wc[SMC_WR_MAX_POLL_CQE];
int polled = 0;
int rc;
@@ -698,10 +698,8 @@ void smc_wr_remove_dev(struct smc_ib_device *smcibdev)
 
 void smc_wr_add_dev(struct smc_ib_device *smcibdev)
 {
-   tasklet_init(>recv_tasklet, smc_wr_rx_tasklet_fn,
-(unsigned long)smcibdev);
-   tasklet_init(>send_tasklet, smc_wr_tx_tasklet_fn,
-(unsigned long)smcibdev);
+   tasklet_setup(>recv_tasklet, smc_wr_rx_tasklet_fn);
+   tasklet_setup(>send_tasklet, smc_wr_tx_tasklet_fn);
 }
 
 int smc_wr_create_link(struct smc_link *lnk)
-- 
2.17.1



[PATCH 6/8] net: sched: convert tasklets to use new tasklet_setup() API

2020-08-17 Thread Allen Pais
From: Allen Pais 

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 
Signed-off-by: Allen Pais 
---
 net/sched/sch_atm.c | 9 +
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/net/sched/sch_atm.c b/net/sched/sch_atm.c
index 1c281cc81f57..0a4452178d5d 100644
--- a/net/sched/sch_atm.c
+++ b/net/sched/sch_atm.c
@@ -466,10 +466,11 @@ drop: __maybe_unused
  * non-ATM interfaces.
  */
 
-static void sch_atm_dequeue(unsigned long data)
+static void sch_atm_dequeue(struct tasklet_struct *t)
 {
-   struct Qdisc *sch = (struct Qdisc *)data;
-   struct atm_qdisc_data *p = qdisc_priv(sch);
+   struct atm_qdisc_data *p = from_tasklet(p, t, task);
+   struct Qdisc *sch = (struct Qdisc *)((char *) p -
+QDISC_ALIGN(sizeof(struct Qdisc)));
struct atm_flow_data *flow;
struct sk_buff *skb;
 
@@ -563,7 +564,7 @@ static int atm_tc_init(struct Qdisc *sch, struct nlattr 
*opt,
if (err)
return err;
 
-   tasklet_init(>task, sch_atm_dequeue, (unsigned long)sch);
+   tasklet_setup(>task, sch_atm_dequeue);
return 0;
 }
 
-- 
2.17.1



[PATCH 4/8] net: mac802154: convert tasklets to use new tasklet_setup() API

2020-08-17 Thread Allen Pais
From: Allen Pais 

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 
Signed-off-by: Allen Pais 
---
 net/mac802154/main.c | 8 +++-
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/net/mac802154/main.c b/net/mac802154/main.c
index 06ea0f8bfd5c..520cedc594e1 100644
--- a/net/mac802154/main.c
+++ b/net/mac802154/main.c
@@ -20,9 +20,9 @@
 #include "ieee802154_i.h"
 #include "cfg.h"
 
-static void ieee802154_tasklet_handler(unsigned long data)
+static void ieee802154_tasklet_handler(struct tasklet_struct *t)
 {
-   struct ieee802154_local *local = (struct ieee802154_local *)data;
+   struct ieee802154_local *local = from_tasklet(local, t, tasklet);
struct sk_buff *skb;
 
while ((skb = skb_dequeue(>skb_queue))) {
@@ -91,9 +91,7 @@ ieee802154_alloc_hw(size_t priv_data_len, const struct 
ieee802154_ops *ops)
INIT_LIST_HEAD(>interfaces);
mutex_init(>iflist_mtx);
 
-   tasklet_init(>tasklet,
-ieee802154_tasklet_handler,
-(unsigned long)local);
+   tasklet_setup(>tasklet, ieee802154_tasklet_handler);
 
skb_queue_head_init(>skb_queue);
 
-- 
2.17.1



[PATCH 8/8] net: xfrm: convert tasklets to use new tasklet_setup() API

2020-08-17 Thread Allen Pais
From: Allen Pais 

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 
Signed-off-by: Allen Pais 
---
 net/xfrm/xfrm_input.c | 7 +++
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/net/xfrm/xfrm_input.c b/net/xfrm/xfrm_input.c
index 37456d022cfa..be6351e3f3cd 100644
--- a/net/xfrm/xfrm_input.c
+++ b/net/xfrm/xfrm_input.c
@@ -760,9 +760,9 @@ int xfrm_input_resume(struct sk_buff *skb, int nexthdr)
 }
 EXPORT_SYMBOL(xfrm_input_resume);
 
-static void xfrm_trans_reinject(unsigned long data)
+static void xfrm_trans_reinject(struct tasklet_struct *t)
 {
-   struct xfrm_trans_tasklet *trans = (void *)data;
+   struct xfrm_trans_tasklet *trans = from_tasklet(trans, t, tasklet);
struct sk_buff_head queue;
struct sk_buff *skb;
 
@@ -818,7 +818,6 @@ void __init xfrm_input_init(void)
 
trans = _cpu(xfrm_trans_tasklet, i);
__skb_queue_head_init(>queue);
-   tasklet_init(>tasklet, xfrm_trans_reinject,
-(unsigned long)trans);
+   tasklet_setup(>tasklet, xfrm_trans_reinject);
}
 }
-- 
2.17.1



[PATCH 5/8] net: rds: convert tasklets to use new tasklet_setup() API

2020-08-17 Thread Allen Pais
From: Allen Pais 

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 
Signed-off-by: Allen Pais 
---
 net/rds/ib_cm.c | 14 ++
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/net/rds/ib_cm.c b/net/rds/ib_cm.c
index c3319ff3ee11..2e8872d51fa8 100644
--- a/net/rds/ib_cm.c
+++ b/net/rds/ib_cm.c
@@ -314,9 +314,9 @@ static void poll_scq(struct rds_ib_connection *ic, struct 
ib_cq *cq,
}
 }
 
-static void rds_ib_tasklet_fn_send(unsigned long data)
+static void rds_ib_tasklet_fn_send(struct tasklet_struct *t)
 {
-   struct rds_ib_connection *ic = (struct rds_ib_connection *)data;
+   struct rds_ib_connection *ic = from_tasklet(ic, t, i_send_tasklet);
struct rds_connection *conn = ic->conn;
 
rds_ib_stats_inc(s_ib_tasklet_call);
@@ -354,9 +354,9 @@ static void poll_rcq(struct rds_ib_connection *ic, struct 
ib_cq *cq,
}
 }
 
-static void rds_ib_tasklet_fn_recv(unsigned long data)
+static void rds_ib_tasklet_fn_recv(struct tasklet_struct *t)
 {
-   struct rds_ib_connection *ic = (struct rds_ib_connection *)data;
+   struct rds_ib_connection *ic = from_tasklet(ic, t, i_recv_tasklet);
struct rds_connection *conn = ic->conn;
struct rds_ib_device *rds_ibdev = ic->rds_ibdev;
struct rds_ib_ack_state state;
@@ -1218,10 +1218,8 @@ int rds_ib_conn_alloc(struct rds_connection *conn, gfp_t 
gfp)
}
 
INIT_LIST_HEAD(>ib_node);
-   tasklet_init(>i_send_tasklet, rds_ib_tasklet_fn_send,
-(unsigned long)ic);
-   tasklet_init(>i_recv_tasklet, rds_ib_tasklet_fn_recv,
-(unsigned long)ic);
+   tasklet_setup(>i_send_tasklet, rds_ib_tasklet_fn_send);
+   tasklet_setup(>i_recv_tasklet, rds_ib_tasklet_fn_recv);
mutex_init(>i_recv_mutex);
 #ifndef KERNEL_HAS_ATOMIC64
spin_lock_init(>i_ack_lock);
-- 
2.17.1



[PATCH 3/8] net: mac80211: convert tasklets to use new tasklet_setup() API

2020-08-17 Thread Allen Pais
From: Allen Pais 

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 
Signed-off-by: Allen Pais 
---
 net/mac80211/ieee80211_i.h |  4 ++--
 net/mac80211/main.c| 14 +-
 net/mac80211/tx.c  |  5 +++--
 net/mac80211/util.c|  5 +++--
 4 files changed, 13 insertions(+), 15 deletions(-)

diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
index 0b1eaec6649f..3fb87a3cee30 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -1775,7 +1775,7 @@ static inline bool ieee80211_sdata_running(struct 
ieee80211_sub_if_data *sdata)
 
 /* tx handling */
 void ieee80211_clear_tx_pending(struct ieee80211_local *local);
-void ieee80211_tx_pending(unsigned long data);
+void ieee80211_tx_pending(struct tasklet_struct *t);
 netdev_tx_t ieee80211_monitor_start_xmit(struct sk_buff *skb,
 struct net_device *dev);
 netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb,
@@ -2125,7 +2125,7 @@ void ieee80211_txq_remove_vlan(struct ieee80211_local 
*local,
   struct ieee80211_sub_if_data *sdata);
 void ieee80211_fill_txq_stats(struct cfg80211_txq_stats *txqstats,
  struct txq_info *txqi);
-void ieee80211_wake_txqs(unsigned long data);
+void ieee80211_wake_txqs(struct tasklet_struct *t);
 void ieee80211_send_auth(struct ieee80211_sub_if_data *sdata,
 u16 transaction, u16 auth_alg, u16 status,
 const u8 *extra, size_t extra_len, const u8 *bssid,
diff --git a/net/mac80211/main.c b/net/mac80211/main.c
index b4a2efe8e83a..dd489b841bb7 100644
--- a/net/mac80211/main.c
+++ b/net/mac80211/main.c
@@ -220,9 +220,9 @@ u32 ieee80211_reset_erp_info(struct ieee80211_sub_if_data 
*sdata)
   BSS_CHANGED_ERP_SLOT;
 }
 
-static void ieee80211_tasklet_handler(unsigned long data)
+static void ieee80211_tasklet_handler(struct tasklet_struct *t)
 {
-   struct ieee80211_local *local = (struct ieee80211_local *) data;
+   struct ieee80211_local *local = from_tasklet(local, t, tasklet);
struct sk_buff *skb;
 
while ((skb = skb_dequeue(>skb_queue)) ||
@@ -733,16 +733,12 @@ struct ieee80211_hw *ieee80211_alloc_hw_nm(size_t 
priv_data_len,
skb_queue_head_init(>pending[i]);
atomic_set(>agg_queue_stop[i], 0);
}
-   tasklet_init(>tx_pending_tasklet, ieee80211_tx_pending,
-(unsigned long)local);
+   tasklet_setup(>tx_pending_tasklet, ieee80211_tx_pending);
 
if (ops->wake_tx_queue)
-   tasklet_init(>wake_txqs_tasklet, ieee80211_wake_txqs,
-(unsigned long)local);
+   tasklet_setup(>wake_txqs_tasklet, ieee80211_wake_txqs);
 
-   tasklet_init(>tasklet,
-ieee80211_tasklet_handler,
-(unsigned long) local);
+   tasklet_setup(>tasklet, ieee80211_tasklet_handler);
 
skb_queue_head_init(>skb_queue);
skb_queue_head_init(>skb_queue_unreliable);
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index dca01d7e6e3e..a7fafd2f196b 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -4401,9 +4401,10 @@ static bool ieee80211_tx_pending_skb(struct 
ieee80211_local *local,
 /*
  * Transmit all pending packets. Called from tasklet.
  */
-void ieee80211_tx_pending(unsigned long data)
+void ieee80211_tx_pending(struct tasklet_struct *t)
 {
-   struct ieee80211_local *local = (struct ieee80211_local *)data;
+   struct ieee80211_local *local = from_tasklet(local, t,
+tx_pending_tasklet);
unsigned long flags;
int i;
bool txok;
diff --git a/net/mac80211/util.c b/net/mac80211/util.c
index c8504ffc71a1..b99d3d2721df 100644
--- a/net/mac80211/util.c
+++ b/net/mac80211/util.c
@@ -334,9 +334,10 @@ _ieee80211_wake_txqs(struct ieee80211_local *local, 
unsigned long *flags)
rcu_read_unlock();
 }
 
-void ieee80211_wake_txqs(unsigned long data)
+void ieee80211_wake_txqs(struct tasklet_struct *t)
 {
-   struct ieee80211_local *local = (struct ieee80211_local *)data;
+   struct ieee80211_local *local = from_tasklet(local, t,
+wake_txqs_tasklet);
unsigned long flags;
 
spin_lock_irqsave(>queue_stop_reason_lock, flags);
-- 
2.17.1



[PATCH 2/8] net: ipv4: convert tasklets to use new tasklet_setup() API

2020-08-17 Thread Allen Pais
From: Allen Pais 

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 
Signed-off-by: Allen Pais 
---
 net/ipv4/tcp_output.c | 8 +++-
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
index 85ff417bda7f..6afad9b407a1 100644
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
@@ -883,9 +883,9 @@ static void tcp_tsq_handler(struct sock *sk)
  * transferring tsq->head because tcp_wfree() might
  * interrupt us (non NAPI drivers)
  */
-static void tcp_tasklet_func(unsigned long data)
+static void tcp_tasklet_func(struct tasklet_struct *t)
 {
-   struct tsq_tasklet *tsq = (struct tsq_tasklet *)data;
+   struct tsq_tasklet *tsq = from_tasklet(tsq,  t, tasklet);
LIST_HEAD(list);
unsigned long flags;
struct list_head *q, *n;
@@ -970,9 +970,7 @@ void __init tcp_tasklet_init(void)
struct tsq_tasklet *tsq = _cpu(tsq_tasklet, i);
 
INIT_LIST_HEAD(>head);
-   tasklet_init(>tasklet,
-tcp_tasklet_func,
-(unsigned long)tsq);
+   tasklet_setup(>tasklet, tcp_tasklet_func);
}
 }
 
-- 
2.17.1



[PATCH 1/8] net: dccp: convert tasklets to use new tasklet_setup() API

2020-08-17 Thread Allen Pais
From: Allen Pais 

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 
Signed-off-by: Allen Pais 
---
 net/dccp/timer.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/net/dccp/timer.c b/net/dccp/timer.c
index 0e06dfc32273..f174ecb2fb4e 100644
--- a/net/dccp/timer.c
+++ b/net/dccp/timer.c
@@ -220,9 +220,10 @@ static void dccp_delack_timer(struct timer_list *t)
  *
  * See the comments above %ccid_dequeueing_decision for supported modes.
  */
-static void dccp_write_xmitlet(unsigned long data)
+static void dccp_write_xmitlet(struct tasklet_struct *t)
 {
-   struct sock *sk = (struct sock *)data;
+   struct dccp_sock *dp = from_tasklet(dp, t, dccps_xmitlet);
+   struct sock *sk = >dccps_inet_connection.icsk_inet.sk;
 
bh_lock_sock(sk);
if (sock_owned_by_user(sk))
@@ -236,16 +237,15 @@ static void dccp_write_xmitlet(unsigned long data)
 static void dccp_write_xmit_timer(struct timer_list *t)
 {
struct dccp_sock *dp = from_timer(dp, t, dccps_xmit_timer);
-   struct sock *sk = >dccps_inet_connection.icsk_inet.sk;
 
-   dccp_write_xmitlet((unsigned long)sk);
+   dccp_write_xmitlet(>dccps_xmitlet);
 }
 
 void dccp_init_xmit_timers(struct sock *sk)
 {
struct dccp_sock *dp = dccp_sk(sk);
 
-   tasklet_init(>dccps_xmitlet, dccp_write_xmitlet, (unsigned long)sk);
+   tasklet_setup(>dccps_xmitlet, dccp_write_xmitlet);
timer_setup(>dccps_xmit_timer, dccp_write_xmit_timer, 0);
inet_csk_init_xmit_timers(sk, _write_timer, _delack_timer,
  _keepalive_timer);
-- 
2.17.1



[PATCH 4/9] net: hso: convert tasklets to use new tasklet_setup() API

2020-08-17 Thread Allen Pais
From: Allen Pais 

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 
Signed-off-by: Allen Pais 
---
 drivers/net/usb/hso.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/net/usb/hso.c b/drivers/net/usb/hso.c
index 2bb28db89432..56b3b6395831 100644
--- a/drivers/net/usb/hso.c
+++ b/drivers/net/usb/hso.c
@@ -1213,9 +1213,10 @@ static void hso_std_serial_read_bulk_callback(struct urb 
*urb)
  * This needs to be a tasklet otherwise we will
  * end up recursively calling this function.
  */
-static void hso_unthrottle_tasklet(unsigned long data)
+static void hso_unthrottle_tasklet(struct tasklet_struct *t)
 {
-   struct hso_serial *serial = (struct hso_serial *)data;
+   struct hso_serial *serial = from_tasklet(serial, t,
+unthrottle_tasklet);
unsigned long flags;
 
spin_lock_irqsave(>serial_lock, flags);
@@ -1264,9 +1265,8 @@ static int hso_serial_open(struct tty_struct *tty, struct 
file *filp)
serial->rx_state = RX_IDLE;
/* Force default termio settings */
_hso_serial_set_termios(tty, NULL);
-   tasklet_init(>unthrottle_tasklet,
-hso_unthrottle_tasklet,
-(unsigned long)serial);
+   tasklet_setup(>unthrottle_tasklet,
+hso_unthrottle_tasklet);
result = hso_start_serial_device(serial->parent, GFP_KERNEL);
if (result) {
hso_stop_serial_device(serial->parent);
-- 
2.17.1



[PATCH 2/9] net: ppp: convert tasklets to use new tasklet_setup() API

2020-08-17 Thread Allen Pais
From: Allen Pais 

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 
Signed-off-by: Allen Pais 
---
 drivers/net/ppp/ppp_async.c   | 8 
 drivers/net/ppp/ppp_synctty.c | 8 
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/net/ppp/ppp_async.c b/drivers/net/ppp/ppp_async.c
index 29a0917a81e6..2b66cf301b0e 100644
--- a/drivers/net/ppp/ppp_async.c
+++ b/drivers/net/ppp/ppp_async.c
@@ -101,7 +101,7 @@ static void ppp_async_input(struct asyncppp *ap, const 
unsigned char *buf,
char *flags, int count);
 static int ppp_async_ioctl(struct ppp_channel *chan, unsigned int cmd,
   unsigned long arg);
-static void ppp_async_process(unsigned long arg);
+static void ppp_async_process(struct tasklet_struct *t);
 
 static void async_lcp_peek(struct asyncppp *ap, unsigned char *data,
   int len, int inbound);
@@ -179,7 +179,7 @@ ppp_asynctty_open(struct tty_struct *tty)
ap->lcp_fcs = -1;
 
skb_queue_head_init(>rqueue);
-   tasklet_init(>tsk, ppp_async_process, (unsigned long) ap);
+   tasklet_setup(>tsk, ppp_async_process);
 
refcount_set(>refcnt, 1);
init_completion(>dead);
@@ -488,9 +488,9 @@ ppp_async_ioctl(struct ppp_channel *chan, unsigned int cmd, 
unsigned long arg)
  * to the ppp_generic code, and to tell the ppp_generic code
  * if we can accept more output now.
  */
-static void ppp_async_process(unsigned long arg)
+static void ppp_async_process(struct tasklet_struct *t)
 {
-   struct asyncppp *ap = (struct asyncppp *) arg;
+   struct asyncppp *ap = from_tasklet(ap, t, tsk);
struct sk_buff *skb;
 
/* process received packets */
diff --git a/drivers/net/ppp/ppp_synctty.c b/drivers/net/ppp/ppp_synctty.c
index 0f338752c38b..86ee5149f4f2 100644
--- a/drivers/net/ppp/ppp_synctty.c
+++ b/drivers/net/ppp/ppp_synctty.c
@@ -90,7 +90,7 @@ static struct sk_buff* ppp_sync_txmunge(struct syncppp *ap, 
struct sk_buff *);
 static int ppp_sync_send(struct ppp_channel *chan, struct sk_buff *skb);
 static int ppp_sync_ioctl(struct ppp_channel *chan, unsigned int cmd,
  unsigned long arg);
-static void ppp_sync_process(unsigned long arg);
+static void ppp_sync_process(struct tasklet_struct *t);
 static int ppp_sync_push(struct syncppp *ap);
 static void ppp_sync_flush_output(struct syncppp *ap);
 static void ppp_sync_input(struct syncppp *ap, const unsigned char *buf,
@@ -177,7 +177,7 @@ ppp_sync_open(struct tty_struct *tty)
ap->raccm = ~0U;
 
skb_queue_head_init(>rqueue);
-   tasklet_init(>tsk, ppp_sync_process, (unsigned long) ap);
+   tasklet_setup(>tsk, ppp_sync_process);
 
refcount_set(>refcnt, 1);
init_completion(>dead_cmp);
@@ -480,9 +480,9 @@ ppp_sync_ioctl(struct ppp_channel *chan, unsigned int cmd, 
unsigned long arg)
  * to the ppp_generic code, and to tell the ppp_generic code
  * if we can accept more output now.
  */
-static void ppp_sync_process(unsigned long arg)
+static void ppp_sync_process(struct tasklet_struct *t)
 {
-   struct syncppp *ap = (struct syncppp *) arg;
+   struct syncppp *ap = from_tasklet(ap, t, tsk);
struct sk_buff *skb;
 
/* process received packets */
-- 
2.17.1



[PATCH 3/9] net: cdc_ncm: convert tasklets to use new tasklet_setup() API

2020-08-17 Thread Allen Pais
From: Allen Pais 

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 
Signed-off-by: Allen Pais 
---
 drivers/net/usb/cdc_ncm.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/usb/cdc_ncm.c b/drivers/net/usb/cdc_ncm.c
index e04f588538cc..57a95ef90385 100644
--- a/drivers/net/usb/cdc_ncm.c
+++ b/drivers/net/usb/cdc_ncm.c
@@ -61,7 +61,7 @@ static bool prefer_mbim;
 module_param(prefer_mbim, bool, 0644);
 MODULE_PARM_DESC(prefer_mbim, "Prefer MBIM setting on dual NCM/MBIM 
functions");
 
-static void cdc_ncm_txpath_bh(unsigned long param);
+static void cdc_ncm_txpath_bh(struct tasklet_struct *t);
 static void cdc_ncm_tx_timeout_start(struct cdc_ncm_ctx *ctx);
 static enum hrtimer_restart cdc_ncm_tx_timer_cb(struct hrtimer *hr_timer);
 static struct usb_driver cdc_ncm_driver;
@@ -815,7 +815,7 @@ int cdc_ncm_bind_common(struct usbnet *dev, struct 
usb_interface *intf, u8 data_
 
hrtimer_init(>tx_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
ctx->tx_timer.function = _ncm_tx_timer_cb;
-   tasklet_init(>bh, cdc_ncm_txpath_bh, (unsigned long)dev);
+   tasklet_setup(>bh, cdc_ncm_txpath_bh);
atomic_set(>stop, 0);
spin_lock_init(>mtx);
 
@@ -1468,9 +1468,9 @@ static enum hrtimer_restart cdc_ncm_tx_timer_cb(struct 
hrtimer *timer)
return HRTIMER_NORESTART;
 }
 
-static void cdc_ncm_txpath_bh(unsigned long param)
+static void cdc_ncm_txpath_bh(struct tasklet_struct *t)
 {
-   struct usbnet *dev = (struct usbnet *)param;
+   struct usbnet *dev = from_tasklet(dev, t, bh);
struct cdc_ncm_ctx *ctx = (struct cdc_ncm_ctx *)dev->data[0];
 
spin_lock_bh(>mtx);
-- 
2.17.1



[PATCH 9/9] net: usbnet: convert tasklets to use new tasklet_setup() API

2020-08-17 Thread Allen Pais
From: Allen Pais 

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
and remove the .data field.

Signed-off-by: Romain Perier 
Signed-off-by: Allen Pais 
---
 drivers/net/usb/usbnet.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c
index e45935a5856a..45bf0814939d 100644
--- a/drivers/net/usb/usbnet.c
+++ b/drivers/net/usb/usbnet.c
@@ -1708,8 +1708,7 @@ usbnet_probe (struct usb_interface *udev, const struct 
usb_device_id *prod)
skb_queue_head_init (>txq);
skb_queue_head_init (>done);
skb_queue_head_init(>rxq_pause);
-   dev->bh.func = usbnet_bh_tasklet;
-   dev->bh.data = (unsigned long)>delay;
+   dev->bh.func = (void(*) (unsigned long))usbnet_bh_tasklet;
INIT_WORK (>kevent, usbnet_deferred_kevent);
init_usb_anchor(>deferred);
timer_setup(>delay, usbnet_bh, 0);
-- 
2.17.1



[PATCH 2/2] net: caif: convert tasklets to use new tasklet_setup() API

2020-08-17 Thread Allen Pais
From: Allen Pais 

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 
Signed-off-by: Allen Pais 
---
 drivers/net/caif/caif_virtio.c | 8 +++-
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/net/caif/caif_virtio.c b/drivers/net/caif/caif_virtio.c
index 80ea2e913c2b..23c2eb8ceeec 100644
--- a/drivers/net/caif/caif_virtio.c
+++ b/drivers/net/caif/caif_virtio.c
@@ -598,9 +598,9 @@ static netdev_tx_t cfv_netdev_tx(struct sk_buff *skb, 
struct net_device *netdev)
return NETDEV_TX_OK;
 }
 
-static void cfv_tx_release_tasklet(unsigned long drv)
+static void cfv_tx_release_tasklet(struct tasklet_struct *t)
 {
-   struct cfv_info *cfv = (struct cfv_info *)drv;
+   struct cfv_info *cfv = from_tasklet(cfv, t, tx_release_tasklet);
cfv_release_used_buf(cfv->vq_tx);
 }
 
@@ -716,9 +716,7 @@ static int cfv_probe(struct virtio_device *vdev)
cfv->ctx.head = USHRT_MAX;
netif_napi_add(netdev, >napi, cfv_rx_poll, CFV_DEFAULT_QUOTA);
 
-   tasklet_init(>tx_release_tasklet,
-cfv_tx_release_tasklet,
-(unsigned long)cfv);
+   tasklet_setup(>tx_release_tasklet, cfv_tx_release_tasklet);
 
/* Carrier is off until netdevice is opened */
netif_carrier_off(netdev);
-- 
2.17.1



[PATCH 6/9] net: pegasus: convert tasklets to use new tasklet_setup() API

2020-08-17 Thread Allen Pais
From: Allen Pais 

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 
Signed-off-by: Allen Pais 
---
 drivers/net/usb/pegasus.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/usb/pegasus.c b/drivers/net/usb/pegasus.c
index 0ef7e1f443e3..addf904e7c65 100644
--- a/drivers/net/usb/pegasus.c
+++ b/drivers/net/usb/pegasus.c
@@ -565,12 +565,12 @@ static void read_bulk_callback(struct urb *urb)
tasklet_schedule(>rx_tl);
 }
 
-static void rx_fixup(unsigned long data)
+static void rx_fixup(struct tasklet_struct *t)
 {
pegasus_t *pegasus;
int status;
 
-   pegasus = (pegasus_t *) data;
+   pegasus = from_tasklet(pegasus, t, rx_tl);
if (pegasus->flags & PEGASUS_UNPLUG)
return;
 
@@ -1141,7 +1141,7 @@ static int pegasus_probe(struct usb_interface *intf,
goto out1;
}
 
-   tasklet_init(>rx_tl, rx_fixup, (unsigned long) pegasus);
+   tasklet_setup(>rx_tl, rx_fixup);
 
INIT_DELAYED_WORK(>carrier_check, check_carrier);
 
-- 
2.17.1



  1   2   3   4   5   >