Re: [Openipmi-developer] [PATCH 9/9] mmc: Convert from tasklet to BH workqueue

2024-06-03 Thread Allen Pais


> On Jun 3, 2024, at 5:38 AM, Aubin Constans  
> wrote:
> 
> On 27/03/2024 17:03, Allen Pais wrote:
>> EXTERNAL EMAIL: Do not click links or open attachments unless you know the 
>> content is safe
>> The only generic interface to execute asynchronously in the BH context is
>> tasklet; however, it's marked deprecated and has some design flaws. To
>> replace tasklets, BH workqueue support was recently added. A BH workqueue
>> behaves similarly to regular workqueues except that the queued work items
>> are executed in the BH context.
>> This patch converts drivers/infiniband/* from tasklet to BH workqueue.
>> Based on the work done by Tejun Heo 
>> Branch: https://git.kernel.org/pub/scm/linux/kernel/git/tj/wq.git for-6.10
>> Signed-off-by: Allen Pais 
>> ---
>>  drivers/mmc/host/atmel-mci.c  | 35 -
> [...]
> 
> For atmel-mci, judging from a few simple tests, performance is preserved.
> E.g. writing to a SD Card on the SAMA5D3-Xplained board:
> time dd if=/dev/zero of=/opt/_del_me bs=4k count=64k
> 
> Base 6.9.0 : 0.07user 5.05system 0:18.92elapsed 27%CPU
>  Patched 6.9.0+: 0.12user 4.92system 0:18.76elapsed 26%CPU
> 
> However, please resolve what checkpatch is complaining about:
> scripts/checkpatch.pl --strict 
> PATCH-9-9-mmc-Convert-from-tasklet-to-BH-workqueue.mbox
> 
>  WARNING: please, no space before tabs
>  #72: FILE: drivers/mmc/host/atmel-mci.c:367:
>  +^Istruct work_struct ^Iwork;$
> 
> Same as discussions on the USB patch[1] and others in this series, I am also 
> in favour of "workqueue" or similar in the comments, rather than just "work".

 Will send out a new version.

Thank you very much for testing and providing your review.

- Allen

> 
> Apart from that:
> Tested-by: Aubin Constans 
> Acked-by: Aubin Constans 
> 
> Thanks.
> 
> [1]: 
> https://lore.kernel.org/linux-mmc/caomdwslippfm3oztpjzz4uf4m+e_8qaotemckbxawlnktqx...@mail.gmail.com/



___
Openipmi-developer mailing list
Openipmi-developer@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openipmi-developer


Re: [Openipmi-developer] [PATCH 8/9] drivers/media/*: Convert from tasklet to BH workqueue

2024-04-24 Thread Allen Pais


> On Apr 24, 2024, at 2:12 AM, Hans Verkuil  wrote:
> 
> On 27/03/2024 17:03, Allen Pais wrote:
>> The only generic interface to execute asynchronously in the BH context is
>> tasklet; however, it's marked deprecated and has some design flaws. To
>> replace tasklets, BH workqueue support was recently added. A BH workqueue
>> behaves similarly to regular workqueues except that the queued work items
>> are executed in the BH context.
>> 
>> This patch converts drivers/media/* from tasklet to BH workqueue.
>> 
>> Based on the work done by Tejun Heo 
>> Branch: https://git.kernel.org/pub/scm/linux/kernel/git/tj/wq.git for-6.10
>> 
>> Signed-off-by: Allen Pais 
>> ---
>> drivers/media/pci/bt8xx/bt878.c   |  8 ++--
>> drivers/media/pci/bt8xx/bt878.h   |  3 +-
>> drivers/media/pci/bt8xx/dvb-bt8xx.c   |  9 ++--
>> drivers/media/pci/ddbridge/ddbridge.h |  3 +-
>> drivers/media/pci/mantis/hopper_cards.c   |  2 +-
>> drivers/media/pci/mantis/mantis_cards.c   |  2 +-
>> drivers/media/pci/mantis/mantis_common.h  |  3 +-
>> drivers/media/pci/mantis/mantis_dma.c |  5 ++-
>> drivers/media/pci/mantis/mantis_dma.h |  2 +-
>> drivers/media/pci/mantis/mantis_dvb.c | 12 +++---
>> drivers/media/pci/ngene/ngene-core.c  | 23 ++-
>> drivers/media/pci/ngene/ngene.h   |  5 ++-
>> drivers/media/pci/smipcie/smipcie-main.c  | 18 
>> drivers/media/pci/smipcie/smipcie.h   |  3 +-
>> drivers/media/pci/ttpci/budget-av.c   |  3 +-
>> drivers/media/pci/ttpci/budget-ci.c   | 27 ++--
>> drivers/media/pci/ttpci/budget-core.c | 10 ++---
>> drivers/media/pci/ttpci/budget.h  |  5 ++-
>> drivers/media/pci/tw5864/tw5864-core.c|  2 +-
>> drivers/media/pci/tw5864/tw5864-video.c   | 13 +++---
>> drivers/media/pci/tw5864/tw5864.h |  7 ++--
>> drivers/media/platform/intel/pxa_camera.c | 15 +++
>> drivers/media/platform/marvell/mcam-core.c| 11 ++---
>> drivers/media/platform/marvell/mcam-core.h|  3 +-
>> .../st/sti/c8sectpfe/c8sectpfe-core.c | 15 +++
>> .../st/sti/c8sectpfe/c8sectpfe-core.h |  2 +-
>> drivers/media/radio/wl128x/fmdrv.h|  7 ++--
>> drivers/media/radio/wl128x/fmdrv_common.c | 41 ++-
>> drivers/media/rc/mceusb.c |  2 +-
>> drivers/media/usb/ttusb-dec/ttusb_dec.c   | 21 +-
>> 30 files changed, 151 insertions(+), 131 deletions(-)
>> 
>> diff --git a/drivers/media/pci/bt8xx/bt878.c 
>> b/drivers/media/pci/bt8xx/bt878.c
>> index 90972d6952f1..983ec29108f0 100644
>> --- a/drivers/media/pci/bt8xx/bt878.c
>> +++ b/drivers/media/pci/bt8xx/bt878.c
>> @@ -300,8 +300,8 @@ static irqreturn_t bt878_irq(int irq, void *dev_id)
>>  }
>>  if (astat & BT878_ARISCI) {
>>  bt->finished_block = (stat & BT878_ARISCS) >> 28;
>> -if (bt->tasklet.callback)
>> -tasklet_schedule(>tasklet);
>> +if (bt->work.func)
>> +queue_work(system_bh_wq,
> 
> I stopped reviewing here: this clearly has not been compile tested.
> 
> Also please check the patch with 'checkpatch.pl --strict' and fix the 
> reported issues.
> 
> Regards,
> 
>   Hans

 Hans,

   Thanks for taking the time out to review. This was a mistake, I sent out a 
v2 which had
This fixed. I am working on v3 based on some of the comments I received  
recently. Will
Appreciate your review when it is sent out.

Allen

> 
>>  break;
>>  }
>>  count++;
>> @@ -478,8 +478,8 @@ static int bt878_probe(struct pci_dev *dev, const struct 
>> pci_device_id *pci_id)
>>  btwrite(0, BT878_AINT_MASK);
>>  bt878_num++;
>> 
>> -if (!bt->tasklet.func)
>> -tasklet_disable(>tasklet);
>> +if (!bt->work.func)
>> +disable_work_sync(>work);
>> 
>>  return 0;
>> 
>> diff --git a/drivers/media/pci/bt8xx/bt878.h 
>> b/drivers/media/pci/bt8xx/bt878.h
>> index fde8db293c54..b9ce78e5116b 100644
>> --- a/drivers/media/pci/bt8xx/bt878.h
>> +++ b/drivers/media/pci/bt8xx/bt878.h
>> @@ -14,6 +14,7 @@
>> #include 
>> #include 
>> #include 
>> +#include 
>> 
>> #include "bt848.h"
>> #include "bttv.h"
>> @@ -120,7 +

[Openipmi-developer] [PATCH 7/9] s390: Convert from tasklet to BH workqueue

2024-03-27 Thread Allen Pais
The only generic interface to execute asynchronously in the BH context is
tasklet; however, it's marked deprecated and has some design flaws. To
replace tasklets, BH workqueue support was recently added. A BH workqueue
behaves similarly to regular workqueues except that the queued work items
are executed in the BH context.

This patch converts drivers/infiniband/* from tasklet to BH workqueue.

Based on the work done by Tejun Heo 
Branch: https://git.kernel.org/pub/scm/linux/kernel/git/tj/wq.git for-6.10

Note: Not tested. Please test/review.

Signed-off-by: Allen Pais 
---
 drivers/s390/block/dasd.c  | 42 
 drivers/s390/block/dasd_int.h  | 10 +++---
 drivers/s390/char/con3270.c| 27 
 drivers/s390/crypto/ap_bus.c   | 24 +++---
 drivers/s390/crypto/ap_bus.h   |  2 +-
 drivers/s390/crypto/zcrypt_msgtype50.c |  2 +-
 drivers/s390/crypto/zcrypt_msgtype6.c  |  4 +--
 drivers/s390/net/ctcm_fsms.c   |  4 +--
 drivers/s390/net/ctcm_main.c   | 15 -
 drivers/s390/net/ctcm_main.h   |  5 +--
 drivers/s390/net/ctcm_mpc.c| 12 +++
 drivers/s390/net/ctcm_mpc.h|  7 ++--
 drivers/s390/net/lcs.c | 26 +++
 drivers/s390/net/lcs.h |  2 +-
 drivers/s390/net/qeth_core_main.c  |  2 +-
 drivers/s390/scsi/zfcp_qdio.c  | 45 +-
 drivers/s390/scsi/zfcp_qdio.h  |  9 +++---
 17 files changed, 117 insertions(+), 121 deletions(-)

diff --git a/drivers/s390/block/dasd.c b/drivers/s390/block/dasd.c
index 0a97cfedd706..c6f9910f0a98 100644
--- a/drivers/s390/block/dasd.c
+++ b/drivers/s390/block/dasd.c
@@ -54,8 +54,8 @@ MODULE_LICENSE("GPL");
  * SECTION: prototypes for static functions of dasd.c
  */
 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_work(struct work_struct *);
