Re: [PATCH] crypto: ccp -A value assigned to a variable is never used.

2021-03-31 Thread John Allen
On Tue, Mar 30, 2021 at 06:10:29PM +0800, Jiapeng Chong wrote:
> Fix the following whitescan warning:
> 
> Assigning value "64" to "dst.address" here, but that stored value is
> overwritten before it can be used.
> 

Thanks for reporting.

Acked-by: John Allen 

> Reported-by: Abaci Robot 
> Signed-off-by: Jiapeng Chong 
> ---
>  drivers/crypto/ccp/ccp-ops.c | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/drivers/crypto/ccp/ccp-ops.c b/drivers/crypto/ccp/ccp-ops.c
> index d6a8f4e..bb88198 100644
> --- a/drivers/crypto/ccp/ccp-ops.c
> +++ b/drivers/crypto/ccp/ccp-ops.c
> @@ -2418,7 +2418,6 @@ static int ccp_run_ecc_pm_cmd(struct ccp_cmd_queue 
> *cmd_q, struct ccp_cmd *cmd)
>   dst.address += CCP_ECC_OUTPUT_SIZE;
>   ccp_reverse_get_dm_area(, 0, ecc->u.pm.result.y, 0,
>   CCP_ECC_MODULUS_BYTES);
> - dst.address += CCP_ECC_OUTPUT_SIZE;
>  
>   /* Restore the workarea address */
>   dst.address = save;
> -- 
> 1.8.3.1
> 


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



[PATCH v6] drm/bridge: add it6505 driver

2020-12-08 Thread allen
This adds support for the iTE IT6505.
This device can convert DPI signal to DP output.

From: Allen Chen 
Signed-off-by: Jitao Shi 
Signed-off-by: Pi-Hsun Shih 
Signed-off-by: Yilun Lin 
Signed-off-by: Hermes Wu 
Signed-off-by: Allen Chen 
---
 drivers/gpu/drm/bridge/Kconfig  |7 +
 drivers/gpu/drm/bridge/Makefile |1 +
 drivers/gpu/drm/bridge/ite-it6505.c | 3343 +++
 3 files changed, 3351 insertions(+)
 create mode 100644 drivers/gpu/drm/bridge/ite-it6505.c

diff --git a/drivers/gpu/drm/bridge/Kconfig b/drivers/gpu/drm/bridge/Kconfig
index e4110d6ca7b3c..25d34d7196004 100644
--- a/drivers/gpu/drm/bridge/Kconfig
+++ b/drivers/gpu/drm/bridge/Kconfig
@@ -74,6 +74,13 @@ config DRM_LONTIUM_LT9611UXC
  HDMI signals
  Please say Y if you have such hardware.
 
+config DRM_ITE_IT6505
+   tristate "ITE IT6505 DisplayPort bridge"
+   depends on OF
+   select DRM_KMS_HELPER
+   help
+ ITE IT6505 DisplayPort bridge chip driver.
+
 config DRM_LVDS_CODEC
tristate "Transparent LVDS encoders and decoders support"
depends on OF
diff --git a/drivers/gpu/drm/bridge/Makefile b/drivers/gpu/drm/bridge/Makefile
index 86e7acc76f8d6..2b2f8f0b5b0fa 100644
--- a/drivers/gpu/drm/bridge/Makefile
+++ b/drivers/gpu/drm/bridge/Makefile
@@ -4,6 +4,7 @@ obj-$(CONFIG_DRM_CHRONTEL_CH7033) += chrontel-ch7033.o
 obj-$(CONFIG_DRM_DISPLAY_CONNECTOR) += display-connector.o
 obj-$(CONFIG_DRM_LONTIUM_LT9611) += lontium-lt9611.o
 obj-$(CONFIG_DRM_LONTIUM_LT9611UXC) += lontium-lt9611uxc.o
+obj-$(CONFIG_DRM_ITE_IT6505) += ite-it6505.o
 obj-$(CONFIG_DRM_LVDS_CODEC) += lvds-codec.o
 obj-$(CONFIG_DRM_MEGACHIPS_STDP_GE_B850V3_FW) += 
megachips-stdp-ge-b850v3-fw.o
 obj-$(CONFIG_DRM_NXP_PTN3460) += nxp-ptn3460.o
diff --git a/drivers/gpu/drm/bridge/ite-it6505.c 
b/drivers/gpu/drm/bridge/ite-it6505.c
new file mode 100644
index 0..5e76719a51a4a
--- /dev/null
+++ b/drivers/gpu/drm/bridge/ite-it6505.c
@@ -0,0 +1,3343 @@
+// SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+/*
+ * Copyright (c) 2020, The Linux Foundation. All rights reserved.
+ */
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+#define REG_IC_VER 0x04
+
+#define REG_RESET_CTRL 0x05
+#define VIDEO_RESET BIT(0)
+#define AUDIO_RESET BIT(1)
+#define ALL_LOGIC_RESET BIT(2)
+#define AUX_RESET BIT(3)
+#define HDCP_RESET BIT(4)
+
+#define INT_STATUS_01 0x06
+#define INT_MASK_01 0x09
+#define INT_HPD_CHANGE BIT(0)
+#define INT_RECEIVE_HPD_IRQ BIT(1)
+#define INT_SCDT_CHANGE BIT(2)
+#define INT_HDCP_FAIL BIT(3)
+#define INT_HDCP_DONE BIT(4)
+
+#define INT_STATUS_02 0x07
+#define INT_MASK_02 0x0A
+#define INT_AUX_CMD_FAIL BIT(0)
+#define INT_HDCP_KSV_CHECK BIT(1)
+#define INT_AUDIO_FIFO_ERROR BIT(2)
+
+#define INT_STATUS_03 0x08
+#define INT_MASK_03 0x0B
+#define INT_LINK_TRAIN_FAIL BIT(4)
+#define INT_VID_FIFO_ERROR BIT(5)
+#define INT_IO_LATCH_FIFO_OVERFLOW BIT(7)
+
+#define REG_SYSTEM_STS 0x0D
+#define INT_STS BIT(0)
+#define HPD_STS BIT(1)
+#define VIDEO_STB BIT(2)
+
+#define REG_LINK_TRAIN_STS 0x0E
+#define LINK_STATE_CR BIT(2)
+#define LINK_STATE_EQ BIT(3)
+#define LINK_STATE_NORP BIT(4)
+
+#define REG_BANK_SEL 0x0F
+#define REG_CLK_CTRL0 0x10
+#define M_PCLK_DELAY 0x03
+
+#define REG_AUX_OPT 0x11
+#define AUX_AUTO_RST BIT(0)
+#define AUX_FIX_FREQ BIT(3)
+
+#define REG_DATA_CTRL0 0x12
+#define VIDEO_LATCH_EDGE BIT(4)
+#define ENABLE_PCLK_COUNTER BIT(7)
+
+#define REG_PCLK_COUNTER_VALUE 0x13
+
+#define REG_501_FIFO_CTRL 0x15
+#define RST_501_FIFO BIT(1)
+
+#define REG_TRAIN_CTRL0 0x16
+#define FORCE_LBR BIT(0)
+#define LANE_COUNT_MASK 0x06
+#define LANE_SWAP BIT(3)
+#define SPREAD_AMP_5 BIT(4)
+#define FORCE_CR_DONE BIT(5)
+#define FORCE_EQ_DONE BIT(6)
+
+#define REG_TRAIN_CTRL1 0x17
+#define AUTO_TRAIN BIT(0)
+#define MANUAL_TRAIN BIT(1)
+#define FORCE_RETRAIN BIT(2)
+
+#define REG_AUX_CTRL 0x23
+#define CLR_EDID_FIFO BIT(0)
+#define AUX_USER_MODE BIT(1)
+#define AUX_NO_SEGMENT_WR BIT(6)
+#define AUX_EN_FIFO_READ BIT(7)
+
+#define REG_AUX_ADR_0_7 0x24
+#define REG_AUX_ADR_8_15 0x25
+#define REG_AUX_ADR_16_19 0x26
+#define REG_AUX_OUT_DATA0 0x27
+
+#define REG_AUX_CMD_REQ 0x2B
+#define AUX_BUSY BIT(5)
+
+#define REG_AUX_DATA_0_7 0x2C
+#define REG_AUX_DATA_8_15 0x2D
+#define REG_AUX_DATA_16_23 0x2E
+#define REG_AUX_DATA_24_31 0x2F
+
+#define REG_AUX_DATA_FIFO 0x2F
+
+#define REG_AUX_ERROR_STS 0x9F
+#define M_AUX_REQ_FAIL 0x03
+
+#define REG_HDCP_CTRL1 0x38
+#define HDCP_CP_ENABLE BIT(0)
+
+#define REG_HDCP_TRIGGER 0x39
+#define HDCP_TRIGGER_START  BIT(0)
+#define HDCP_TRIGGER_CPIRQ  BIT(1)
+#define HDCP_TRIGGER_KSV_DONE  BIT(4)
+#define HDCP_TRIGGER_KSV_FAIL BIT(5)
+
+#define REG_HDCP_CTRL2 0x3A
+#defi

[PATCH v5] drm/bridge: add it6505 driver

2020-11-30 Thread allen
This adds support for the iTE IT6505.
This device can convert DPI signal to DP output.

From: Allen Chen 
Signed-off-by: Jitao Shi 
Signed-off-by: Pi-Hsun Shih 
Signed-off-by: Yilun Lin 
Signed-off-by: Hermes Wu 
Signed-off-by: Allen Chen 
---
 drivers/gpu/drm/bridge/Kconfig  |7 +
 drivers/gpu/drm/bridge/Makefile |1 +
 drivers/gpu/drm/bridge/ite-it6505.c | 3343 +++
 3 files changed, 3351 insertions(+)
 create mode 100644 drivers/gpu/drm/bridge/ite-it6505.c

diff --git a/drivers/gpu/drm/bridge/Kconfig b/drivers/gpu/drm/bridge/Kconfig
index e4110d6ca7b3c..25d34d7196004 100644
--- a/drivers/gpu/drm/bridge/Kconfig
+++ b/drivers/gpu/drm/bridge/Kconfig
@@ -74,6 +74,13 @@ config DRM_LONTIUM_LT9611UXC
  HDMI signals
  Please say Y if you have such hardware.
 
+config DRM_ITE_IT6505
+   tristate "ITE IT6505 DisplayPort bridge"
+   depends on OF
+   select DRM_KMS_HELPER
+   help
+ ITE IT6505 DisplayPort bridge chip driver.
+
 config DRM_LVDS_CODEC
tristate "Transparent LVDS encoders and decoders support"
depends on OF
diff --git a/drivers/gpu/drm/bridge/Makefile b/drivers/gpu/drm/bridge/Makefile
index 86e7acc76f8d6..2b2f8f0b5b0fa 100644
--- a/drivers/gpu/drm/bridge/Makefile
+++ b/drivers/gpu/drm/bridge/Makefile
@@ -4,6 +4,7 @@ obj-$(CONFIG_DRM_CHRONTEL_CH7033) += chrontel-ch7033.o
 obj-$(CONFIG_DRM_DISPLAY_CONNECTOR) += display-connector.o
 obj-$(CONFIG_DRM_LONTIUM_LT9611) += lontium-lt9611.o
 obj-$(CONFIG_DRM_LONTIUM_LT9611UXC) += lontium-lt9611uxc.o