+static void dasd_block_work(struct work_struct *);
 static void do_kick_device(struct work_struct *);
 static void do_reload_device(struct work_struct *);
 static void do_requeue_requests(struct work_struct *);
@@ -114,9 +114,8 @@ struct dasd_device *dasd_alloc_device(void)
dasd_init_chunklist(>erp_chunks, device->erp_mem, PAGE_SIZE);
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);
+   atomic_set(>work_scheduled, 0);
+   INIT_WORK(>bh, dasd_device_work);
INIT_LIST_HEAD(>ccw_queue);
timer_setup(>timer, dasd_device_timeout, 0);
INIT_WORK(>kick_work, do_kick_device);
@@ -154,9 +153,8 @@ struct dasd_block *dasd_alloc_block(void)
/* open_count = 0 means device online but not in use */
atomic_set(>open_count, -1);
 
-   atomic_set(>tasklet_scheduled, 0);
-   tasklet_init(>tasklet, dasd_block_tasklet,
-(unsigned long) block);
+   atomic_set(>work_scheduled, 0);
+   INIT_WORK(>bh, dasd_block_work);
INIT_LIST_HEAD(>ccw_queue);
spin_lock_init(>queue_lock);
INIT_LIST_HEAD(>format_list);
@@ -2148,12 +2146,12 @@ 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_work(struct work_struct *t)
 {
-   struct dasd_device *device = (struct dasd_device *) data;
+   struct dasd_device *device = from_work(device, t, bh);
struct list_head final_queue;
 
-   atomic_set (>tasklet_scheduled, 0);
+   atomic_set (>work_scheduled, 0);
INIT_LIST_HEAD(_queue);
spin_lock_irq(get_ccwdev_lock(device->cdev));
/* Check expire time of first request on the ccw queue. */
@@ -2174,15 +2172,15 @@ static void dasd_device_tasklet(unsigned long data)
 }
 
 /*
- * Schedules a call to dasd_tasklet over the device tasklet.
+ * Schedules a call to dasd_work over the device wq.
  */
 void dasd_schedule_device_bh(struct dasd_device *device)
 {
/* Protect against rescheduling. */
-   if (atomic_cmpxchg (>tasklet_scheduled, 0, 1) != 0)
+   if (atomic_cmpxchg (>work_scheduled, 0, 1) != 0)
return;
dasd_get_device(device);
-   tasklet_hi_schedule(>tasklet);
+   queue_work(system_bh_highpri_wq, >bh);
 }
 EXPORT_SYMBOL(dasd_schedule_device_bh);
 
@@ -2595,7 +2593,7 @@ int dasd_sleep_on_immediatly(struct dasd_ccw_req *cqr)
else
rc = -EIO;
 
-   /* kick tasklets */
+   /* kick works */
dasd_schedule_device_bh(device);
if (device->block)
dasd_schedule_block_bh

[Openipmi-developer] [PATCH 5/9] mailbox: Convert from tasklet to BH workqueue

2024-03-27 Thread Allen Pais
The only generic interface to execute asynchronously in the BH context is
tasklet; however, it's marked deprecated and has some design flaws. To
replace tasklets, BH workqueue support was recently added. A BH workqueue
behaves similarly to regular workqueues except that the queued work items
are executed in the BH context.

This patch converts drivers/infiniband/* from tasklet to BH workqueue.

Based on the work done by Tejun Heo 
Branch: https://git.kernel.org/pub/scm/linux/kernel/git/tj/wq.git for-6.10

Signed-off-by: Allen Pais 
---
 drivers/mailbox/bcm-pdc-mailbox.c | 21 +++--
 drivers/mailbox/imx-mailbox.c | 16 
 2 files changed, 19 insertions(+), 18 deletions(-)

diff --git a/drivers/mailbox/bcm-pdc-mailbox.c 
b/drivers/mailbox/bcm-pdc-mailbox.c
index 1768d3d5aaa0..242e7504a628 100644
--- a/drivers/mailbox/bcm-pdc-mailbox.c
+++ b/drivers/mailbox/bcm-pdc-mailbox.c
@@ -43,6 +43,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #define PDC_SUCCESS  0
 
@@ -293,8 +294,8 @@ struct pdc_state {
 
unsigned int pdc_irq;
 
-   /* tasklet for deferred processing after DMA rx interrupt */
-   struct tasklet_struct rx_tasklet;
+   /* work for deferred processing after DMA rx interrupt */
+   struct work_struct rx_work;
 
/* Number of bytes of receive status prior to each rx frame */
u32 rx_status_len;
@@ -952,18 +953,18 @@ static irqreturn_t pdc_irq_handler(int irq, void *data)
iowrite32(intstatus, pdcs->pdc_reg_vbase + PDC_INTSTATUS_OFFSET);
 
/* Wakeup IRQ thread */
-   tasklet_schedule(>rx_tasklet);
+   queue_work(system_bh_wq, >rx_work);
return IRQ_HANDLED;
 }
 
 /**
- * pdc_tasklet_cb() - Tasklet callback that runs the deferred processing after
+ * pdc_work_cb() - Work callback that runs the deferred processing after
  * a DMA receive interrupt. Reenables the receive interrupt.
  * @t: Pointer to the Altera sSGDMA channel structure
  */
-static void pdc_tasklet_cb(struct tasklet_struct *t)
+static void pdc_work_cb(struct work_struct *t)
 {
-   struct pdc_state *pdcs = from_tasklet(pdcs, t, rx_tasklet);
+   struct pdc_state *pdcs = from_work(pdcs, t, rx_work);
 
pdc_receive(pdcs);
 
@@ -1577,8 +1578,8 @@ static int pdc_probe(struct platform_device *pdev)
 
pdc_hw_init(pdcs);
 
-   /* Init tasklet for deferred DMA rx processing */
-   tasklet_setup(>rx_tasklet, pdc_tasklet_cb);
+   /* Init work for deferred DMA rx processing */
+   INIT_WORK(>rx_work, pdc_work_cb);
 
err = pdc_interrupts_init(pdcs);
if (err)
@@ -1595,7 +1596,7 @@ static int pdc_probe(struct platform_device *pdev)
return PDC_SUCCESS;
 
 cleanup_buf_pool:
-   tasklet_kill(>rx_tasklet);
+   cancel_work_sync(>rx_work);
dma_pool_destroy(pdcs->rx_buf_pool);
 
 cleanup_ring_pool:
@@ -1611,7 +1612,7 @@ static void pdc_remove(struct platform_device *pdev)
 
pdc_free_debugfs();
 
-   tasklet_kill(>rx_tasklet);
+   cancel_work_sync(>rx_work);
 
pdc_hw_disable(pdcs);
 
diff --git a/drivers/mailbox/imx-mailbox.c b/drivers/mailbox/imx-mailbox.c
index 5c1d09cad761..933727f89431 100644
--- a/drivers/mailbox/imx-mailbox.c
+++ b/drivers/mailbox/imx-mailbox.c
@@ -21,6 +21,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include "mailbox.h"
 
@@ -80,7 +81,7 @@ struct imx_mu_con_priv {
charirq_desc[IMX_MU_CHAN_NAME_SIZE];
enum imx_mu_chan_type   type;
struct mbox_chan*chan;
-   struct tasklet_struct   txdb_tasklet;
+   struct work_struct  txdb_work;
 };
 
 struct imx_mu_priv {
@@ -232,7 +233,7 @@ static int imx_mu_generic_tx(struct imx_mu_priv *priv,
break;
case IMX_MU_TYPE_TXDB:
imx_mu_xcr_rmw(priv, IMX_MU_GCR, 
IMX_MU_xCR_GIRn(priv->dcfg->type, cp->idx), 0);
-   tasklet_schedule(>txdb_tasklet);
+   queue_work(system_bh_wq, >txdb_work);
break;
case IMX_MU_TYPE_TXDB_V2:
imx_mu_xcr_rmw(priv, IMX_MU_GCR, 
IMX_MU_xCR_GIRn(priv->dcfg->type, cp->idx), 0);
@@ -420,7 +421,7 @@ static int imx_mu_seco_tx(struct imx_mu_priv *priv, struct 
imx_mu_con_priv *cp,
}
 
/* Simulate hack for mbox framework */
-   tasklet_schedule(>txdb_tasklet);
+   queue_work(system_bh_wq, >txdb_work);
 
break;
default:
@@ -484,9 +485,9 @@ static int imx_mu_seco_rxdb(struct imx_mu_priv *priv, 
struct imx_mu_con_priv *cp
return err;
 }
 
-static void imx_mu_txdb_tasklet(unsigned long data)
+static void imx_mu_txdb_work(struct work_struct *t)
 {
-   struct imx_mu_con_priv *cp = (struct imx_mu_con_priv *)data;
+   struct imx_mu_con_priv *cp = from_work(cp, t, txdb_work);
 
mbox_chan_txdone(cp->chan, 0);
 }
@@ -570,8 +571,7 @@ static int imx_mu_s

[Openipmi-developer] [PATCH 2/9] dma: Convert from tasklet to BH workqueue

2024-03-27 Thread Allen Pais
The only generic interface to execute asynchronously in the BH context is
tasklet; however, it's marked deprecated and has some design flaws. To
replace tasklets, BH workqueue support was recently added. A BH workqueue
behaves similarly to regular workqueues except that the queued work items
are executed in the BH context.

This patch converts drivers/dma/* from tasklet to BH workqueue.

Based on the work done by Tejun Heo 
Branch: git://git.kernel.org/pub/scm/linux/kernel/git/tj/wq.git for-6.10

Signed-off-by: Allen Pais 
---
 drivers/dma/altera-msgdma.c   | 15 
 drivers/dma/apple-admac.c | 15 
 drivers/dma/at_hdmac.c|  2 +-
 drivers/dma/at_xdmac.c| 15 
 drivers/dma/bcm2835-dma.c |  2 +-
 drivers/dma/dma-axi-dmac.c|  2 +-
 drivers/dma/dma-jz4780.c  |  2 +-
 .../dma/dw-axi-dmac/dw-axi-dmac-platform.c|  2 +-
 drivers/dma/dw-edma/dw-edma-core.c|  2 +-
 drivers/dma/dw/core.c | 13 +++
 drivers/dma/dw/regs.h |  3 +-
 drivers/dma/ep93xx_dma.c  | 15 
 drivers/dma/fsl-edma-common.c |  2 +-
 drivers/dma/fsl-qdma.c|  2 +-
 drivers/dma/fsl_raid.c| 11 +++---
 drivers/dma/fsl_raid.h|  2 +-
 drivers/dma/fsldma.c  | 15 
 drivers/dma/fsldma.h  |  3 +-
 drivers/dma/hisi_dma.c|  2 +-
 drivers/dma/hsu/hsu.c |  2 +-
 drivers/dma/idma64.c  |  4 +--
 drivers/dma/img-mdc-dma.c |  2 +-
 drivers/dma/imx-dma.c | 27 +++---
 drivers/dma/imx-sdma.c|  6 ++--
 drivers/dma/ioat/dma.c| 17 -
 drivers/dma/ioat/dma.h|  5 +--
 drivers/dma/ioat/init.c   |  2 +-
 drivers/dma/k3dma.c   | 19 +-
 drivers/dma/mediatek/mtk-cqdma.c  | 35 ++-
 drivers/dma/mediatek/mtk-hsdma.c  |  2 +-
 drivers/dma/mediatek/mtk-uart-apdma.c |  4 +--
 drivers/dma/mmp_pdma.c| 13 +++
 drivers/dma/mmp_tdma.c| 11 +++---
 drivers/dma/mpc512x_dma.c | 17 -
 drivers/dma/mv_xor.c  | 13 +++
 drivers/dma/mv_xor.h  |  5 +--
 drivers/dma/mv_xor_v2.c   | 23 ++--
 drivers/dma/mxs-dma.c | 13 +++
 drivers/dma/nbpfaxi.c | 15 
 drivers/dma/owl-dma.c |  2 +-
 drivers/dma/pch_dma.c | 17 -
 drivers/dma/pl330.c   | 31 
 drivers/dma/plx_dma.c | 13 +++
 drivers/dma/ppc4xx/adma.c | 17 -
 drivers/dma/ppc4xx/adma.h |  5 +--
 drivers/dma/pxa_dma.c |  2 +-
 drivers/dma/qcom/bam_dma.c| 35 ++-
 drivers/dma/qcom/gpi.c| 18 +-
 drivers/dma/qcom/hidma.c  | 11 +++---
 drivers/dma/qcom/hidma.h  |  5 +--
 drivers/dma/qcom/hidma_ll.c   | 11 +++---
 drivers/dma/qcom/qcom_adm.c   |  2 +-
 drivers/dma/sa11x0-dma.c  | 27 +++---
 drivers/dma/sf-pdma/sf-pdma.c | 23 ++--
 drivers/dma/sf-pdma/sf-pdma.h |  5 +--
 drivers/dma/sprd-dma.c|  2 +-
 drivers/dma/st_fdma.c |  2 +-
 drivers/dma/ste_dma40.c   | 17 -
 drivers/dma/sun6i-dma.c   | 33 -
 drivers/dma/tegra186-gpc-dma.c|  2 +-
 drivers/dma/tegra20-apb-dma.c | 19 +-
 drivers/dma/tegra210-adma.c   |  2 +-
 drivers/dma/ti/edma.c |  2 +-
 drivers/dma/ti/k3-udma.c  | 11 +++---
 drivers/dma/ti/omap-dma.c |  2 +-
 drivers/dma/timb_dma.c| 23 ++--
 drivers/dma/txx9dmac.c| 29 +++
 drivers/dma/txx9dmac.h|  5 +--
 drivers/dma/virt-dma.c|  9 ++---
 drivers/dma/virt-dma.h|  9 ++---
 drivers/dma/xgene-dma.c   | 21 +--
 drivers/dma/xilinx/xilinx_dma.c   | 23 ++--
 drivers/dma/xilinx/xilinx_dpdma.c | 21 +--
 drivers/dma/xilinx/zynqmp_dma.c   | 21 +--
 74 files changed, 442 insertions(+), 395 deletions(-)

diff --git

[Openipmi-developer] [PATCH 8/9] drivers/media/*: Convert from tasklet to BH workqueue

2024-03-27 Thread Allen Pais
The only generic interface to execute asynchronously in the BH context is
tasklet; however, it's marked deprecated and has some design flaws. To
replace tasklets, BH workqueue support was recently added. A BH workqueue
behaves similarly to regular workqueues except that the queued work items
are executed in the BH context.

This patch converts drivers/media/* from tasklet to BH workqueue.

Based on the work done by Tejun Heo 
Branch: https://git.kernel.org/pub/scm/linux/kernel/git/tj/wq.git for-6.10

Signed-off-by: Allen Pais 
---
 drivers/media/pci/bt8xx/bt878.c   |  8 ++--
 drivers/media/pci/bt8xx/bt878.h   |  3 +-
 drivers/media/pci/bt8xx/dvb-bt8xx.c   |  9 ++--
 drivers/media/pci/ddbridge/ddbridge.h |  3 +-
 drivers/media/pci/mantis/hopper_cards.c   |  2 +-
 drivers/media/pci/mantis/mantis_cards.c   |  2 +-
 drivers/media/pci/mantis/mantis_common.h  |  3 +-
 drivers/media/pci/mantis/mantis_dma.c |  5 ++-
 drivers/media/pci/mantis/mantis_dma.h |  2 +-
 drivers/media/pci/mantis/mantis_dvb.c | 12 +++---
 drivers/media/pci/ngene/ngene-core.c  | 23 ++-
 drivers/media/pci/ngene/ngene.h   |  5 ++-
 drivers/media/pci/smipcie/smipcie-main.c  | 18 
 drivers/media/pci/smipcie/smipcie.h   |  3 +-
 drivers/media/pci/ttpci/budget-av.c   |  3 +-
 drivers/media/pci/ttpci/budget-ci.c   | 27 ++--
 drivers/media/pci/ttpci/budget-core.c | 10 ++---
 drivers/media/pci/ttpci/budget.h  |  5 ++-
 drivers/media/pci/tw5864/tw5864-core.c|  2 +-
 drivers/media/pci/tw5864/tw5864-video.c   | 13 +++---
 drivers/media/pci/tw5864/tw5864.h |  7 ++--
 drivers/media/platform/intel/pxa_camera.c | 15 +++
 drivers/media/platform/marvell/mcam-core.c| 11 ++---
 drivers/media/platform/marvell/mcam-core.h|  3 +-
 .../st/sti/c8sectpfe/c8sectpfe-core.c | 15 +++
 .../st/sti/c8sectpfe/c8sectpfe-core.h |  2 +-
 drivers/media/radio/wl128x/fmdrv.h|  7 ++--
 drivers/media/radio/wl128x/fmdrv_common.c | 41 ++-
 drivers/media/rc/mceusb.c |  2 +-
 drivers/media/usb/ttusb-dec/ttusb_dec.c   | 21 +-
 30 files changed, 151 insertions(+), 131 deletions(-)

diff --git a/drivers/media/pci/bt8xx/bt878.c b/drivers/media/pci/bt8xx/bt878.c
index 90972d6952f1..983ec29108f0 100644
--- a/drivers/media/pci/bt8xx/bt878.c
+++ b/drivers/media/pci/bt8xx/bt878.c
@@ -300,8 +300,8 @@ static irqreturn_t bt878_irq(int irq, void *dev_id)
}
if (astat & BT878_ARISCI) {
bt->finished_block = (stat & BT878_ARISCS) >> 28;
-   if (bt->tasklet.callback)
-   tasklet_schedule(>tasklet);
+   if (bt->work.func)
+   queue_work(system_bh_wq,
break;
}
count++;
@@ -478,8 +478,8 @@ static int bt878_probe(struct pci_dev *dev, const struct 
pci_device_id *pci_id)
btwrite(0, BT878_AINT_MASK);
bt878_num++;
 
-   if (!bt->tasklet.func)
-   tasklet_disable(>tasklet);
+   if (!bt->work.func)
+   disable_work_sync(>work);
 
return 0;
 
diff --git a/drivers/media/pci/bt8xx/bt878.h b/drivers/media/pci/bt8xx/bt878.h
index fde8db293c54..b9ce78e5116b 100644
--- a/drivers/media/pci/bt8xx/bt878.h
+++ b/drivers/media/pci/bt8xx/bt878.h
@@ -14,6 +14,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include "bt848.h"
 #include "bttv.h"
@@ -120,7 +121,7 @@ struct bt878 {
dma_addr_t risc_dma;
u32 risc_pos;
 
-   struct tasklet_struct tasklet;
+   struct work_struct work;
int shutdown;
 };
 
diff --git a/drivers/media/pci/bt8xx/dvb-bt8xx.c 
b/drivers/media/pci/bt8xx/dvb-bt8xx.c
index 390cbba6c065..8c0e1fa764a4 100644
--- a/drivers/media/pci/bt8xx/dvb-bt8xx.c
+++ b/drivers/media/pci/bt8xx/dvb-bt8xx.c
@@ -15,6 +15,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -39,9 +40,9 @@ DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
 
 #define IF_FREQUENCYx6 217/* 6 * 36.167MHz */
 
-static void dvb_bt8xx_task(struct tasklet_struct *t)
+static void dvb_bt8xx_task(struct work_struct *t)
 {
-   struct bt878 *bt = from_tasklet(bt, t, tasklet);
+   struct bt878 *bt = from_work(bt, t, work);
struct dvb_bt8xx_card *card = dev_get_drvdata(>adapter->dev);
 
dprintk("%d\n", card->bt->finished_block);
@@ -782,7 +783,7 @@ static int dvb_bt8xx_load_card(struct dvb_bt8xx_card *card, 
u32 type)
goto err_disconnect_frontend;
}
 
-   tasklet_setup(>bt->tasklet, dvb_bt8xx_task);
+   INIT_WORK(>bt->work, dvb_bt8xx_task);
 
frontend_init(card, type);
 
@@ -922,7 +923,7 @@ static voi

[Openipmi-developer] [PATCH 9/9] mmc: Convert from tasklet to BH workqueue

2024-03-27 Thread Allen Pais
The only generic interface to execute asynchronously in the BH context is
tasklet; however, it's marked deprecated and has some design flaws. To
replace tasklets, BH workqueue support was recently added. A BH workqueue
behaves similarly to regular workqueues except that the queued work items
are executed in the BH context.

This patch converts drivers/infiniband/* from tasklet to BH workqueue.

Based on the work done by Tejun Heo 
Branch: https://git.kernel.org/pub/scm/linux/kernel/git/tj/wq.git for-6.10

Signed-off-by: Allen Pais 
---
 drivers/mmc/host/atmel-mci.c  | 35 -
 drivers/mmc/host/au1xmmc.c| 37 -
 drivers/mmc/host/cb710-mmc.c  | 15 ++--
 drivers/mmc/host/cb710-mmc.h  |  3 +-
 drivers/mmc/host/dw_mmc.c | 25 ---
 drivers/mmc/host/dw_mmc.h |  9 ++-
 drivers/mmc/host/omap.c   | 17 +++--
 drivers/mmc/host/renesas_sdhi.h   |  3 +-
 drivers/mmc/host/renesas_sdhi_internal_dmac.c | 24 +++---
 drivers/mmc/host/renesas_sdhi_sys_dmac.c  |  9 +--
 drivers/mmc/host/sdhci-bcm-kona.c |  2 +-
 drivers/mmc/host/tifm_sd.c| 15 ++--
 drivers/mmc/host/tmio_mmc.h   |  3 +-
 drivers/mmc/host/tmio_mmc_core.c  |  4 +-
 drivers/mmc/host/uniphier-sd.c| 13 ++--
 drivers/mmc/host/via-sdmmc.c  | 25 ---
 drivers/mmc/host/wbsd.c   | 75 ++-
 drivers/mmc/host/wbsd.h   | 10 +--
 18 files changed, 167 insertions(+), 157 deletions(-)

diff --git a/drivers/mmc/host/atmel-mci.c b/drivers/mmc/host/atmel-mci.c
index dba826db739a..0a92a7fd020f 100644
--- a/drivers/mmc/host/atmel-mci.c
+++ b/drivers/mmc/host/atmel-mci.c
@@ -33,6 +33,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -284,12 +285,12 @@ struct atmel_mci_dma {
  * EVENT_DATA_ERROR is pending.
  * @stop_cmdr: Value to be loaded into CMDR when the stop command is
  * to be sent.
- * @tasklet: Tasklet running the request state machine.
+ * @work: Work running the request state machine.
  * @pending_events: Bitmask of events flagged by the interrupt handler
- * to be processed by the tasklet.
+ * to be processed by the work.
  * @completed_events: Bitmask of events which the state machine has
  * processed.
- * @state: Tasklet state.
+ * @state: Work state.
  * @queue: List of slots waiting for access to the controller.
  * @need_clock_update: Update the clock rate before the next request.
  * @need_reset: Reset controller before next request.
@@ -363,7 +364,7 @@ struct atmel_mci {
u32 data_status;
u32 stop_cmdr;
 
-   struct tasklet_struct   tasklet;
+   struct work_struct  work;
unsigned long   pending_events;
unsigned long   completed_events;
enum atmel_mci_statestate;
@@ -761,7 +762,7 @@ static void atmci_timeout_timer(struct timer_list *t)
host->need_reset = 1;
host->state = STATE_END_REQUEST;
smp_wmb();
-   tasklet_schedule(>tasklet);
+   queue_work(system_bh_wq, >work);
 }
 
 static inline unsigned int atmci_ns_to_clocks(struct atmel_mci *host,
@@ -983,7 +984,7 @@ static void atmci_pdc_complete(struct atmel_mci *host)
 
dev_dbg(>pdev->dev, "(%s) set pending xfer complete\n", __func__);
atmci_set_pending(host, EVENT_XFER_COMPLETE);
-   tasklet_schedule(>tasklet);
+   queue_work(system_bh_wq, >work);
 }
 
 static void atmci_dma_cleanup(struct atmel_mci *host)
@@ -997,7 +998,7 @@ static void atmci_dma_cleanup(struct atmel_mci *host)
 }
 
 /*
- * This function is called by the DMA driver from tasklet context.
+ * This function is called by the DMA driver from work context.
  */
 static void atmci_dma_complete(void *arg)
 {
@@ -1020,7 +1021,7 @@ static void atmci_dma_complete(void *arg)
dev_dbg(>pdev->dev,
"(%s) set pending xfer complete\n", __func__);
atmci_set_pending(host, EVENT_XFER_COMPLETE);
-   tasklet_schedule(>tasklet);
+   queue_work(system_bh_wq, >work);
 
/*
 * Regardless of what the documentation says, we have
@@ -1033,7 +1034,7 @@ static void atmci_dma_complete(void *arg)
 * haven't seen all the potential error bits yet.
 *
 * The interrupt handler will schedule a different
-* tasklet to finish things up when the data transfer
+* work to finish things up when the data transfer
 * is completely done.
 *
 * We may not complete the mmc request here anyway
@@ -1765,9 +1766,9 @@ static void atmci_detect_change(struct timer_list *t)
}
 }
 
-static v

[Openipmi-developer] [PATCH 6/9] ipmi: Convert from tasklet to BH workqueue

2024-03-27 Thread Allen Pais
The only generic interface to execute asynchronously in the BH context is
tasklet; however, it's marked deprecated and has some design flaws. To
replace tasklets, BH workqueue support was recently added. A BH workqueue
behaves similarly to regular workqueues except that the queued work items
are executed in the BH context.

This patch converts drivers/infiniband/* from tasklet to BH workqueue.

Based on the work done by Tejun Heo 
Branch: https://git.kernel.org/pub/scm/linux/kernel/git/tj/wq.git for-6.10

Signed-off-by: Allen Pais 
---
 drivers/char/ipmi/ipmi_msghandler.c | 30 ++---
 1 file changed, 15 insertions(+), 15 deletions(-)

diff --git a/drivers/char/ipmi/ipmi_msghandler.c 
b/drivers/char/ipmi/ipmi_msghandler.c
index b0eedc4595b3..fce2a2dbdc82 100644
--- a/drivers/char/ipmi/ipmi_msghandler.c
+++ b/drivers/char/ipmi/ipmi_msghandler.c
@@ -36,12 +36,13 @@
 #include 
 #include 
 #include 
+#include 
 
 #define IPMI_DRIVER_VERSION "39.2"
 
 static struct ipmi_recv_msg *ipmi_alloc_recv_msg(void);
 static int ipmi_init_msghandler(void);
-static void smi_recv_tasklet(struct tasklet_struct *t);
+static void smi_recv_work(struct work_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,
@@ -498,13 +499,13 @@ struct ipmi_smi {
/*
 * Messages queued for delivery.  If delivery fails (out of memory
 * for instance), They will stay in here to be processed later in a
-* periodic timer interrupt.  The tasklet is for handling received
+* periodic timer interrupt.  The work is for handling received
 * messages directly from the handler.
 */
spinlock_t   waiting_rcv_msgs_lock;
struct list_head waiting_rcv_msgs;
atomic_t watchdog_pretimeouts_to_deliver;
-   struct tasklet_struct recv_tasklet;
+   struct work_struct recv_work;
 
spinlock_t xmit_msgs_lock;
struct list_head   xmit_msgs;
@@ -704,7 +705,7 @@ static void clean_up_interface_data(struct ipmi_smi *intf)
struct cmd_rcvr  *rcvr, *rcvr2;
struct list_head list;
 
-   tasklet_kill(>recv_tasklet);
+   cancel_work_sync(>recv_work);
 
free_smi_msg_list(>waiting_rcv_msgs);
free_recv_msg_list(>waiting_events);
@@ -1319,7 +1320,7 @@ static void free_user(struct kref *ref)
 {
struct ipmi_user *user = container_of(ref, struct ipmi_user, refcount);
 
-   /* SRCU cleanup must happen in task context. */
+   /* SRCU cleanup must happen in work context. */
queue_work(remove_work_wq, >remove_work);
 }
 
@@ -3605,8 +3606,7 @@ 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_setup(>recv_tasklet,
-smi_recv_tasklet);
+   INIT_WORK(>recv_work, smi_recv_work);
atomic_set(>watchdog_pretimeouts_to_deliver, 0);
spin_lock_init(>xmit_msgs_lock);
INIT_LIST_HEAD(>xmit_msgs);
@@ -4779,7 +4779,7 @@ static void handle_new_recv_msgs(struct ipmi_smi *intf)
 * To preserve message order, quit if we
 * can't handle a message.  Add the message
 * back at the head, this is safe because this
-* tasklet is the only thing that pulls the
+* work is the only thing that pulls the
 * messages.
 */
list_add(_msg->link, >waiting_rcv_msgs);
@@ -4812,10 +4812,10 @@ static void handle_new_recv_msgs(struct ipmi_smi *intf)
}
 }
 
-static void smi_recv_tasklet(struct tasklet_struct *t)
+static void smi_recv_work(struct work_struct *t)
 {
unsigned long flags = 0; /* keep us warning-free. */
-   struct ipmi_smi *intf = from_tasklet(intf, t, recv_tasklet);
+   struct ipmi_smi *intf = from_work(intf, t, recv_work);
int run_to_completion = intf->run_to_completion;
struct ipmi_smi_msg *newmsg = NULL;
 
@@ -4866,7 +4866,7 @@ void ipmi_smi_msg_received(struct ipmi_smi *intf,
 
/*
 * To preserve message order, we keep a queue and deliver from
-* a tasklet.
+* a work.
 */
if (!run_to_completion)
spin_lock_irqsave(>waiting_rcv_msgs_lock, flags);
@@ -4887,9 +4887,9 @@ void ipmi_smi_msg_received(struct ipmi_smi *intf,
spin_unlock_irqrestore(>xmit_msgs_lock, flags);
 
if (run_to_completion)
-   smi_recv_tasklet(>recv_tasklet);
+   smi_recv_work(>recv_work);
else
-   tasklet_schedule(>recv_tasklet);
+   queue_work(system_bh_wq, >recv_work);
 }
 EXPORT_SYMBOL(ipmi_smi_msg

[Openipmi-developer] [PATCH 3/9] IB: Convert from tasklet to BH workqueue

2024-03-27 Thread Allen Pais
The only generic interface to execute asynchronously in the BH context is
tasklet; however, it's marked deprecated and has some design flaws. To
replace tasklets, BH workqueue support was recently added. A BH workqueue
behaves similarly to regular workqueues except that the queued work items
are executed in the BH context.

This patch converts drivers/infiniband/* from tasklet to BH workqueue.

Based on the work done by Tejun Heo 
Branch: https://git.kernel.org/pub/scm/linux/kernel/git/tj/wq.git for-6.10

Signed-off-by: Allen Pais 
---
 drivers/infiniband/hw/bnxt_re/bnxt_re.h|  3 +-
 drivers/infiniband/hw/bnxt_re/qplib_fp.c   | 21 ++--
 drivers/infiniband/hw/bnxt_re/qplib_fp.h   |  2 +-
 drivers/infiniband/hw/bnxt_re/qplib_rcfw.c | 25 ---
 drivers/infiniband/hw/bnxt_re/qplib_rcfw.h |  2 +-
 drivers/infiniband/hw/erdma/erdma.h|  3 +-
 drivers/infiniband/hw/erdma/erdma_eq.c | 11 ---
 drivers/infiniband/hw/hfi1/rc.c|  2 +-
 drivers/infiniband/hw/hfi1/sdma.c  | 37 +++---
 drivers/infiniband/hw/hfi1/sdma.h  |  9 +++---
 drivers/infiniband/hw/hfi1/tid_rdma.c  |  6 ++--
 drivers/infiniband/hw/irdma/ctrl.c |  2 +-
 drivers/infiniband/hw/irdma/hw.c   | 24 +++---
 drivers/infiniband/hw/irdma/main.h |  5 +--
 drivers/infiniband/hw/qib/qib.h|  7 ++--
 drivers/infiniband/hw/qib/qib_iba7322.c|  9 +++---
 drivers/infiniband/hw/qib/qib_rc.c | 16 +-
 drivers/infiniband/hw/qib/qib_ruc.c|  4 +--
 drivers/infiniband/hw/qib/qib_sdma.c   | 11 ---
 drivers/infiniband/sw/rdmavt/qp.c  |  2 +-
 20 files changed, 106 insertions(+), 95 deletions(-)

diff --git a/drivers/infiniband/hw/bnxt_re/bnxt_re.h 
b/drivers/infiniband/hw/bnxt_re/bnxt_re.h
index 9dca451ed522..f511c8415806 100644
--- a/drivers/infiniband/hw/bnxt_re/bnxt_re.h
+++ b/drivers/infiniband/hw/bnxt_re/bnxt_re.h
@@ -42,6 +42,7 @@
 #include 
 #include "hw_counters.h"
 #include 
+#include 
 #define ROCE_DRV_MODULE_NAME   "bnxt_re"
 
 #define BNXT_RE_DESC   "Broadcom NetXtreme-C/E RoCE Driver"
@@ -162,7 +163,7 @@ struct bnxt_re_dev {
u8  cur_prio_map;
 
/* FP Notification Queue (CQ & SRQ) */
-   struct tasklet_struct   nq_task;
+   struct work_struct  nq_work;
 
/* RCFW Channel */
struct bnxt_qplib_rcfw  rcfw;
diff --git a/drivers/infiniband/hw/bnxt_re/qplib_fp.c 
b/drivers/infiniband/hw/bnxt_re/qplib_fp.c
index 439d0c7c5d0c..052906982cdf 100644
--- a/drivers/infiniband/hw/bnxt_re/qplib_fp.c
+++ b/drivers/infiniband/hw/bnxt_re/qplib_fp.c
@@ -46,6 +46,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include "roce_hsi.h"
@@ -294,9 +295,9 @@ static void __wait_for_all_nqes(struct bnxt_qplib_cq *cq, 
u16 cnq_events)
}
 }
 
-static void bnxt_qplib_service_nq(struct tasklet_struct *t)
+static void bnxt_qplib_service_nq(struct work_struct *t)
 {
-   struct bnxt_qplib_nq *nq = from_tasklet(nq, t, nq_tasklet);
+   struct bnxt_qplib_nq *nq = from_work(nq, t, nq_work);
struct bnxt_qplib_hwq *hwq = >hwq;
struct bnxt_qplib_cq *cq;
int budget = nq->budget;
@@ -394,7 +395,7 @@ void bnxt_re_synchronize_nq(struct bnxt_qplib_nq *nq)
int budget = nq->budget;
 
nq->budget = nq->hwq.max_elements;
-   bnxt_qplib_service_nq(>nq_tasklet);
+   bnxt_qplib_service_nq(>nq_work);
nq->budget = budget;
 }
 
@@ -409,7 +410,7 @@ static irqreturn_t bnxt_qplib_nq_irq(int irq, void 
*dev_instance)
prefetch(bnxt_qplib_get_qe(hwq, sw_cons, NULL));
 
/* Fan out to CPU affinitized kthreads? */
-   tasklet_schedule(>nq_tasklet);
+   queue_work(system_bh_wq, >nq_work);
 
return IRQ_HANDLED;
 }
@@ -430,8 +431,8 @@ void bnxt_qplib_nq_stop_irq(struct bnxt_qplib_nq *nq, bool 
kill)
nq->name = NULL;
 
if (kill)
-   tasklet_kill(>nq_tasklet);
-   tasklet_disable(>nq_tasklet);
+   cancel_work_sync(>nq_work);
+   disable_work_sync(>nq_work);
 }
 
 void bnxt_qplib_disable_nq(struct bnxt_qplib_nq *nq)
@@ -465,9 +466,9 @@ int bnxt_qplib_nq_start_irq(struct bnxt_qplib_nq *nq, int 
nq_indx,
 
nq->msix_vec = msix_vector;
if (need_init)
-   tasklet_setup(>nq_tasklet, bnxt_qplib_service_nq);
+   INIT_WORK(>nq_work, bnxt_qplib_service_nq);
else
-   tasklet_enable(>nq_tasklet);
+   enable_and_queue_work(system_bh_wq, >nq_work);
 
nq->name = kasprintf(GFP_KERNEL, "bnxt_re-nq-%d@pci:%s",
 nq_indx, pci_name(res->pdev));
@@ -477,7 +478,7 @@ int bnxt_qplib_nq_start_irq(struct bnxt_qplib_nq *nq, int 
nq_indx,
if (rc) {
kfree(nq->name)

[Openipmi-developer] [PATCH 1/9] hyperv: Convert from tasklet to BH workqueue

2024-03-27 Thread Allen Pais
The only generic interface to execute asynchronously in the BH context is
tasklet; however, it's marked deprecated and has some design flaws. To
replace tasklets, BH workqueue support was recently added. A BH workqueue
behaves similarly to regular workqueues except that the queued work items
are executed in the BH context.

This patch converts drivers/hv/* from tasklet to BH workqueue.

Based on the work done by Tejun Heo 
Branch: https://git.kernel.org/pub/scm/linux/kernel/git/tj/wq.git for-6.10

Signed-off-by: Allen Pais 
---
 drivers/hv/channel.c  |  8 
 drivers/hv/channel_mgmt.c |  5 ++---
 drivers/hv/connection.c   |  9 +
 drivers/hv/hv.c   |  3 +--
 drivers/hv/hv_balloon.c   |  4 ++--
 drivers/hv/hv_fcopy.c |  8 
 drivers/hv/hv_kvp.c   |  8 
 drivers/hv/hv_snapshot.c  |  8 
 drivers/hv/hyperv_vmbus.h |  9 +
 drivers/hv/vmbus_drv.c| 19 ++-
 include/linux/hyperv.h|  2 +-
 11 files changed, 42 insertions(+), 41 deletions(-)

diff --git a/drivers/hv/channel.c b/drivers/hv/channel.c
index adbf674355b2..876d78eb4dce 100644
--- a/drivers/hv/channel.c
+++ b/drivers/hv/channel.c
@@ -859,7 +859,7 @@ void vmbus_reset_channel_cb(struct vmbus_channel *channel)
unsigned long flags;
 
/*
-* vmbus_on_event(), running in the per-channel tasklet, can race
+* vmbus_on_event(), running in the per-channel work, can race
 * with vmbus_close_internal() in the case of SMP guest, e.g., when
 * the former is accessing channel->inbound.ring_buffer, the latter
 * could be freeing the ring_buffer pages, so here we must stop it
@@ -871,7 +871,7 @@ void vmbus_reset_channel_cb(struct vmbus_channel *channel)
 * and that the channel ring buffer is no longer being accessed, cf.
 * the calls to napi_disable() in netvsc_device_remove().
 */
-   tasklet_disable(>callback_event);
+   disable_work_sync(>callback_event);
 
/* See the inline comments in vmbus_chan_sched(). */
spin_lock_irqsave(>sched_lock, flags);
@@ -880,8 +880,8 @@ void vmbus_reset_channel_cb(struct vmbus_channel *channel)
 
channel->sc_creation_callback = NULL;
 
-   /* Re-enable tasklet for use on re-open */
-   tasklet_enable(>callback_event);
+   /* Re-enable work for use on re-open */
+   enable_and_queue_work(system_bh_wq, >callback_event);
 }
 
 static int vmbus_close_internal(struct vmbus_channel *channel)
diff --git a/drivers/hv/channel_mgmt.c b/drivers/hv/channel_mgmt.c
index 2f4d09ce027a..58397071a0de 100644
--- a/drivers/hv/channel_mgmt.c
+++ b/drivers/hv/channel_mgmt.c
@@ -353,8 +353,7 @@ static struct vmbus_channel *alloc_channel(void)
 
INIT_LIST_HEAD(>sc_list);
 
-   tasklet_init(>callback_event,
-vmbus_on_event, (unsigned long)channel);
+   INIT_WORK(>callback_event, vmbus_on_event);
 
hv_ringbuffer_pre_init(channel);
 
@@ -366,7 +365,7 @@ static struct vmbus_channel *alloc_channel(void)
  */
 static void free_channel(struct vmbus_channel *channel)
 {
-   tasklet_kill(>callback_event);
+   cancel_work_sync(>callback_event);
vmbus_remove_channel_attr_group(channel);
 
kobject_put(>kobj);
diff --git a/drivers/hv/connection.c b/drivers/hv/connection.c
index 3cabeeabb1ca..f2a3394a8303 100644
--- a/drivers/hv/connection.c
+++ b/drivers/hv/connection.c
@@ -372,12 +372,13 @@ struct vmbus_channel *relid2channel(u32 relid)
  * 3. Once we return, enable signaling from the host. Once this
  *state is set we check to see if additional packets are
  *available to read. In this case we repeat the process.
- *If this tasklet has been running for a long time
+ *If this work has been running for a long time
  *then reschedule ourselves.
  */
-void vmbus_on_event(unsigned long data)
+void vmbus_on_event(struct work_struct *t)
 {
-   struct vmbus_channel *channel = (void *) data;
+   struct vmbus_channel *channel = from_work(channel, t,
+   callback_event);
void (*callback_fn)(void *context);
 
trace_vmbus_on_event(channel);
@@ -401,7 +402,7 @@ void vmbus_on_event(unsigned long data)
return;
 
hv_begin_read(>inbound);
-   tasklet_schedule(>callback_event);
+   queue_work(system_bh_wq, >callback_event);
 }
 
 /*
diff --git a/drivers/hv/hv.c b/drivers/hv/hv.c
index a8ad728354cb..2af92f08f9ce 100644
--- a/drivers/hv/hv.c
+++ b/drivers/hv/hv.c
@@ -119,8 +119,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);
+   INIT_WORK(_cpu->msg_dpc, vmbus_on_msg_dpc);
 
if (ms_hyperv.paravisor_present &&

[Openipmi-developer] [PATCH 0/9] Convert Tasklets to BH Workqueues

2024-03-27 Thread Allen Pais
This patch series represents a significant shift in how asynchronous
execution in the bottom half (BH) context is handled within the kernel.
Traditionally, tasklets have been the go-to mechanism for such operations.
This series introduces the conversion of existing tasklet implementations
to the newly supported BH workqueues, marking a pivotal enhancement
in how asynchronous tasks are managed and executed.

Background and Motivation:
Tasklets have served as the kernel's lightweight mechanism for
scheduling bottom-half processing, providing a simple interface
for deferring work from interrupt context. There have been increasing
requests and motivations to deprecate and eventually remove tasklets
in favor of more modern and flexible mechanisms.

Introduction of BH Workqueues:
BH workqueues are designed to behave similarly to regular workqueues
with the added benefit of execution in the BH context.

Conversion Details:
The conversion process involved identifying all instances where
tasklets were used within the kernel and replacing them with BH workqueue
implementations.

This patch series is a first step toward broader adoption of BH workqueues
across the kernel, and soon other subsystems using tasklets will undergo
a similar transition. The groundwork laid here could serve as a
blueprint for such future conversions.

Testing Request:
In addition to a thorough review of these changes,
I kindly request that the reviwers engage in both functional and
performance testing of this patch series. Specifically, benchmarks
that measure interrupt handling efficiency, latency, and throughput.

I welcome your feedback, suggestions, and any further discussion on this
patch series.


Additional Info:
Based on the work done by Tejun Heo 
Branch: https://git.kernel.org/pub/scm/linux/kernel/git/tj/wq.git for-6.10

Allen Pais (9):
  hyperv: Convert from tasklet to BH workqueue
  dma: Convert from tasklet to BH workqueue
  IB: Convert from tasklet to BH workqueue
  USB: Convert from tasklet to BH workqueue
  mailbox: Convert from tasklet to BH workqueue
  ipmi: Convert from tasklet to BH workqueue
  s390: Convert from tasklet to BH workqueue
  drivers/media/*: Convert from tasklet to BH workqueue
  mmc: Convert from tasklet to BH workqueue

 drivers/char/ipmi/ipmi_msghandler.c   | 30 
 drivers/dma/altera-msgdma.c   | 15 ++--
 drivers/dma/apple-admac.c | 15 ++--
 drivers/dma/at_hdmac.c|  2 +-
 drivers/dma/at_xdmac.c| 15 ++--
 drivers/dma/bcm2835-dma.c |  2 +-
 drivers/dma/dma-axi-dmac.c|  2 +-
 drivers/dma/dma-jz4780.c  |  2 +-
 .../dma/dw-axi-dmac/dw-axi-dmac-platform.c|  2 +-
 drivers/dma/dw-edma/dw-edma-core.c|  2 +-
 drivers/dma/dw/core.c | 13 ++--
 drivers/dma/dw/regs.h |  3 +-
 drivers/dma/ep93xx_dma.c  | 15 ++--
 drivers/dma/fsl-edma-common.c |  2 +-
 drivers/dma/fsl-qdma.c|  2 +-
 drivers/dma/fsl_raid.c| 11 +--
 drivers/dma/fsl_raid.h|  2 +-
 drivers/dma/fsldma.c  | 15 ++--
 drivers/dma/fsldma.h  |  3 +-
 drivers/dma/hisi_dma.c|  2 +-
 drivers/dma/hsu/hsu.c |  2 +-
 drivers/dma/idma64.c  |  4 +-
 drivers/dma/img-mdc-dma.c |  2 +-
 drivers/dma/imx-dma.c | 27 +++
 drivers/dma/imx-sdma.c|  6 +-
 drivers/dma/ioat/dma.c| 17 +++--
 drivers/dma/ioat/dma.h|  5 +-
 drivers/dma/ioat/init.c   |  2 +-
 drivers/dma/k3dma.c   | 19 ++---
 drivers/dma/mediatek/mtk-cqdma.c  | 35 -
 drivers/dma/mediatek/mtk-hsdma.c  |  2 +-
 drivers/dma/mediatek/mtk-uart-apdma.c |  4 +-
 drivers/dma/mmp_pdma.c| 13 ++--
 drivers/dma/mmp_tdma.c| 11 +--
 drivers/dma/mpc512x_dma.c | 17 +++--
 drivers/dma/mv_xor.c  | 13 ++--
 drivers/dma/mv_xor.h  |  5 +-
 drivers/dma/mv_xor_v2.c   | 23 +++---
 drivers/dma/mxs-dma.c | 13 ++--
 drivers/dma/nbpfaxi.c | 15 ++--
 drivers/dma/owl-dma.c |  2 +-
 drivers/dma/pch_dma.c | 17 +++--
 drivers/dma/pl330.c   | 31 
 drivers/dma/plx_dma.c | 13 ++--
 drivers/dma/ppc4xx/adma.c | 17 +++--
 drivers/dma/ppc4xx/adma.h |  5 +-
 drivers/dma/pxa_dma.c |  2 +-
 drivers/dma/qcom/bam_dma.c| 35 -
 drivers/dma

[Openipmi-developer] [PATCH 4/9] USB: Convert from tasklet to BH workqueue

2024-03-27 Thread Allen Pais
The only generic interface to execute asynchronously in the BH context is
tasklet; however, it's marked deprecated and has some design flaws. To
replace tasklets, BH workqueue support was recently added. A BH workqueue
behaves similarly to regular workqueues except that the queued work items
are executed in the BH context.

This patch converts drivers/infiniband/* from tasklet to BH workqueue.

Based on the work done by Tejun Heo 
Branch: https://git.kernel.org/pub/scm/linux/kernel/git/tj/wq.git for-6.10

Signed-off-by: Allen Pais 
---
 drivers/usb/atm/usbatm.c| 55 +++--
 drivers/usb/atm/usbatm.h|  3 +-
 drivers/usb/core/hcd.c  | 22 ++--
 drivers/usb/gadget/udc/fsl_qe_udc.c | 21 +--
 drivers/usb/gadget/udc/fsl_qe_udc.h |  4 +--
 drivers/usb/host/ehci-sched.c   |  2 +-
 drivers/usb/host/fhci-hcd.c |  3 +-
 drivers/usb/host/fhci-sched.c   | 10 +++---
 drivers/usb/host/fhci.h |  5 +--
 drivers/usb/host/xhci-dbgcap.h  |  3 +-
 drivers/usb/host/xhci-dbgtty.c  | 15 
 include/linux/usb/cdc_ncm.h |  2 +-
 include/linux/usb/usbnet.h  |  2 +-
 13 files changed, 76 insertions(+), 71 deletions(-)

diff --git a/drivers/usb/atm/usbatm.c b/drivers/usb/atm/usbatm.c
index 2da6615fbb6f..74849f24e52e 100644
--- a/drivers/usb/atm/usbatm.c
+++ b/drivers/usb/atm/usbatm.c
@@ -17,7 +17,7 @@
  * - Removed the limit on the number of devices
  * - Module now autoloads on device plugin
  * - Merged relevant parts of sarlib
- * - Replaced the kernel thread with a tasklet
+ * - Replaced the kernel thread with a work
  * - New packet transmission code
  * - Changed proc file contents
  * - Fixed all known SMP races
@@ -68,6 +68,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #ifdef VERBOSE_DEBUG
 static int usbatm_print_packet(struct usbatm_data *instance, const unsigned 
char *data, int len);
@@ -249,7 +250,7 @@ static void usbatm_complete(struct urb *urb)
/* vdbg("%s: urb 0x%p, status %d, actual_length %d",
 __func__, urb, status, urb->actual_length); */
 
-   /* Can be invoked from task context, protect against interrupts */
+   /* Can be invoked from work context, protect against interrupts */
spin_lock_irqsave(>lock, flags);
 
/* must add to the back when receiving; doesn't matter when sending */
@@ -269,7 +270,7 @@ static void usbatm_complete(struct urb *urb)
/* throttle processing in case of an error */
mod_timer(>delay, jiffies + 
msecs_to_jiffies(THROTTLE_MSECS));
} else
-   tasklet_schedule(>tasklet);
+   queue_work(system_bh_wq, >work);
 }
 
 
@@ -511,10 +512,10 @@ static unsigned int usbatm_write_cells(struct usbatm_data 
*instance,
 **  receive  **
 **/
 
-static void usbatm_rx_process(struct tasklet_struct *t)
+static void usbatm_rx_process(struct work_struct *t)
 {
-   struct usbatm_data *instance = from_tasklet(instance, t,
-   rx_channel.tasklet);
+   struct usbatm_data *instance = from_work(instance, t,
+   rx_channel.work);
struct urb *urb;
 
while ((urb = usbatm_pop_urb(>rx_channel))) {
@@ -565,10 +566,10 @@ static void usbatm_rx_process(struct tasklet_struct *t)
 **  send  **
 ***/
 
-static void usbatm_tx_process(struct tasklet_struct *t)
+static void usbatm_tx_process(struct work_struct *t)
 {
-   struct usbatm_data *instance = from_tasklet(instance, t,
-   tx_channel.tasklet);
+   struct usbatm_data *instance = from_work(instance, t,
+   tx_channel.work);
struct sk_buff *skb = instance->current_skb;
struct urb *urb = NULL;
const unsigned int buf_size = instance->tx_channel.buf_size;
@@ -632,13 +633,13 @@ static void usbatm_cancel_send(struct usbatm_data 
*instance,
}
spin_unlock_irq(>sndqueue.lock);
 
-   tasklet_disable(>tx_channel.tasklet);
+   disable_work_sync(>tx_channel.work);
if ((skb = instance->current_skb) && (UDSL_SKB(skb)->atm.vcc == vcc)) {
atm_dbg(instance, "%s: popping current skb (0x%p)\n", __func__, 
skb);
instance->current_skb = NULL;
usbatm_pop(vcc, skb);
}
-   tasklet_enable(>tx_channel.tasklet);
+   enable_and_queue_work(system_bh_wq, >tx_channel.work);
 }
 
 static int usbatm_atm_send(struct atm_vcc *vcc, struct sk_buff *skb)
@@ -677,7 +678,7 @@ static int usbatm_atm_send(struct atm_vcc *vcc, struct 
sk_buff *skb)
ctrl->crc = crc32_be(~0, skb->data, skb->len);
 
skb_queue_tail(>sndque

Re: [Openipmi-developer] [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.


___
Openipmi-developer mailing list
Openipmi-developer@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openipmi-developer


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

2020-08-19 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

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

2020-08-19 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



___
Openipmi-developer mailing list
Openipmi-developer@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openipmi-developer


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

2020-08-19 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



___
Openipmi-developer mailing list
Openipmi-developer@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openipmi-developer


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

2020-08-19 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



___
Openipmi-developer mailing list
Openipmi-developer@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openipmi-developer


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

2020-08-19 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

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

2020-08-19 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 @@ 

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

2020-08-19 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



___
Openipmi-developer mailing list
Openipmi-developer@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openipmi-developer


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

2020-08-19 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



___
Openipmi-developer mailing list
Openipmi-developer@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openipmi-developer


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

2020-08-19 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



___
Openipmi-developer mailing list
Openipmi-developer@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openipmi-developer


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

2020-08-19 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



___
Openipmi-developer mailing list
Openipmi-developer@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openipmi-developer


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

2020-08-19 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



___
Openipmi-developer mailing list
Openipmi-developer@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openipmi-developer


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

2020-08-19 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



___
Openipmi-developer mailing list
Openipmi-developer@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openipmi-developer


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

2020-08-19 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



___
Openipmi-developer mailing list
Openipmi-developer@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openipmi-developer


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

2020-08-19 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



___
Openipmi-developer mailing list
Openipmi-developer@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openipmi-developer


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

2020-08-19 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



___
Openipmi-developer mailing list
Openipmi-developer@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openipmi-developer


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

2020-08-19 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



___
Openipmi-developer mailing list
Openipmi-developer@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openipmi-developer


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

2020-08-19 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



___
Openipmi-developer mailing list
Openipmi-developer@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openipmi-developer


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

2020-08-19 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



___
Openipmi-developer mailing list
Openipmi-developer@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openipmi-developer