+obj-$(CONFIG_DRM_ITE_IT6505) += ite-it6505.o
 obj-$(CONFIG_DRM_LVDS_CODEC) += lvds-codec.o
 obj-$(CONFIG_DRM_MEGACHIPS_STDP_GE_B850V3_FW) += 
megachips-stdp-ge-b850v3-fw.o
 obj-$(CONFIG_DRM_NXP_PTN3460) += nxp-ptn3460.o
diff --git a/drivers/gpu/drm/bridge/ite-it6505.c 
b/drivers/gpu/drm/bridge/ite-it6505.c
new file mode 100644
index 0..e4251c69fc991
--- /dev/null
+++ b/drivers/gpu/drm/bridge/ite-it6505.c
@@ -0,0 +1,3343 @@
+// SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+/*
+ * Copyright (c) 2020, The Linux Foundation. All rights reserved.
+ */
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+#define REG_IC_VER 0x04
+
+#define REG_RESET_CTRL 0x05
+#define VIDEO_RESET BIT(0)
+#define AUDIO_RESET BIT(1)
+#define ALL_LOGIC_RESET BIT(2)
+#define AUX_RESET BIT(3)
+#define HDCP_RESET BIT(4)
+
+#define INT_STATUS_01 0x06
+#define INT_MASK_01 0x09
+#define INT_HPD_CHANGE BIT(0)
+#define INT_RECEIVE_HPD_IRQ BIT(1)
+#define INT_SCDT_CHANGE BIT(2)
+#define INT_HDCP_FAIL BIT(3)
+#define INT_HDCP_DONE BIT(4)
+
+#define INT_STATUS_02 0x07
+#define INT_MASK_02 0x0A
+#define INT_AUX_CMD_FAIL BIT(0)
+#define INT_HDCP_KSV_CHECK BIT(1)
+#define INT_AUDIO_FIFO_ERROR BIT(2)
+
+#define INT_STATUS_03 0x08
+#define INT_MASK_03 0x0B
+#define INT_LINK_TRAIN_FAIL BIT(4)
+#define INT_VID_FIFO_ERROR BIT(5)
+#define INT_IO_LATCH_FIFO_OVERFLOW BIT(7)
+
+#define REG_SYSTEM_STS 0x0D
+#define INT_STS BIT(0)
+#define HPD_STS BIT(1)
+#define VIDEO_STB BIT(2)
+
+#define REG_LINK_TRAIN_STS 0x0E
+#define LINK_STATE_CR BIT(2)
+#define LINK_STATE_EQ BIT(3)
+#define LINK_STATE_NORP BIT(4)
+
+#define REG_BANK_SEL 0x0F
+#define REG_CLK_CTRL0 0x10
+#define M_PCLK_DELAY 0x03
+
+#define REG_AUX_OPT 0x11
+#define AUX_AUTO_RST BIT(0)
+#define AUX_FIX_FREQ BIT(3)
+
+#define REG_DATA_CTRL0 0x12
+#define VIDEO_LATCH_EDGE BIT(4)
+#define ENABLE_PCLK_COUNTER BIT(7)
+
+#define REG_PCLK_COUNTER_VALUE 0x13
+
+#define REG_501_FIFO_CTRL 0x15
+#define RST_501_FIFO BIT(1)
+
+#define REG_TRAIN_CTRL0 0x16
+#define FORCE_LBR BIT(0)
+#define LANE_COUNT_MASK 0x06
+#define LANE_SWAP BIT(3)
+#define SPREAD_AMP_5 BIT(4)
+#define FORCE_CR_DONE BIT(5)
+#define FORCE_EQ_DONE BIT(6)
+
+#define REG_TRAIN_CTRL1 0x17
+#define AUTO_TRAIN BIT(0)
+#define MANUAL_TRAIN BIT(1)
+#define FORCE_RETRAIN BIT(2)
+
+#define REG_AUX_CTRL 0x23
+#define CLR_EDID_FIFO BIT(0)
+#define AUX_USER_MODE BIT(1)
+#define AUX_NO_SEGMENT_WR BIT(6)
+#define AUX_EN_FIFO_READ BIT(7)
+
+#define REG_AUX_ADR_0_7 0x24
+#define REG_AUX_ADR_8_15 0x25
+#define REG_AUX_ADR_16_19 0x26
+#define REG_AUX_OUT_DATA0 0x27
+
+#define REG_AUX_CMD_REQ 0x2B
+#define AUX_BUSY BIT(5)
+
+#define REG_AUX_DATA_0_7 0x2C
+#define REG_AUX_DATA_8_15 0x2D
+#define REG_AUX_DATA_16_23 0x2E
+#define REG_AUX_DATA_24_31 0x2F
+
+#define REG_AUX_DATA_FIFO 0x2F
+
+#define REG_AUX_ERROR_STS 0x9F
+#define M_AUX_REQ_FAIL 0x03
+
+#define REG_HDCP_CTRL1 0x38
+#define HDCP_CP_ENABLE BIT(0)
+
+#define REG_HDCP_TRIGGER 0x39
+#define HDCP_TRIGGER_START  BIT(0)
+#define HDCP_TRIGGER_CPIRQ  BIT(1)
+#define HDCP_TRIGGER_KSV_DONE  BIT(4)
+#define HDCP_TRIGGER_KSV_FAIL BIT(5)
+
+#define REG_HDCP_CTRL2 0x3A
+#defi

[PATCH] linux-firmware: Update AMD SEV firmware

2020-11-20 Thread John Allen
Update AMD SEV firmware to version 0.17 build 44 for AMD family 17h
processors with models in the range 00h to 0fh.

Update AMD SEV firmware to version 0.24 build 7 for AMD family 17h
processors with models in the range 30h to 3fh.

Signed-off-by: John Allen 
---
 WHENCE   |   4 ++--
 amd/amd_sev_fam17h_model0xh.sbin | Bin 33472 -> 33344 bytes
 amd/amd_sev_fam17h_model3xh.sbin | Bin 44032 -> 43904 bytes
 3 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/WHENCE b/WHENCE
index cfdbee7..5471a23 100644
--- a/WHENCE
+++ b/WHENCE
@@ -3724,9 +3724,9 @@ Licence: Redistributable. See LICENCE.go7007 for details
 Driver: ccp - Platform Security Processor (PSP) device
 
 File: amd/amd_sev_fam17h_model0xh.sbin
-Version: 2020-09-15
+Version: 2020-11-20
 File: amd/amd_sev_fam17h_model3xh.sbin
-Version: 2020-09-15
+Version: 2020-11-20
 
 License: Redistributable. See LICENSE.amd-sev for details
 
diff --git a/amd/amd_sev_fam17h_model0xh.sbin b/amd/amd_sev_fam17h_model0xh.sbin
index 
331f3e94e8624b31583af8cba0c466c66810066a..5e6afc2b4c16e40d1a02b85eff23c6ecd8b6cfec
 100644
GIT binary patch
delta 15342
zcmZvD34Bvk+WtAWH%s@F7TVJ7rcK+F7D!p71%!0rHh{9buqXjh(*hE3!*Mh%jDmad
zpi>wfcc-m7HXm1W&9qCCAlJv&?r8H5@Ox6`39+d#*BgEuUycbK6KgCJDW*|wY_g>>KvQOjna;)CII(Jfnrba^xtOD$`reUnv;~3GVkyGpq5CAQJyL5<)}I*swLUV
z{8-!H21#+6*DP<)v{se2O;7Ym^tD9r020qZw%z=X)^7W+ztB-R$BUR*eVWX
z7zln}wP;$!Ht}M~jpE?RyT!rTtHg`S2CZFelkLfE)REFg9P#7DHfq=Io#Z86(Q6xw
zBdJ~39M@xq21sh0=R-fSf9MzOAGqh(7um;p*Phc8!IQi%s=gGx6J__>6TSc0vcOHH
z5BiAKZzs}My+m5*FC*~-G#F>ZhIK8k{GVg*A=yqD*rYEv|2pAP9wEHk;FcwLY;Uy0h)eiO0gF2wKY
zK4Rpw{XU2%LsTtgtCN?~6!u#3PO4{>DVI-vIzr6{J^KB+eWYz!KJoPggx0QZ&3;lu
z_L=eKSAL<@*-iINi0zS$J)M$GH?X%-is?>vI;EUWVDYJ?u4n!QR|D(j4s
zDqI}UItBf5lOOJ2d!y#yEu?UqUvYCTq8J?yg|hN
z`{GDI7@S#O=yTTo_U{m+fS_*9y(3pYDa~_eK-9+%i1GhYCcDv^ZeEsK>T_B@
zv?D``?ahuXcaoQs%#gq6HACL4`I22i!)E$`gOsTrBE8e=JUEt!ki$GrR1JnL4$kTa
z`whfO0cK1oaF27OxXaxd?@>R&
zSM+Z59?o7;zE9?iolN?A7dozX9H*b(s{T;KjZ?AcP5u#J$dxT7OQHvA|zp
znV6b1K$FP+z4N{~u~+_I9sKP5lmRj2|9GEerdG@v5qHYblC+%I=L%qI(OA3jJ7A0AdDwpLi^%pK#;xDwn)UVau
zcTTH`JNM-!UAVidgd{3gSO+-GY8r>N9wMUHI9CDQwSq{i99c@A6Q(re|l=Y;rVxn6FN(>!L!
zc6awcZmLbrIKgFWX1^ep$rdp4PXF3-L_b;4d4a|r3-)9M1*4lxk-uM>oF_|&>xFH{8{xoFE%zE@5_m1yGX@{;zYSY%KA|cYCok7sJmlL?vu6WPo#LkT!s?aU3;k!?H9K`kfZ6}p*#|ld7P2H#3qkhIc7mn
zlu4W39p~#0Ng%lYG4|BBk_JmiOL7!}>j!P7m$bbN<)HOY$FUz%Xth1g_g*N;TOG?$
zJ86sa9SLp76)R4k*qkd&{PKh)))65~SbSzFHL}Xgbb67^%bZ1TXDylO2InV~=noP}
zH@`_Htr{D9Hgj9?)ln)r?Di(J-Mg{fuDKZJT)*j?O%b)}Lg6Nml01j!4Qxi1(UmMe
z*)@(coQUb^OrE?0D~t{~qLxOjg=I2-s=bifc2u9%nu1?LYg$`Zt#I6cUwT4oO7|M}
zX$GuhOsl>=ZC^TmGw|)m1~7azTNb@53L9YnMATO=jO*eQ@wGS)zSxx_Ysg}sL<(CI
z)_NAXCFA(^i26gs0p30o7Kv$uR-)t`nF4eQO0$&-n;de-CgMAe+!&<^xjy9nf?T3f
z*y)hRcM#t?+Ez|Mfj9$(|YiZ79p#zLEO=!5Xvkig$;JTWcDb4I!3;8nUNr
ztVc5HF^T&1**eluPRrYXmx4wg;`^G3A#39G|rUgWz#Q=@6zMcApqr5MNEExr#
z#-D~YT6%0BvXt@pu9^s`xYBd+fENSb5ju6?S)|)ShYmQ5J2B7{4D>Y8Ns*oH#HWUc
zd75G^G|D`e8z$z7O5vuR?ayI-W05OS)+6@~aw*6aC@*zB-N9SFi1)ITCP!SmadSj9
zf8U5F>MM>Cb258nd=4#TABLSy+@Zv2Cj%F1ADa|C=6U7M$})2ZN@Q}IYVkf`WVv7kUoUe
zhIALwRY-Rt-GtPI^j@TQhYRIdkbJ(&9g)_<6ObFzo+gusW=we}#A-Aey6LQDHw(dX#zr}L`mDVCW(mj>81
z`DMZ(58IJnk`ae}(ki6QC`&#

Re: [PATCH] ASoC: bcm2835: Add enable/disable clock functions

2020-10-29 Thread Allen Martin

On Wed, Oct 28, 2020 at 10:39:12AM +0100, Matthias Reichl wrote:

On Wed, Oct 28, 2020 at 01:18:33AM -0700, Allen Martin wrote:

Hi, just checking if you had a chance to review this patch.

On Sat, Oct 10, 2020 at 12:26 PM Allen Martin  wrote:

> Add functions to control enable/disable of BCLK output of bcm2835 I2S
> controller so that BCLK output only starts when dma starts.  This
> resolves issues of audio pop with DACs such as max98357 on rpi.  The
> LRCLK output of bcm2835 only starts when the frame size has been
> configured and there is data in the FIFO.  The max98357 dac makes a
> loud popping sound when BCLK is toggling but LRCLK is not.


I'm afraid that changing the clocking in the way you proposed has a high
potential of breaking existing setups which need bclk to be present
after prepare(). And it complicates the already rather convoluted
clock setup even more. So I don't think this patch should be applied.

Since you mentioned max98357: have you properly connected and configured
the sd-mode GPIO? This chip has very strict timing requirements and is
known to "pop" without sd-mode wired up - see the datasheet and devicetree
binding docs.


The board I'm testing on is this: https://www.adafruit.com/product/3346
which does not have SD_MODE wired to GPIO (schematic is here:
https://www.adafruit.com/product/3346).  I agree this should ideally
be wired to GPIO as described in the max98357 datasheet to enable the
click and pop suppression feature, however there are still problems
with the clock initialization this patch addresses:

1) In bcm2835_i2s_hw_params() BCLK is enabled before the FIFO is
cleared causing residual data in the FIFO to be transmitted when BCLK
is initialized.

2) Also in bcm2835_i2s_hw_params() BCLK is enabled before the frame
size is configured in MODE_A or DMA is initialized.  This causes the
i2s controller to transmit a data frame many thousands of bits long,
violating the 0.5*BCLK < t < 0.5*LRCLK requirement of the max98357
datasheet.

I think the driver should separate clock initialization from output
enable and only start trasmitting once everything is initialized and
there is data to transmit.

Do you have more details about what setups require BCLK output after
prepare()?  I have access to a PCM5101A DAC, but I have not tested it
yet.

-Allen



>
> Signed-off-by: Allen Martin 
> ---
>  sound/soc/bcm/bcm2835-i2s.c | 35 +++
>  1 file changed, 35 insertions(+)
>
> diff --git a/sound/soc/bcm/bcm2835-i2s.c b/sound/soc/bcm/bcm2835-i2s.c
> index e6a12e271b07..5c8649864c0d 100644
> --- a/sound/soc/bcm/bcm2835-i2s.c
> +++ b/sound/soc/bcm/bcm2835-i2s.c
> @@ -122,9 +122,27 @@ struct bcm2835_i2s_dev {
> struct regmap   *i2s_regmap;
> struct clk  *clk;
> boolclk_prepared;
> +   boolclk_enabled;
> int clk_rate;
>  };
>
> +static void bcm2835_i2s_enable_clock(struct bcm2835_i2s_dev *dev)
> +{
> +   if (dev->clk_enabled)
> +   return;
> +
> +   regmap_update_bits(dev->i2s_regmap, BCM2835_I2S_MODE_A_REG,
> BCM2835_I2S_CLKDIS, 0);
> +   dev->clk_enabled = true;
> +}
> +
> +static void bcm2835_i2s_disable_clock(struct bcm2835_i2s_dev *dev)
> +{
> +   if (dev->clk_enabled)
> +   regmap_update_bits(dev->i2s_regmap,
> BCM2835_I2S_MODE_A_REG, BCM2835_I2S_CLKDIS, BCM2835_I2S_CLKDIS);
> +
> +   dev->clk_enabled = false;
> +}
> +
>  static void bcm2835_i2s_start_clock(struct bcm2835_i2s_dev *dev)
>  {
> unsigned int master = dev->fmt & SND_SOC_DAIFMT_MASTER_MASK;
> @@ -145,6 +163,7 @@ static void bcm2835_i2s_start_clock(struct
> bcm2835_i2s_dev *dev)
>
>  static void bcm2835_i2s_stop_clock(struct bcm2835_i2s_dev *dev)
>  {
> +   bcm2835_i2s_disable_clock(dev);
> if (dev->clk_prepared)
> clk_disable_unprepare(dev->clk);
> dev->clk_prepared = false;
> @@ -158,6 +177,7 @@ static void bcm2835_i2s_clear_fifos(struct
> bcm2835_i2s_dev *dev,
> uint32_t csreg;
> uint32_t i2s_active_state;
> bool clk_was_prepared;
> +   bool clk_was_enabled;
> uint32_t off;
> uint32_t clr;
>
> @@ -176,6 +196,11 @@ static void bcm2835_i2s_clear_fifos(struct
> bcm2835_i2s_dev *dev,
> if (!clk_was_prepared)
> bcm2835_i2s_start_clock(dev);
>
> +   /* Enable clock if not enabled */
> +   clk_was_enabled = dev->clk_enabled;
> +   if (!clk_was_enabled)
> +   bcm2835_i2s_enable_clock(dev);
> +
> /* Stop I2S module */
> regmap_update_bit

[PATCH v4] drm/bridge: add it6505 driver

2020-10-20 Thread allen
This adds support for the iTE IT6505.
This device can convert DPI signal to DP output.

From: Allen Chen 
Signed-off-by: Jitao Shi 
Signed-off-by: Pi-Hsun Shih 
Signed-off-by: Yilun Lin 
Signed-off-by: Hermes Wu 
Signed-off-by: Allen Chen 
---
 drivers/gpu/drm/bridge/Kconfig  |7 +
 drivers/gpu/drm/bridge/Makefile |1 +
 drivers/gpu/drm/bridge/ite-it6505.c | 3344 +++
 3 files changed, 3352 insertions(+)
 create mode 100644 drivers/gpu/drm/bridge/ite-it6505.c

diff --git a/drivers/gpu/drm/bridge/Kconfig b/drivers/gpu/drm/bridge/Kconfig
index ef91646441b16..1e9c6ade786b1 100644
--- a/drivers/gpu/drm/bridge/Kconfig
+++ b/drivers/gpu/drm/bridge/Kconfig
@@ -61,6 +61,13 @@ config DRM_LONTIUM_LT9611
  HDMI signals
  Please say Y if you have such hardware.
 
+config DRM_ITE_IT6505
+   tristate "ITE IT6505 DisplayPort bridge"
+   depends on OF
+   select DRM_KMS_HELPER
+   help
+ ITE IT6505 DisplayPort bridge chip driver.
+
 config DRM_LVDS_CODEC
tristate "Transparent LVDS encoders and decoders support"
depends on OF
diff --git a/drivers/gpu/drm/bridge/Makefile b/drivers/gpu/drm/bridge/Makefile
index 2b3aff104e466..1f8cbc27a0643 100644
--- a/drivers/gpu/drm/bridge/Makefile
+++ b/drivers/gpu/drm/bridge/Makefile
@@ -3,6 +3,7 @@ obj-$(CONFIG_DRM_CDNS_DSI) += cdns-dsi.o
 obj-$(CONFIG_DRM_CHRONTEL_CH7033) += chrontel-ch7033.o
 obj-$(CONFIG_DRM_DISPLAY_CONNECTOR) += display-connector.o
 obj-$(CONFIG_DRM_LONTIUM_LT9611) += lontium-lt9611.o
+obj-$(CONFIG_DRM_ITE_IT6505) += ite-it6505.o
 obj-$(CONFIG_DRM_LVDS_CODEC) += lvds-codec.o
 obj-$(CONFIG_DRM_MEGACHIPS_STDP_GE_B850V3_FW) += 
megachips-stdp-ge-b850v3-fw.o
 obj-$(CONFIG_DRM_NXP_PTN3460) += nxp-ptn3460.o
diff --git a/drivers/gpu/drm/bridge/ite-it6505.c 
b/drivers/gpu/drm/bridge/ite-it6505.c
new file mode 100644
index 0..8ffcaf1158801
--- /dev/null
+++ b/drivers/gpu/drm/bridge/ite-it6505.c
@@ -0,0 +1,3344 @@
+// SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+/*
+ * Copyright (c) 2020, The Linux Foundation. All rights reserved.
+ */
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+#define REG_IC_VER 0x04
+
+#define REG_RESET_CTRL 0x05
+#define VIDEO_RESET BIT(0)
+#define AUDIO_RESET BIT(1)
+#define ALL_LOGIC_RESET BIT(2)
+#define AUX_RESET BIT(3)
+#define HDCP_RESET BIT(4)
+
+#define INT_STATUS_01 0x06
+#define INT_MASK_01 0x09
+#define INT_HPD_CHANGE BIT(0)
+#define INT_RECEIVE_HPD_IRQ BIT(1)
+#define INT_SCDT_CHANGE BIT(2)
+#define INT_HDCP_FAIL BIT(3)
+#define INT_HDCP_DONE BIT(4)
+
+#define INT_STATUS_02 0x07
+#define INT_MASK_02 0x0A
+#define INT_AUX_CMD_FAIL BIT(0)
+#define INT_HDCP_KSV_CHECK BIT(1)
+#define INT_AUDIO_FIFO_ERROR BIT(2)
+
+#define INT_STATUS_03 0x08
+#define INT_MASK_03 0x0B
+#define INT_LINK_TRAIN_FAIL BIT(4)
+#define INT_VID_FIFO_ERROR BIT(5)
+#define INT_IO_LATCH_FIFO_OVERFLOW BIT(7)
+
+#define REG_SYSTEM_STS 0x0D
+#define INT_STS BIT(0)
+#define HPD_STS BIT(1)
+#define VIDEO_STB BIT(2)
+
+#define REG_LINK_TRAIN_STS 0x0E
+#define LINK_STATE_CR BIT(2)
+#define LINK_STATE_EQ BIT(3)
+#define LINK_STATE_NORP BIT(4)
+
+#define REG_BANK_SEL 0x0F
+#define REG_CLK_CTRL0 0x10
+#define M_PCLK_DELAY 0x03
+
+#define REG_AUX_OPT 0x11
+#define AUX_AUTO_RST BIT(0)
+#define AUX_FIX_FREQ BIT(3)
+
+#define REG_DATA_CTRL0 0x12
+#define VIDEO_LATCH_EDGE BIT(4)
+#define ENABLE_PCLK_COUNTER BIT(7)
+
+#define REG_PCLK_COUNTER_VALUE 0x13
+
+#define REG_501_FIFO_CTRL 0x15
+#define RST_501_FIFO BIT(1)
+
+#define REG_TRAIN_CTRL0 0x16
+#define FORCE_LBR BIT(0)
+#define LANE_COUNT_MASK 0x06
+#define LANE_SWAP BIT(3)
+#define SPREAD_AMP_5 BIT(4)
+#define FORCE_CR_DONE BIT(5)
+#define FORCE_EQ_DONE BIT(6)
+
+#define REG_TRAIN_CTRL1 0x17
+#define AUTO_TRAIN BIT(0)
+#define MANUAL_TRAIN BIT(1)
+#define FORCE_RETRAIN BIT(2)
+
+#define REG_AUX_CTRL 0x23
+#define CLR_EDID_FIFO BIT(0)
+#define AUX_USER_MODE BIT(1)
+#define AUX_NO_SEGMENT_WR BIT(6)
+#define AUX_EN_FIFO_READ BIT(7)
+
+#define REG_AUX_ADR_0_7 0x24
+#define REG_AUX_ADR_8_15 0x25
+#define REG_AUX_ADR_16_19 0x26
+#define REG_AUX_OUT_DATA0 0x27
+
+#define REG_AUX_CMD_REQ 0x2B
+#define AUX_BUSY BIT(5)
+
+#define REG_AUX_DATA_0_7 0x2C
+#define REG_AUX_DATA_8_15 0x2D
+#define REG_AUX_DATA_16_23 0x2E
+#define REG_AUX_DATA_24_31 0x2F
+
+#define REG_AUX_DATA_FIFO 0x2F
+
+#define REG_AUX_ERROR_STS 0x9F
+#define M_AUX_REQ_FAIL 0x03
+
+#define REG_HDCP_CTRL1 0x38
+#define HDCP_CP_ENABLE BIT(0)
+
+#define REG_HDCP_TRIGGER 0x39
+#define HDCP_TRIGGER_START  BIT(0)
+#define HDCP_TRIGGER_CPIRQ  BIT(1)
+#define HDCP_TRIGGER_KSV_DONE  BIT(4)
+#define HDCP_TRIGGER_KSV_FAIL BIT(5)
+
+#define REG_HDCP_CTRL2 0x3A
+#define HDCP_AN

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

2020-10-19 Thread Allen
> > > > > >  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?
> > > > >
> > > > > Why?  What needs this reduced capability?
> > > >
> > > > Thanks for the review.
> > > >
> > > > We need read access to /sys/bus/pci/devices/,  We need write access to 
> > > > config,
> > > > remove, rescan & enable files under the device directory for each PCIe
> > > > functions & the downstream PCIe port.
> > > >
> > > > We need r/w access to sysfs to unbind and rebind the root complex.
> > >
> > > That didn't answer my question at all.
> >
> > Sorry about that, breaking it down:
> >
> > When the machine first boots, the VFIO device bindings under /dev/vfio
> > are not present.
> >
> > root@localhost:/tmp# ls -l /dev/vfio/
> > total 0
> > crw-rw-rw-. 1 root root 10, 196 Jan  5 01:47 vfio
> >
> > We have an agent which needs to run the following commands (We get
> > access denied here and need permissions to do this).
> > echo -n   > /sys/module/vfio_pci/drivers/pci:vfio-pci/new_id
> > echo -n   > /sys/module/vfio_pci/drivers/pci:vfio-pci/new_id
> >
> > And we want to avoid handing CAP_SYS_ADMIN here. Which is why the
> > thought about CAP_SYS_RAWIO.
>
> But that is not what you were asking this patch to do at all.  So why
> bring it up?
>
> new_id is NOT for "raw io" control, that should be only for admin
> priviliges.

Okay. Thanks for the explanation.
>
> And just because the vfio driver "abuses" this
> traditionally-debug-functionality doesn't mean you get to abuse the
> permission levels either.

 This makes sense now. I will drop the patch.
Thank you very much for the review.

>
> > > Why can't you have the process that wants to do all of the above, have
> > > admin rights as well?  Doing all of that is _very_ low-level and can
> > > cause all sorts of horrible things to happen to your machine, and is not
> > > really "raw io" in the traditional sense at all, right?
> >
> >
> > If the above approach is going to cause the system to do horrible things,
> > then I'll drop the idea.
>
> Of course it can cause the system to do horrible things, try it yourself
> and see!
>
> greg k-h



-- 
   - Allen


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

2020-10-19 Thread Allen
> > > >
> > > >  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?
> > >
> > > Why?  What needs this reduced capability?
> >
> > Thanks for the review.
> >
> > We need read access to /sys/bus/pci/devices/,  We need write access to 
> > config,
> > remove, rescan & enable files under the device directory for each PCIe
> > functions & the downstream PCIe port.
> >
> > We need r/w access to sysfs to unbind and rebind the root complex.
>
> That didn't answer my question at all.

Sorry about that, breaking it down:

When the machine first boots, the VFIO device bindings under /dev/vfio
are not present.

root@localhost:/tmp# ls -l /dev/vfio/
total 0
crw-rw-rw-. 1 root root 10, 196 Jan  5 01:47 vfio

We have an agent which needs to run the following commands (We get
access denied here and need permissions to do this).
echo -n   > /sys/module/vfio_pci/drivers/pci:vfio-pci/new_id
echo -n   > /sys/module/vfio_pci/drivers/pci:vfio-pci/new_id

And we want to avoid handing CAP_SYS_ADMIN here. Which is why the
thought about CAP_SYS_RAWIO.
>
> Why can't you have the process that wants to do all of the above, have
> admin rights as well?  Doing all of that is _very_ low-level and can
> cause all sorts of horrible things to happen to your machine, and is not
> really "raw io" in the traditional sense at all, right?


If the above approach is going to cause the system to do horrible things,
then I'll drop the idea.

-- 
   - Allen


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

2020-10-19 Thread Allen
> >
> >  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?
>
> Why?  What needs this reduced capability?

Thanks for the review.

We need read access to /sys/bus/pci/devices/,  We need write access to config,
remove, rescan & enable files under the device directory for each PCIe
functions & the downstream PCIe port.

We need r/w access to sysfs to unbind and rebind the root complex.

>
> > 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.
>
> Who is reading this config space that doesn't have admin rights?  And
> what are they doing with it?
>
> One big problem is that some devices will crash if you do this wrong,
> which is why we restricted it to root.  Hopefully all of those devices
> are now gone, but I don't think you can count on it.
>
> The "guaranteed safe" fields in the config space are already exported by
> sysfs for all users to read, are they not sufficient?
>
> thanks,
>
> greg k-h



-- 
   - Allen


[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



[PATCH] ASoC: bcm2835: Add enable/disable clock functions

2020-10-10 Thread Allen Martin
Add functions to control enable/disable of BCLK output of bcm2835 I2S
controller so that BCLK output only starts when dma starts.  This
resolves issues of audio pop with DACs such as max98357 on rpi.  The
LRCLK output of bcm2835 only starts when the frame size has been
configured and there is data in the FIFO.  The max98357 dac makes a
loud popping sound when BCLK is toggling but LRCLK is not.

Signed-off-by: Allen Martin 
---
 sound/soc/bcm/bcm2835-i2s.c | 35 +++
 1 file changed, 35 insertions(+)

diff --git a/sound/soc/bcm/bcm2835-i2s.c b/sound/soc/bcm/bcm2835-i2s.c
index e6a12e271b07..5c8649864c0d 100644
--- a/sound/soc/bcm/bcm2835-i2s.c
+++ b/sound/soc/bcm/bcm2835-i2s.c
@@ -122,9 +122,27 @@ struct bcm2835_i2s_dev {
struct regmap   *i2s_regmap;
struct clk  *clk;
boolclk_prepared;
+   boolclk_enabled;
int clk_rate;
 };
 
+static void bcm2835_i2s_enable_clock(struct bcm2835_i2s_dev *dev)
+{
+   if (dev->clk_enabled)
+   return;
+
+   regmap_update_bits(dev->i2s_regmap, BCM2835_I2S_MODE_A_REG, 
BCM2835_I2S_CLKDIS, 0);
+   dev->clk_enabled = true;
+}
+
+static void bcm2835_i2s_disable_clock(struct bcm2835_i2s_dev *dev)
+{
+   if (dev->clk_enabled)
+   regmap_update_bits(dev->i2s_regmap, BCM2835_I2S_MODE_A_REG, 
BCM2835_I2S_CLKDIS, BCM2835_I2S_CLKDIS);
+
+   dev->clk_enabled = false;
+}
+
 static void bcm2835_i2s_start_clock(struct bcm2835_i2s_dev *dev)
 {
unsigned int master = dev->fmt & SND_SOC_DAIFMT_MASTER_MASK;
@@ -145,6 +163,7 @@ static void bcm2835_i2s_start_clock(struct bcm2835_i2s_dev 
*dev)
 
 static void bcm2835_i2s_stop_clock(struct bcm2835_i2s_dev *dev)
 {
+   bcm2835_i2s_disable_clock(dev);
if (dev->clk_prepared)
clk_disable_unprepare(dev->clk);
dev->clk_prepared = false;
@@ -158,6 +177,7 @@ static void bcm2835_i2s_clear_fifos(struct bcm2835_i2s_dev 
*dev,
uint32_t csreg;
uint32_t i2s_active_state;
bool clk_was_prepared;
+   bool clk_was_enabled;
uint32_t off;
uint32_t clr;
 
@@ -176,6 +196,11 @@ static void bcm2835_i2s_clear_fifos(struct bcm2835_i2s_dev 
*dev,
if (!clk_was_prepared)
bcm2835_i2s_start_clock(dev);
 
+   /* Enable clock if not enabled */
+   clk_was_enabled = dev->clk_enabled;
+   if (!clk_was_enabled)
+   bcm2835_i2s_enable_clock(dev);
+
/* Stop I2S module */
regmap_update_bits(dev->i2s_regmap, BCM2835_I2S_CS_A_REG, off, 0);
 
@@ -207,6 +232,10 @@ static void bcm2835_i2s_clear_fifos(struct bcm2835_i2s_dev 
*dev,
if (!timeout)
dev_err(dev->dev, "I2S SYNC error!\n");
 
+   /* Disable clock if it was not enabled before */
+   if (!clk_was_enabled)
+   bcm2835_i2s_disable_clock(dev);
+
/* Stop clock if it was not running before */
if (!clk_was_prepared)
bcm2835_i2s_stop_clock(dev);
@@ -414,6 +443,8 @@ static int bcm2835_i2s_hw_params(struct snd_pcm_substream 
*substream,
/* Clock should only be set up here if CPU is clock master */
if (bit_clock_master &&
(!dev->clk_prepared || dev->clk_rate != bclk_rate)) {
+   if (dev->clk_enabled)
+   bcm2835_i2s_disable_clock(dev);
if (dev->clk_prepared)
bcm2835_i2s_stop_clock(dev);
 
@@ -534,6 +565,8 @@ static int bcm2835_i2s_hw_params(struct snd_pcm_substream 
*substream,
mode |= BCM2835_I2S_FTXP | BCM2835_I2S_FRXP;
}
 
+   if (!dev->clk_enabled)
+   mode |= BCM2835_I2S_CLKDIS;
mode |= BCM2835_I2S_FLEN(frame_length - 1);
mode |= BCM2835_I2S_FSLEN(framesync_length);
 
@@ -668,6 +701,7 @@ static int bcm2835_i2s_trigger(struct snd_pcm_substream 
*substream, int cmd,
case SNDRV_PCM_TRIGGER_RESUME:
case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
bcm2835_i2s_start_clock(dev);
+   bcm2835_i2s_enable_clock(dev);
 
if (substream->stream == SNDRV_PCM_STREAM_CAPTURE)
mask = BCM2835_I2S_RXON;
@@ -839,6 +873,7 @@ static int bcm2835_i2s_probe(struct platform_device *pdev)
 
/* get the clock */
dev->clk_prepared = false;
+   dev->clk_enabled = false;
dev->clk = devm_clk_get(>dev, NULL);
if (IS_ERR(dev->clk)) {
dev_err(>dev, "could not get clk: %ld\n",
-- 
2.20.1



Re: [PATCH] crypto: ccp - fix error handling

2020-09-22 Thread John Allen
On Mon, Sep 21, 2020 at 01:34:35PM +0200, Pavel Machek wrote:
> Fix resource leak in error handling.
> 
> Signed-off-by: Pavel Machek (CIP) 

Acked-by: John Allen 

> 
> diff --git a/drivers/crypto/ccp/ccp-ops.c b/drivers/crypto/ccp/ccp-ops.c
> index bd270e66185e..40869ea1ed20 100644
> --- a/drivers/crypto/ccp/ccp-ops.c
> +++ b/drivers/crypto/ccp/ccp-ops.c
> @@ -1744,7 +1744,7 @@ ccp_run_sha_cmd(struct ccp_cmd_queue *cmd_q, struct 
> ccp_cmd *cmd)
>   break;
>   default:
>   ret = -EINVAL;
> - goto e_ctx;
> + goto e_data;
>   }
>   } else {
>   /* Stash the context */
> 
> -- 
> DENX Software Engineering GmbH,  Managing Director: Wolfgang Denk
> HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany




[PATCH] linux-firmware: Update AMD SEV firmware

2020-09-15 Thread John Allen
Update AMD SEV firmware to version 0.17 build 39 for AMD family 17h
processors with models in the range 00h to 0fh.

Add SEV firmware version 0.24 build 6 for AMD family 17h processors in
the range 30h to 3fh.

Signed-off-by: John Allen 
---
 WHENCE   |   4 ++--
 amd/amd_sev_fam17h_model0xh.sbin | Bin 32640 -> 33472 bytes
 amd/amd_sev_fam17h_model3xh.sbin | Bin 43840 -> 44032 bytes
 3 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/WHENCE b/WHENCE
index 4adac39..108df0b 100644
--- a/WHENCE
+++ b/WHENCE
@@ -3599,9 +3599,9 @@ Licence: Redistributable. See LICENCE.go7007 for details
 Driver: ccp - Platform Security Processor (PSP) device
 
 File: amd/amd_sev_fam17h_model0xh.sbin
-Version: 2020-07-21
+Version: 2020-09-15
 File: amd/amd_sev_fam17h_model3xh.sbin
-Version: 2020-07-21
+Version: 2020-09-15
 
 License: Redistributable. See LICENSE.amd-sev for details
 
diff --git a/amd/amd_sev_fam17h_model0xh.sbin b/amd/amd_sev_fam17h_model0xh.sbin
index 
b0a4653ead1f47719ace90177e8eb5feaf76a842..331f3e94e8624b31583af8cba0c466c66810066a
 100644
GIT binary patch
delta 12972
zcmZ{L34Bvk+V?rPNt13gZ7FT(!cE%Jw6v0zEiHoS!X*WvY$BUd7KfBY$~Zc>ridE~
zFU5mc@Kw=Kr!9(&4r;+FI^u}$;N*(9F=!ke+ftCU4BRy9_dmB~miPNUe!ukG=iIYC
z=Xw6maxP5~di-Ibd8BZ>Y0tLNdo1JjShOPwk_e69AEAUCe{j$3tHtw~|fo@axwT
z6|&{K_Ya4*E_+D4=ep^wQ$M_P|Dpwt$a}o4WyKo=QoKq$SFGUvO=fruf|HO<6+8
zSEnsfSC4NuAwT_@#ios=nXEJ|g}%*Zq)i<)No{!Q^j%rPbtg~T)P|ZlX2?Yw9a7sy;{5_tvb-KtFQ`+X;$&01LmJ#+1x8
zJ`I*`c91-3*2z5^sQ1sobXP0NPgq07q*#4xSa~Nb8XXdA%@{i~vDRQRXNQ$1LrtCf
zHnS8_HbnTK4k^k@{2CH1i>3xi-%7ooMTjdp>iss7)FDciF3-o5q?jVg6D(nL
zn)8k@DW2oL@}>uq)d#RvM_W@@h~@Bfs4KY#VR+3i_qX>m5<8#!X>m*~JDtQLiCF%n9sw
zqcer%2s=J{EPA
zBjKJ-duxSMiRb0vcRDARw4-6$GVI_ZaM})PS=_Jnt#8wu>|=|wP08o`^nF@#(nm<1(IQdr$S`|6yU5t*Z+7Jw
zMG1=z8cdZEfBLY`U@Dh1{RR?N-eqU9%jtV8G3N*;(N6z0k7o}96k^I?YR
z=#3_%S?m4MZ|$-id9;J%p6iXBp=GCf$pj7l3Ny6c&-~1tlOw$6XI>PC{md{XM|jT9
zEMv^V4nJEqrYPr|h`o~fN04@A#6tO3~`gE1C$AD}Kx9?@zrHc5i_D613G(u)Q)L?btv%#zR+RyLk*
zGzt)c13`9|c-^$|0Yhu)QwHNUsqCoEwW*WGvmeBilE34*N~XEBQfYf$YecCDYeF9m~
z7N&#

Re: [PATCH 0/8] drivers: net: convert tasklets to use new tasklet_setup()

2020-09-10 Thread Allen
David,
>
> Commit 12cc923f1ccc ("tasklet: Introduce new initialization API")'
> introduced a new tasklet initialization API. This series converts
> all the net/* drivers to use the new tasklet_setup() API
>
> Allen Pais (8):
>   net: dccp: convert tasklets to use new tasklet_setup() API
>   net: ipv4: convert tasklets to use new tasklet_setup() API
>   net: mac80211: convert tasklets to use new tasklet_setup() API
>   net: mac802154: convert tasklets to use new tasklet_setup() API
>   net: rds: convert tasklets to use new tasklet_setup() API
>   net: sched: convert tasklets to use new tasklet_setup() API
>   net: smc: convert tasklets to use new tasklet_setup() API
>   net: xfrm: convert tasklets to use new tasklet_setup() API
>
>  net/dccp/timer.c   | 10 +-
>  net/ipv4/tcp_output.c  |  8 +++-
>  net/mac80211/ieee80211_i.h |  4 ++--
>  net/mac80211/main.c| 14 +-
>  net/mac80211/tx.c  |  5 +++--
>  net/mac80211/util.c|  5 +++--
>  net/mac802154/main.c   |  8 +++-
>  net/rds/ib_cm.c| 14 ++
>  net/sched/sch_atm.c|  9 +
>  net/smc/smc_cdc.c  |  6 +++---
>  net/smc/smc_wr.c   | 14 ++
>  net/xfrm/xfrm_input.c  |  7 +++
>  12 files changed, 47 insertions(+), 57 deletions(-)
>
> --
> 2.17.1
>

Will you pick these up or should I send these out again when I
have fixed the two patches on the other thread.

Thanks,


-- 
   - Allen


[PATCH v3] drm/bridge: add it6505 driver

2020-09-03 Thread allen
This adds support for the iTE IT6505.
This device can convert DPI signal to DP output.

From: Allen Chen 
Signed-off-by: Jitao Shi 
Signed-off-by: Pi-Hsun Shih 
Signed-off-by: Yilun Lin 
Signed-off-by: Hermes Wu 
Signed-off-by: Allen Chen 
Reported-by: kernel test robot 
---
 drivers/gpu/drm/bridge/Kconfig  |7 +
 drivers/gpu/drm/bridge/Makefile |1 +
 drivers/gpu/drm/bridge/ite-it6505.c | 3338 +++
 3 files changed, 3346 insertions(+)
 create mode 100644 drivers/gpu/drm/bridge/ite-it6505.c

diff --git a/drivers/gpu/drm/bridge/Kconfig b/drivers/gpu/drm/bridge/Kconfig
index 3e11af4e9f63e..f21dce3fabeb9 100644
--- a/drivers/gpu/drm/bridge/Kconfig
+++ b/drivers/gpu/drm/bridge/Kconfig
@@ -61,6 +61,13 @@ config DRM_LONTIUM_LT9611
  HDMI signals
  Please say Y if you have such hardware.
 
+config DRM_ITE_IT6505
+   tristate "ITE IT6505 DisplayPort bridge"
+   depends on OF
+   select DRM_KMS_HELPER
+   help
+ ITE IT6505 DisplayPort bridge chip driver.
+
 config DRM_LVDS_CODEC
tristate "Transparent LVDS encoders and decoders support"
depends on OF
diff --git a/drivers/gpu/drm/bridge/Makefile b/drivers/gpu/drm/bridge/Makefile
index c589a6a7cbe1d..8a118fd901ad7 100644
--- a/drivers/gpu/drm/bridge/Makefile
+++ b/drivers/gpu/drm/bridge/Makefile
@@ -3,6 +3,7 @@ obj-$(CONFIG_DRM_CDNS_DSI) += cdns-dsi.o
 obj-$(CONFIG_DRM_CHRONTEL_CH7033) += chrontel-ch7033.o
 obj-$(CONFIG_DRM_DISPLAY_CONNECTOR) += display-connector.o
 obj-$(CONFIG_DRM_LONTIUM_LT9611) += lontium-lt9611.o
+obj-$(CONFIG_DRM_ITE_IT6505) += ite-it6505.o
 obj-$(CONFIG_DRM_LVDS_CODEC) += lvds-codec.o
 obj-$(CONFIG_DRM_MEGACHIPS_STDP_GE_B850V3_FW) += 
megachips-stdp-ge-b850v3-fw.o
 obj-$(CONFIG_DRM_NXP_PTN3460) += nxp-ptn3460.o
diff --git a/drivers/gpu/drm/bridge/ite-it6505.c 
b/drivers/gpu/drm/bridge/ite-it6505.c
new file mode 100644
index 0..0ed19673431ee
--- /dev/null
+++ b/drivers/gpu/drm/bridge/ite-it6505.c
@@ -0,0 +1,3338 @@
+// SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+/*
+ * Copyright (c) 2020, The Linux Foundation. All rights reserved.
+ */
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+#define REG_IC_VER 0x04
+
+#define REG_RESET_CTRL 0x05
+#define VIDEO_RESET BIT(0)
+#define AUDIO_RESET BIT(1)
+#define ALL_LOGIC_RESET BIT(2)
+#define AUX_RESET BIT(3)
+#define HDCP_RESET BIT(4)
+
+#define INT_STATUS_01 0x06
+#define INT_MASK_01 0x09
+#define INT_HPD_CHANGE BIT(0)
+#define INT_RECEIVE_HPD_IRQ BIT(1)
+#define INT_SCDT_CHANGE BIT(2)
+#define INT_HDCP_FAIL BIT(3)
+#define INT_HDCP_DONE BIT(4)
+
+#define INT_STATUS_02 0x07
+#define INT_MASK_02 0x0A
+#define INT_AUX_CMD_FAIL BIT(0)
+#define INT_HDCP_KSV_CHECK BIT(1)
+#define INT_AUDIO_FIFO_ERROR BIT(2)
+
+#define INT_STATUS_03 0x08
+#define INT_MASK_03 0x0B
+#define INT_LINK_TRAIN_FAIL BIT(4)
+#define INT_VID_FIFO_ERROR BIT(5)
+#define INT_IO_LATCH_FIFO_OVERFLOW BIT(7)
+
+#define REG_SYSTEM_STS 0x0D
+#define INT_STS BIT(0)
+#define HPD_STS BIT(1)
+#define VIDEO_STB BIT(2)
+
+#define REG_LINK_TRAIN_STS 0x0E
+#define LINK_STATE_CR BIT(2)
+#define LINK_STATE_EQ BIT(3)
+#define LINK_STATE_NORP BIT(4)
+
+#define REG_BANK_SEL 0x0F
+#define REG_CLK_CTRL0 0x10
+#define M_PCLK_DELAY 0x03
+
+#define REG_AUX_OPT 0x11
+#define AUX_AUTO_RST BIT(0)
+#define AUX_FIX_FREQ BIT(3)
+
+#define REG_DATA_CTRL0 0x12
+#define VIDEO_LATCH_EDGE BIT(4)
+#define ENABLE_PCLK_COUNTER BIT(7)
+
+#define REG_PCLK_COUNTER_VALUE 0x13
+
+#define REG_501_FIFO_CTRL 0x15
+#define RST_501_FIFO BIT(1)
+
+#define REG_TRAIN_CTRL0 0x16
+#define FORCE_LBR BIT(0)
+#define LANE_COUNT_MASK 0x06
+#define LANE_SWAP BIT(3)
+#define SPREAD_AMP_5 BIT(4)
+#define FORCE_CR_DONE BIT(5)
+#define FORCE_EQ_DONE BIT(6)
+
+#define REG_TRAIN_CTRL1 0x17
+#define AUTO_TRAIN BIT(0)
+#define MANUAL_TRAIN BIT(1)
+#define FORCE_RETRAIN BIT(2)
+
+#define REG_AUX_CTRL 0x23
+#define CLR_EDID_FIFO BIT(0)
+#define AUX_USER_MODE BIT(1)
+#define AUX_NO_SEGMENT_WR BIT(6)
+#define AUX_EN_FIFO_READ BIT(7)
+
+#define REG_AUX_ADR_0_7 0x24
+#define REG_AUX_ADR_8_15 0x25
+#define REG_AUX_ADR_16_19 0x26
+#define REG_AUX_OUT_DATA0 0x27
+
+#define REG_AUX_CMD_REQ 0x2B
+#define AUX_BUSY BIT(5)
+
+#define REG_AUX_DATA_0_7 0x2C
+#define REG_AUX_DATA_8_15 0x2D
+#define REG_AUX_DATA_16_23 0x2E
+#define REG_AUX_DATA_24_31 0x2F
+
+#define REG_AUX_DATA_FIFO 0x2F
+
+#define REG_AUX_ERROR_STS 0x9F
+#define M_AUX_REQ_FAIL 0x03
+
+#define REG_HDCP_CTRL1 0x38
+#define HDCP_CP_ENABLE BIT(0)
+
+#define REG_HDCP_TRIGGER 0x39
+#define HDCP_TRIGGER_START  BIT(0)
+#define HDCP_TRIGGER_CPIRQ  BIT(1)
+#define HDCP_TRIGGER_KSV_DONE  BIT(4)
+#define HDCP_TRIGGER_KSV_FAIL BIT(5)
+
+#define REG_HDCP

[PATCH v2] drm/bridge: add it6505 driver

2020-09-03 Thread allen
This adds support for the iTE IT6505.
This device can convert DPI signal to DP output.

From: Allen Chen 
Signed-off-by: Jitao Shi 
Signed-off-by: Pi-Hsun Shih 
Signed-off-by: Yilun Lin 
Signed-off-by: Hermes Wu 
Signed-off-by: Allen Chen 
---
 drivers/gpu/drm/bridge/Kconfig  |7 +
 drivers/gpu/drm/bridge/Makefile |1 +
 drivers/gpu/drm/bridge/ite-it6505.c | 3336 +++
 3 files changed, 3344 insertions(+)
 create mode 100644 drivers/gpu/drm/bridge/ite-it6505.c

diff --git a/drivers/gpu/drm/bridge/Kconfig b/drivers/gpu/drm/bridge/Kconfig
index 3e11af4e9f63e..f21dce3fabeb9 100644
--- a/drivers/gpu/drm/bridge/Kconfig
+++ b/drivers/gpu/drm/bridge/Kconfig
@@ -61,6 +61,13 @@ config DRM_LONTIUM_LT9611
  HDMI signals
  Please say Y if you have such hardware.
 
+config DRM_ITE_IT6505
+   tristate "ITE IT6505 DisplayPort bridge"
+   depends on OF
+   select DRM_KMS_HELPER
+   help
+ ITE IT6505 DisplayPort bridge chip driver.
+
 config DRM_LVDS_CODEC
tristate "Transparent LVDS encoders and decoders support"
depends on OF
diff --git a/drivers/gpu/drm/bridge/Makefile b/drivers/gpu/drm/bridge/Makefile
index c589a6a7cbe1d..8a118fd901ad7 100644
--- a/drivers/gpu/drm/bridge/Makefile
+++ b/drivers/gpu/drm/bridge/Makefile
@@ -3,6 +3,7 @@ obj-$(CONFIG_DRM_CDNS_DSI) += cdns-dsi.o
 obj-$(CONFIG_DRM_CHRONTEL_CH7033) += chrontel-ch7033.o
 obj-$(CONFIG_DRM_DISPLAY_CONNECTOR) += display-connector.o
 obj-$(CONFIG_DRM_LONTIUM_LT9611) += lontium-lt9611.o
+obj-$(CONFIG_DRM_ITE_IT6505) += ite-it6505.o
 obj-$(CONFIG_DRM_LVDS_CODEC) += lvds-codec.o
 obj-$(CONFIG_DRM_MEGACHIPS_STDP_GE_B850V3_FW) += 
megachips-stdp-ge-b850v3-fw.o
 obj-$(CONFIG_DRM_NXP_PTN3460) += nxp-ptn3460.o
diff --git a/drivers/gpu/drm/bridge/ite-it6505.c 
b/drivers/gpu/drm/bridge/ite-it6505.c
new file mode 100644
index 0..a72e524eb20b1
--- /dev/null
+++ b/drivers/gpu/drm/bridge/ite-it6505.c
@@ -0,0 +1,3336 @@
+// SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+/*
+ * Copyright (c) 2020, The Linux Foundation. All rights reserved.
+ */
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+#define REG_IC_VER 0x04
+
+#define REG_RESET_CTRL 0x05
+#define VIDEO_RESET BIT(0)
+#define AUDIO_RESET BIT(1)
+#define ALL_LOGIC_RESET BIT(2)
+#define AUX_RESET BIT(3)
+#define HDCP_RESET BIT(4)
+
+#define INT_STATUS_01 0x06
+#define INT_MASK_01 0x09
+#define INT_HPD_CHANGE BIT(0)
+#define INT_RECEIVE_HPD_IRQ BIT(1)
+#define INT_SCDT_CHANGE BIT(2)
+#define INT_HDCP_FAIL BIT(3)
+#define INT_HDCP_DONE BIT(4)
+
+#define INT_STATUS_02 0x07
+#define INT_MASK_02 0x0A
+#define INT_AUX_CMD_FAIL BIT(0)
+#define INT_HDCP_KSV_CHECK BIT(1)
+#define INT_AUDIO_FIFO_ERROR BIT(2)
+
+#define INT_STATUS_03 0x08
+#define INT_MASK_03 0x0B
+#define INT_LINK_TRAIN_FAIL BIT(4)
+#define INT_VID_FIFO_ERROR BIT(5)
+#define INT_IO_LATCH_FIFO_OVERFLOW BIT(7)
+
+#define REG_SYSTEM_STS 0x0D
+#define INT_STS BIT(0)
+#define HPD_STS BIT(1)
+#define VIDEO_STB BIT(2)
+
+#define REG_LINK_TRAIN_STS 0x0E
+#define LINK_STATE_CR BIT(2)
+#define LINK_STATE_EQ BIT(3)
+#define LINK_STATE_NORP BIT(4)
+
+#define REG_BANK_SEL 0x0F
+#define REG_CLK_CTRL0 0x10
+#define M_PCLK_DELAY 0x03
+
+#define REG_AUX_OPT 0x11
+#define AUX_AUTO_RST BIT(0)
+#define AUX_FIX_FREQ BIT(3)
+
+#define REG_DATA_CTRL0 0x12
+#define VIDEO_LATCH_EDGE BIT(4)
+#define ENABLE_PCLK_COUNTER BIT(7)
+
+#define REG_PCLK_COUNTER_VALUE 0x13
+
+#define REG_501_FIFO_CTRL 0x15
+#define RST_501_FIFO BIT(1)
+
+#define REG_TRAIN_CTRL0 0x16
+#define FORCE_LBR BIT(0)
+#define LANE_COUNT_MASK 0x06
+#define LANE_SWAP BIT(3)
+#define SPREAD_AMP_5 BIT(4)
+#define FORCE_CR_DONE BIT(5)
+#define FORCE_EQ_DONE BIT(6)
+
+#define REG_TRAIN_CTRL1 0x17
+#define AUTO_TRAIN BIT(0)
+#define MANUAL_TRAIN BIT(1)
+#define FORCE_RETRAIN BIT(2)
+
+#define REG_AUX_CTRL 0x23
+#define CLR_EDID_FIFO BIT(0)
+#define AUX_USER_MODE BIT(1)
+#define AUX_NO_SEGMENT_WR BIT(6)
+#define AUX_EN_FIFO_READ BIT(7)
+
+#define REG_AUX_ADR_0_7 0x24
+#define REG_AUX_ADR_8_15 0x25
+#define REG_AUX_ADR_16_19 0x26
+#define REG_AUX_OUT_DATA0 0x27
+
+#define REG_AUX_CMD_REQ 0x2B
+#define AUX_BUSY BIT(5)
+
+#define REG_AUX_DATA_0_7 0x2C
+#define REG_AUX_DATA_8_15 0x2D
+#define REG_AUX_DATA_16_23 0x2E
+#define REG_AUX_DATA_24_31 0x2F
+
+#define REG_AUX_DATA_FIFO 0x2F
+
+#define REG_AUX_ERROR_STS 0x9F
+#define M_AUX_REQ_FAIL 0x03
+
+#define REG_HDCP_CTRL1 0x38
+#define HDCP_CP_ENABLE BIT(0)
+
+#define REG_HDCP_TRIGGER 0x39
+#define HDCP_TRIGGER_START  BIT(0)
+#define HDCP_TRIGGER_CPIRQ  BIT(1)
+#define HDCP_TRIGGER_KSV_DONE  BIT(4)
+#define HDCP_TRIGGER_KSV_FAIL BIT(5)
+
+#define REG_HDCP_CTRL2 0x3A
+#define HDCP_AN

[PATCH] drm/bridge: add it6505 driver

2020-09-03 Thread allen
This adds support for the iTE IT6505.
This device can convert DPI signal to DP output.

From: Allen Chen 
Signed-off-by: Jitao Shi 
Signed-off-by: Pi-Hsun Shih 
Signed-off-by: Yilun Lin 
Signed-off-by: Hermes Wu 
Signed-off-by: Allen Chen 

---
 drivers/gpu/drm/bridge/Kconfig  |7 +
 drivers/gpu/drm/bridge/Makefile |1 +
 drivers/gpu/drm/bridge/ite-it6505.c | 3336 +++
 3 files changed, 3344 insertions(+)
 create mode 100644 drivers/gpu/drm/bridge/ite-it6505.c

diff --git a/drivers/gpu/drm/bridge/Kconfig b/drivers/gpu/drm/bridge/Kconfig
index 3e11af4e9f63e..f21dce3fabeb9 100644
--- a/drivers/gpu/drm/bridge/Kconfig
+++ b/drivers/gpu/drm/bridge/Kconfig
@@ -61,6 +61,13 @@ config DRM_LONTIUM_LT9611
  HDMI signals
  Please say Y if you have such hardware.
 
+config DRM_ITE_IT6505
+   tristate "ITE IT6505 DisplayPort bridge"
+   depends on OF
+   select DRM_KMS_HELPER
+   help
+ ITE IT6505 DisplayPort bridge chip driver.
+
 config DRM_LVDS_CODEC
tristate "Transparent LVDS encoders and decoders support"
depends on OF
diff --git a/drivers/gpu/drm/bridge/Makefile b/drivers/gpu/drm/bridge/Makefile
index c589a6a7cbe1d..8a118fd901ad7 100644
--- a/drivers/gpu/drm/bridge/Makefile
+++ b/drivers/gpu/drm/bridge/Makefile
@@ -3,6 +3,7 @@ obj-$(CONFIG_DRM_CDNS_DSI) += cdns-dsi.o
 obj-$(CONFIG_DRM_CHRONTEL_CH7033) += chrontel-ch7033.o
 obj-$(CONFIG_DRM_DISPLAY_CONNECTOR) += display-connector.o
 obj-$(CONFIG_DRM_LONTIUM_LT9611) += lontium-lt9611.o
+obj-$(CONFIG_DRM_ITE_IT6505) += ite-it6505.o
 obj-$(CONFIG_DRM_LVDS_CODEC) += lvds-codec.o
 obj-$(CONFIG_DRM_MEGACHIPS_STDP_GE_B850V3_FW) += 
megachips-stdp-ge-b850v3-fw.o
 obj-$(CONFIG_DRM_NXP_PTN3460) += nxp-ptn3460.o
diff --git a/drivers/gpu/drm/bridge/ite-it6505.c 
b/drivers/gpu/drm/bridge/ite-it6505.c
new file mode 100644
index 0..a72e524eb20b1
--- /dev/null
+++ b/drivers/gpu/drm/bridge/ite-it6505.c
@@ -0,0 +1,3336 @@
+// SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+/*
+ * Copyright (c) 2020, The Linux Foundation. All rights reserved.
+ */
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+#define REG_IC_VER 0x04
+
+#define REG_RESET_CTRL 0x05
+#define VIDEO_RESET BIT(0)
+#define AUDIO_RESET BIT(1)
+#define ALL_LOGIC_RESET BIT(2)
+#define AUX_RESET BIT(3)
+#define HDCP_RESET BIT(4)
+
+#define INT_STATUS_01 0x06
+#define INT_MASK_01 0x09
+#define INT_HPD_CHANGE BIT(0)
+#define INT_RECEIVE_HPD_IRQ BIT(1)
+#define INT_SCDT_CHANGE BIT(2)
+#define INT_HDCP_FAIL BIT(3)
+#define INT_HDCP_DONE BIT(4)
+
+#define INT_STATUS_02 0x07
+#define INT_MASK_02 0x0A
+#define INT_AUX_CMD_FAIL BIT(0)
+#define INT_HDCP_KSV_CHECK BIT(1)
+#define INT_AUDIO_FIFO_ERROR BIT(2)
+
+#define INT_STATUS_03 0x08
+#define INT_MASK_03 0x0B
+#define INT_LINK_TRAIN_FAIL BIT(4)
+#define INT_VID_FIFO_ERROR BIT(5)
+#define INT_IO_LATCH_FIFO_OVERFLOW BIT(7)
+
+#define REG_SYSTEM_STS 0x0D
+#define INT_STS BIT(0)
+#define HPD_STS BIT(1)
+#define VIDEO_STB BIT(2)
+
+#define REG_LINK_TRAIN_STS 0x0E
+#define LINK_STATE_CR BIT(2)
+#define LINK_STATE_EQ BIT(3)
+#define LINK_STATE_NORP BIT(4)
+
+#define REG_BANK_SEL 0x0F
+#define REG_CLK_CTRL0 0x10
+#define M_PCLK_DELAY 0x03
+
+#define REG_AUX_OPT 0x11
+#define AUX_AUTO_RST BIT(0)
+#define AUX_FIX_FREQ BIT(3)
+
+#define REG_DATA_CTRL0 0x12
+#define VIDEO_LATCH_EDGE BIT(4)
+#define ENABLE_PCLK_COUNTER BIT(7)
+
+#define REG_PCLK_COUNTER_VALUE 0x13
+
+#define REG_501_FIFO_CTRL 0x15
+#define RST_501_FIFO BIT(1)
+
+#define REG_TRAIN_CTRL0 0x16
+#define FORCE_LBR BIT(0)
+#define LANE_COUNT_MASK 0x06
+#define LANE_SWAP BIT(3)
+#define SPREAD_AMP_5 BIT(4)
+#define FORCE_CR_DONE BIT(5)
+#define FORCE_EQ_DONE BIT(6)
+
+#define REG_TRAIN_CTRL1 0x17
+#define AUTO_TRAIN BIT(0)
+#define MANUAL_TRAIN BIT(1)
+#define FORCE_RETRAIN BIT(2)
+
+#define REG_AUX_CTRL 0x23
+#define CLR_EDID_FIFO BIT(0)
+#define AUX_USER_MODE BIT(1)
+#define AUX_NO_SEGMENT_WR BIT(6)
+#define AUX_EN_FIFO_READ BIT(7)
+
+#define REG_AUX_ADR_0_7 0x24
+#define REG_AUX_ADR_8_15 0x25
+#define REG_AUX_ADR_16_19 0x26
+#define REG_AUX_OUT_DATA0 0x27
+
+#define REG_AUX_CMD_REQ 0x2B
+#define AUX_BUSY BIT(5)
+
+#define REG_AUX_DATA_0_7 0x2C
+#define REG_AUX_DATA_8_15 0x2D
+#define REG_AUX_DATA_16_23 0x2E
+#define REG_AUX_DATA_24_31 0x2F
+
+#define REG_AUX_DATA_FIFO 0x2F
+
+#define REG_AUX_ERROR_STS 0x9F
+#define M_AUX_REQ_FAIL 0x03
+
+#define REG_HDCP_CTRL1 0x38
+#define HDCP_CP_ENABLE BIT(0)
+
+#define REG_HDCP_TRIGGER 0x39
+#define HDCP_TRIGGER_START  BIT(0)
+#define HDCP_TRIGGER_CPIRQ  BIT(1)
+#define HDCP_TRIGGER_KSV_DONE  BIT(4)
+#define HDCP_TRIGGER_KSV_FAIL BIT(5)
+
+#define REG_HDCP_CTRL2 0x3A
+#define HDCP_AN

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

2020-09-01 Thread Allen
> > > >
> > > > 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
> > >
> > > I've got to say I agree with Jens, this was a silly obfuscation:
> > >
> > > +#define from_tasklet(var, callback_tasklet, tasklet_fieldname) \
> > > +   container_of(callback_tasklet, typeof(*var),
> > > tasklet_fieldname)
> > >
> > > Just use container_of directly since we all understand what it
> > > does.
> >
> > But then the lines get really long, wrapped, etc.
>
> I really don't think that's a problem but if you want to add a new
> generic container_of that does typeof instead of insisting on the type,
> I'd be sort of OK with that ... provided you don't gratuitously alter
> the argument order.
>
> The thing I object to is that this encourages everyone to roll their
> own unnecessary container_of type macros in spite of the fact that it's
> function is wholly generic.  It's fine if you're eliminating one of the
> arguments, or actually making the macro specific to the type, but in
> this case you're not, you're making a completely generic macro where
> the name is the only thing that's specific to this case.
>
> >  This is what the timer_struct conversion did too (added a
> > container_of wrapper), so I think it makes sense here too.
>
> I didn't see that one to object to it ...

Since we could not get the generic API accepted, can I send out V2
which would use container_of()?

Thanks,

-- 
   - Allen


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

2020-09-01 Thread Allen
Takashi,
> > > > These patches which I wasn't CCed on and which need their subject lines
> > > > fixing :( .  With the subject lines fixed I guess so so
> >
> > > Extremely sorry. I thought I had it covered. How would you like it
> > > worded?
> >
> > ASoC:
>
> To be more exact, "ASoC:" prefix is for sound/soc/*, and for the rest
> sound/*, use "ALSA:" prefix please.

I could not get the generic API accepted upstream. We would stick to
from_tasklet()
or container_of(). Could I go ahead and send out V2 using
from_tasklet() with subject line fixed?

Thanks,
-- 
   - Allen


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

2020-08-28 Thread Allen
> > > You really have to pick some pretty excessive type names (or variable
> > > names) to get close to 80 characters. Again, to pick an example:
> > >
> > > struct timer_group_priv *priv = container_of(handle,
> > > struct timer_group_priv, timer[handle->num]);
> > >
> > > ends up being long even if you were to split it, but that funky
> > > container_from() wouldn't have helped the real problem - the fact that
> > > the above is complex and nasty.
>
> The point about doing the assignment with the declaration certainly makes
> the "ugliness" worse, I agree. I'm still not generally convinced about
> the redundancy level pros/cons, but I concede that having a common idiom
> (rather than a succinct but subsystem-dependent idiom) is better for
> people reading the code for the first time.
>
> > > And I had to _search_ for that example. All the normal cases of
> > > split-line container-of's were due to doing it with the declaration,
> > > or beause the first argument ended up being an expression in itself
> > > and the nested expressions made it more complex.
> >
> > Speaking of searching, this kind of typeof use is, IMO, actively
> > harmful - it makes finding the places where we might get from
> > e.g. linked list to containing objects much harder.  container_of
> > (unless combined with obfuscating use of typeof()) at least gives
> > you a chance to grep - struct foo *not* followed by '*' is a pattern
> > that doesn't give too many false positives.  This one, OTOH, is
> > essentially impossible to grep for.
>
> And this observation about workflow does strike a chord with me. I do end
> up with those kind of searches too. In trying to examine my preferences
> here, I think my instincts are to avoid open-coded types (leading me to
> want to use typeof()) but I think those instincts were actually developed
> from dealing with _sizeof_ and all the way it goes terribly wrong. So,
> okay, I'm convinced. container_of() it is.

 so container_of() it is :)
Will start updating the rest of the patches.

Thanks,
- Allen

> Doing these conversions becomes a little less mechanical if assignment
> needs to be split from declaration, but hey, we've got a 100 character
> line "limit" now, so maybe it'll be less needed. :)
>
> --
> Kees Cook


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

2020-08-28 Thread Allen
>
> I don't see that kind of redundancy being a _problem_, though. "So
> much redundancy" is just over-stating the issue completely.
>
> In fact, we often encourage people to split declaration from
> initialization exactly because it results in simpler expressions and
> more legible code, even if that name is now redundant. So it's a small
> extra typing of the type. Big deal.
>
> The above is also a common pattern that once you know how
> container_of() works, it's very legible.
>
> Sure, if you're new to the kernel, and haven't seen "container_of()"
> in other projects, it might initially be a bit of an odd pattern, but
> that's the advantage of having one single standardized model: it
> becomes a pattern, and you don't have to think about it.
>
> And particularly with that argument-type pattern, you really have to
> work at making over-long lines, since the indentation level will by
> definition be just one.
>
> Looking around, I do see a lot of people doing line-breaks, but that
> tends to be when they insist on putting the variable initialization in
> the declaration. And even then, it often seems pointless (eg
>
> struct idp_led *led = container_of(cdev,
> struct idp_led, cdev);
>
> was split for no good reason I can see, but it seems to be a pattern
> in that file).
>
> You really have to pick some pretty excessive type names (or variable
> names) to get close to 80 characters. Again, to pick an example:
>
> struct timer_group_priv *priv = container_of(handle,
> struct timer_group_priv, timer[handle->num]);
>
> ends up being long even if you were to split it, but that funky
> container_from() wouldn't have helped the real problem - the fact that
> the above is complex and nasty.
>

 An example with a really long member name is

+struct nokia_modem_device *modem = from_tasklet(modem, t,
+nokia_modem_rst_ind_tasklet);

With container_of() one can imagine how long it would end up. And
am sure we have many more examples in the kernel.

I agree, It would have been simpler to use container_of() as it's been
widely used, but as mentioned by Kees, for 1-to-many conversions
it does not work well.

I guess container_from() is a NAK, if you would want us to just use
container_of() to keep the code clean and simple instead of using wrappers,
or any other method, we are open to suggestions.

Thanks,
- Allen


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


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

2020-08-26 Thread Allen
On Wed, Aug 26, 2020 at 8:43 PM Kees Cook  wrote:
>
> On Wed, Aug 26, 2020 at 12:55:28PM +0300, Dan Carpenter wrote:
> > On Wed, Aug 26, 2020 at 07:21:35AM +0530, Allen Pais wrote:
> > > 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.
> >
> > I liked that James swapped the first two arguments so that it matches
> > container_of().  Plus it's nice that when you have:
> >
> >   struct whatever *foo = container_from(ptr, foo, member);
> >
> > Then it means that "ptr == >member".
>
> I'm a bit stalled right now -- the merge window was keeping me busy, and
> this week is the Linux Plumbers Conference. This is on my list, but I
> haven't gotten back around to it. If you want, feel free to send the
> container_from() patch; you might be able to unblock this faster than me
> right now. :)
>

Sure, 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.


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

2020-08-19 Thread Allen
> [...]
> > > 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().

-- 
   - Allen


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

2020-08-19 Thread Allen
>
> > Mark, may I apply those ASoC patches through my tree together with
> > others?  Those seem targeting to 5.9, and I have a patch set to
> > convert to tasklet for 5.10, which would be better manageable when
> > based on top of those changes.
>
> These patches which I wasn't CCed on and which need their subject lines
> fixing :( .  With the subject lines fixed I guess so so

Extremely sorry. I thought I had it covered. How would you like it
worded?

> Acked-by: Mark Brown 
>
> but judging from some of the other threads about similar patches that I
> was randomly CCed on I'm not sure people like from_tasklet() so perhaps
> there might be issues.

Yes, there is a new macro by name cast_out() is suggested in place of
from_tasklet(). Hopefully it will go in soon. Will spin out V2 with the change
and also re-word subject line.

> Allen, as documented in submitting-patches.rst please send patches to
> the maintainers for the code you would like to change.  The normal
> kernel workflow is that people apply patches from their inboxes, if they
> aren't copied they are likely to not see the patch at all and it is much
> more difficult to apply patches.

I understand, I'll take care of it in the future. Thank you.

-- 
   - Allen


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

2020-08-19 Thread Allen
> > > > > > > >
> > > > > > > > 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.
> > > > > > >
> > > > > > > Who came up with the idea to add a macro 'from_tasklet' that
> > > > > > > is just container_of? container_of in the code would be
> > > > > > > _much_ more readable, and not leave anyone guessing wtf
> > > > > > > from_tasklet is doing.
> > > > > > >
> > > > > > > I'd fix that up now before everything else goes in...
> > > > > >
> > > > > > As I mentioned in the other thread, I think this makes things
> > > > > > much more readable. It's the same thing that the timer_struct
> > > > > > conversion did (added a container_of wrapper) to avoid the
> > > > > > ever-repeating use of typeof(), long lines, etc.
> > > > >
> > > > > But then it should use a generic name, instead of each sub-system
> > > > > using some random name that makes people look up exactly what it
> > > > > does. I'm not huge fan of the container_of() redundancy, but
> > > > > adding private variants of this doesn't seem like the best way
> > > > > forward. Let's have a generic helper that does this, and use it
> > > > > everywhere.
> > > >
> > > > I'm open to suggestions, but as things stand, these kinds of
> > > > treewide
> > >
> > > On naming? Implementation is just as it stands, from_tasklet() is
> > > totally generic which is why I objected to it. from_member()? Not
> > > great with naming... But I can see this going further and then we'll
> > > suddenly have tons of these. It's not good for readability.
> >
> > 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.
>
> I like this! Shall I send this to Linus to see if this can land in -rc2
> for use going forward?
>

Cool, I shall wait for it to be accepted and then spin out V2 with cast_out()

-- 
   - Allen


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

2020-08-18 Thread Allen
>
> Well, then at the next time, please mention it explicitly in the cover
> letter.  Usually this kind of API conversion isn't done during rc.  Or
> it's done systematically via script or such.  So unless mentioned,
> it's not expected to be carried to 5.9.

 Sorry for having missed the detail. Will take care of it in the future.

>
> In anyway, if the final purpose is to drop the old tasklet API and
> that's the plan for 5.9, all tree-wide changes have to be done in
> 5.9 beforehand.  Was that the decision?

 The idea was to land the tree-wide changes as part of 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.
>
> Adapting the changes are trivial, don't worry.  It was just a question
> of how to organize changes.

Sure, Thank you.

- Allen


Re: [PATCH 1/5] infiniband: bnxt_re: convert tasklets to use new tasklet_setup() API

2020-08-18 Thread Allen
> > diff --git a/drivers/infiniband/hw/bnxt_re/qplib_rcfw.c 
> > b/drivers/infiniband/hw/bnxt_re/qplib_rcfw.c
> > index 4e211162acee..7261be29fb09 100644
> > +++ b/drivers/infiniband/hw/bnxt_re/qplib_rcfw.c
> > @@ -50,7 +50,7 @@
> >  #include "qplib_sp.h"
> >  #include "qplib_fp.h"
> >
> > -static void bnxt_qplib_service_creq(unsigned long data);
> > +static void bnxt_qplib_service_creq(struct tasklet_struct *t);
> >
> >  /* Hardware communication channel */
> >  static int __wait_for_resp(struct bnxt_qplib_rcfw *rcfw, u16 cookie)
> > @@ -79,7 +79,7 @@ static int __block_for_resp(struct bnxt_qplib_rcfw *rcfw, 
> > u16 cookie)
> >   goto done;
> >   do {
> >   mdelay(1); /* 1m sec */
> > - bnxt_qplib_service_creq((unsigned long)rcfw);
> > + bnxt_qplib_service_creq(>creq.creq_tasklet);
> >   } while (test_bit(cbit, cmdq->cmdq_bitmap) && --count);
> >  done:
> >   return count ? 0 : -ETIMEDOUT;
> > @@ -369,10 +369,10 @@ static int bnxt_qplib_process_qp_event(struct 
> > bnxt_qplib_rcfw *rcfw,
> >  }
> >
> >  /* SP - CREQ Completion handlers */
> > -static void bnxt_qplib_service_creq(unsigned long data)
> > +static void bnxt_qplib_service_creq(struct tasklet_struct *t)
> >  {
> > - struct bnxt_qplib_rcfw *rcfw = (struct bnxt_qplib_rcfw *)data;
> > - struct bnxt_qplib_creq_ctx *creq = >creq;
> > + struct bnxt_qplib_creq_ctx *creq = from_tasklet(creq, t, 
> > creq_tasklet);
>
> This is just:
>
>   struct bnxt_qplib_rcfw *rcfw = from_tasklet(rcfw, t, crew.creq_tasklet);
>
> No need for the extra container_of

Sure, will fix it and spin V2.

Thanks.
>
> Jason



-- 
   - Allen


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

2020-08-18 Thread Allen
> >
> > Signed-off-by: Romain Perier 
> > Signed-off-by: Allen Pais 
>
> This looks good to me.
>
> Reviewed-by: Corey Minyard 
>
> Are you planning to push this, or do you want me to take it?  If you
> want me to take it, what is the urgency?

 Thanks. Well, not hurry, as long as it goes into 5.9 with all other
changes.


>
> -corey
>
> > ---
> >  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
> >



-- 
   - Allen


Re: [PATCH 06/20] ethernet: chelsio: convert tasklets to use new tasklet_setup() API

2020-08-18 Thread Allen
>
> You need to adjust kdoc when you change functions:
>
> drivers/net/ethernet/chelsio/cxgb4/sge.c:2664: warning: Function parameter or 
> member 't' not described in 'restart_ctrlq'
> drivers/net/ethernet/chelsio/cxgb4/sge.c:2664: warning: Excess function 
> parameter 'data' description in 'restart_ctrlq'
> drivers/net/ethernet/chelsio/cxgb4/sge.c:2965: warning: Function parameter or 
> member 't' not described in 'restart_ofldq'
> drivers/net/ethernet/chelsio/cxgb4/sge.c:2965: warning: Excess function 
> parameter 'data' description in 'restart_ofldq'


Thanks, will fix it and spin V2.

-- 
   - Allen


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

2020-08-18 Thread Allen
>
> General question for the whole series: have you considered the long-term
> aim instead? That is: convert away from tasklets completely? I.e. use
> threaded irqs or workqueues?
>

 Yes, since changing tasklets to workqueues or threaded irqs
becomes a little trivial when it comes to tree-wide change, this
approach was considered. I am open to both.

-- 
   - Allen


[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



  1   2   3   4   5   6   7   8   9   10   >