Skip to contentSkip to conversation

Modernize the tasklet API

PATCH In review Romain Perier 3 participants 32 messages Sep 29, 2019 – Nov 7, 2019

Subsystems (155)
lore
Share & tools
lore
#0 lore raw

cover Modernize the tasklet API

Hello,

Nowadays, modern kernel subsystems that use callbacks pass the data structure associated with a given callback as argument to the callback. The data structure specific to the driver or subsystem that uses this callback framework is usually "derivated" from the data structure that is passed as argument to the callback.

The tasklet subsystem remains the one to pass callback argument as an arbitrary unsigned long argument (This has several issues that are explained in the first commit).

This series aims to improve the tasklet API and converts all the code that is using it. It is based on the series for timer_list at [1].

1. https://lore.kernel.org/patchwork/patch/835464

Romain Perier (16):
tasklet: Prepare to change tasklet callback argument type
crypto: ccp - Prepare to use the new tasklet API
mmc: renesas_sdhi: Prepare to use the new tasklet API
net: liquidio: Prepare to use the new tasklet API
chelsio: Prepare to use the new tasklet API
net: mvpp2: Prepare to use the new tasklet API
qed: Prepare to use the new tasklet API
isdn: Prepare to use the new tasklet API
scsi: pm8001: Prepare to use the new tasklet API
scsi: pmcraid: Prepare to use the new tasklet API
treewide: Globally replace tasklet_init() by tasklet_setup()
tasklet: Pass tasklet_struct pointer as .data in DECLARE_TASKLET
tasklet: Pass tasklet_struct pointer to callbacks unconditionally
tasklet: Remove the data argument from DECLARE_TASKLET() macros
tasklet: convert callbacks prototype for using struct tasklet_struct *
arguments
tasklet: Add the new initialization function permanently

 arch/mips/lasat/picvue_proc.c                 |  2 +-
 arch/um/drivers/vector_kern.c                 |  6 +-
 drivers/atm/eni.c                             |  8 +--
 drivers/atm/fore200e.c                        | 14 ++---
 drivers/atm/he.c                              |  8 +--
 drivers/atm/solos-pci.c                       |  8 +--
 drivers/block/umem.c                          |  6 +-
 drivers/block/xsysace.c                       |  6 +-
 drivers/char/ipmi/ipmi_msghandler.c           | 12 ++--
 drivers/crypto/amcc/crypto4xx_core.c          |  7 +--
 drivers/crypto/atmel-aes.c                    | 14 ++---
 drivers/crypto/atmel-sha.c                    | 14 ++---
 drivers/crypto/atmel-tdes.c                   | 14 ++---
 drivers/crypto/axis/artpec6_crypto.c          |  7 +--
 drivers/crypto/caam/jr.c                      |  8 +--
 drivers/crypto/cavium/cpt/cptvf_main.c        |  9 ++-
 drivers/crypto/cavium/nitrox/nitrox_common.h  |  2 +-
 drivers/crypto/cavium/nitrox/nitrox_isr.c     | 13 ++---
 drivers/crypto/cavium/nitrox/nitrox_reqmgr.c  |  4 +-
 drivers/crypto/ccp/ccp-dev-v3.c               |  9 ++-
 drivers/crypto/ccp/ccp-dev-v5.c               |  9 ++-
 drivers/crypto/ccp/ccp-dev.c                  | 10 ++--
 drivers/crypto/ccp/ccp-dmaengine.c            |  7 +--
 drivers/crypto/ccree/cc_fips.c                |  8 +--
 drivers/crypto/ccree/cc_request_mgr.c         | 12 ++--
 drivers/crypto/hifn_795x.c                    |  6 +-
 drivers/crypto/img-hash.c                     | 12 ++--
 drivers/crypto/ixp4xx_crypto.c                |  5 +-
 drivers/crypto/mediatek/mtk-aes.c             | 14 ++---
 drivers/crypto/mediatek/mtk-sha.c             | 14 ++---
 drivers/crypto/omap-aes.c                     |  6 +-
 drivers/crypto/omap-des.c                     |  6 +-
 drivers/crypto/omap-sham.c                    |  6 +-
 drivers/crypto/picoxcell_crypto.c             |  7 +--
 drivers/crypto/qat/qat_common/adf_isr.c       |  5 +-
 drivers/crypto/qat/qat_common/adf_sriov.c     |  8 +--
 drivers/crypto/qat/qat_common/adf_transport.c |  4 +-
 .../qat/qat_common/adf_transport_internal.h   |  2 +-
 drivers/crypto/qat/qat_common/adf_vf_isr.c    | 11 ++--
 drivers/crypto/qce/core.c                     |  7 +--
 drivers/crypto/rockchip/rk3288_crypto.c       | 14 ++---
 drivers/crypto/s5p-sss.c                      | 13 ++---
 drivers/crypto/talitos.c                      | 42 +++++++-------
 drivers/dma/altera-msgdma.c                   |  6 +-
 drivers/dma/at_hdmac.c                        |  7 +--
 drivers/dma/at_xdmac.c                        |  7 +--
 drivers/dma/coh901318.c                       |  7 +--
 drivers/dma/dw/core.c                         |  6 +-
 drivers/dma/ep93xx_dma.c                      |  7 +--
 drivers/dma/fsl_raid.c                        |  8 +--
 drivers/dma/fsldma.c                          |  6 +-
 drivers/dma/imx-dma.c                         |  7 +--
 drivers/dma/ioat/dma.c                        |  6 +-
 drivers/dma/ioat/dma.h                        |  2 +-
 drivers/dma/ioat/init.c                       |  2 +-
 drivers/dma/iop-adma.c                        |  8 +--
 drivers/dma/ipu/ipu_idmac.c                   |  6 +-
 drivers/dma/k3dma.c                           |  6 +-
 drivers/dma/mediatek/mtk-cqdma.c              |  7 +--
 drivers/dma/mmp_pdma.c                        |  6 +-
 drivers/dma/mmp_tdma.c                        |  6 +-
 drivers/dma/mpc512x_dma.c                     |  6 +-
 drivers/dma/mv_xor.c                          |  7 +--
 drivers/dma/mv_xor_v2.c                       |  8 +--
 drivers/dma/mxs-dma.c                         |  7 +--
 drivers/dma/nbpfaxi.c                         |  6 +-
 drivers/dma/pch_dma.c                         |  7 +--
 drivers/dma/pl330.c                           | 12 ++--
 drivers/dma/ppc4xx/adma.c                     |  7 +--
 drivers/dma/qcom/bam_dma.c                    |  6 +-
 drivers/dma/qcom/hidma.c                      |  6 +-
 drivers/dma/qcom/hidma_ll.c                   |  6 +-
 drivers/dma/sa11x0-dma.c                      |  6 +-
 drivers/dma/sirf-dma.c                        |  6 +-
 drivers/dma/ste_dma40.c                       |  7 +--
 drivers/dma/sun6i-dma.c                       |  6 +-
 drivers/dma/tegra20-apb-dma.c                 |  7 +--
 drivers/dma/timb_dma.c                        |  6 +-
 drivers/dma/txx9dmac.c                        | 14 ++---
 drivers/dma/virt-dma.c                        |  6 +-
 drivers/dma/xgene-dma.c                       |  7 +--
 drivers/dma/xilinx/xilinx_dma.c               |  7 +--
 drivers/dma/xilinx/zynqmp_dma.c               |  6 +-
 drivers/firewire/ohci.c                       | 16 +++---
 drivers/gpu/drm/i915/gt/intel_engine_cs.c     |  2 +-
 drivers/gpu/drm/i915/gt/intel_lrc.c           | 28 +++++-----
 .../gpu/drm/i915/gt/uc/intel_guc_submission.c |  7 ++-
 drivers/hsi/clients/nokia-modem.c             |  9 +--
 drivers/hsi/controllers/omap_ssi_core.c       |  9 ++-
 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 +-
 drivers/infiniband/hw/bnxt_re/qplib_fp.c      |  7 +--
 drivers/infiniband/hw/bnxt_re/qplib_rcfw.c    | 11 ++--
 drivers/infiniband/hw/hfi1/sdma.c             | 20 +++----
 drivers/infiniband/hw/i40iw/i40iw_main.c      | 14 ++---
 drivers/infiniband/hw/qib/qib_iba7322.c       |  7 +--
 drivers/infiniband/hw/qib/qib_sdma.c          | 10 ++--
 drivers/infiniband/sw/rxe/rxe_cq.c            |  6 +-
 drivers/infiniband/sw/rxe/rxe_task.c          |  8 +--
 drivers/infiniband/sw/rxe/rxe_task.h          |  2 +-
 drivers/input/keyboard/omap-keypad.c          | 14 +++--
 drivers/input/serio/hil_mlc.c                 |  4 +-
 drivers/input/serio/hp_sdc.c                  |  4 +-
 drivers/mailbox/bcm-pdc-mailbox.c             |  6 +-
 drivers/mailbox/imx-mailbox.c                 |  7 +--
 drivers/media/pci/bt8xx/dvb-bt8xx.c           |  7 ++-
 drivers/media/pci/mantis/mantis_dma.c         |  4 +-
 drivers/media/pci/mantis/mantis_dma.h         |  2 +-
 drivers/media/pci/mantis/mantis_dvb.c         |  2 +-
 drivers/media/pci/ngene/ngene-core.c          | 12 ++--
 drivers/media/pci/smipcie/smipcie-main.c      |  6 +-
 drivers/media/pci/ttpci/av7110.c              | 20 +++----
 drivers/media/pci/ttpci/budget-ci.c           | 16 +++---
 drivers/media/pci/ttpci/budget-core.c         |  6 +-
 drivers/media/pci/tw5864/tw5864-video.c       |  9 ++-
 .../media/platform/marvell-ccic/mcam-core.c   |  7 +--
 drivers/media/platform/pxa_camera.c           |  6 +-
 .../platform/sti/c8sectpfe/c8sectpfe-core.c   | 10 ++--
 drivers/media/radio/wl128x/fmdrv_common.c     | 12 ++--
 drivers/media/usb/ttusb-dec/ttusb_dec.c       |  7 +--
 drivers/memstick/host/jmb38x_ms.c             |  8 +--
 drivers/memstick/host/tifm_ms.c               |  8 +--
 drivers/misc/ibmvmc.c                         |  8 +--
 drivers/misc/vmw_vmci/vmci_guest.c            | 15 +++--
 drivers/mmc/host/atmel-mci.c                  |  6 +-
 drivers/mmc/host/au1xmmc.c                    | 14 ++---
 drivers/mmc/host/cb710-mmc.c                  | 10 ++--
 drivers/mmc/host/dw_mmc.c                     |  6 +-
 drivers/mmc/host/omap.c                       |  7 +--
 drivers/mmc/host/renesas_sdhi.h               |  1 +
 drivers/mmc/host/renesas_sdhi_core.c          |  2 +
 drivers/mmc/host/renesas_sdhi_internal_dmac.c | 19 +++----
 drivers/mmc/host/renesas_sdhi_sys_dmac.c      |  9 ++-
 drivers/mmc/host/s3cmci.c                     |  6 +-
 drivers/mmc/host/tifm_sd.c                    |  7 +--
 drivers/mmc/host/uniphier-sd.c                | 14 ++---
 drivers/mmc/host/via-sdmmc.c                  |  7 +--
 drivers/mmc/host/wbsd.c                       | 35 +++++-------
 drivers/net/arcnet/arcnet.c                   |  7 +--
 drivers/net/caif/caif_virtio.c                |  8 +--
 drivers/net/ethernet/alteon/acenic.c          |  9 +--
 drivers/net/ethernet/alteon/acenic.h          |  2 +-
 drivers/net/ethernet/amd/xgbe/xgbe-drv.c      | 19 +++----
 drivers/net/ethernet/amd/xgbe/xgbe-i2c.c      | 11 ++--
 drivers/net/ethernet/amd/xgbe/xgbe-mdio.c     | 11 ++--
 drivers/net/ethernet/broadcom/cnic.c          | 18 +++---
 drivers/net/ethernet/cadence/macb_main.c      |  7 +--
 .../net/ethernet/cavium/liquidio/lio_main.c   | 11 ++--
 .../ethernet/cavium/liquidio/octeon_main.h    |  1 +
 .../net/ethernet/cavium/octeon/octeon_mgmt.c  |  7 +--
 .../net/ethernet/cavium/thunder/nicvf_main.c  | 10 ++--
 .../ethernet/cavium/thunder/nicvf_queues.c    |  4 +-
 .../ethernet/cavium/thunder/nicvf_queues.h    |  2 +-
 drivers/net/ethernet/chelsio/cxgb/sge.c       | 11 ++--
 drivers/net/ethernet/chelsio/cxgb3/sge.c      | 16 +++---
 drivers/net/ethernet/chelsio/cxgb4/sge.c      | 12 ++--
 drivers/net/ethernet/dlink/sundance.c         | 19 +++----
 .../net/ethernet/huawei/hinic/hinic_hw_eqs.c  |  7 +--
 drivers/net/ethernet/ibm/ehea/ehea_main.c     |  7 +--
 drivers/net/ethernet/ibm/ibmvnic.c            |  7 +--
 drivers/net/ethernet/jme.c                    | 43 ++++++---------
 drivers/net/ethernet/marvell/mvpp2/mvpp2.h    |  1 +
 .../net/ethernet/marvell/mvpp2/mvpp2_main.c   |  1 +
 drivers/net/ethernet/marvell/skge.c           |  6 +-
 drivers/net/ethernet/mellanox/mlx4/cq.c       |  4 +-
 drivers/net/ethernet/mellanox/mlx4/eq.c       |  3 +-
 drivers/net/ethernet/mellanox/mlx4/mlx4.h     |  2 +-
 drivers/net/ethernet/mellanox/mlx5/core/cq.c  |  4 +-
 drivers/net/ethernet/mellanox/mlx5/core/eq.c  |  3 +-
 .../ethernet/mellanox/mlx5/core/fpga/conn.c   |  7 +--
 .../net/ethernet/mellanox/mlx5/core/lib/eq.h  |  2 +-
 drivers/net/ethernet/mellanox/mlxsw/pci.c     | 12 ++--
 drivers/net/ethernet/micrel/ks8842.c          | 19 ++++---
 drivers/net/ethernet/micrel/ksz884x.c         | 14 ++---
 drivers/net/ethernet/natsemi/ns83820.c        |  8 +--
 .../ethernet/netronome/nfp/nfp_net_common.c   |  7 +--
 drivers/net/ethernet/ni/nixge.c               |  7 +--
 drivers/net/ethernet/qlogic/qed/qed.h         |  2 +-
 drivers/net/ethernet/qlogic/qed/qed_int.c     | 27 +--------
 drivers/net/ethernet/qlogic/qed/qed_int.h     |  2 +-
 drivers/net/ethernet/qlogic/qed/qed_main.c    | 14 ++---
 drivers/net/ethernet/silan/sc92031.c          | 11 ++--
 drivers/net/ethernet/smsc/smc91x.c            |  8 +--
 .../net/ethernet/xilinx/xilinx_axienet_main.c |  9 ++-
 drivers/net/ifb.c                             |  7 +--
 drivers/net/ppp/ppp_async.c                   |  8 +--
 drivers/net/ppp/ppp_synctty.c                 |  8 +--
 drivers/net/usb/cdc_ncm.c                     |  8 +--
 drivers/net/usb/hso.c                         |  8 +--
 drivers/net/usb/lan78xx.c                     |  6 +-
 drivers/net/usb/pegasus.c                     |  6 +-
 drivers/net/usb/r8152.c                       |  8 +--
 drivers/net/usb/rtl8150.c                     |  6 +-
 drivers/net/usb/usbnet.c                      |  3 +-
 drivers/net/wan/farsync.c                     | 12 ++--
 drivers/net/wireless/ath/ath5k/base.c         | 24 ++++----
 drivers/net/wireless/ath/ath5k/rfkill.c       |  8 +--
 drivers/net/wireless/ath/ath9k/ath9k.h        |  4 +-
 drivers/net/wireless/ath/ath9k/beacon.c       |  4 +-
 drivers/net/wireless/ath/ath9k/htc.h          |  4 +-
 drivers/net/wireless/ath/ath9k/htc_drv_init.c |  6 +-
 drivers/net/wireless/ath/ath9k/htc_drv_txrx.c |  8 +--
 drivers/net/wireless/ath/ath9k/init.c         |  5 +-
 drivers/net/wireless/ath/ath9k/main.c         |  4 +-
 drivers/net/wireless/ath/ath9k/wmi.c          |  7 +--
 drivers/net/wireless/ath/ath9k/wmi.h          |  2 +-
 drivers/net/wireless/ath/carl9170/usb.c       |  7 +--
 drivers/net/wireless/atmel/at76c50x-usb.c     |  9 ++-
 .../net/wireless/broadcom/b43legacy/main.c    |  7 +--
 drivers/net/wireless/broadcom/b43legacy/pio.c |  7 +--
 .../broadcom/brcm80211/brcmsmac/mac80211_if.c |  6 +-
 .../broadcom/brcm80211/brcmsmac/mac80211_if.h |  2 +-
 drivers/net/wireless/intel/ipw2x00/ipw2100.c  |  8 +--
 drivers/net/wireless/intel/ipw2x00/ipw2200.c  |  6 +-
 .../net/wireless/intel/iwlegacy/3945-mac.c    |  7 +--
 .../net/wireless/intel/iwlegacy/4965-mac.c    |  7 +--
 .../net/wireless/intersil/hostap/hostap_hw.c  | 18 +++---
 drivers/net/wireless/intersil/orinoco/main.c  |  7 +--
 drivers/net/wireless/intersil/p54/p54pci.c    |  8 +--
 drivers/net/wireless/marvell/mwl8k.c          | 16 +++---
 drivers/net/wireless/mediatek/mt76/mac80211.c |  2 +-
 drivers/net/wireless/mediatek/mt76/mt76.h     |  2 +-
 .../wireless/mediatek/mt76/mt7603/beacon.c    |  4 +-
 .../net/wireless/mediatek/mt76/mt7603/init.c  |  3 +-
 .../wireless/mediatek/mt76/mt7603/mt7603.h    |  2 +-
 .../net/wireless/mediatek/mt76/mt76x02_dfs.c  |  9 ++-
 .../net/wireless/mediatek/mt76/mt76x02_mmio.c | 14 ++---
 drivers/net/wireless/mediatek/mt76/tx.c       |  4 +-
 drivers/net/wireless/mediatek/mt76/usb.c      | 12 ++--
 drivers/net/wireless/mediatek/mt7601u/dma.c   | 12 ++--
 .../quantenna/qtnfmac/pcie/pearl_pcie.c       |  7 +--
 .../quantenna/qtnfmac/pcie/topaz_pcie.c       |  7 +--
 .../net/wireless/ralink/rt2x00/rt2400pci.c    | 14 +++--
 .../net/wireless/ralink/rt2x00/rt2500pci.c    | 14 +++--
 .../net/wireless/ralink/rt2x00/rt2800mmio.c   | 25 +++++----
 .../net/wireless/ralink/rt2x00/rt2800mmio.h   | 10 ++--
 drivers/net/wireless/ralink/rt2x00/rt2x00.h   | 10 ++--
 .../net/wireless/ralink/rt2x00/rt2x00dev.c    |  5 +-
 drivers/net/wireless/ralink/rt2x00/rt61pci.c  | 19 ++++---
 drivers/net/wireless/realtek/rtlwifi/pci.c    | 20 ++++---
 drivers/net/wireless/realtek/rtlwifi/usb.c    |  9 ++-
 drivers/net/wireless/zydas/zd1211rw/zd_usb.c  |  7 +--
 drivers/ntb/ntb_transport.c                   |  9 ++-
 drivers/platform/goldfish/goldfish_pipe.c     |  7 +--
 drivers/rapidio/devices/tsi721_dma.c          |  7 +--
 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/crypto/ap_bus.c                  |  8 +--
 drivers/s390/net/ctcm_main.c                  |  9 ++-
 drivers/s390/net/ctcm_mpc.c                   | 16 +++---
 drivers/s390/net/ctcm_mpc.h                   |  6 +-
 drivers/scsi/aic94xx/aic94xx_hwi.c            |  9 ++-
 drivers/scsi/esas2r/esas2r.h                  |  2 +-
 drivers/scsi/esas2r/esas2r_init.c             |  4 +-
 drivers/scsi/esas2r/esas2r_main.c             |  4 +-
 drivers/scsi/hisi_sas/hisi_sas_v2_hw.c        |  6 +-
 drivers/scsi/hisi_sas/hisi_sas_v3_hw.c        |  6 +-
 drivers/scsi/ibmvscsi/ibmvfc.c                |  6 +-
 drivers/scsi/ibmvscsi/ibmvscsi.c              |  8 +--
 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c      |  7 +--
 drivers/scsi/isci/host.c                      |  4 +-
 drivers/scsi/isci/host.h                      |  2 +-
 drivers/scsi/isci/init.c                      |  4 +-
 drivers/scsi/megaraid/megaraid_mbox.c         | 11 ++--
 drivers/scsi/megaraid/megaraid_sas.h          |  2 +-
 drivers/scsi/megaraid/megaraid_sas_base.c     | 16 +++---
 drivers/scsi/megaraid/megaraid_sas_fusion.c   | 13 ++---
 drivers/scsi/mvsas/mv_init.c                  |  8 +--
 drivers/scsi/pm8001/pm8001_init.c             | 55 +++++++++++--------
 drivers/scsi/pm8001/pm8001_sas.h              |  6 +-
 drivers/scsi/pmcraid.c                        | 29 +++++-----
 drivers/scsi/pmcraid.h                        |  9 ++-
 drivers/spi/spi-pl022.c                       |  7 +--
 drivers/staging/isdn/gigaset/bas-gigaset.c    | 23 ++++----
 drivers/staging/isdn/gigaset/common.c         |  3 +-
 drivers/staging/isdn/gigaset/ev-layer.c       |  4 +-
 drivers/staging/isdn/gigaset/gigaset.h        |  3 +-
 drivers/staging/isdn/gigaset/interface.c      |  6 +-
 drivers/staging/isdn/gigaset/ser-gigaset.c    |  7 +--
 drivers/staging/isdn/gigaset/usb-gigaset.c    |  7 +--
 drivers/staging/ks7010/ks7010_sdio.c          |  6 +-
 drivers/staging/ks7010/ks_hostif.c            |  6 +-
 drivers/staging/most/dim2/dim2.c              | 19 ++++---
 drivers/staging/mt7621-dma/mtk-hsdma.c        |  6 +-
 drivers/staging/octeon/ethernet-tx.c          |  6 +-
 drivers/staging/ralink-gdma/ralink-gdma.c     |  6 +-
 .../staging/rtl8188eu/hal/rtl8188eu_recv.c    |  4 +-
 .../staging/rtl8188eu/hal/rtl8188eu_xmit.c    |  5 +-
 .../staging/rtl8188eu/include/rtl8188e_recv.h |  2 +-
 .../staging/rtl8188eu/include/rtl8188e_xmit.h |  2 +-
 .../staging/rtl8188eu/os_dep/usb_ops_linux.c  |  8 +--
 drivers/staging/rtl8192e/rtl8192e/rtl_core.c  | 29 +++++-----
 drivers/staging/rtl8192e/rtllib_softmac.c     |  8 +--
 .../rtl8192u/ieee80211/ieee80211_softmac.c    |  7 +--
 drivers/staging/rtl8192u/r8192U_core.c        |  9 ++-
 drivers/staging/rtl8712/rtl8712_recv.c        | 10 ++--
 drivers/staging/rtl8712/rtl871x_xmit.c        |  4 +-
 drivers/staging/rtl8712/rtl871x_xmit.h        |  2 +-
 drivers/staging/rtl8712/usb_ops_linux.c       |  4 +-
 .../staging/rtl8723bs/hal/rtl8723bs_recv.c    | 13 ++---
 drivers/staging/wlan-ng/hfa384x_usb.c         | 18 +++---
 drivers/staging/wlan-ng/p80211netdev.c        |  7 +--
 drivers/tty/ipwireless/hardware.c             |  6 +-
 drivers/tty/serial/atmel_serial.c             | 18 +++---
 drivers/tty/serial/ifx6x60.c                  |  7 +--
 drivers/tty/serial/timbuart.c                 |  6 +-
 drivers/tty/vt/keyboard.c                     |  4 +-
 drivers/usb/atm/usbatm.c                      | 12 ++--
 drivers/usb/c67x00/c67x00-sched.c             |  7 +--
 drivers/usb/core/hcd.c                        |  6 +-
 drivers/usb/gadget/function/f_midi.c          |  6 +-
 drivers/usb/gadget/udc/amd5536udc.h           |  1 +
 drivers/usb/gadget/udc/fsl_qe_udc.c           |  7 +--
 drivers/usb/gadget/udc/snps_udc_core.c        | 16 +++---
 drivers/usb/host/fhci-hcd.c                   |  5 +-
 drivers/usb/host/fhci-sched.c                 |  8 +--
 drivers/usb/host/fhci.h                       |  2 +-
 drivers/usb/host/xhci-dbgtty.c                |  6 +-
 drivers/usb/serial/mos7720.c                  |  7 +--
 drivers/vme/bridges/vme_fake.c                |  9 ++-
 include/linux/interrupt.h                     | 20 ++++---
 kernel/backtracetest.c                        |  4 +-
 kernel/debug/debug_core.c                     |  4 +-
 kernel/irq/resend.c                           |  4 +-
 kernel/softirq.c                              |  9 ++-
 net/atm/pppoatm.c                             |  8 +--
 net/dccp/timer.c                              |  9 +--
 net/ipv4/tcp_output.c                         |  8 +--
 net/iucv/iucv.c                               |  4 +-
 net/mac80211/ieee80211_i.h                    |  4 +-
 net/mac80211/main.c                           | 14 ++---
 net/mac80211/tx.c                             |  4 +-
 net/mac80211/util.c                           |  4 +-
 net/mac802154/main.c                          |  8 +--
 net/rds/ib_cm.c                               | 14 ++---
 net/sched/sch_atm.c                           |  8 +--
 net/smc/smc_cdc.c                             |  6 +-
 net/smc/smc_wr.c                              | 14 ++---
 net/xfrm/xfrm_input.c                         |  7 +--
 sound/core/timer.c                            |  7 +--
 sound/drivers/pcsp/pcsp_lib.c                 |  4 +-
 sound/firewire/amdtp-stream.c                 |  8 +--
 sound/pci/asihpi/asihpi.c                     |  9 ++-
 sound/pci/riptide/riptide.c                   |  6 +-
 sound/pci/rme9652/hdsp.c                      |  6 +-
 sound/pci/rme9652/hdspm.c                     |  7 +--
 sound/soc/fsl/fsl_esai.c                      |  7 +--
 sound/soc/sh/siu_pcm.c                        | 10 ++--
 sound/soc/txx9/txx9aclc.c                     |  7 +--
 sound/usb/midi.c                              |  7 +--
 sound/usb/misc/ua101.c                        |  7 +--
 359 files changed, 1432 insertions(+), 1612 deletions(-)
Signature · 1 line
2.23.0
#1 lore raw

PATCH 1/16 tasklet: Prepare to change tasklet callback argument type

Nowadays, modern kernel subsystems that use callbacks pass the data structure associated with a given callback as argument to the callback. The tasklet subsystem remains the one to pass callback argument as an arbitrary unsigned long argument. This has several problems:

- This keeps an extra field for storing the argument in each tasklet data structure, it bloats the tasklet_struct structure with a redundant .data field

- No type checking cannot be performed on this argument. Instead of using container_of() like other callback subsystems, it forces callbacks to do explicit type cast of the unsigned long argument into the required object type.

- Buffer overflows can overwrite the .function and the .data field, so an attacker can easily overwrite the function and its first argument to whatever it wants.

This adds a new tasklet initialization API which will gradually replace the existing one.

This work is greatly inspired from the timer_struct conversion series, see commit e99e88a9d ("treewide: setup_timer() -> timer_setup()")

---
 include/linux/interrupt.h | 12 ++++++++++++
 1 file changed, 12 insertions(+)
include/linux/interrupt.h +12 -0
index 89fc59dab57d..f5332ae2dbeb 100644
@@ -673,6 +673,18 @@ extern void tasklet_kill_immediate(struct tasklet_struct *t, unsigned int cpu);
 extern void tasklet_init(struct tasklet_struct *t,
 			 void (*func)(unsigned long), unsigned long data);
 
+#define TASKLET_DATA_TYPE		unsigned long
+#define TASKLET_FUNC_TYPE		void (*)(TASKLET_DATA_TYPE)
+
+#define from_tasklet(var, callback_tasklet, tasklet_fieldname) \
+	container_of(callback_tasklet, typeof(*var), tasklet_fieldname)
+
+static inline void tasklet_setup(struct tasklet_struct *t,
+				 void (*callback)(struct tasklet_struct *))
+{
+	tasklet_init(t, (TASKLET_FUNC_TYPE)callback, (TASKLET_DATA_TYPE)t);
+}
+
 /*
  * Autoprobing for irqs:
  *
Signature · 1 line
2.23.0
#2 lore raw

PATCH 2/16 crypto: ccp - Prepare to use the new tasklet API

In reply to Romain Perier

Currently, the tasklet and its "tdata" has no relationship. The future tasklet API, will no longer allow to pass an arbitrary "unsigned long" data parameter. The tasklet data structure will need to be embedded into a data structure that will be retrieved from the tasklet handler (most of the time, it is the driver data structure). This commit prepares the driver to this change. For doing so, it embeds "tasklet" into "tdata". Then, "tdata" will be recoverable from its "tasklet" field, with the tasklet API.

---
 drivers/crypto/ccp/ccp-dev.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/crypto/ccp/ccp-dev.c +3 -3
index 73acf0fdb793..d0d180176f45 100644
@@ -44,6 +44,7 @@ MODULE_PARM_DESC(max_devs, "Maximum number of CCPs to enable (default: all; 0 di
 struct ccp_tasklet_data {
 	struct completion completion;
 	struct ccp_cmd *cmd;
+	struct tasklet_struct tasklet;
 };
 
 /* Human-readable error strings */
@@ -436,9 +437,8 @@ int ccp_cmd_queue_thread(void *data)
 	struct ccp_cmd_queue *cmd_q = (struct ccp_cmd_queue *)data;
 	struct ccp_cmd *cmd;
 	struct ccp_tasklet_data tdata;
-	struct tasklet_struct tasklet;
 
-	tasklet_init(&tasklet, ccp_do_cmd_complete, (unsigned long)&tdata);
+	tasklet_init(&tdata.tasklet, ccp_do_cmd_complete, (unsigned long)&tdata);
 
 	set_current_state(TASK_INTERRUPTIBLE);
 	while (!kthread_should_stop()) {
@@ -458,7 +458,7 @@ int ccp_cmd_queue_thread(void *data)
 		/* Schedule the completion callback */
 		tdata.cmd = cmd;
 		init_completion(&tdata.completion);
-		tasklet_schedule(&tasklet);
+		tasklet_schedule(&tdata.tasklet);
 		wait_for_completion(&tdata.completion);
 	}
 
Signature · 1 line
2.23.0
#4 lore raw

PATCH 3/16 mmc: renesas_sdhi: Prepare to use the new tasklet API

In reply to Romain Perier

From: Romain Perier <[email protected]>

The future tasklet API will no longer allow to pass an arbitrary "unsigned long" data parameter. The tasklet data structure will need to be embedded into a data structure that will be retrieved from the tasklet handler. Then, all other data structure that must be retrieved from the handler (by using the tasklet as root object) must be retrievable via container_of(). This commits adds a field to get the address of the device binded to this driver, so the corresponding platform_device and its drvdata can be retrieved from the tasklet handler.

---
 drivers/mmc/host/renesas_sdhi.h      | 1 +
 drivers/mmc/host/renesas_sdhi_core.c | 2 ++
 2 files changed, 3 insertions(+)
drivers/mmc/host/renesas_sdhi.h +1 -0
index c0504aa90857..01ef8ff5b525 100644
@@ -42,6 +42,7 @@ struct tmio_mmc_dma {
 };
 
 struct renesas_sdhi {
+	struct platform_device *pdev;
 	struct clk *clk;
 	struct clk *clk_cd;
 	struct tmio_mmc_data mmc_data;
drivers/mmc/host/renesas_sdhi_core.c +2 -0
index d4ada5cca2d1..ceb3b0af1470 100644
@@ -843,6 +843,8 @@ int renesas_sdhi_probe(struct platform_device *pdev,
 		goto eirq;
 	}
 
+	priv->pdev = pdev;
+
 	dev_info(&pdev->dev, "%s base at 0x%08lx max clock rate %u MHz\n",
 		 mmc_hostname(host->mmc), (unsigned long)
 		 (platform_get_resource(pdev, IORESOURCE_MEM, 0)->start),
Signature · 1 line
2.23.0
#5 lore raw

PATCH 4/16 net: liquidio: Prepare to use the new tasklet API

In reply to Romain Perier

The future tasklet API will no longer allow to pass an arbitrary "unsigned long" data parameter. The tasklet data structure will need to be embedded into a data structure that will be retrieved from the tasklet handler. Currently, the private driver data structure "struct octeon_priv" is retrievable from the tasklet (by using container_of), howerver it is not the case for the "struct octeon_device" (the field "priv" is a pointer and cannot be used in container_of). This commit adds a new field in the private data structure, so we can easily get a pointer to the main device from the private context.

---
 drivers/net/ethernet/cavium/liquidio/lio_main.c    | 1 +
 drivers/net/ethernet/cavium/liquidio/octeon_main.h | 1 +
 2 files changed, 2 insertions(+)
drivers/net/ethernet/cavium/liquidio/lio_main.c +1 -0
index 7f3b2e3b0868..283e1461257d 100644
@@ -4326,6 +4326,7 @@ static int octeon_device_init(struct octeon_device *octeon_dev)
 	complete(&handshake[octeon_dev->octeon_id].init);
 
 	atomic_set(&octeon_dev->status, OCT_DEV_HOST_OK);
+	oct_priv->dev = octeon_dev;
 
 	return 0;
 }
drivers/net/ethernet/cavium/liquidio/octeon_main.h +1 -0
index 073d0647b439..5b4cb725f60f 100644
@@ -39,6 +39,7 @@ struct octeon_device_priv {
 	/** Tasklet structures for this device. */
 	struct tasklet_struct droq_tasklet;
 	unsigned long napi_mask;
+	struct octeon_device *dev;
 };
 
 /** This structure is used by NIC driver to store information required
Signature · 1 line
2.23.0
#6 lore raw

PATCH 5/16 chelsio: Prepare to use the new tasklet API

In reply to Romain Perier

The future tasklet API will no longer allow to pass an arbitrary "unsigned long" data parameter. The tasklet data structure will need to be embedded into a data structure that will be retrieved from the tasklet handler. Currently, there are no ways to get the sge data structure from a given "struct sched *". This commits adds a field to store the pointer of "the parent sge" into the context of each sched, so future tasklet handlers will retrieve the "struct sched *" of the corresponding tasklet and its "struct sge *".

---
 drivers/net/ethernet/chelsio/cxgb/sge.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/net/ethernet/chelsio/cxgb/sge.c +2 -0
index 47b5c8e2104b..b6c656e15801 100644
@@ -239,6 +239,7 @@ struct sched {
 	unsigned int	num;		/* num skbs in per port queues */
 	struct sched_port p[MAX_NPORTS];
 	struct tasklet_struct sched_tsk;/* tasklet used to run scheduler */
+	struct sge *sge;
 };
 static void restart_sched(unsigned long);
 
@@ -379,6 +380,7 @@ static int tx_sched_init(struct sge *sge)
 
 	pr_debug("tx_sched_init\n");
 	tasklet_init(&s->sched_tsk, restart_sched, (unsigned long) sge);
+	s->sge = sge;
 	sge->tx_sched = s;
 
 	for (i = 0; i < MAX_NPORTS; i++) {
Signature · 1 line
2.23.0
#7 lore raw

PATCH 6/16 net: mvpp2: Prepare to use the new tasklet API

In reply to Romain Perier

From: Romain Perier <[email protected]>

The future tasklet API will no longer allow to pass an arbitrary "unsigned long" data parameter. The tasklet data structure will need to be embedded into a data structure that will be retrieved from the tasklet handler. Currently, there are no ways to retrieve the "struct mvpp2_port *" from a given "struct mvpp2_port_pcpu *". This commit adds a new field to get the address of the main port for each pcpu context.

---
 drivers/net/ethernet/marvell/mvpp2/mvpp2.h      | 1 +
 drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c | 1 +
 2 files changed, 2 insertions(+)
drivers/net/ethernet/marvell/mvpp2/mvpp2.h +1 -0
index 543a310ec102..ca61eb601f15 100644
@@ -835,6 +835,7 @@ struct mvpp2_port_pcpu {
 	struct hrtimer tx_done_timer;
 	struct net_device *dev;
 	bool timer_scheduled;
+	struct mvpp2_port *port;
 };
 
 struct mvpp2_queue_vector {
drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c +1 -0
index 111b3b8239e1..6cdd68866263 100644
@@ -5353,6 +5353,7 @@ static int mvpp2_port_probe(struct platform_device *pdev,
 		err = -ENOMEM;
 		goto err_free_txq_pcpu;
 	}
+	port->pcpu->port = port;
 
 	if (!port->has_tx_irqs) {
 		for (thread = 0; thread < priv->nthreads; thread++) {
Signature · 1 line
2.23.0
#8 lore raw

PATCH 7/16 qed: Prepare to use the new tasklet API

In reply to Romain Perier

The future tasklet API will no longer allow to pass an arbitrary "unsigned long" data parameter. The tasklet data structure will need to be embedded into a data structure that will be retrieved from the tasklet handler. For this, the parent structure will be retrieved by the help of container_of(), which means that tasklet must be statically allocated into the parent structure and not allocated via kmalloc(). This commit, remove the dynamic allocation of the tasklet in each "struct qed_hwfn". Before each reused the tasklet will be killed, disabled then reinit, redefining its internal data structure state, so it can be reused for another purpose without requiring the need to reallocate a new object dynamically (which can be subject to use-after-free, double-free or memleak issues).

---
 drivers/net/ethernet/qlogic/qed/qed.h      |  2 +-
 drivers/net/ethernet/qlogic/qed/qed_int.c  | 22 +---------------------
 drivers/net/ethernet/qlogic/qed/qed_main.c | 14 +++++++-------
 3 files changed, 9 insertions(+), 29 deletions(-)
drivers/net/ethernet/qlogic/qed/qed.h +1 -1
index 89fe091c958d..e180df1d340e 100644
@@ -592,7 +592,7 @@ struct qed_hwfn {
 	struct qed_consq		*p_consq;
 
 	/* Slow-Path definitions */
-	struct tasklet_struct		*sp_dpc;
+	struct tasklet_struct		sp_dpc;
 	bool				b_sp_dpc_enabled;
 
 	struct qed_ptt			*p_main_ptt;
drivers/net/ethernet/qlogic/qed/qed_int.c +1 -21
index 9f5113639eaf..7e1ef7b281b5 100644
@@ -2279,34 +2279,15 @@ u64 qed_int_igu_read_sisr_reg(struct qed_hwfn *p_hwfn)
 
 static void qed_int_sp_dpc_setup(struct qed_hwfn *p_hwfn)
 {
-	tasklet_init(p_hwfn->sp_dpc,
+	tasklet_init(&p_hwfn->sp_dpc,
 		     qed_int_sp_dpc, (unsigned long)p_hwfn);
 	p_hwfn->b_sp_dpc_enabled = true;
 }
 
-static int qed_int_sp_dpc_alloc(struct qed_hwfn *p_hwfn)
-{
-	p_hwfn->sp_dpc = kmalloc(sizeof(*p_hwfn->sp_dpc), GFP_KERNEL);
-	if (!p_hwfn->sp_dpc)
-		return -ENOMEM;
-
-	return 0;
-}
-
-static void qed_int_sp_dpc_free(struct qed_hwfn *p_hwfn)
-{
-	kfree(p_hwfn->sp_dpc);
-	p_hwfn->sp_dpc = NULL;
-}
-
 int qed_int_alloc(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt)
 {
 	int rc = 0;
 
-	rc = qed_int_sp_dpc_alloc(p_hwfn);
-	if (rc)
-		return rc;
-
 	rc = qed_int_sp_sb_alloc(p_hwfn, p_ptt);
 	if (rc)
 		return rc;
@@ -2320,7 +2301,6 @@ void qed_int_free(struct qed_hwfn *p_hwfn)
 {
 	qed_int_sp_sb_free(p_hwfn);
 	qed_int_sb_attn_free(p_hwfn);
-	qed_int_sp_dpc_free(p_hwfn);
 }
 
 void qed_int_setup(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt)
drivers/net/ethernet/qlogic/qed/qed_main.c +7 -7
index 2ce70097d018..743c4561e251 100644
@@ -678,7 +678,7 @@ static irqreturn_t qed_single_int(int irq, void *dev_instance)
 
 		/* Slowpath interrupt */
 		if (unlikely(status & 0x1)) {
-			tasklet_schedule(hwfn->sp_dpc);
+			tasklet_schedule(&hwfn->sp_dpc);
 			status &= ~0x1;
 			rc = IRQ_HANDLED;
 		}
@@ -724,7 +724,7 @@ int qed_slowpath_irq_req(struct qed_hwfn *hwfn)
 			 id, cdev->pdev->bus->number,
 			 PCI_SLOT(cdev->pdev->devfn), hwfn->abs_pf_id);
 		rc = request_irq(cdev->int_params.msix_table[id].vector,
-				 qed_msix_sp_int, 0, hwfn->name, hwfn->sp_dpc);
+				 qed_msix_sp_int, 0, hwfn->name, &hwfn->sp_dpc);
 	} else {
 		unsigned long flags = 0;
 
@@ -756,8 +756,8 @@ static void qed_slowpath_tasklet_flush(struct qed_hwfn *p_hwfn)
 	 * enable function makes this sequence a flush-like operation.
 	 */
 	if (p_hwfn->b_sp_dpc_enabled) {
-		tasklet_disable(p_hwfn->sp_dpc);
-		tasklet_enable(p_hwfn->sp_dpc);
+		tasklet_disable(&p_hwfn->sp_dpc);
+		tasklet_enable(&p_hwfn->sp_dpc);
 	}
 }
 
@@ -786,7 +786,7 @@ static void qed_slowpath_irq_free(struct qed_dev *cdev)
 				break;
 			synchronize_irq(cdev->int_params.msix_table[i].vector);
 			free_irq(cdev->int_params.msix_table[i].vector,
-				 cdev->hwfns[i].sp_dpc);
+				 &cdev->hwfns[i].sp_dpc);
 		}
 	} else {
 		if (QED_LEADING_HWFN(cdev)->b_int_requested)
@@ -805,11 +805,11 @@ static int qed_nic_stop(struct qed_dev *cdev)
 		struct qed_hwfn *p_hwfn = &cdev->hwfns[i];
 
 		if (p_hwfn->b_sp_dpc_enabled) {
-			tasklet_disable(p_hwfn->sp_dpc);
+			tasklet_disable(&p_hwfn->sp_dpc);
 			p_hwfn->b_sp_dpc_enabled = false;
 			DP_VERBOSE(cdev, NETIF_MSG_IFDOWN,
 				   "Disabled sp tasklet [hwfn %d] at %p\n",
-				   i, p_hwfn->sp_dpc);
+				   i, &p_hwfn->sp_dpc);
 		}
 	}
 
Signature · 1 line
2.23.0
#9 lore raw

PATCH 8/16 isdn: Prepare to use the new tasklet API

In reply to Romain Perier

The future tasklet API will no longer allow to pass an arbitrary "unsigned long" data parameter. The tasklet data structure will need to be embedded into a data structure that will be retrieved from the tasklet handler. The current tasklets handlers get the pointer of the "struct bc_state", so it is an address we will need to retrieve from the "struct bas_bc_state", parent of the tasklet being run. This commit adds a new field in this structure, so we can get the address of the corresponding "bcs" for any "ubc" and retrieve everything from the tasklets handlers that will be modified soon.

---
 drivers/staging/isdn/gigaset/bas-gigaset.c | 1 +
 drivers/staging/isdn/gigaset/gigaset.h     | 1 +
 2 files changed, 2 insertions(+)
drivers/staging/isdn/gigaset/bas-gigaset.c +1 -0
index c334525a5f63..a3febefde39b 100644
@@ -2128,6 +2128,7 @@ static int gigaset_initbcshw(struct bc_state *bcs)
 		return -ENOMEM;
 	}
 
+	ubc->bcs = bcs;
 	ubc->running = 0;
 	atomic_set(&ubc->corrbytes, 0);
 	spin_lock_init(&ubc->isooutlock);
drivers/staging/isdn/gigaset/gigaset.h +1 -0
index 0ecc2b5ea553..df745c7bf57c 100644
@@ -559,6 +559,7 @@ struct bas_bc_state {
 	unsigned stolen0s;		/* '0' stuff bits also serving as
 					   leading flag bits */
 	struct tasklet_struct rcvd_tasklet;
+	struct bc_state *bcs;
 };
 
 struct gigaset_ops {
Signature · 1 line
2.23.0
#10 lore raw

PATCH 9/16 scsi: pm8001: Prepare to use the new tasklet API

In reply to Romain Perier

The future tasklet API will no longer allow to pass an arbitrary "unsigned long" data parameter. The tasklet data structure will need to be embedded into a data structure that will be retrieved from the tasklet handler. Currently, there are no ways from the tasklet of the handler to retrieve the parent data structure by using container_of(), mainly because we cannot know the index of the tasklet in the array of tasklets. This commits adds a intermediate data structure, that stores "irq_id", that is the index of the irq_vector and of the tasklet, so based on this index we will be able to use container_of() and retrieve the root parent structure.

---
 drivers/scsi/pm8001/pm8001_init.c | 42 +++++++++++++++++++------------
 drivers/scsi/pm8001/pm8001_sas.h  |  6 ++++-
 2 files changed, 31 insertions(+), 17 deletions(-)
drivers/scsi/pm8001/pm8001_init.c +26 -16
index 3374f553c617..f508e8314188 100644
@@ -204,7 +204,7 @@ static irqreturn_t pm8001_interrupt_handler_msix(int irq, void *opaque)
 	if (!PM8001_CHIP_DISP->is_our_interrupt(pm8001_ha))
 		return IRQ_NONE;
 #ifdef PM8001_USE_TASKLET
-	tasklet_schedule(&pm8001_ha->tasklet[irq_vector->irq_id]);
+	tasklet_schedule(&pm8001_ha->tasklet[irq_vector->irq_id].tasklet);
 #else
 	ret = PM8001_CHIP_DISP->isr(pm8001_ha, irq_vector->irq_id);
 #endif
@@ -228,7 +228,7 @@ static irqreturn_t pm8001_interrupt_handler_intx(int irq, void *dev_id)
 		return IRQ_NONE;
 
 #ifdef PM8001_USE_TASKLET
-	tasklet_schedule(&pm8001_ha->tasklet[0]);
+	tasklet_schedule(&pm8001_ha->tasklet[0].tasklet);
 #else
 	ret = PM8001_CHIP_DISP->isr(pm8001_ha, 0);
 #endif
@@ -477,13 +477,18 @@ static struct pm8001_hba_info *pm8001_pci_alloc(struct pci_dev *pdev,
 #ifdef PM8001_USE_TASKLET
 	/* Tasklet for non msi-x interrupt handler */
 	if ((!pdev->msix_cap || !pci_msi_enabled())
-	    || (pm8001_ha->chip_id == chip_8001))
-		tasklet_init(&pm8001_ha->tasklet[0], pm8001_tasklet,
+	    || (pm8001_ha->chip_id == chip_8001)) {
+		pm8001_ha->tasklet[0].irq_id = 0;
+		tasklet_init(&pm8001_ha->tasklet[0].tasklet, pm8001_tasklet,
 			(unsigned long)&(pm8001_ha->irq_vector[0]));
-	else
-		for (j = 0; j < PM8001_MAX_MSIX_VEC; j++)
-			tasklet_init(&pm8001_ha->tasklet[j], pm8001_tasklet,
+	} else {
+		for (j = 0; j < PM8001_MAX_MSIX_VEC; j++) {
+			pm8001_ha->tasklet[j].irq_id = j;
+			tasklet_init(&pm8001_ha->tasklet[j].tasklet,
+				pm8001_tasklet,
 				(unsigned long)&(pm8001_ha->irq_vector[j]));
+		}
+	}
 #endif
 	pm8001_ioremap(pm8001_ha);
 	if (!pm8001_alloc(pm8001_ha, ent))
@@ -1092,10 +1097,10 @@ static void pm8001_pci_remove(struct pci_dev *pdev)
 	/* For non-msix and msix interrupts */
 	if ((!pdev->msix_cap || !pci_msi_enabled()) ||
 	    (pm8001_ha->chip_id == chip_8001))
-		tasklet_kill(&pm8001_ha->tasklet[0]);
+		tasklet_kill(&pm8001_ha->tasklet[0].tasklet);
 	else
 		for (j = 0; j < PM8001_MAX_MSIX_VEC; j++)
-			tasklet_kill(&pm8001_ha->tasklet[j]);
+			tasklet_kill(&pm8001_ha->tasklet[j].tasklet);
 #endif
 	scsi_host_put(pm8001_ha->shost);
 	pm8001_free(pm8001_ha);
@@ -1142,10 +1147,10 @@ static int pm8001_pci_suspend(struct pci_dev *pdev, pm_message_t state)
 	/* For non-msix and msix interrupts */
 	if ((!pdev->msix_cap || !pci_msi_enabled()) ||
 	    (pm8001_ha->chip_id == chip_8001))
-		tasklet_kill(&pm8001_ha->tasklet[0]);
+		tasklet_kill(&pm8001_ha->tasklet[0].tasklet);
 	else
 		for (j = 0; j < PM8001_MAX_MSIX_VEC; j++)
-			tasklet_kill(&pm8001_ha->tasklet[j]);
+			tasklet_kill(&pm8001_ha->tasklet[j].tasklet);
 #endif
 	device_state = pci_choose_state(pdev, state);
 	pm8001_printk("pdev=0x%p, slot=%s, entering "
@@ -1211,13 +1216,18 @@ static int pm8001_pci_resume(struct pci_dev *pdev)
 #ifdef PM8001_USE_TASKLET
 	/*  Tasklet for non msi-x interrupt handler */
 	if ((!pdev->msix_cap || !pci_msi_enabled()) ||
-	    (pm8001_ha->chip_id == chip_8001))
-		tasklet_init(&pm8001_ha->tasklet[0], pm8001_tasklet,
+	    (pm8001_ha->chip_id == chip_8001)) {
+		pm8001_ha->tasklet[0].irq_id = 0;
+		tasklet_init(&pm8001_ha->tasklet[0].tasklet, pm8001_tasklet,
 			(unsigned long)&(pm8001_ha->irq_vector[0]));
-	else
-		for (j = 0; j < PM8001_MAX_MSIX_VEC; j++)
-			tasklet_init(&pm8001_ha->tasklet[j], pm8001_tasklet,
+	} else {
+		for (j = 0; j < PM8001_MAX_MSIX_VEC; j++) {
+			pm8001_ha->tasklet[j].irq_id = j;
+			tasklet_init(&pm8001_ha->tasklet[j].tasklet,
+				pm8001_tasklet,
 				(unsigned long)&(pm8001_ha->irq_vector[j]));
+		}
+	}
 #endif
 	PM8001_CHIP_DISP->interrupt_enable(pm8001_ha, 0);
 	if (pm8001_ha->chip_id != chip_8001) {
drivers/scsi/pm8001/pm8001_sas.h +5 -1
index ff17c6aff63d..0199c64f6cc3 100644
@@ -480,6 +480,10 @@ struct isr_param {
 	struct pm8001_hba_info *drv_inst;
 	u32 irq_id;
 };
+struct tsk_param {
+	struct tasklet_struct tasklet;
+	u32 irq_id;
+};
 struct pm8001_hba_info {
 	char			name[PM8001_NAME_LENGTH];
 	struct list_head	list;
@@ -532,7 +536,7 @@ struct pm8001_hba_info {
 	int			number_of_intr;/*will be used in remove()*/
 #endif
 #ifdef PM8001_USE_TASKLET
-	struct tasklet_struct	tasklet[PM8001_MAX_MSIX_VEC];
+	struct tsk_param	tasklet[PM8001_MAX_MSIX_VEC];
 #endif
 	u32			logging_level;
 	u32			fw_status;
Signature · 1 line
2.23.0
#11 lore raw

PATCH 10/16 scsi: pmcraid: Prepare to use the new tasklet API

In reply to Romain Perier

The future tasklet API will no longer allow to pass an arbitrary "unsigned long" data parameter. The tasklet data structure will need to be embedded into a data structure that will be retrieved from the tasklet handler. Currently, with the current array of tasklets, there are no ways to know precisely which tasklet is passed as argument of the handler. This commit introduces a intermediate type "struct pmcraid_tsk_param", that is used in this array. It contains the offset of the given tasklet and the tasklet itself, so we will be able to use container_of() on the pointer of the tasklet to retrieve the parents data structure.

---
 drivers/scsi/pmcraid.c | 12 +++++++-----
 drivers/scsi/pmcraid.h |  9 +++++++--
 2 files changed, 14 insertions(+), 7 deletions(-)
drivers/scsi/pmcraid.c +7 -5
index 7eb88fe1eb0b..2e44e3954bb0 100644
@@ -4198,7 +4198,7 @@ static irqreturn_t pmcraid_isr_msix(int irq, void *dev_id)
 		}
 	}
 
-	tasklet_schedule(&(pinstance->isr_tasklet[hrrq_id]));
+	tasklet_schedule(&(pinstance->isr_tasklet[hrrq_id].tasklet));
 
 	return IRQ_HANDLED;
 }
@@ -4267,7 +4267,7 @@ static irqreturn_t pmcraid_isr(int irq, void *dev_id)
 				pinstance->int_regs.ioa_host_interrupt_clr_reg);
 
 			tasklet_schedule(
-					&(pinstance->isr_tasklet[hrrq_id]));
+				&(pinstance->isr_tasklet[hrrq_id].tasklet));
 		}
 	}
 
@@ -4884,10 +4884,12 @@ static int pmcraid_allocate_config_buffers(struct pmcraid_instance *pinstance)
 static void pmcraid_init_tasklets(struct pmcraid_instance *pinstance)
 {
 	int i;
-	for (i = 0; i < pinstance->num_hrrq; i++)
-		tasklet_init(&pinstance->isr_tasklet[i],
+	for (i = 0; i < pinstance->num_hrrq; i++) {
+		pinstance->isr_tasklet[i].isr_tasklet_id = i;
+		tasklet_init(&pinstance->isr_tasklet[i].tasklet,
 			     pmcraid_tasklet_function,
 			     (unsigned long)&pinstance->hrrq_vector[i]);
+	}
 }
 
 /**
@@ -4902,7 +4904,7 @@ static void pmcraid_kill_tasklets(struct pmcraid_instance *pinstance)
 {
 	int i;
 	for (i = 0; i < pinstance->num_hrrq; i++)
-		tasklet_kill(&pinstance->isr_tasklet[i]);
+		tasklet_kill(&pinstance->isr_tasklet[i].tasklet);
 }
 
 /**
drivers/scsi/pmcraid.h +7 -2
index a4f7eb8f50a3..58b2acd37541 100644
@@ -617,6 +617,11 @@ struct pmcraid_isr_param {
 	u8 hrrq_id;			/* hrrq entry index */
 };
 
+/* Tasklet parameters (one for each enabled tasklet) */
+struct pmcraid_tsk_param {
+	struct tasklet_struct tasklet;
+	u8 isr_tasklet_id;		/* isr_tasklet entry index */
+};
 
 /* AEN message header sent as part of event data to applications */
 struct pmcraid_aen_msg {
@@ -752,8 +757,8 @@ struct pmcraid_instance {
 	spinlock_t free_pool_lock;		/* free pool lock */
 	spinlock_t pending_pool_lock;		/* pending pool lock */
 
-	/* Tasklet to handle deferred processing */
-	struct tasklet_struct isr_tasklet[PMCRAID_NUM_MSIX_VECTORS];
+	/* Tasklet parameters and tasklets to handle deferred processing */
+	struct pmcraid_tsk_param isr_tasklet[PMCRAID_NUM_MSIX_VECTORS];
 
 	/* Work-queue (Shared) for deferred reset processing */
 	struct work_struct worker_q;
Signature · 1 line
2.23.0
#16 lore raw

PATCH 12/16 tasklet: Pass tasklet_struct pointer as .data in DECLARE_TASKLET

In reply to Romain Perier

Now that all tasklet initializations have been replaced, this updates the core of the DECLARE_TASKLET macros by passing the pointer of the tasklet structure as .data, so current static tasklets will continue to work by deadling with the tasklet_struct pointer in their handler, without have to change the API of the macro. It also updates all callbacks of all tasklets statically allocated via DECLARE_TASKLET() for extracting the the parent data structure of the tasklet by using from_tasklet().

---
 arch/mips/lasat/picvue_proc.c          |  2 +-
 drivers/input/keyboard/omap-keypad.c   | 14 ++++++++------
 drivers/input/serio/hil_mlc.c          |  4 ++--
 drivers/net/wan/farsync.c              |  8 ++++----
 drivers/s390/crypto/ap_bus.c           |  8 ++++----
 drivers/staging/most/dim2/dim2.c       | 20 +++++++++++---------
 drivers/staging/octeon/ethernet-tx.c   |  4 ++--
 drivers/tty/vt/keyboard.c              |  2 +-
 drivers/usb/gadget/udc/amd5536udc.h    |  1 +
 drivers/usb/gadget/udc/snps_udc_core.c | 17 ++++++++---------
 drivers/usb/host/fhci-hcd.c            |  5 +++--
 drivers/usb/host/fhci-sched.c          |  8 ++++----
 drivers/usb/host/fhci.h                |  2 +-
 include/linux/interrupt.h              | 10 +++++-----
 kernel/backtracetest.c                 |  2 +-
 kernel/debug/debug_core.c              |  2 +-
 kernel/irq/resend.c                    |  2 +-
 net/atm/pppoatm.c                      |  7 ++++---
 net/iucv/iucv.c                        |  4 ++--
 sound/drivers/pcsp/pcsp_lib.c          |  2 +-
 20 files changed, 65 insertions(+), 59 deletions(-)
arch/mips/lasat/picvue_proc.c +1 -1
index 8126f15b8e09..ebb5b4c3079b 100644
@@ -30,7 +30,7 @@ static int scroll_dir, scroll_interval;
 
 static struct timer_list timer;
 
-static void pvc_display(unsigned long data)
+static void pvc_display(struct tasklet_struct *unused)
 {
 	int i;
 
drivers/input/keyboard/omap-keypad.c +8 -6
index 5fe7a5633e33..f202ea05f647 100644
@@ -27,7 +27,7 @@
 
 #undef NEW_BOARD_LEARNING_MODE
 
-static void omap_kp_tasklet(unsigned long);
+static void omap_kp_tasklet(struct tasklet_struct *);
 static void omap_kp_timer(struct timer_list *);
 
 static unsigned char keypad_state[8];
@@ -44,9 +44,9 @@ struct omap_kp {
 	unsigned long delay;
 	unsigned int debounce;
 	unsigned short keymap[];
+	struct tasklet_struct kp_tasklet;
 };
 
-static DECLARE_TASKLET_DISABLED(kp_tasklet, omap_kp_tasklet, 0);
 
 static unsigned int *row_gpios;
 static unsigned int *col_gpios;
@@ -88,9 +88,10 @@ static void omap_kp_scan_keypad(struct omap_kp *omap_kp, unsigned char *state)
 	udelay(2);
 }
 
-static void omap_kp_tasklet(unsigned long data)
+static void omap_kp_tasklet(struct tasklet_struct *t)
 {
-	struct omap_kp *omap_kp_data = (struct omap_kp *) data;
+	struct omap_kp *omap_kp_data = from_tasklet(omap_kp_data, t,
+						    kp_tasklet);
 	unsigned short *keycodes = omap_kp_data->input->keycode;
 	unsigned int row_shift = get_count_order(omap_kp_data->cols);
 	unsigned char new_state[8], changed, key_down = 0;
@@ -181,6 +182,7 @@ static int omap_kp_probe(struct platform_device *pdev)
 	struct omap_kp_platform_data *pdata = dev_get_platdata(&pdev->dev);
 	int i, col_idx, row_idx, ret;
 	unsigned int row_shift, keycodemax;
+	DECLARE_TASKLET_DISABLED(kp_tasklet, omap_kp_tasklet, 0);
 
 	if (!pdata->rows || !pdata->cols || !pdata->keymap_data) {
 		printk(KERN_ERR "No rows, cols or keymap_data from pdata\n");
@@ -222,8 +224,8 @@ static int omap_kp_probe(struct platform_device *pdev)
 
 	timer_setup(&omap_kp->timer, omap_kp_timer, 0);
 
-	/* get the irq and init timer*/
-	kp_tasklet.data = (unsigned long) omap_kp;
+	omap_kp->kp_tasklet = kp_tasklet;
+	omap_kp->kp_tasklet.data = (TASKLET_DATA_TYPE)&omap_kp->kp_tasklet;
 	tasklet_enable(&kp_tasklet);
 
 	ret = device_create_file(&pdev->dev, &dev_attr_enable);
drivers/input/serio/hil_mlc.c +2 -2
index e1423f7648d6..d7a4ea4f0695 100644
@@ -76,7 +76,7 @@ static DEFINE_RWLOCK(hil_mlcs_lock);
 static struct timer_list	hil_mlcs_kicker;
 static int			hil_mlcs_probe;
 
-static void hil_mlcs_process(unsigned long unused);
+static void hil_mlcs_process(struct tasklet_struct *unused);
 static DECLARE_TASKLET_DISABLED(hil_mlcs_tasklet, hil_mlcs_process, 0);
 
 
@@ -757,7 +757,7 @@ static int hilse_donode(hil_mlc *mlc)
 }
 
 /******************** tasklet context functions **************************/
-static void hil_mlcs_process(unsigned long unused)
+static void hil_mlcs_process(struct tasklet_struct *unused)
 {
 	struct list_head *tmp;
 
drivers/net/wan/farsync.c +4 -4
index 1901ec7948d8..d2da087191ba 100644
@@ -566,8 +566,8 @@ MODULE_DEVICE_TABLE(pci, fst_pci_dev_id);
 
 static void do_bottom_half_tx(struct fst_card_info *card);
 static void do_bottom_half_rx(struct fst_card_info *card);
-static void fst_process_tx_work_q(unsigned long work_q);
-static void fst_process_int_work_q(unsigned long work_q);
+static void fst_process_tx_work_q(struct tasklet_struct *work_q);
+static void fst_process_int_work_q(struct tasklet_struct *work_q);
 
 static DECLARE_TASKLET(fst_tx_task, fst_process_tx_work_q, 0);
 static DECLARE_TASKLET(fst_int_task, fst_process_int_work_q, 0);
@@ -600,7 +600,7 @@ fst_q_work_item(u64 * queue, int card_index)
 }
 
 static void
-fst_process_tx_work_q(unsigned long /*void **/work_q)
+fst_process_tx_work_q(struct tasklet_struct * /*void **/work_q)
 {
 	unsigned long flags;
 	u64 work_txq;
@@ -630,7 +630,7 @@ fst_process_tx_work_q(unsigned long /*void **/work_q)
 }
 
 static void
-fst_process_int_work_q(unsigned long /*void **/work_q)
+fst_process_int_work_q(struct tasklet_struct * /*void **/work_q)
 {
 	unsigned long flags;
 	u64 work_intq;
drivers/s390/crypto/ap_bus.c +4 -4
index a76b8a8bcbbb..a013effd2536 100644
@@ -90,7 +90,7 @@ static DECLARE_WORK(ap_scan_work, ap_scan_bus);
 /*
  * Tasklet & timer for AP request polling and interrupts
  */
-static void ap_tasklet_fn(unsigned long);
+static void ap_tasklet_fn(struct tasklet_struct *t);
 static DECLARE_TASKLET(ap_tasklet, ap_tasklet_fn, 0);
 static DECLARE_WAIT_QUEUE_HEAD(ap_poll_wait);
 static struct task_struct *ap_poll_kthread;
@@ -419,11 +419,11 @@ static void ap_interrupt_handler(struct airq_struct *airq, bool floating)
 
 /**
  * ap_tasklet_fn(): Tasklet to poll all AP devices.
- * @dummy: Unused variable
+ * @unused: Unused variable
  *
  * Poll all AP devices on the bus.
  */
-static void ap_tasklet_fn(unsigned long dummy)
+static void ap_tasklet_fn(struct tasklet_struct *unused)
 {
 	struct ap_card *ac;
 	struct ap_queue *aq;
@@ -497,7 +497,7 @@ static int ap_poll_thread(void *data)
 			try_to_freeze();
 			continue;
 		}
-		ap_tasklet_fn(0);
+		ap_tasklet_fn(&ap_tasklet);
 	}
 
 	return 0;
drivers/staging/most/dim2/dim2.c +11 -9
index 64c979155a49..98f0acca5c06 100644
@@ -46,8 +46,7 @@ MODULE_PARM_DESC(fcnt, "Num of frames per sub-buffer for sync channels as a powe
 
 static DEFINE_SPINLOCK(dim_lock);
 
-static void dim2_tasklet_fn(unsigned long data);
-static DECLARE_TASKLET(dim2_tasklet, dim2_tasklet_fn, 0);
+static void dim2_tasklet_fn(struct tasklet_struct *t);
 
 /**
  * struct hdm_channel - private structure to keep channel specific data
@@ -102,6 +101,7 @@ struct dim2_hdm {
 	void (*on_netinfo)(struct most_interface *most_iface,
 			   unsigned char link_state, unsigned char *addrs);
 	void (*disable_platform)(struct platform_device *);
+	struct tasklet_struct dim2_tasklet;
 };
 
 struct dim2_platform_data {
@@ -351,13 +351,13 @@ static irqreturn_t dim2_mlb_isr(int irq, void *_dev)
 
 /**
  * dim2_tasklet_fn - tasklet function
- * @data: private data
+ * @t: instance of the running tasklet
  *
  * Service each initialized channel, if needed
  */
-static void dim2_tasklet_fn(unsigned long data)
+static void dim2_tasklet_fn(struct tasklet_struct *t)
 {
-	struct dim2_hdm *dev = (struct dim2_hdm *)data;
+	struct dim2_hdm *dev = from_tasklet(dev, t, dim2_tasklet);
 	unsigned long flags;
 	int ch_idx;
 
@@ -393,8 +393,7 @@ static irqreturn_t dim2_ahb_isr(int irq, void *_dev)
 	dim_service_ahb_int_irq(get_active_channels(dev, buffer));
 	spin_unlock_irqrestore(&dim_lock, flags);
 
-	dim2_tasklet.data = (unsigned long)dev;
-	tasklet_schedule(&dim2_tasklet);
+	tasklet_schedule(&dev->dim2_tasklet);
 	return IRQ_HANDLED;
 }
 
@@ -641,14 +640,14 @@ static int poison_channel(struct most_interface *most_iface, int ch_idx)
 	if (!hdm_ch->is_initialized)
 		return -EPERM;
 
-	tasklet_disable(&dim2_tasklet);
+	tasklet_disable(&dev->dim2_tasklet);
 	spin_lock_irqsave(&dim_lock, flags);
 	hal_ret = dim_destroy_channel(&hdm_ch->ch);
 	hdm_ch->is_initialized = false;
 	if (ch_idx == dev->atx_idx)
 		dev->atx_idx = -1;
 	spin_unlock_irqrestore(&dim_lock, flags);
-	tasklet_enable(&dim2_tasklet);
+	tasklet_enable(&dev->dim2_tasklet);
 	if (hal_ret != DIM_NO_ERROR) {
 		pr_err("HAL Failed to close channel %s\n", hdm_ch->name);
 		ret = -EFAULT;
@@ -731,6 +730,7 @@ static int dim2_probe(struct platform_device *pdev)
 	int ret, i;
 	u8 hal_ret;
 	int irq;
+	DECLARE_TASKLET(dim2_tasklet, dim2_tasklet_fn, 0);
 
 	enum { MLB_INT_IDX, AHB0_INT_IDX };
 
@@ -739,6 +739,8 @@ static int dim2_probe(struct platform_device *pdev)
 		return -ENOMEM;
 
 	dev->atx_idx = -1;
+	dev->dim2_tasklet = dim2_tasklet;
+	dev->dim2_tasklet.data = (TASKLET_DATA_TYPE)&dev->dim2_tasklet;
 
 	platform_set_drvdata(pdev, dev);
 
drivers/staging/octeon/ethernet-tx.c +2 -2
index c64728fc21f2..acb32a7c8b1d 100644
@@ -40,7 +40,7 @@
 #define GET_SKBUFF_QOS(skb) 0
 #endif
 
-static void cvm_oct_tx_do_cleanup(unsigned long arg);
+static void cvm_oct_tx_do_cleanup(struct tasklet_struct *unused);
 static DECLARE_TASKLET(cvm_oct_tx_cleanup_tasklet, cvm_oct_tx_do_cleanup, 0);
 
 /* Maximum number of SKBs to try to free per xmit packet. */
@@ -674,7 +674,7 @@ void cvm_oct_tx_shutdown_dev(struct net_device *dev)
 	}
 }
 
-static void cvm_oct_tx_do_cleanup(unsigned long arg)
+static void cvm_oct_tx_do_cleanup(struct tasklet_struct *unused)
 {
 	int port;
 
drivers/tty/vt/keyboard.c +1 -1
index 515fc095e3b4..06e54abcfac6 100644
@@ -1214,7 +1214,7 @@ void vt_kbd_con_stop(int console)
  * handle the scenario when keyboard handler is not registered yet
  * but we already getting updates from the VT to update led state.
  */
-static void kbd_bh(unsigned long dummy)
+static void kbd_bh(struct tasklet_struct *unused)
 {
 	unsigned int leds;
 	unsigned long flags;
drivers/usb/gadget/udc/amd5536udc.h +1 -0
index dfdef6a28904..72b89fb1b3fd 100644
@@ -573,6 +573,7 @@ struct udc {
 	struct notifier_block		nb;
 	struct delayed_work		drd_work;
 	struct workqueue_struct		*drd_wq;
+	struct tasklet_struct		disconnect_tasklet;
 	u32				conn_type;
 };
 
drivers/usb/gadget/udc/snps_udc_core.c +8 -9
index 3fcded31405a..c9f29b7ad986 100644
@@ -36,7 +36,7 @@
 #include <asm/unaligned.h>
 #include "amd5536udc.h"
 
-static void udc_tasklet_disconnect(unsigned long);
+static void udc_tasklet_disconnect(struct tasklet_struct *t);
 static void udc_setup_endpoints(struct udc *dev);
 static void udc_soft_reset(struct udc *dev);
 static struct udc_request *udc_alloc_bna_dummy(struct udc_ep *ep);
@@ -95,11 +95,6 @@ static struct timer_list udc_pollstall_timer;
 static int stop_pollstall_timer;
 static DECLARE_COMPLETION(on_pollstall_exit);
 
-/* tasklet for usb disconnect */
-static DECLARE_TASKLET(disconnect_tasklet, udc_tasklet_disconnect,
-		(unsigned long) &udc);
-
-
 /* endpoint names used for print */
 static const char ep0_string[] = "ep0in";
 static const struct {
@@ -1655,13 +1650,13 @@ static void usb_disconnect(struct udc *dev)
 	 * the spinlock needed to process the disconnect.
 	 */
 
-	tasklet_schedule(&disconnect_tasklet);
+	tasklet_schedule(&dev->disconnect_tasklet);
 }
 
 /* Tasklet for disconnect to be outside of interrupt context */
-static void udc_tasklet_disconnect(unsigned long par)
+static void udc_tasklet_disconnect(struct tasklet_struct *t)
 {
-	struct udc *dev = (struct udc *)(*((struct udc **) par));
+	struct udc *dev = from_tasklet(dev, t, disconnect_tasklet);
 	u32 tmp;
 
 	DBG(dev, "Tasklet disconnect\n");
@@ -3156,6 +3151,7 @@ int udc_probe(struct udc *dev)
 	char		tmp[128];
 	u32		reg;
 	int		retval;
+	DECLARE_TASKLET(disconnect_tasklet, udc_tasklet_disconnect, 0);
 
 	/* device struct setup */
 	dev->gadget.ops = &udc_ops;
@@ -3190,6 +3186,9 @@ int udc_probe(struct udc *dev)
 
 	udc = dev;
 
+	dev->disconnect_tasklet = disconnect_tasklet;
+	dev->disconnect_tasklet.data = (TASKLET_DATA_TYPE)&dev->disconnect_tasklet;
+
 	retval = usb_add_gadget_udc_release(udc->dev, &dev->gadget,
 					    gadget_release);
 	if (retval)
drivers/usb/host/fhci-hcd.c +3 -2
index 04733876c9c6..27e9b637a38e 100644
@@ -210,8 +210,9 @@ static int fhci_mem_init(struct fhci_hcd *fhci)
 	INIT_LIST_HEAD(&fhci->empty_tds);
 
 	/* initialize work queue to handle done list */
-	fhci_tasklet.data = (unsigned long)fhci;
-	fhci->process_done_task = &fhci_tasklet;
+	fhci->process_done_task = fhci_tasklet;
+	fhci->process_done_task.data =
+		(TASKLET_DATA_TYPE)&fhci->process_done_task;
 
 	for (i = 0; i < MAX_TDS; i++) {
 		struct td *td;
drivers/usb/host/fhci-sched.c +4 -4
index 3235d5307403..a04a049c7cd9 100644
@@ -628,13 +628,13 @@ irqreturn_t fhci_irq(struct usb_hcd *hcd)
  * is process_del_list(),which unlinks URBs by scanning EDs,instead of scanning
  * the (re-reversed) done list as this does.
  */
-static void process_done_list(unsigned long data)
+static void process_done_list(struct tasklet_struct *t)
 {
 	struct urb *urb;
 	struct ed *ed;
 	struct td *td;
 	struct urb_priv *urb_priv;
-	struct fhci_hcd *fhci = (struct fhci_hcd *)data;
+	struct fhci_hcd *fhci = from_tasklet(fhci, t, process_done_task);
 
 	disable_irq(fhci->timer->irq);
 	disable_irq(fhci_to_hcd(fhci)->irq);
@@ -682,8 +682,8 @@ DECLARE_TASKLET(fhci_tasklet, process_done_list, 0);
 /* transfer complted callback */
 u32 fhci_transfer_confirm_callback(struct fhci_hcd *fhci)
 {
-	if (!fhci->process_done_task->state)
-		tasklet_schedule(fhci->process_done_task);
+	if (!fhci->process_done_task.state)
+		tasklet_schedule(&fhci->process_done_task);
 	return 0;
 }
 
drivers/usb/host/fhci.h +1 -1
index 2ce5031d866d..196f9a15ebd0 100644
@@ -254,7 +254,7 @@ struct fhci_hcd {
 	struct virtual_root_hub *vroot_hub; /* the virtual root hub */
 	int active_urbs;
 	struct fhci_controller_list *hc_list;
-	struct tasklet_struct *process_done_task; /* tasklet for done list */
+	struct tasklet_struct process_done_task; /* tasklet for done list */
 
 	struct list_head empty_eds;
 	struct list_head empty_tds;
include/linux/interrupt.h +5 -5
index f5332ae2dbeb..949bbaeaff0e 100644
@@ -598,11 +598,14 @@ struct tasklet_struct
 	unsigned long data;
 };
 
+#define TASKLET_DATA_TYPE		unsigned long
+#define TASKLET_FUNC_TYPE		void (*)(TASKLET_DATA_TYPE)
+
 #define DECLARE_TASKLET(name, func, data) \
-struct tasklet_struct name = { NULL, 0, ATOMIC_INIT(0), func, data }
+struct tasklet_struct name = { NULL, 0, ATOMIC_INIT(0), (TASKLET_FUNC_TYPE)func, (TASKLET_DATA_TYPE)&name }
 
 #define DECLARE_TASKLET_DISABLED(name, func, data) \
-struct tasklet_struct name = { NULL, 0, ATOMIC_INIT(1), func, data }
+struct tasklet_struct name = { NULL, 0, ATOMIC_INIT(1), (TASKLET_FUNC_TYPE)func, (TASKLET_DATA_TYPE)&name }
 
 
 enum
@@ -673,9 +676,6 @@ extern void tasklet_kill_immediate(struct tasklet_struct *t, unsigned int cpu);
 extern void tasklet_init(struct tasklet_struct *t,
 			 void (*func)(unsigned long), unsigned long data);
 
-#define TASKLET_DATA_TYPE		unsigned long
-#define TASKLET_FUNC_TYPE		void (*)(TASKLET_DATA_TYPE)
-
 #define from_tasklet(var, callback_tasklet, tasklet_fieldname) \
 	container_of(callback_tasklet, typeof(*var), tasklet_fieldname)
 
kernel/backtracetest.c +1 -1
index a2a97fa3071b..b5b9e16f0083 100644
@@ -23,7 +23,7 @@ static void backtrace_test_normal(void)
 
 static DECLARE_COMPLETION(backtrace_work);
 
-static void backtrace_test_irq_callback(unsigned long data)
+static void backtrace_test_irq_callback(struct tasklet_struct *unused)
 {
 	dump_stack();
 	complete(&backtrace_work);
kernel/debug/debug_core.c +1 -1
index f76d6f77dd5e..ceac3a21cf41 100644
@@ -998,7 +998,7 @@ static void kgdb_unregister_callbacks(void)
  * such as is the case with kgdboe, where calling a breakpoint in the
  * I/O driver itself would be fatal.
  */
-static void kgdb_tasklet_bpt(unsigned long ing)
+static void kgdb_tasklet_bpt(struct tasklet_struct *unused)
 {
 	kgdb_breakpoint();
 	atomic_set(&kgdb_break_tasklet_var, 0);
kernel/irq/resend.c +1 -1
index 98c04ca5fa43..7edb88afebb5 100644
@@ -27,7 +27,7 @@ static DECLARE_BITMAP(irqs_resend, IRQ_BITMAP_BITS);
 /*
  * Run software resends of IRQ's
  */
-static void resend_irqs(unsigned long arg)
+static void resend_irqs(struct tasklet_struct *unused)
 {
 	struct irq_desc *desc;
 	int irq;
net/atm/pppoatm.c +4 -3
index 45d8e1d5d033..fe45fba20be2 100644
@@ -101,9 +101,10 @@ static inline struct pppoatm_vcc *chan_to_pvcc(const struct ppp_channel *chan)
  * doesn't want to be called in interrupt context, so we do it from
  * a tasklet
  */
-static void pppoatm_wakeup_sender(unsigned long arg)
+static void pppoatm_wakeup_sender(struct tasklet_struct *t)
 {
-	ppp_output_wakeup((struct ppp_channel *) arg);
+	struct pppoatm_vcc *pvcc = from_tasklet(pvcc, t, wakeup_tasklet);
+	ppp_output_wakeup(&pvcc->chan);
 }
 
 static void pppoatm_release_cb(struct atm_vcc *atmvcc)
@@ -416,7 +417,7 @@ 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) &pvcc->chan;
+	pvcc->wakeup_tasklet.data = (TASKLET_DATA_TYPE)&pvcc->wakeup_tasklet;
 	err = ppp_register_channel(&pvcc->chan);
 	if (err != 0) {
 		kfree(pvcc);
net/iucv/iucv.c +2 -2
index 9a2d023842fe..d186c76f63b6 100644
@@ -127,7 +127,7 @@ static LIST_HEAD(iucv_task_queue);
 /*
  * The tasklet for fast delivery of iucv interrupts.
  */
-static void iucv_tasklet_fn(unsigned long);
+static void iucv_tasklet_fn(struct tasklet_struct);
 static DECLARE_TASKLET(iucv_tasklet, iucv_tasklet_fn,0);
 
 /*
@@ -1726,7 +1726,7 @@ static void iucv_message_pending(struct iucv_irq_data *data)
  * iucv_external_interrupt, calls the appropriate action handler
  * and then frees the buffer.
  */
-static void iucv_tasklet_fn(unsigned long ignored)
+static void iucv_tasklet_fn(struct tasklet_struct *unused)
 {
 	typedef void iucv_irq_fn(struct iucv_irq_data *);
 	static iucv_irq_fn *irq_fn[] = {
sound/drivers/pcsp/pcsp_lib.c +1 -1
index 8f0f05bbc081..fbeeecaac8d4 100644
@@ -26,7 +26,7 @@ MODULE_PARM_DESC(nforce_wa, "Apply NForce chipset workaround "
  * Call snd_pcm_period_elapsed in a tasklet
  * This avoids spinlock messes and long-running irq contexts
  */
-static void pcsp_call_pcm_elapsed(unsigned long priv)
+static void pcsp_call_pcm_elapsed(struct tasklet_struct *unused)
 {
 	if (atomic_read(&pcsp_chip.timer_active)) {
 		struct snd_pcm_substream *substream;
Signature · 1 line
2.23.0
#12 lore raw

PATCH 11/16 treewide: Globally replace tasklet_init() by tasklet_setup()

In reply to Romain Perier

This converts all remaining cases of the old tasklet_init() API into tasklet_setup(), where the callback argument is the structure already holding the struct tasklet_struct. These should have no behavioral changes, since they just change which pointer is passed into the callback with the same available pointers after conversion. Moreover, all callbacks that were not passing a pointer of structure holding the struct tasklet_struct has already been converted.

---
 arch/um/drivers/vector_kern.c                 |  6 +--
 drivers/atm/eni.c                             |  8 ++--
 drivers/atm/fore200e.c                        | 14 +++---
 drivers/atm/he.c                              |  8 ++--
 drivers/atm/solos-pci.c                       |  8 ++--
 drivers/block/umem.c                          |  6 +--
 drivers/block/xsysace.c                       |  6 +--
 drivers/char/ipmi/ipmi_msghandler.c           | 12 +++---
 drivers/crypto/amcc/crypto4xx_core.c          |  7 ++-
 drivers/crypto/atmel-aes.c                    | 14 +++---
 drivers/crypto/atmel-sha.c                    | 14 +++---
 drivers/crypto/atmel-tdes.c                   | 14 +++---
 drivers/crypto/axis/artpec6_crypto.c          |  7 ++-
 drivers/crypto/caam/jr.c                      |  8 ++--
 drivers/crypto/cavium/cpt/cptvf_main.c        |  9 ++--
 drivers/crypto/cavium/nitrox/nitrox_common.h  |  2 +-
 drivers/crypto/cavium/nitrox/nitrox_isr.c     | 13 +++---
 drivers/crypto/cavium/nitrox/nitrox_reqmgr.c  |  4 +-
 drivers/crypto/ccp/ccp-dev-v3.c               |  9 ++--
 drivers/crypto/ccp/ccp-dev-v5.c               |  9 ++--
 drivers/crypto/ccp/ccp-dev.c                  |  6 +--
 drivers/crypto/ccp/ccp-dmaengine.c            |  7 ++-
 drivers/crypto/ccree/cc_fips.c                |  8 ++--
 drivers/crypto/ccree/cc_request_mgr.c         | 12 +++---
 drivers/crypto/hifn_795x.c                    |  6 +--
 drivers/crypto/img-hash.c                     | 12 +++---
 drivers/crypto/ixp4xx_crypto.c                |  5 +--
 drivers/crypto/mediatek/mtk-aes.c             | 14 +++---
 drivers/crypto/mediatek/mtk-sha.c             | 14 +++---
 drivers/crypto/omap-aes.c                     |  6 +--
 drivers/crypto/omap-des.c                     |  6 +--
 drivers/crypto/omap-sham.c                    |  6 +--
 drivers/crypto/picoxcell_crypto.c             |  7 ++-
 drivers/crypto/qat/qat_common/adf_isr.c       |  5 +--
 drivers/crypto/qat/qat_common/adf_sriov.c     |  8 ++--
 drivers/crypto/qat/qat_common/adf_transport.c |  4 +-
 .../qat/qat_common/adf_transport_internal.h   |  2 +-
 drivers/crypto/qat/qat_common/adf_vf_isr.c    | 11 +++--
 drivers/crypto/qce/core.c                     |  7 ++-
 drivers/crypto/rockchip/rk3288_crypto.c       | 14 +++---
 drivers/crypto/s5p-sss.c                      | 13 +++---
 drivers/crypto/talitos.c                      | 42 ++++++++----------
 drivers/dma/altera-msgdma.c                   |  6 +--
 drivers/dma/at_hdmac.c                        |  7 ++-
 drivers/dma/at_xdmac.c                        |  7 ++-
 drivers/dma/coh901318.c                       |  7 ++-
 drivers/dma/dw/core.c                         |  6 +--
 drivers/dma/ep93xx_dma.c                      |  7 ++-
 drivers/dma/fsl_raid.c                        |  8 ++--
 drivers/dma/fsldma.c                          |  6 +--
 drivers/dma/imx-dma.c                         |  7 ++-
 drivers/dma/ioat/dma.c                        |  6 +--
 drivers/dma/ioat/dma.h                        |  2 +-
 drivers/dma/ioat/init.c                       |  2 +-
 drivers/dma/iop-adma.c                        |  8 ++--
 drivers/dma/ipu/ipu_idmac.c                   |  6 +--
 drivers/dma/k3dma.c                           |  6 +--
 drivers/dma/mediatek/mtk-cqdma.c              |  7 ++-
 drivers/dma/mmp_pdma.c                        |  6 +--
 drivers/dma/mmp_tdma.c                        |  6 +--
 drivers/dma/mpc512x_dma.c                     |  6 +--
 drivers/dma/mv_xor.c                          |  7 ++-
 drivers/dma/mv_xor_v2.c                       |  8 ++--
 drivers/dma/mxs-dma.c                         |  7 ++-
 drivers/dma/nbpfaxi.c                         |  6 +--
 drivers/dma/pch_dma.c                         |  7 ++-
 drivers/dma/pl330.c                           | 12 +++---
 drivers/dma/ppc4xx/adma.c                     |  7 ++-
 drivers/dma/qcom/bam_dma.c                    |  6 +--
 drivers/dma/qcom/hidma.c                      |  6 +--
 drivers/dma/qcom/hidma_ll.c                   |  6 +--
 drivers/dma/sa11x0-dma.c                      |  6 +--
 drivers/dma/sirf-dma.c                        |  6 +--
 drivers/dma/ste_dma40.c                       |  7 ++-
 drivers/dma/sun6i-dma.c                       |  6 +--
 drivers/dma/tegra20-apb-dma.c                 |  7 ++-
 drivers/dma/timb_dma.c                        |  6 +--
 drivers/dma/txx9dmac.c                        | 14 +++---
 drivers/dma/virt-dma.c                        |  6 +--
 drivers/dma/xgene-dma.c                       |  7 ++-
 drivers/dma/xilinx/xilinx_dma.c               |  7 ++-
 drivers/dma/xilinx/zynqmp_dma.c               |  6 +--
 drivers/firewire/ohci.c                       | 16 +++----
 drivers/gpu/drm/i915/gt/intel_lrc.c           | 26 ++++++-----
 .../gpu/drm/i915/gt/uc/intel_guc_submission.c |  7 +--
 drivers/hsi/clients/nokia-modem.c             |  9 ++--
 drivers/hsi/controllers/omap_ssi_core.c       |  9 ++--
 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 +-
 drivers/infiniband/hw/bnxt_re/qplib_fp.c      |  7 ++-
 drivers/infiniband/hw/bnxt_re/qplib_rcfw.c    | 11 +++--
 drivers/infiniband/hw/hfi1/sdma.c             | 20 ++++-----
 drivers/infiniband/hw/i40iw/i40iw_main.c      | 14 +++---
 drivers/infiniband/hw/qib/qib_iba7322.c       |  7 ++-
 drivers/infiniband/hw/qib/qib_sdma.c          | 10 ++---
 drivers/infiniband/sw/rxe/rxe_cq.c            |  6 +--
 drivers/infiniband/sw/rxe/rxe_task.c          |  8 ++--
 drivers/infiniband/sw/rxe/rxe_task.h          |  2 +-
 drivers/input/serio/hp_sdc.c                  |  4 +-
 drivers/mailbox/bcm-pdc-mailbox.c             |  6 +--
 drivers/mailbox/imx-mailbox.c                 |  7 ++-
 drivers/media/pci/bt8xx/dvb-bt8xx.c           |  7 +--
 drivers/media/pci/mantis/mantis_dma.c         |  4 +-
 drivers/media/pci/mantis/mantis_dma.h         |  2 +-
 drivers/media/pci/mantis/mantis_dvb.c         |  2 +-
 drivers/media/pci/ngene/ngene-core.c          | 12 +++---
 drivers/media/pci/smipcie/smipcie-main.c      |  6 +--
 drivers/media/pci/ttpci/av7110.c              | 20 ++++-----
 drivers/media/pci/ttpci/budget-ci.c           | 16 ++++---
 drivers/media/pci/ttpci/budget-core.c         |  6 +--
 drivers/media/pci/tw5864/tw5864-video.c       |  9 ++--
 .../media/platform/marvell-ccic/mcam-core.c   |  7 ++-
 drivers/media/platform/pxa_camera.c           |  6 +--
 .../platform/sti/c8sectpfe/c8sectpfe-core.c   | 10 ++---
 drivers/media/radio/wl128x/fmdrv_common.c     | 12 +++---
 drivers/media/usb/ttusb-dec/ttusb_dec.c       |  7 ++-
 drivers/memstick/host/jmb38x_ms.c             |  8 ++--
 drivers/memstick/host/tifm_ms.c               |  8 ++--
 drivers/misc/ibmvmc.c                         |  8 ++--
 drivers/misc/vmw_vmci/vmci_guest.c            | 15 +++----
 drivers/mmc/host/atmel-mci.c                  |  6 +--
 drivers/mmc/host/au1xmmc.c                    | 14 +++---
 drivers/mmc/host/cb710-mmc.c                  | 10 ++---
 drivers/mmc/host/dw_mmc.c                     |  6 +--
 drivers/mmc/host/omap.c                       |  7 ++-
 drivers/mmc/host/renesas_sdhi_internal_dmac.c | 19 ++++----
 drivers/mmc/host/renesas_sdhi_sys_dmac.c      |  9 ++--
 drivers/mmc/host/s3cmci.c                     |  6 +--
 drivers/mmc/host/tifm_sd.c                    |  7 ++-
 drivers/mmc/host/uniphier-sd.c                | 14 +++---
 drivers/mmc/host/via-sdmmc.c                  |  7 ++-
 drivers/mmc/host/wbsd.c                       | 35 +++++++--------
 drivers/net/arcnet/arcnet.c                   |  7 ++-
 drivers/net/caif/caif_virtio.c                |  8 ++--
 drivers/net/ethernet/alteon/acenic.c          |  9 ++--
 drivers/net/ethernet/alteon/acenic.h          |  2 +-
 drivers/net/ethernet/amd/xgbe/xgbe-drv.c      | 19 ++++----
 drivers/net/ethernet/amd/xgbe/xgbe-i2c.c      | 11 +++--
 drivers/net/ethernet/amd/xgbe/xgbe-mdio.c     | 11 +++--
 drivers/net/ethernet/broadcom/cnic.c          | 18 ++++----
 drivers/net/ethernet/cadence/macb_main.c      |  7 ++-
 .../net/ethernet/cavium/liquidio/lio_main.c   | 10 ++---
 .../net/ethernet/cavium/octeon/octeon_mgmt.c  |  7 ++-
 .../net/ethernet/cavium/thunder/nicvf_main.c  | 10 ++---
 .../ethernet/cavium/thunder/nicvf_queues.c    |  4 +-
 .../ethernet/cavium/thunder/nicvf_queues.h    |  2 +-
 drivers/net/ethernet/chelsio/cxgb/sge.c       |  9 ++--
 drivers/net/ethernet/chelsio/cxgb3/sge.c      | 16 +++----
 drivers/net/ethernet/chelsio/cxgb4/sge.c      | 12 +++---
 drivers/net/ethernet/dlink/sundance.c         | 19 ++++----
 .../net/ethernet/huawei/hinic/hinic_hw_eqs.c  |  7 ++-
 drivers/net/ethernet/ibm/ehea/ehea_main.c     |  7 ++-
 drivers/net/ethernet/ibm/ibmvnic.c            |  7 ++-
 drivers/net/ethernet/jme.c                    | 43 +++++++------------
 drivers/net/ethernet/marvell/skge.c           |  6 +--
 drivers/net/ethernet/mellanox/mlx4/cq.c       |  4 +-
 drivers/net/ethernet/mellanox/mlx4/eq.c       |  3 +-
 drivers/net/ethernet/mellanox/mlx4/mlx4.h     |  2 +-
 drivers/net/ethernet/mellanox/mlx5/core/cq.c  |  4 +-
 drivers/net/ethernet/mellanox/mlx5/core/eq.c  |  3 +-
 .../ethernet/mellanox/mlx5/core/fpga/conn.c   |  7 ++-
 .../net/ethernet/mellanox/mlx5/core/lib/eq.h  |  2 +-
 drivers/net/ethernet/mellanox/mlxsw/pci.c     | 12 +++---
 drivers/net/ethernet/micrel/ks8842.c          | 19 ++++----
 drivers/net/ethernet/micrel/ksz884x.c         | 14 +++---
 drivers/net/ethernet/natsemi/ns83820.c        |  8 ++--
 .../ethernet/netronome/nfp/nfp_net_common.c   |  7 ++-
 drivers/net/ethernet/ni/nixge.c               |  7 ++-
 drivers/net/ethernet/qlogic/qed/qed_int.c     |  7 ++-
 drivers/net/ethernet/qlogic/qed/qed_int.h     |  2 +-
 drivers/net/ethernet/silan/sc92031.c          | 11 ++---
 drivers/net/ethernet/smsc/smc91x.c            |  8 ++--
 .../net/ethernet/xilinx/xilinx_axienet_main.c |  9 ++--
 drivers/net/ifb.c                             |  7 ++-
 drivers/net/ppp/ppp_async.c                   |  8 ++--
 drivers/net/ppp/ppp_synctty.c                 |  8 ++--
 drivers/net/usb/cdc_ncm.c                     |  8 ++--
 drivers/net/usb/hso.c                         |  8 ++--
 drivers/net/usb/lan78xx.c                     |  6 +--
 drivers/net/usb/pegasus.c                     |  6 +--
 drivers/net/usb/r8152.c                       |  8 ++--
 drivers/net/usb/rtl8150.c                     |  6 +--
 drivers/net/usb/usbnet.c                      |  4 +-
 drivers/net/wireless/ath/ath5k/base.c         | 24 +++++------
 drivers/net/wireless/ath/ath5k/rfkill.c       |  8 ++--
 drivers/net/wireless/ath/ath9k/ath9k.h        |  4 +-
 drivers/net/wireless/ath/ath9k/beacon.c       |  4 +-
 drivers/net/wireless/ath/ath9k/htc.h          |  4 +-
 drivers/net/wireless/ath/ath9k/htc_drv_init.c |  6 +--
 drivers/net/wireless/ath/ath9k/htc_drv_txrx.c |  8 ++--
 drivers/net/wireless/ath/ath9k/init.c         |  5 +--
 drivers/net/wireless/ath/ath9k/main.c         |  4 +-
 drivers/net/wireless/ath/ath9k/wmi.c          |  7 ++-
 drivers/net/wireless/ath/ath9k/wmi.h          |  2 +-
 drivers/net/wireless/ath/carl9170/usb.c       |  7 ++-
 drivers/net/wireless/atmel/at76c50x-usb.c     |  8 ++--
 .../net/wireless/broadcom/b43legacy/main.c    |  7 ++-
 drivers/net/wireless/broadcom/b43legacy/pio.c |  7 ++-
 .../broadcom/brcm80211/brcmsmac/mac80211_if.c |  6 +--
 .../broadcom/brcm80211/brcmsmac/mac80211_if.h |  2 +-
 drivers/net/wireless/intel/ipw2x00/ipw2100.c  |  8 ++--
 drivers/net/wireless/intel/ipw2x00/ipw2200.c  |  6 +--
 .../net/wireless/intel/iwlegacy/3945-mac.c    |  7 ++-
 .../net/wireless/intel/iwlegacy/4965-mac.c    |  7 ++-
 .../net/wireless/intersil/hostap/hostap_hw.c  | 18 ++++----
 drivers/net/wireless/intersil/orinoco/main.c  |  7 ++-
 drivers/net/wireless/intersil/p54/p54pci.c    |  8 ++--
 drivers/net/wireless/marvell/mwl8k.c          | 16 +++----
 drivers/net/wireless/mediatek/mt76/mac80211.c |  2 +-
 drivers/net/wireless/mediatek/mt76/mt76.h     |  2 +-
 .../wireless/mediatek/mt76/mt7603/beacon.c    |  4 +-
 .../net/wireless/mediatek/mt76/mt7603/init.c  |  3 +-
 .../wireless/mediatek/mt76/mt7603/mt7603.h    |  2 +-
 .../net/wireless/mediatek/mt76/mt76x02_dfs.c  |  9 ++--
 .../net/wireless/mediatek/mt76/mt76x02_mmio.c | 14 +++---
 drivers/net/wireless/mediatek/mt76/tx.c       |  4 +-
 drivers/net/wireless/mediatek/mt76/usb.c      | 12 +++---
 drivers/net/wireless/mediatek/mt7601u/dma.c   | 12 +++---
 .../quantenna/qtnfmac/pcie/pearl_pcie.c       |  7 ++-
 .../quantenna/qtnfmac/pcie/topaz_pcie.c       |  7 ++-
 .../net/wireless/ralink/rt2x00/rt2400pci.c    | 14 +++---
 .../net/wireless/ralink/rt2x00/rt2500pci.c    | 14 +++---
 .../net/wireless/ralink/rt2x00/rt2800mmio.c   | 25 ++++++-----
 .../net/wireless/ralink/rt2x00/rt2800mmio.h   | 10 ++---
 drivers/net/wireless/ralink/rt2x00/rt2x00.h   | 10 ++---
 .../net/wireless/ralink/rt2x00/rt2x00dev.c    |  5 +--
 drivers/net/wireless/ralink/rt2x00/rt61pci.c  | 19 ++++----
 drivers/net/wireless/realtek/rtlwifi/pci.c    | 20 +++++----
 drivers/net/wireless/realtek/rtlwifi/usb.c    | 10 ++---
 drivers/net/wireless/zydas/zd1211rw/zd_usb.c  |  8 ++--
 drivers/ntb/ntb_transport.c                   |  9 ++--
 drivers/platform/goldfish/goldfish_pipe.c     |  7 ++-
 drivers/rapidio/devices/tsi721_dma.c          |  7 ++-
 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                  |  9 ++--
 drivers/s390/net/ctcm_mpc.c                   | 16 +++----
 drivers/s390/net/ctcm_mpc.h                   |  6 +--
 drivers/scsi/aic94xx/aic94xx_hwi.c            |  9 ++--
 drivers/scsi/esas2r/esas2r.h                  |  2 +-
 drivers/scsi/esas2r/esas2r_init.c             |  4 +-
 drivers/scsi/esas2r/esas2r_main.c             |  4 +-
 drivers/scsi/hisi_sas/hisi_sas_v2_hw.c        |  6 +--
 drivers/scsi/hisi_sas/hisi_sas_v3_hw.c        |  6 +--
 drivers/scsi/ibmvscsi/ibmvfc.c                |  6 +--
 drivers/scsi/ibmvscsi/ibmvscsi.c              |  8 ++--
 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c      |  7 ++-
 drivers/scsi/isci/host.c                      |  4 +-
 drivers/scsi/isci/host.h                      |  2 +-
 drivers/scsi/isci/init.c                      |  4 +-
 drivers/scsi/megaraid/megaraid_mbox.c         | 11 +++--
 drivers/scsi/megaraid/megaraid_sas.h          |  2 +-
 drivers/scsi/megaraid/megaraid_sas_base.c     | 16 +++----
 drivers/scsi/megaraid/megaraid_sas_fusion.c   | 13 +++---
 drivers/scsi/mvsas/mv_init.c                  |  8 ++--
 drivers/scsi/pm8001/pm8001_init.c             | 25 ++++++-----
 drivers/scsi/pmcraid.c                        | 21 +++++----
 drivers/spi/spi-pl022.c                       |  7 ++-
 drivers/staging/isdn/gigaset/bas-gigaset.c    | 22 +++++-----
 drivers/staging/isdn/gigaset/common.c         |  3 +-
 drivers/staging/isdn/gigaset/ev-layer.c       |  4 +-
 drivers/staging/isdn/gigaset/gigaset.h        |  2 +-
 drivers/staging/isdn/gigaset/interface.c      |  6 +--
 drivers/staging/isdn/gigaset/ser-gigaset.c    |  7 ++-
 drivers/staging/isdn/gigaset/usb-gigaset.c    |  7 ++-
 drivers/staging/ks7010/ks7010_sdio.c          |  6 +--
 drivers/staging/ks7010/ks_hostif.c            |  6 +--
 drivers/staging/mt7621-dma/mtk-hsdma.c        |  6 +--
 drivers/staging/ralink-gdma/ralink-gdma.c     |  6 +--
 .../staging/rtl8188eu/hal/rtl8188eu_recv.c    |  4 +-
 .../staging/rtl8188eu/hal/rtl8188eu_xmit.c    |  5 +--
 .../staging/rtl8188eu/include/rtl8188e_recv.h |  2 +-
 .../staging/rtl8188eu/include/rtl8188e_xmit.h |  2 +-
 .../staging/rtl8188eu/os_dep/usb_ops_linux.c  |  8 ++--
 drivers/staging/rtl8192e/rtl8192e/rtl_core.c  | 29 +++++++------
 drivers/staging/rtl8192e/rtllib_softmac.c     |  8 ++--
 .../rtl8192u/ieee80211/ieee80211_softmac.c    |  7 ++-
 drivers/staging/rtl8192u/r8192U_core.c        |  9 ++--
 drivers/staging/rtl8712/rtl8712_recv.c        | 10 ++---
 drivers/staging/rtl8712/rtl871x_xmit.c        |  4 +-
 drivers/staging/rtl8712/rtl871x_xmit.h        |  2 +-
 drivers/staging/rtl8712/usb_ops_linux.c       |  4 +-
 .../staging/rtl8723bs/hal/rtl8723bs_recv.c    | 13 +++---
 drivers/staging/wlan-ng/hfa384x_usb.c         | 18 ++++----
 drivers/staging/wlan-ng/p80211netdev.c        |  7 ++-
 drivers/tty/ipwireless/hardware.c             |  6 +--
 drivers/tty/serial/atmel_serial.c             | 18 ++++----
 drivers/tty/serial/ifx6x60.c                  |  7 ++-
 drivers/tty/serial/timbuart.c                 |  6 +--
 drivers/usb/atm/usbatm.c                      | 12 +++---
 drivers/usb/c67x00/c67x00-sched.c             |  7 ++-
 drivers/usb/core/hcd.c                        |  6 +--
 drivers/usb/gadget/function/f_midi.c          |  6 +--
 drivers/usb/gadget/udc/fsl_qe_udc.c           |  7 ++-
 drivers/usb/host/xhci-dbgtty.c                |  6 +--
 drivers/usb/serial/mos7720.c                  |  7 ++-
 drivers/vme/bridges/vme_fake.c                |  9 ++--
 net/dccp/timer.c                              |  9 ++--
 net/ipv4/tcp_output.c                         |  8 ++--
 net/mac80211/ieee80211_i.h                    |  4 +-
 net/mac80211/main.c                           | 14 +++---
 net/mac80211/tx.c                             |  4 +-
 net/mac80211/util.c                           |  4 +-
 net/mac802154/main.c                          |  8 ++--
 net/rds/ib_cm.c                               | 14 +++---
 net/sched/sch_atm.c                           |  8 ++--
 net/smc/smc_cdc.c                             |  6 +--
 net/smc/smc_wr.c                              | 14 +++---
 net/xfrm/xfrm_input.c                         |  7 ++-
 sound/core/timer.c                            |  7 ++-
 sound/firewire/amdtp-stream.c                 |  8 ++--
 sound/pci/asihpi/asihpi.c                     |  9 ++--
 sound/pci/riptide/riptide.c                   |  6 +--
 sound/pci/rme9652/hdsp.c                      |  6 +--
 sound/pci/rme9652/hdspm.c                     |  7 ++-
 sound/soc/fsl/fsl_esai.c                      |  7 ++-
 sound/soc/sh/siu_pcm.c                        | 10 ++---
 sound/soc/txx9/txx9aclc.c                     |  7 ++-
 sound/usb/midi.c                              |  7 ++-
 sound/usb/misc/ua101.c                        |  7 ++-
 328 files changed, 1293 insertions(+), 1487 deletions(-)
arch/um/drivers/vector_kern.c +3 -3
index 769ffbd9e9a6..36bd2b02746b 100644
@@ -1166,9 +1166,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);
@@ -1532,7 +1532,7 @@ static void vector_eth_configure(
 		});
 
 	dev->features = dev->hw_features = (NETIF_F_SG | NETIF_F_FRAGLIST);
-	tasklet_init(&vp->tx_poll, vector_tx_poll, (unsigned long)vp);
+	tasklet_setup(&vp->tx_poll, vector_tx_poll);
 	INIT_WORK(&vp->reset_tx, vector_reset_tx);
 
 	timer_setup(&vp->tl, vector_timer_expire, 0);
drivers/atm/eni.c +4 -4
index b23d1e4bad33..8a6fbc469ce1 100644
@@ -1525,10 +1525,10 @@ 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;
 
@@ -1842,7 +1842,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(&eni_dev->lock);
-	tasklet_init(&eni_dev->task,eni_tasklet,(unsigned long) dev);
+	tasklet_setup(&eni_dev->task, eni_tasklet);
 	eni_dev->events = 0;
 	/* initialize memory management */
 	buffer_mem = eni_dev->mem - (buf - eni_dev->ram);
drivers/atm/fore200e.c +7 -7
index f1a500205313..35976eb61498 100644
@@ -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 long    flags;
 
     DPRINTK(3, "rx tasklet scheduled for device %d\n", fore200e->atm_dev->number);
 
     spin_lock_irqsave(&fore200e->q_lock, flags);
-    fore200e_rx_irq((struct fore200e*) data);
+    fore200e_rx_irq(fore200e);
     spin_unlock_irqrestore(&fore200e->q_lock, flags);
 }
 #endif
@@ -1957,8 +1957,8 @@ static int fore200e_irq_request(struct fore200e *fore200e)
 	   fore200e_irq_itoa(fore200e->irq), fore200e->name);
 
 #ifdef FORE200E_USE_TASKLET
-    tasklet_init(&fore200e->tx_tasklet, fore200e_tx_tasklet, (unsigned long)fore200e);
-    tasklet_init(&fore200e->rx_tasklet, fore200e_rx_tasklet, (unsigned long)fore200e);
+    tasklet_setup(&fore200e->tx_tasklet, fore200e_tx_tasklet);
+    tasklet_setup(&fore200e->rx_tasklet, fore200e_rx_tasklet);
 #endif
 
     fore200e->state = FORE200E_STATE_IRQ;
drivers/atm/he.c +4 -4
index 70b00ae4ec38..b12823a036cc 100644
@@ -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(&he_dev->tasklet, he_tasklet, (unsigned long) he_dev);
+	tasklet_setup(&he_dev->tasklet, he_tasklet);
 	spin_lock_init(&he_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;
 
drivers/atm/solos-pci.c +4 -4
index c32f7dd9879a..29ae47427445 100644
@@ -167,7 +167,7 @@ static struct atm_vcc* find_vcc(struct atm_dev *dev, short vpi, int vci);
 static int atm_init(struct solos_card *, struct device *);
 static void atm_remove(struct solos_card *);
 static int send_command(struct solos_card *card, int dev, const char *buf, size_t size);
-static void solos_bh(unsigned long);
+static void solos_bh(struct tasklet_struct *t);
 static int print_buffer(struct sk_buff *buf);
 
 static inline void solos_pop(struct atm_vcc *vcc, struct sk_buff *skb)
@@ -754,9 +754,9 @@ static irqreturn_t solos_irq(int irq, void *dev_id)
 	return IRQ_RETVAL(handled);
 }
 
-static void solos_bh(unsigned long card_arg)
+static void solos_bh(struct tasklet_struct *t)
 {
-	struct solos_card *card = (void *)card_arg;
+	struct solos_card *card = from_tasklet(card, t, tlet);
 	uint32_t card_flags;
 	uint32_t rx_done = 0;
 	int port;
@@ -1296,7 +1296,7 @@ static int fpga_probe(struct pci_dev *dev, const struct pci_device_id *id)
 
 	pci_set_drvdata(dev, card);
 
-	tasklet_init(&card->tlet, solos_bh, (unsigned long)card);
+	tasklet_setup(&card->tlet, solos_bh);
 	spin_lock_init(&card->tx_lock);
 	spin_lock_init(&card->tx_queue_lock);
 	spin_lock_init(&card->cli_queue_lock);
drivers/block/umem.c +3 -3
index 1f3f9e0f02a8..2373bd61cd6e 100644
@@ -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(&card->lock);
@@ -892,7 +892,7 @@ static int mm_pci_probe(struct pci_dev *dev, const struct pci_device_id *id)
 	blk_queue_make_request(card->queue, mm_make_request);
 	card->queue->queuedata = card;
 
-	tasklet_init(&card->tasklet, process_page, (unsigned long)card);
+	tasklet_setup(&card->tasklet, process_page);
 
 	card->check_batteries = 0;
 
drivers/block/xsysace.c +3 -3
index 5d8e0ab3f054..bdd50a87d10f 100644
@@ -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(&ace->lock, flags);
@@ -1001,7 +1001,7 @@ static int ace_setup(struct ace_device *ace)
 	/*
 	 * Initialize the state machine tasklet and stall timer
 	 */
-	tasklet_init(&ace->fsm_tasklet, ace_fsm_tasklet, (unsigned long)ace);
+	tasklet_setup(&ace->fsm_tasklet, ace_fsm_tasklet);
 	timer_setup(&ace->stall_timer, ace_stall_timer, 0);
 
 	/*
drivers/char/ipmi/ipmi_msghandler.c +5 -7
index 2aab80e19ae0..c51a195ab98b 100644
@@ -38,7 +38,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,
@@ -3433,9 +3433,7 @@ int ipmi_register_smi(const struct ipmi_smi_handlers *handlers,
 	intf->curr_seq = 0;
 	spin_lock_init(&intf->waiting_rcv_msgs_lock);
 	INIT_LIST_HEAD(&intf->waiting_rcv_msgs);
-	tasklet_init(&intf->recv_tasklet,
-		     smi_recv_tasklet,
-		     (unsigned long) intf);
+	tasklet_setup(&intf->recv_tasklet, smi_recv_tasklet);
 	atomic_set(&intf->watchdog_pretimeouts_to_deliver, 0);
 	spin_lock_init(&intf->xmit_msgs_lock);
 	INIT_LIST_HEAD(&intf->xmit_msgs);
@@ -4469,10 +4467,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;
 
@@ -4544,7 +4542,7 @@ void ipmi_smi_msg_received(struct ipmi_smi *intf,
 		spin_unlock_irqrestore(&intf->xmit_msgs_lock, flags);
 
 	if (run_to_completion)
-		smi_recv_tasklet((unsigned long) intf);
+		smi_recv_tasklet(&intf->recv_tasklet);
 	else
 		tasklet_schedule(&intf->recv_tasklet);
 }
drivers/crypto/amcc/crypto4xx_core.c +3 -4
index de5e9352e920..e2858cbde9d1 100644
@@ -1075,9 +1075,9 @@ static void crypto4xx_unregister_alg(struct crypto4xx_device *sec_dev)
 	}
 }
 
-static void crypto4xx_bh_tasklet_cb(unsigned long data)
+static void crypto4xx_bh_tasklet_cb(struct tasklet_struct *t)
 {
-	struct device *dev = (struct device *)data;
+	struct device *dev = from_tasklet(dev, t, tasklet);
 	struct crypto4xx_core_device *core_dev = dev_get_drvdata(dev);
 	struct pd_uinfo *pd_uinfo;
 	struct ce_pd *pd;
@@ -1456,8 +1456,7 @@ static int crypto4xx_probe(struct platform_device *ofdev)
 		goto err_build_sdr;
 
 	/* Init tasklet for bottom half processing */
-	tasklet_init(&core_dev->tasklet, crypto4xx_bh_tasklet_cb,
-		     (unsigned long) dev);
+	tasklet_setup(&core_dev->tasklet, crypto4xx_bh_tasklet_cb);
 
 	core_dev->dev->ce_base = of_iomap(ofdev->dev.of_node, 0);
 	if (!core_dev->dev->ce_base) {
drivers/crypto/atmel-aes.c +6 -8
index 026f193556f9..0ee5b8c1552a 100644
@@ -2423,16 +2423,16 @@ static void atmel_aes_dma_cleanup(struct atmel_aes_dev *dd)
 	dma_release_channel(dd->src.chan);
 }
 
-static void atmel_aes_queue_task(unsigned long data)
+static void atmel_aes_queue_task(struct tasklet_struct *t)
 {
-	struct atmel_aes_dev *dd = (struct atmel_aes_dev *)data;
+	struct atmel_aes_dev *dd = from_tasklet(dd, t, queue_task);
 
 	atmel_aes_handle_queue(dd, NULL);
 }
 
-static void atmel_aes_done_task(unsigned long data)
+static void atmel_aes_done_task(struct tasklet_struct *t)
 {
-	struct atmel_aes_dev *dd = (struct atmel_aes_dev *)data;
+	struct atmel_aes_dev *dd = from_tasklet(dd, t, done_task);
 
 	dd->is_async = true;
 	(void)dd->resume(dd);
@@ -2654,10 +2654,8 @@ static int atmel_aes_probe(struct platform_device *pdev)
 	INIT_LIST_HEAD(&aes_dd->list);
 	spin_lock_init(&aes_dd->lock);
 
-	tasklet_init(&aes_dd->done_task, atmel_aes_done_task,
-					(unsigned long)aes_dd);
-	tasklet_init(&aes_dd->queue_task, atmel_aes_queue_task,
-					(unsigned long)aes_dd);
+	tasklet_setup(&aes_dd->done_task, atmel_aes_done_task);
+	tasklet_setup(&aes_dd->queue_task, atmel_aes_queue_task);
 
 	crypto_init_queue(&aes_dd->queue, ATMEL_AES_QUEUE_LENGTH);
 
drivers/crypto/atmel-sha.c +6 -8
index 84cb8748a795..a24e91073f58 100644
@@ -1375,9 +1375,9 @@ static struct ahash_alg sha_384_512_algs[] = {
 },
 };
 
-static void atmel_sha_queue_task(unsigned long data)
+static void atmel_sha_queue_task(struct tasklet_struct *t)
 {
-	struct atmel_sha_dev *dd = (struct atmel_sha_dev *)data;
+	struct atmel_sha_dev *dd = from_tasklet(dd, t, queue_task);
 
 	atmel_sha_handle_queue(dd, NULL);
 }
@@ -1418,9 +1418,9 @@ static int atmel_sha_done(struct atmel_sha_dev *dd)
 	return err;
 }
 
-static void atmel_sha_done_task(unsigned long data)
+static void atmel_sha_done_task(struct tasklet_struct *t)
 {
-	struct atmel_sha_dev *dd = (struct atmel_sha_dev *)data;
+	struct atmel_sha_dev *dd = from_tasklet(dd, t, done_task);
 
 	dd->is_async = true;
 	(void)dd->resume(dd);
@@ -2760,10 +2760,8 @@ static int atmel_sha_probe(struct platform_device *pdev)
 	INIT_LIST_HEAD(&sha_dd->list);
 	spin_lock_init(&sha_dd->lock);
 
-	tasklet_init(&sha_dd->done_task, atmel_sha_done_task,
-					(unsigned long)sha_dd);
-	tasklet_init(&sha_dd->queue_task, atmel_sha_queue_task,
-					(unsigned long)sha_dd);
+	tasklet_setup(&sha_dd->done_task, atmel_sha_done_task);
+	tasklet_setup(&sha_dd->queue_task, atmel_sha_queue_task);
 
 	crypto_init_queue(&sha_dd->queue, ATMEL_SHA_QUEUE_LENGTH);
 
drivers/crypto/atmel-tdes.c +6 -8
index 1a6c86ae6148..7c0f845f76ce 100644
@@ -1089,16 +1089,16 @@ static struct crypto_alg tdes_algs[] = {
 },
 };
 
-static void atmel_tdes_queue_task(unsigned long data)
+static void atmel_tdes_queue_task(struct tasklet_struct *t)
 {
-	struct atmel_tdes_dev *dd = (struct atmel_tdes_dev *)data;
+	struct atmel_tdes_dev *dd = from_tasklet(dd, t, queue_task);
 
 	atmel_tdes_handle_queue(dd, NULL);
 }
 
-static void atmel_tdes_done_task(unsigned long data)
+static void atmel_tdes_done_task(struct tasklet_struct *t)
 {
-	struct atmel_tdes_dev *dd = (struct atmel_tdes_dev *) data;
+	struct atmel_tdes_dev *dd = from_tasklet(dd, t, done_task);
 	int err;
 
 	if (!(dd->flags & TDES_FLAGS_DMA))
@@ -1248,10 +1248,8 @@ static int atmel_tdes_probe(struct platform_device *pdev)
 	INIT_LIST_HEAD(&tdes_dd->list);
 	spin_lock_init(&tdes_dd->lock);
 
-	tasklet_init(&tdes_dd->done_task, atmel_tdes_done_task,
-					(unsigned long)tdes_dd);
-	tasklet_init(&tdes_dd->queue_task, atmel_tdes_queue_task,
-					(unsigned long)tdes_dd);
+	tasklet_setup(&tdes_dd->done_task, atmel_tdes_done_task);
+	tasklet_setup(&tdes_dd->queue_task, atmel_tdes_queue_task);
 
 	crypto_init_queue(&tdes_dd->queue, ATMEL_TDES_QUEUE_LENGTH);
 
drivers/crypto/axis/artpec6_crypto.c +3 -4
index 4b20606983a4..f4f19eed3248 100644
@@ -2080,9 +2080,9 @@ static void artpec6_crypto_timeout(struct timer_list *t)
 	tasklet_schedule(&ac->task);
 }
 
-static void artpec6_crypto_task(unsigned long data)
+static void artpec6_crypto_task(struct tasklet_struct *t)
 {
-	struct artpec6_crypto *ac = (struct artpec6_crypto *)data;
+	struct artpec6_crypto *ac = from_tasklet(ac, t, task);
 	struct artpec6_crypto_req_common *req;
 	struct artpec6_crypto_req_common *n;
 	struct list_head complete_done;
@@ -2901,8 +2901,7 @@ static int artpec6_crypto_probe(struct platform_device *pdev)
 	artpec6_crypto_init_debugfs();
 #endif
 
-	tasklet_init(&ac->task, artpec6_crypto_task,
-		     (unsigned long)ac);
+	tasklet_setup(&ac->task, artpec6_crypto_task);
 
 	ac->pad_buffer = devm_kzalloc(&pdev->dev, 2 * ARTPEC_CACHE_LINE_MAX,
 				      GFP_KERNEL);
drivers/crypto/caam/jr.c +4 -4
index fc97cde27059..2f6aa5652bb8 100644
@@ -189,11 +189,11 @@ static irqreturn_t caam_jr_interrupt(int irq, void *st_dev)
 }
 
 /* Deferred service handler, run as interrupt-fired tasklet */
-static void caam_jr_dequeue(unsigned long devarg)
+static void caam_jr_dequeue(struct tasklet_struct *t)
 {
 	int hw_idx, sw_idx, i, head, tail;
-	struct device *dev = (struct device *)devarg;
-	struct caam_drv_private_jr *jrp = dev_get_drvdata(dev);
+	struct caam_drv_private_jr *jrp = from_tasklet(jrp, t, irqtask);
+	struct device *dev = jrp->dev;
 	void (*usercall)(struct device *dev, u32 *desc, u32 status, void *arg);
 	u32 *userdesc, userstatus;
 	void *userarg;
@@ -472,7 +472,7 @@ static int caam_jr_init(struct device *dev)
 		      (JOBR_INTC_COUNT_THLD << JRCFG_ICDCT_SHIFT) |
 		      (JOBR_INTC_TIME_THLD << JRCFG_ICTT_SHIFT));
 
-	tasklet_init(&jrp->irqtask, caam_jr_dequeue, (unsigned long)dev);
+	tasklet_setup(&jrp->irqtask, caam_jr_dequeue);
 
 	/* Connect job ring interrupt handler. */
 	error = devm_request_irq(dev, jrp->irq, caam_jr_interrupt, IRQF_SHARED,
drivers/crypto/cavium/cpt/cptvf_main.c +4 -5
index 0f72e9abdefe..514eaf1140fa 100644
@@ -21,10 +21,10 @@ struct cptvf_wqe_info {
 	struct cptvf_wqe vq_wqe[CPT_NUM_QS_PER_VF];
 };
 
-static void vq_work_handler(unsigned long data)
+static void vq_work_handler(struct tasklet_struct *t)
 {
-	struct cptvf_wqe_info *cwqe_info = (struct cptvf_wqe_info *)data;
-	struct cptvf_wqe *cwqe = &cwqe_info->vq_wqe[0];
+	struct cptvf_wqe *cwqe = from_tasklet(cwqe, t, twork);
+	struct cptvf_wqe_info *cwqe_info = container_of(cwqe, typeof(*cwqe_info), vq_wqe[0]);
 
 	vq_post_process(cwqe->cptvf, cwqe->qno);
 }
@@ -45,8 +45,7 @@ static int init_worker_threads(struct cpt_vf *cptvf)
 	}
 
 	for (i = 0; i < cptvf->nr_queues; i++) {
-		tasklet_init(&cwqe_info->vq_wqe[i].twork, vq_work_handler,
-			     (u64)cwqe_info);
+		tasklet_setup(&cwqe_info->vq_wqe[i].twork, vq_work_handler);
 		cwqe_info->vq_wqe[i].qno = i;
 		cwqe_info->vq_wqe[i].cptvf = cptvf;
 	}
drivers/crypto/cavium/nitrox/nitrox_common.h +1 -1
index e4be69d7e6e5..f73ae8735272 100644
@@ -19,7 +19,7 @@ void nitrox_put_device(struct nitrox_device *ndev);
 int nitrox_common_sw_init(struct nitrox_device *ndev);
 void nitrox_common_sw_cleanup(struct nitrox_device *ndev);
 
-void pkt_slc_resp_tasklet(unsigned long data);
+void pkt_slc_resp_tasklet(struct tasklet_struct *t);
 int nitrox_process_se_request(struct nitrox_device *ndev,
 			      struct se_crypto_request *req,
 			      completion_t cb,
drivers/crypto/cavium/nitrox/nitrox_isr.c +5 -8
index 3dec570a190a..cc6b7c78e070 100644
@@ -200,9 +200,9 @@ static void clear_bmi_err_intr(struct nitrox_device *ndev)
 	dev_err_ratelimited(DEV(ndev), "BMI_INT  0x%016llx\n", value);
 }
 
-static void nps_core_int_tasklet(unsigned long data)
+static void nps_core_int_tasklet(struct tasklet_struct *t)
 {
-	struct nitrox_q_vector *qvec = (void *)(uintptr_t)(data);
+	struct nitrox_q_vector *qvec = from_tasklet(qvec, t, resp_tasklet);
 	struct nitrox_device *ndev = qvec->ndev;
 
 	/* if pf mode do queue recovery */
@@ -342,8 +342,7 @@ int nitrox_register_interrupts(struct nitrox_device *ndev)
 		cpu = qvec->ring % num_online_cpus();
 		irq_set_affinity_hint(vec, get_cpu_mask(cpu));
 
-		tasklet_init(&qvec->resp_tasklet, pkt_slc_resp_tasklet,
-			     (unsigned long)qvec);
+		tasklet_setup(&qvec->resp_tasklet, pkt_slc_resp_tasklet);
 		qvec->valid = true;
 	}
 
@@ -363,8 +362,7 @@ int nitrox_register_interrupts(struct nitrox_device *ndev)
 	cpu = num_online_cpus();
 	irq_set_affinity_hint(vec, get_cpu_mask(cpu));
 
-	tasklet_init(&qvec->resp_tasklet, nps_core_int_tasklet,
-		     (unsigned long)qvec);
+	tasklet_setup(&qvec->resp_tasklet, nps_core_int_tasklet);
 	qvec->valid = true;
 
 	return 0;
@@ -441,8 +439,7 @@ int nitrox_sriov_register_interupts(struct nitrox_device *ndev)
 	cpu = num_online_cpus();
 	irq_set_affinity_hint(vec, get_cpu_mask(cpu));
 
-	tasklet_init(&qvec->resp_tasklet, nps_core_int_tasklet,
-		     (unsigned long)qvec);
+	tasklet_setup(&qvec->resp_tasklet, nps_core_int_tasklet);
 	qvec->valid = true;
 
 	return 0;
drivers/crypto/cavium/nitrox/nitrox_reqmgr.c +2 -2
index 5826c2c98a50..1c113be87ada 100644
@@ -579,9 +579,9 @@ static void process_response_list(struct nitrox_cmdq *cmdq)
 /**
  * pkt_slc_resp_tasklet - post processing of SE responses
  */
-void pkt_slc_resp_tasklet(unsigned long data)
+void pkt_slc_resp_tasklet(struct tasklet_struct *t)
 {
-	struct nitrox_q_vector *qvec = (void *)(uintptr_t)(data);
+	struct nitrox_q_vector *qvec = from_tasklet(qvec, t, resp_tasklet);
 	struct nitrox_cmdq *cmdq = qvec->cmdq;
 	union nps_pkt_slc_cnts slc_cnts;
 
drivers/crypto/ccp/ccp-dev-v3.c +4 -5
index 0186b3df4c87..a4b912e7aec2 100644
@@ -321,9 +321,9 @@ static void ccp_enable_queue_interrupts(struct ccp_device *ccp)
 	iowrite32(ccp->qim, ccp->io_regs + IRQ_MASK_REG);
 }
 
-static void ccp_irq_bh(unsigned long data)
+static void ccp_irq_bh(struct tasklet_struct *t)
 {
-	struct ccp_device *ccp = (struct ccp_device *)data;
+	struct ccp_device *ccp = from_tasklet(ccp, t, irq_tasklet);
 	struct ccp_cmd_queue *cmd_q;
 	u32 q_int, status;
 	unsigned int i;
@@ -361,7 +361,7 @@ static irqreturn_t ccp_irq_handler(int irq, void *data)
 	if (ccp->use_tasklet)
 		tasklet_schedule(&ccp->irq_tasklet);
 	else
-		ccp_irq_bh((unsigned long)ccp);
+		ccp_irq_bh(&ccp->irq_tasklet);
 
 	return IRQ_HANDLED;
 }
@@ -457,8 +457,7 @@ static int ccp_init(struct ccp_device *ccp)
 
 	/* Initialize the ISR tasklet? */
 	if (ccp->use_tasklet)
-		tasklet_init(&ccp->irq_tasklet, ccp_irq_bh,
-			     (unsigned long)ccp);
+		tasklet_setup(&ccp->irq_tasklet, ccp_irq_bh);
 
 	dev_dbg(dev, "Starting threads...\n");
 	/* Create a kthread for each queue */
drivers/crypto/ccp/ccp-dev-v5.c +4 -5
index 57eb53b8ac21..604bc4947829 100644
@@ -733,9 +733,9 @@ static void ccp5_enable_queue_interrupts(struct ccp_device *ccp)
 		iowrite32(SUPPORTED_INTERRUPTS, ccp->cmd_q[i].reg_int_enable);
 }
 
-static void ccp5_irq_bh(unsigned long data)
+static void ccp5_irq_bh(struct tasklet_struct *t)
 {
-	struct ccp_device *ccp = (struct ccp_device *)data;
+	struct ccp_device *ccp = from_tasklet(ccp, t, irq_tasklet);
 	u32 status;
 	unsigned int i;
 
@@ -772,7 +772,7 @@ static irqreturn_t ccp5_irq_handler(int irq, void *data)
 	if (ccp->use_tasklet)
 		tasklet_schedule(&ccp->irq_tasklet);
 	else
-		ccp5_irq_bh((unsigned long)ccp);
+		ccp5_irq_bh(&ccp->irq_tasklet);
 	return IRQ_HANDLED;
 }
 
@@ -882,8 +882,7 @@ static int ccp5_init(struct ccp_device *ccp)
 	}
 	/* Initialize the ISR tasklet */
 	if (ccp->use_tasklet)
-		tasklet_init(&ccp->irq_tasklet, ccp5_irq_bh,
-			     (unsigned long)ccp);
+		tasklet_setup(&ccp->irq_tasklet, ccp5_irq_bh);
 
 	dev_dbg(dev, "Loading LSB map...\n");
 	/* Copy the private LSB mask to the public registers */
drivers/crypto/ccp/ccp-dev.c +3 -3
index d0d180176f45..12adf272d3a6 100644
@@ -417,9 +417,9 @@ static struct ccp_cmd *ccp_dequeue_cmd(struct ccp_cmd_queue *cmd_q)
 	return cmd;
 }
 
-static void ccp_do_cmd_complete(unsigned long data)
+static void ccp_do_cmd_complete(struct tasklet_struct *t)
 {
-	struct ccp_tasklet_data *tdata = (struct ccp_tasklet_data *)data;
+	struct ccp_tasklet_data *tdata = from_tasklet(tdata, t, tasklet);
 	struct ccp_cmd *cmd = tdata->cmd;
 
 	cmd->callback(cmd->data, cmd->ret);
@@ -438,7 +438,7 @@ int ccp_cmd_queue_thread(void *data)
 	struct ccp_cmd *cmd;
 	struct ccp_tasklet_data tdata;
 
-	tasklet_init(&tdata.tasklet, ccp_do_cmd_complete, (unsigned long)&tdata);
+	tasklet_setup(&tdata.tasklet, ccp_do_cmd_complete);
 
 	set_current_state(TASK_INTERRUPTIBLE);
 	while (!kthread_should_stop()) {
drivers/crypto/ccp/ccp-dmaengine.c +3 -4
index a54f9367a580..d6c7db573f94 100644
@@ -121,9 +121,9 @@ static void ccp_cleanup_desc_resources(struct ccp_device *ccp,
 	}
 }
 
-static void ccp_do_cleanup(unsigned long data)
+static void ccp_do_cleanup(struct tasklet_struct *t)
 {
-	struct ccp_dma_chan *chan = (struct ccp_dma_chan *)data;
+	struct ccp_dma_chan *chan = from_tasklet(chan, t, cleanup_tasklet);
 	unsigned long flags;
 
 	dev_dbg(chan->ccp->dev, "%s - chan=%s\n", __func__,
@@ -711,8 +711,7 @@ int ccp_dmaengine_register(struct ccp_device *ccp)
 		INIT_LIST_HEAD(&chan->active);
 		INIT_LIST_HEAD(&chan->complete);
 
-		tasklet_init(&chan->cleanup_tasklet, ccp_do_cleanup,
-			     (unsigned long)chan);
+		tasklet_setup(&chan->cleanup_tasklet, ccp_do_cleanup);
 
 		dma_chan->device = dma_dev;
 		dma_cookie_init(dma_chan);
drivers/crypto/ccree/cc_fips.c +4 -4
index 4c8bce33abcf..87332357fdf3 100644
@@ -8,7 +8,7 @@
 #include "cc_driver.h"
 #include "cc_fips.h"
 
-static void fips_dsr(unsigned long devarg);
+static void fips_dsr(struct tasklet_struct *t);
 
 struct cc_fips_handle {
 	struct tasklet_struct tasklet;
@@ -109,9 +109,9 @@ void cc_tee_handle_fips_error(struct cc_drvdata *p_drvdata)
 }
 
 /* Deferred service handler, run as interrupt-fired tasklet */
-static void fips_dsr(unsigned long devarg)
+static void fips_dsr(struct tasklet_struct *t)
 {
-	struct cc_drvdata *drvdata = (struct cc_drvdata *)devarg;
+	struct cc_drvdata *drvdata = from_tasklet(drvdata, t, tasklet);
 	u32 irq, val;
 
 	irq = (drvdata->irq & (CC_GPR0_IRQ_MASK));
@@ -143,7 +143,7 @@ int cc_fips_init(struct cc_drvdata *p_drvdata)
 	p_drvdata->fips_handle = fips_h;
 
 	dev_dbg(dev, "Initializing fips tasklet\n");
-	tasklet_init(&fips_h->tasklet, fips_dsr, (unsigned long)p_drvdata);
+	tasklet_setup(&fips_h->tasklet, fips_dsr);
 	fips_h->drvdata = p_drvdata;
 	fips_h->nb.notifier_call = cc_ree_fips_failure;
 	atomic_notifier_chain_register(&fips_fail_notif_chain, &fips_h->nb);
drivers/crypto/ccree/cc_request_mgr.c +5 -7
index a947d5a2cf35..673994f11af7 100644
@@ -71,7 +71,7 @@ static const u32 cc_cpp_int_masks[CC_CPP_NUM_ALGS][CC_CPP_NUM_SLOTS] = {
 	  BIT(CC_HOST_IRR_REE_OP_ABORTED_SM_7_INT_BIT_SHIFT) }
 };
 
-static void comp_handler(unsigned long devarg);
+static void comp_handler(struct tasklet_struct *t);
 #ifdef COMP_IN_WQ
 static void comp_work_handler(struct work_struct *work);
 #endif
@@ -141,8 +141,7 @@ int cc_req_mgr_init(struct cc_drvdata *drvdata)
 	INIT_DELAYED_WORK(&req_mgr_h->compwork, comp_work_handler);
 #else
 	dev_dbg(dev, "Initializing completion tasklet\n");
-	tasklet_init(&req_mgr_h->comptask, comp_handler,
-		     (unsigned long)drvdata);
+	tasklet_setup(&req_mgr_h->comptask, comp_handler);
 #endif
 	req_mgr_h->hw_queue_size = cc_ioread(drvdata,
 					     CC_REG(DSCRPTR_QUEUE_SRAM_SIZE));
@@ -627,11 +626,10 @@ static inline u32 cc_axi_comp_count(struct cc_drvdata *drvdata)
 }
 
 /* Deferred service handler, run as interrupt-fired tasklet */
-static void comp_handler(unsigned long devarg)
+static void comp_handler(struct tasklet_struct *t)
 {
-	struct cc_drvdata *drvdata = (struct cc_drvdata *)devarg;
-	struct cc_req_mgr_handle *request_mgr_handle =
-						drvdata->request_mgr_handle;
+	struct cc_req_mgr_handle *request_mgr_handle = from_tasklet(request_mgr_handle, t, comptask);
+	struct cc_drvdata *drvdata = container_of((void *)request_mgr_handle, typeof(*drvdata), request_mgr_handle);
 	struct device *dev = drvdata_to_dev(drvdata);
 	u32 irq;
 
drivers/crypto/hifn_795x.c +3 -3
index a18e62df68d9..5d5d6ea58ca2 100644
@@ -2442,9 +2442,9 @@ static int hifn_register_alg(struct hifn_device *dev)
 	return err;
 }
 
-static void hifn_tasklet_callback(unsigned long data)
+static void hifn_tasklet_callback(struct tasklet_struct *t)
 {
-	struct hifn_device *dev = (struct hifn_device *)data;
+	struct hifn_device *dev = from_tasklet(dev, t, tasklet);
 
 	/*
 	 * This is ok to call this without lock being held,
@@ -2529,7 +2529,7 @@ static int hifn_probe(struct pci_dev *pdev, const struct pci_device_id *id)
 
 	pci_set_drvdata(pdev, dev);
 
-	tasklet_init(&dev->tasklet, hifn_tasklet_callback, (unsigned long)dev);
+	tasklet_setup(&dev->tasklet, hifn_tasklet_callback);
 
 	crypto_init_queue(&dev->queue, 1);
 
drivers/crypto/img-hash.c +6 -6
index fe4cc8babe1c..3981b0ed297a 100644
@@ -353,9 +353,9 @@ static int img_hash_dma_init(struct img_hash_dev *hdev)
 	return 0;
 }
 
-static void img_hash_dma_task(unsigned long d)
+static void img_hash_dma_task(struct tasklet_struct *t)
 {
-	struct img_hash_dev *hdev = (struct img_hash_dev *)d;
+	struct img_hash_dev *hdev = from_tasklet(hdev, t, dma_task);
 	struct img_hash_request_ctx *ctx = ahash_request_ctx(hdev->req);
 	u8 *addr;
 	size_t nbytes, bleft, wsend, len, tbc;
@@ -885,9 +885,9 @@ static int img_unregister_algs(struct img_hash_dev *hdev)
 	return 0;
 }
 
-static void img_hash_done_task(unsigned long data)
+static void img_hash_done_task(struct tasklet_struct *t)
 {
-	struct img_hash_dev *hdev = (struct img_hash_dev *)data;
+	struct img_hash_dev *hdev = from_tasklet(hdev, t, done_task);
 	int err = 0;
 
 	if (hdev->err == -EINVAL) {
@@ -952,8 +952,8 @@ static int img_hash_probe(struct platform_device *pdev)
 
 	INIT_LIST_HEAD(&hdev->list);
 
-	tasklet_init(&hdev->done_task, img_hash_done_task, (unsigned long)hdev);
-	tasklet_init(&hdev->dma_task, img_hash_dma_task, (unsigned long)hdev);
+	tasklet_setup(&hdev->done_task, img_hash_done_task);
+	tasklet_setup(&hdev->dma_task, img_hash_dma_task);
 
 	crypto_init_queue(&hdev->queue, IMG_HASH_QUEUE_LENGTH);
 
drivers/crypto/ixp4xx_crypto.c +2 -3
index 9181523ba760..8bd3c6acbf5e 100644
@@ -413,8 +413,7 @@ static void irqhandler(void *_unused)
 	tasklet_schedule(&crypto_done_tasklet);
 }
 
-static void crypto_done_action(unsigned long arg)
-{
+static void crypto_done_action(struct tasklet_struct *unused){
 	int i;
 
 	for(i=0; i<4; i++) {
@@ -496,7 +495,7 @@ static int init_ixp_crypto(struct device *dev)
 		goto err;
 	}
 	qmgr_set_irq(RECV_QID, QUEUE_IRQ_SRC_NOT_EMPTY, irqhandler, NULL);
-	tasklet_init(&crypto_done_tasklet, crypto_done_action, 0);
+	tasklet_setup(&crypto_done_tasklet, crypto_done_action);
 
 	qmgr_enable_irq(RECV_QID);
 	return 0;
drivers/crypto/mediatek/mtk-aes.c +6 -8
index 90c9644fb8a8..48b3e8b72448 100644
@@ -1156,16 +1156,16 @@ static struct aead_alg aes_gcm_alg = {
 	},
 };
 
-static void mtk_aes_queue_task(unsigned long data)
+static void mtk_aes_queue_task(struct tasklet_struct *t)
 {
-	struct mtk_aes_rec *aes = (struct mtk_aes_rec *)data;
+	struct mtk_aes_rec *aes = from_tasklet(aes, t, queue_task);
 
 	mtk_aes_handle_queue(aes->cryp, aes->id, NULL);
 }
 
-static void mtk_aes_done_task(unsigned long data)
+static void mtk_aes_done_task(struct tasklet_struct *t)
 {
-	struct mtk_aes_rec *aes = (struct mtk_aes_rec *)data;
+	struct mtk_aes_rec *aes = from_tasklet(aes, t, done_task);
 	struct mtk_cryp *cryp = aes->cryp;
 
 	mtk_aes_unmap(cryp, aes);
@@ -1218,10 +1218,8 @@ static int mtk_aes_record_init(struct mtk_cryp *cryp)
 		spin_lock_init(&aes[i]->lock);
 		crypto_init_queue(&aes[i]->queue, AES_QUEUE_SIZE);
 
-		tasklet_init(&aes[i]->queue_task, mtk_aes_queue_task,
-			     (unsigned long)aes[i]);
-		tasklet_init(&aes[i]->done_task, mtk_aes_done_task,
-			     (unsigned long)aes[i]);
+		tasklet_setup(&aes[i]->queue_task, mtk_aes_queue_task);
+		tasklet_setup(&aes[i]->done_task, mtk_aes_done_task);
 	}
 
 	/* Link to ring0 and ring1 respectively */
drivers/crypto/mediatek/mtk-sha.c +6 -8
index 9e9f48bb7f85..fa59ca315d77 100644
@@ -1166,16 +1166,16 @@ static struct ahash_alg algs_sha384_sha512[] = {
 },
 };
 
-static void mtk_sha_queue_task(unsigned long data)
+static void mtk_sha_queue_task(struct tasklet_struct *t)
 {
-	struct mtk_sha_rec *sha = (struct mtk_sha_rec *)data;
+	struct mtk_sha_rec *sha = from_tasklet(sha, t, queue_task);
 
 	mtk_sha_handle_queue(sha->cryp, sha->id - MTK_RING2, NULL);
 }
 
-static void mtk_sha_done_task(unsigned long data)
+static void mtk_sha_done_task(struct tasklet_struct *t)
 {
-	struct mtk_sha_rec *sha = (struct mtk_sha_rec *)data;
+	struct mtk_sha_rec *sha = from_tasklet(sha, t, done_task);
 	struct mtk_cryp *cryp = sha->cryp;
 
 	mtk_sha_unmap(cryp, sha);
@@ -1221,10 +1221,8 @@ static int mtk_sha_record_init(struct mtk_cryp *cryp)
 		spin_lock_init(&sha[i]->lock);
 		crypto_init_queue(&sha[i]->queue, SHA_QUEUE_SIZE);
 
-		tasklet_init(&sha[i]->queue_task, mtk_sha_queue_task,
-			     (unsigned long)sha[i]);
-		tasklet_init(&sha[i]->done_task, mtk_sha_done_task,
-			     (unsigned long)sha[i]);
+		tasklet_setup(&sha[i]->queue_task, mtk_sha_queue_task);
+		tasklet_setup(&sha[i]->done_task, mtk_sha_done_task);
 	}
 
 	/* Link to ring2 and ring3 respectively */
drivers/crypto/omap-aes.c +3 -3
index 2f53fbb74100..54045315189e 100644
@@ -479,9 +479,9 @@ static int omap_aes_crypt_req(struct crypto_engine *engine,
 	return omap_aes_crypt_dma_start(dd);
 }
 
-static void omap_aes_done_task(unsigned long data)
+static void omap_aes_done_task(struct tasklet_struct *t)
 {
-	struct omap_aes_dev *dd = (struct omap_aes_dev *)data;
+	struct omap_aes_dev *dd = from_tasklet(dd, t, done_task);
 
 	pr_debug("enter done_task\n");
 
@@ -1170,7 +1170,7 @@ static int omap_aes_probe(struct platform_device *pdev)
 		 (reg & dd->pdata->major_mask) >> dd->pdata->major_shift,
 		 (reg & dd->pdata->minor_mask) >> dd->pdata->minor_shift);
 
-	tasklet_init(&dd->done_task, omap_aes_done_task, (unsigned long)dd);
+	tasklet_setup(&dd->done_task, omap_aes_done_task);
 
 	err = omap_aes_dma_init(dd);
 	if (err == -EPROBE_DEFER) {
drivers/crypto/omap-des.c +3 -3
index b19d7e5d55ec..b8e7c3609b9a 100644
@@ -593,9 +593,9 @@ static int omap_des_crypt_req(struct crypto_engine *engine,
 	return omap_des_crypt_dma_start(dd);
 }
 
-static void omap_des_done_task(unsigned long data)
+static void omap_des_done_task(struct tasklet_struct *t)
 {
-	struct omap_des_dev *dd = (struct omap_des_dev *)data;
+	struct omap_des_dev *dd = from_tasklet(dd, t, done_task);
 
 	pr_debug("enter done_task\n");
 
@@ -1028,7 +1028,7 @@ static int omap_des_probe(struct platform_device *pdev)
 		 (reg & dd->pdata->major_mask) >> dd->pdata->major_shift,
 		 (reg & dd->pdata->minor_mask) >> dd->pdata->minor_shift);
 
-	tasklet_init(&dd->done_task, omap_des_done_task, (unsigned long)dd);
+	tasklet_setup(&dd->done_task, omap_des_done_task);
 
 	err = omap_des_dma_init(dd);
 	if (err == -EPROBE_DEFER) {
drivers/crypto/omap-sham.c +3 -3
index ac80bc6af093..cf7c49508ccb 100644
@@ -1725,9 +1725,9 @@ static struct ahash_alg algs_sha384_sha512[] = {
 },
 };
 
-static void omap_sham_done_task(unsigned long data)
+static void omap_sham_done_task(struct tasklet_struct *t)
 {
-	struct omap_sham_dev *dd = (struct omap_sham_dev *)data;
+	struct omap_sham_dev *dd = from_tasklet(dd, t, done_task);
 	int err = 0;
 
 	if (!test_bit(FLAGS_BUSY, &dd->flags)) {
@@ -2099,7 +2099,7 @@ static int omap_sham_probe(struct platform_device *pdev)
 
 	INIT_LIST_HEAD(&dd->list);
 	spin_lock_init(&dd->lock);
-	tasklet_init(&dd->done_task, omap_sham_done_task, (unsigned long)dd);
+	tasklet_setup(&dd->done_task, omap_sham_done_task);
 	crypto_init_queue(&dd->queue, OMAP_SHAM_QUEUE_LENGTH);
 
 	err = (dev->of_node) ? omap_sham_get_res_of(dd, dev, &res) :
drivers/crypto/picoxcell_crypto.c +3 -4
index 3cbefb41b099..0a4d600f1731 100644
@@ -1142,9 +1142,9 @@ static int spacc_req_submit(struct spacc_req *req)
 		return spacc_ablk_submit(req);
 }
 
-static void spacc_spacc_complete(unsigned long data)
+static void spacc_spacc_complete(struct tasklet_struct *t)
 {
-	struct spacc_engine *engine = (struct spacc_engine *)data;
+	struct spacc_engine *engine = from_tasklet(engine, t, complete);
 	struct spacc_req *req, *tmp;
 	unsigned long flags;
 	LIST_HEAD(completed);
@@ -1712,8 +1712,7 @@ static int spacc_probe(struct platform_device *pdev)
 	INIT_LIST_HEAD(&engine->completed);
 	INIT_LIST_HEAD(&engine->in_progress);
 	engine->in_flight = 0;
-	tasklet_init(&engine->complete, spacc_spacc_complete,
-		     (unsigned long)engine);
+	tasklet_setup(&engine->complete, spacc_spacc_complete);
 
 	platform_set_drvdata(pdev, engine);
 
drivers/crypto/qat/qat_common/adf_isr.c +2 -3
index cd1cdf5305bc..75c85b46062d 100644
@@ -283,9 +283,8 @@ static int adf_setup_bh(struct adf_accel_dev *accel_dev)
 	int i;
 
 	for (i = 0; i < hw_data->num_banks; i++)
-		tasklet_init(&priv_data->banks[i].resp_handler,
-			     adf_response_handler,
-			     (unsigned long)&priv_data->banks[i]);
+		tasklet_setup(&priv_data->banks[i].resp_handler,
+			      adf_response_handler);
 	return 0;
 }
 
drivers/crypto/qat/qat_common/adf_sriov.c +3 -5
index b36d8653b1ba..e7cdeb57f726 100644
@@ -93,9 +93,9 @@ static void adf_iov_send_resp(struct work_struct *work)
 	kfree(pf2vf_resp);
 }
 
-static void adf_vf2pf_bh_handler(void *data)
+static void adf_vf2pf_bh_handler(struct tasklet_struct *t)
 {
-	struct adf_accel_vf_info *vf_info = (struct adf_accel_vf_info *)data;
+	struct adf_accel_vf_info *vf_info = from_tasklet(vf_info, t, vf2pf_bh_tasklet);
 	struct adf_pf2vf_resp *pf2vf_resp;
 
 	pf2vf_resp = kzalloc(sizeof(*pf2vf_resp), GFP_ATOMIC);
@@ -125,9 +125,7 @@ static int adf_enable_sriov(struct adf_accel_dev *accel_dev)
 		vf_info->accel_dev = accel_dev;
 		vf_info->vf_nr = i;
 
-		tasklet_init(&vf_info->vf2pf_bh_tasklet,
-			     (void *)adf_vf2pf_bh_handler,
-			     (unsigned long)vf_info);
+		tasklet_setup(&vf_info->vf2pf_bh_tasklet, adf_vf2pf_bh_handler);
 		mutex_init(&vf_info->pf2vf_lock);
 		ratelimit_state_init(&vf_info->vf2pf_ratelimit,
 				     DEFAULT_RATELIMIT_INTERVAL,
drivers/crypto/qat/qat_common/adf_transport.c +2 -2
index 2136cbe4bf6c..52f7bd30848b 100644
@@ -341,9 +341,9 @@ static void adf_ring_response_handler(struct adf_etr_bank_data *bank)
 	}
 }
 
-void adf_response_handler(uintptr_t bank_addr)
+void adf_response_handler(struct tasklet_struct *t)
 {
-	struct adf_etr_bank_data *bank = (void *)bank_addr;
+	struct adf_etr_bank_data *bank = from_tasklet(bank, t, resp_handler);
 
 	/* Handle all the responses and reenable IRQs */
 	adf_ring_response_handler(bank);
drivers/crypto/qat/qat_common/adf_transport_internal.h +1 -1
index bb883368ac01..5caaf001e44f 100644
@@ -91,7 +91,7 @@ struct adf_etr_data {
 	struct dentry *debug;
 };
 
-void adf_response_handler(uintptr_t bank_addr);
+void adf_response_handler(struct tasklet_struct *t);
 #ifdef CONFIG_DEBUG_FS
 #include <linux/debugfs.h>
 int adf_bank_debugfs_add(struct adf_etr_bank_data *bank);
drivers/crypto/qat/qat_common/adf_vf_isr.c +5 -6
index 4a73fc70f7a9..2ea5523dce66 100644
@@ -112,9 +112,10 @@ static void adf_dev_stop_async(struct work_struct *work)
 	kfree(stop_data);
 }
 
-static void adf_pf2vf_bh_handler(void *data)
+static void adf_pf2vf_bh_handler(struct tasklet_struct *t)
 {
-	struct adf_accel_dev *accel_dev = data;
+	struct adf_accel_dev *accel_dev = from_tasklet(accel_dev, t,
+					  vf.pf2vf_bh_tasklet);
 	struct adf_hw_device_data *hw_data = accel_dev->hw_device;
 	struct adf_bar *pmisc =
 			&GET_BARS(accel_dev)[hw_data->get_misc_bar_id(hw_data)];
@@ -182,8 +183,7 @@ static void adf_pf2vf_bh_handler(void *data)
 
 static int adf_setup_pf2vf_bh(struct adf_accel_dev *accel_dev)
 {
-	tasklet_init(&accel_dev->vf.pf2vf_bh_tasklet,
-		     (void *)adf_pf2vf_bh_handler, (unsigned long)accel_dev);
+	tasklet_setup(&accel_dev->vf.pf2vf_bh_tasklet, adf_pf2vf_bh_handler);
 
 	mutex_init(&accel_dev->vf.vf2pf_lock);
 	return 0;
@@ -259,8 +259,7 @@ static int adf_setup_bh(struct adf_accel_dev *accel_dev)
 {
 	struct adf_etr_data *priv_data = accel_dev->transport;
 
-	tasklet_init(&priv_data->banks[0].resp_handler, adf_response_handler,
-		     (unsigned long)priv_data->banks);
+	tasklet_setup(&priv_data->banks[0].resp_handler, adf_response_handler);
 	return 0;
 }
 
drivers/crypto/qce/core.c +3 -4
index 08d4ce3bfddf..ada8538e3d2e 100644
@@ -112,9 +112,9 @@ static int qce_handle_queue(struct qce_device *qce,
 	return ret;
 }
 
-static void qce_tasklet_req_done(unsigned long data)
+static void qce_tasklet_req_done(struct tasklet_struct *t)
 {
-	struct qce_device *qce = (struct qce_device *)data;
+	struct qce_device *qce = from_tasklet(qce, t, done_tasklet);
 	struct crypto_async_request *req;
 	unsigned long flags;
 
@@ -217,8 +217,7 @@ static int qce_crypto_probe(struct platform_device *pdev)
 		goto err_clks;
 
 	spin_lock_init(&qce->lock);
-	tasklet_init(&qce->done_tasklet, qce_tasklet_req_done,
-		     (unsigned long)qce);
+	tasklet_setup(&qce->done_tasklet, qce_tasklet_req_done);
 	crypto_init_queue(&qce->queue, QCE_QUEUE_LENGTH);
 
 	qce->async_req_enqueue = qce_async_request_enqueue;
drivers/crypto/rockchip/rk3288_crypto.c +6 -8
index e5714ef24bf2..e1bd1f4f3e72 100644
@@ -200,9 +200,9 @@ static int rk_crypto_enqueue(struct rk_crypto_info *dev,
 	return ret;
 }
 
-static void rk_crypto_queue_task_cb(unsigned long data)
+static void rk_crypto_queue_task_cb(struct tasklet_struct *t)
 {
-	struct rk_crypto_info *dev = (struct rk_crypto_info *)data;
+	struct rk_crypto_info *dev = from_tasklet(dev, t, queue_task);
 	struct crypto_async_request *async_req, *backlog;
 	unsigned long flags;
 	int err = 0;
@@ -230,9 +230,9 @@ static void rk_crypto_queue_task_cb(unsigned long data)
 		dev->complete(dev->async_req, err);
 }
 
-static void rk_crypto_done_task_cb(unsigned long data)
+static void rk_crypto_done_task_cb(struct tasklet_struct *t)
 {
-	struct rk_crypto_info *dev = (struct rk_crypto_info *)data;
+	struct rk_crypto_info *dev = from_tasklet(dev, t, done_task);
 
 	if (dev->err) {
 		dev->complete(dev->async_req, dev->err);
@@ -388,10 +388,8 @@ static int rk_crypto_probe(struct platform_device *pdev)
 	crypto_info->dev = &pdev->dev;
 	platform_set_drvdata(pdev, crypto_info);
 
-	tasklet_init(&crypto_info->queue_task,
-		     rk_crypto_queue_task_cb, (unsigned long)crypto_info);
-	tasklet_init(&crypto_info->done_task,
-		     rk_crypto_done_task_cb, (unsigned long)crypto_info);
+	tasklet_setup(&crypto_info->queue_task, rk_crypto_queue_task_cb);
+	tasklet_setup(&crypto_info->done_task, rk_crypto_done_task_cb);
 	crypto_init_queue(&crypto_info->queue, 50);
 
 	crypto_info->enable_clk = rk_crypto_enable_clk;
drivers/crypto/s5p-sss.c +6 -7
index 010f1bb20dad..d4a31bb08c97 100644
@@ -1443,9 +1443,9 @@ static int s5p_hash_handle_queue(struct s5p_aes_dev *dd,
  * s5p_hash_tasklet_cb() - hash tasklet
  * @data:	ptr to s5p_aes_dev
  */
-static void s5p_hash_tasklet_cb(unsigned long data)
+static void s5p_hash_tasklet_cb(struct tasklet_struct *t)
 {
-	struct s5p_aes_dev *dd = (struct s5p_aes_dev *)data;
+	struct s5p_aes_dev *dd = from_tasklet(dd, t, hash_tasklet);
 
 	if (!test_bit(HASH_FLAGS_BUSY, &dd->hash_flags)) {
 		s5p_hash_handle_queue(dd, NULL);
@@ -2000,9 +2000,9 @@ static void s5p_aes_crypt_start(struct s5p_aes_dev *dev, unsigned long mode)
 	s5p_aes_complete(req, err);
 }
 
-static void s5p_tasklet_cb(unsigned long data)
+static void s5p_tasklet_cb(struct tasklet_struct *t)
 {
-	struct s5p_aes_dev *dev = (struct s5p_aes_dev *)data;
+	struct s5p_aes_dev *dev = from_tasklet(dev, t, tasklet);
 	struct crypto_async_request *async_req, *backlog;
 	struct s5p_aes_reqctx *reqctx;
 	unsigned long flags;
@@ -2293,7 +2293,7 @@ static int s5p_aes_probe(struct platform_device *pdev)
 	platform_set_drvdata(pdev, pdata);
 	s5p_dev = pdata;
 
-	tasklet_init(&pdata->tasklet, s5p_tasklet_cb, (unsigned long)pdata);
+	tasklet_setup(&pdata->tasklet, s5p_tasklet_cb);
 	crypto_init_queue(&pdata->queue, CRYPTO_QUEUE_LEN);
 
 	for (i = 0; i < ARRAY_SIZE(algs); i++) {
@@ -2303,8 +2303,7 @@ static int s5p_aes_probe(struct platform_device *pdev)
 	}
 
 	if (pdata->use_hash) {
-		tasklet_init(&pdata->hash_tasklet, s5p_hash_tasklet_cb,
-			     (unsigned long)pdata);
+		tasklet_setup(&pdata->hash_tasklet, s5p_hash_tasklet_cb);
 		crypto_init_queue(&pdata->hash_queue, SSS_HASH_QUEUE_LENGTH);
 
 		for (hash_i = 0; hash_i < ARRAY_SIZE(algs_sha1_md5_sha256);
drivers/crypto/talitos.c +19 -23

73 lines not on this page · raw message

drivers/dma/altera-msgdma.c +3 -3
index 832aefbe7af9..6ce616c6b51d 100644
@@ -678,9 +678,9 @@ static int msgdma_alloc_chan_resources(struct dma_chan *dchan)
  * msgdma_tasklet - Schedule completion tasklet
  * @data: Pointer to the Altera sSGDMA channel structure
  */
-static void msgdma_tasklet(unsigned long data)
+static void msgdma_tasklet(struct tasklet_struct *t)
 {
-	struct msgdma_device *mdev = (struct msgdma_device *)data;
+	struct msgdma_device *mdev = from_tasklet(mdev, t, irq_tasklet);
 	u32 count;
 	u32 __maybe_unused size;
 	u32 __maybe_unused status;
@@ -828,7 +828,7 @@ static int msgdma_probe(struct platform_device *pdev)
 	if (ret)
 		return ret;
 
-	tasklet_init(&mdev->irq_tasklet, msgdma_tasklet, (unsigned long)mdev);
+	tasklet_setup(&mdev->irq_tasklet, msgdma_tasklet);
 
 	dma_cookie_init(&mdev->dmachan);
 
drivers/dma/at_hdmac.c +3 -4
index 672c73b4a2d4..e09e8fd1cec1 100644
@@ -597,9 +597,9 @@ static void atc_handle_cyclic(struct at_dma_chan *atchan)
 
 /*--  IRQ & Tasklet  ---------------------------------------------------*/
 
-static void atc_tasklet(unsigned long data)
+static void atc_tasklet(struct tasklet_struct *t)
 {
-	struct at_dma_chan *atchan = (struct at_dma_chan *)data;
+	struct at_dma_chan *atchan = from_tasklet(atchan, t, tasklet);
 	unsigned long flags;
 
 	spin_lock_irqsave(&atchan->lock, flags);
@@ -1902,8 +1902,7 @@ static int __init at_dma_probe(struct platform_device *pdev)
 		INIT_LIST_HEAD(&atchan->queue);
 		INIT_LIST_HEAD(&atchan->free_list);
 
-		tasklet_init(&atchan->tasklet, atc_tasklet,
-				(unsigned long)atchan);
+		tasklet_setup(&atchan->tasklet, atc_tasklet);
 		atc_enable_chan_irq(atdma, i);
 	}
 
drivers/dma/at_xdmac.c +3 -4
index b58ac720d9a1..a1ef35174f35 100644
@@ -1618,9 +1618,9 @@ static void at_xdmac_handle_error(struct at_xdmac_chan *atchan)
 	/* Then continue with usual descriptor management */
 }
 
-static void at_xdmac_tasklet(unsigned long data)
+static void at_xdmac_tasklet(struct tasklet_struct *t)
 {
-	struct at_xdmac_chan	*atchan = (struct at_xdmac_chan *)data;
+	struct at_xdmac_chan *atchan = from_tasklet(atchan, t, tasklet);
 	struct at_xdmac_desc	*desc;
 	u32			error_mask;
 
@@ -2076,8 +2076,7 @@ static int at_xdmac_probe(struct platform_device *pdev)
 		spin_lock_init(&atchan->lock);
 		INIT_LIST_HEAD(&atchan->xfers_list);
 		INIT_LIST_HEAD(&atchan->free_descs_list);
-		tasklet_init(&atchan->tasklet, at_xdmac_tasklet,
-			     (unsigned long)atchan);
+		tasklet_setup(&atchan->tasklet, at_xdmac_tasklet);
 
 		/* Clear pending interrupts. */
 		while (at_xdmac_chan_read(atchan, AT_XDMAC_CIS))
drivers/dma/coh901318.c +3 -4
index e51d836afcc7..90490ddc2e1e 100644
@@ -1868,9 +1868,9 @@ static struct coh901318_desc *coh901318_queue_start(struct coh901318_chan *cohc)
  * This tasklet is called from the interrupt handler to
  * handle each descriptor (DMA job) that is sent to a channel.
  */
-static void dma_tasklet(unsigned long data)
+static void dma_tasklet(struct tasklet_struct *t)
 {
-	struct coh901318_chan *cohc = (struct coh901318_chan *) data;
+	struct coh901318_chan *cohc = from_tasklet(cohc, t, tasklet);
 	struct coh901318_desc *cohd_fin;
 	unsigned long flags;
 	struct dmaengine_desc_callback cb;
@@ -2619,8 +2619,7 @@ static void coh901318_base_init(struct dma_device *dma, const int *pick_chans,
 			INIT_LIST_HEAD(&cohc->active);
 			INIT_LIST_HEAD(&cohc->queue);
 
-			tasklet_init(&cohc->tasklet, dma_tasklet,
-				     (unsigned long) cohc);
+			tasklet_setup(&cohc->tasklet, dma_tasklet);
 
 			list_add_tail(&cohc->chan.device_node,
 				      &dma->channels);
drivers/dma/dw/core.c +3 -3
index 21cb2a58dbd2..4feb97fe1b9d 100644
@@ -468,9 +468,9 @@ static void dwc_handle_error(struct dw_dma *dw, struct dw_dma_chan *dwc)
 	dwc_descriptor_complete(dwc, bad_desc, true);
 }
 
-static void dw_dma_tasklet(unsigned long data)
+static void dw_dma_tasklet(struct tasklet_struct *t)
 {
-	struct dw_dma *dw = (struct dw_dma *)data;
+	struct dw_dma *dw = from_tasklet(dw, t, tasklet);
 	struct dw_dma_chan *dwc;
 	u32 status_xfer;
 	u32 status_err;
@@ -1126,7 +1126,7 @@ int do_dma_probe(struct dw_dma_chip *chip)
 		goto err_pdata;
 	}
 
-	tasklet_init(&dw->tasklet, dw_dma_tasklet, (unsigned long)dw);
+	tasklet_setup(&dw->tasklet, dw_dma_tasklet);
 
 	err = request_irq(chip->irq, dw_dma_interrupt, IRQF_SHARED,
 			  dw->name, dw);
drivers/dma/ep93xx_dma.c +3 -4
index 9c8b4d35cf03..b7f81921d419 100644
@@ -743,9 +743,9 @@ static void ep93xx_dma_advance_work(struct ep93xx_dma_chan *edmac)
 	spin_unlock_irqrestore(&edmac->lock, flags);
 }
 
-static void ep93xx_dma_tasklet(unsigned long data)
+static void ep93xx_dma_tasklet(struct tasklet_struct *t)
 {
-	struct ep93xx_dma_chan *edmac = (struct ep93xx_dma_chan *)data;
+	struct ep93xx_dma_chan *edmac = from_tasklet(edmac, t, tasklet);
 	struct ep93xx_dma_desc *desc, *d;
 	struct dmaengine_desc_callback cb;
 	LIST_HEAD(list);
@@ -1351,8 +1351,7 @@ static int __init ep93xx_dma_probe(struct platform_device *pdev)
 		INIT_LIST_HEAD(&edmac->active);
 		INIT_LIST_HEAD(&edmac->queue);
 		INIT_LIST_HEAD(&edmac->free_list);
-		tasklet_init(&edmac->tasklet, ep93xx_dma_tasklet,
-			     (unsigned long)edmac);
+		tasklet_setup(&edmac->tasklet, ep93xx_dma_tasklet);
 
 		list_add_tail(&edmac->chan.device_node,
 			      &dma_dev->channels);
drivers/dma/fsl_raid.c +3 -5
index 493dc6c59d1d..fdf3500d96a9 100644
@@ -154,17 +154,15 @@ static void fsl_re_cleanup_descs(struct fsl_re_chan *re_chan)
 	fsl_re_issue_pending(&re_chan->chan);
 }
 
-static void fsl_re_dequeue(unsigned long data)
+static void fsl_re_dequeue(struct tasklet_struct *t)
 {
-	struct fsl_re_chan *re_chan;
+	struct fsl_re_chan *re_chan = from_tasklet(re_chan, t, irqtask);
 	struct fsl_re_desc *desc, *_desc;
 	struct fsl_re_hw_desc *hwdesc;
 	unsigned long flags;
 	unsigned int count, oub_count;
 	int found;
 
-	re_chan = dev_get_drvdata((struct device *)data);
-
 	fsl_re_cleanup_descs(re_chan);
 
 	spin_lock_irqsave(&re_chan->desc_lock, flags);
@@ -671,7 +669,7 @@ static int fsl_re_chan_probe(struct platform_device *ofdev,
 	snprintf(chan->name, sizeof(chan->name), "re_jr%02d", q);
 
 	chandev = &chan_ofdev->dev;
-	tasklet_init(&chan->irqtask, fsl_re_dequeue, (unsigned long)chandev);
+	tasklet_setup(&chan->irqtask, fsl_re_dequeue);
 
 	ret = request_irq(chan->irq, fsl_re_isr, 0, chan->name, chandev);
 	if (ret) {
drivers/dma/fsldma.c +3 -3
index ad72b3f42ffa..3ce9cf3d62f5 100644
@@ -976,9 +976,9 @@ static irqreturn_t fsldma_chan_irq(int irq, void *data)
 	return IRQ_HANDLED;
 }
 
-static void dma_do_tasklet(unsigned long data)
+static void dma_do_tasklet(struct tasklet_struct *t)
 {
-	struct fsldma_chan *chan = (struct fsldma_chan *)data;
+	struct fsldma_chan *chan = from_tasklet(chan, t, tasklet);
 
 	chan_dbg(chan, "tasklet entry\n");
 
@@ -1151,7 +1151,7 @@ static int fsl_dma_chan_probe(struct fsldma_device *fdev,
 	}
 
 	fdev->chan[chan->id] = chan;
-	tasklet_init(&chan->tasklet, dma_do_tasklet, (unsigned long)chan);
+	tasklet_setup(&chan->tasklet, dma_do_tasklet);
 	snprintf(chan->name, sizeof(chan->name), "chan%d", chan->id);
 
 	/* Initialize the channel */
drivers/dma/imx-dma.c +3 -4
index 5c0fb3134825..67b9f2bf35b7 100644
@@ -613,9 +613,9 @@ static int imxdma_xfer_desc(struct imxdma_desc *d)
 	return 0;
 }
 
-static void imxdma_tasklet(unsigned long data)
+static void imxdma_tasklet(struct tasklet_struct *t)
 {
-	struct imxdma_channel *imxdmac = (void *)data;
+	struct imxdma_channel *imxdmac = from_tasklet(imxdmac, t, dma_tasklet);
 	struct imxdma_engine *imxdma = imxdmac->imxdma;
 	struct imxdma_desc *desc, *next_desc;
 	unsigned long flags;
@@ -1169,8 +1169,7 @@ static int __init imxdma_probe(struct platform_device *pdev)
 		INIT_LIST_HEAD(&imxdmac->ld_free);
 		INIT_LIST_HEAD(&imxdmac->ld_active);
 
-		tasklet_init(&imxdmac->dma_tasklet, imxdma_tasklet,
-			     (unsigned long)imxdmac);
+		tasklet_setup(&imxdmac->dma_tasklet, imxdma_tasklet);
 		imxdmac->chan.device = &imxdma->dma_device;
 		dma_cookie_init(&imxdmac->chan);
 		imxdmac->channel = i;
drivers/dma/ioat/dma.c +3 -3
index 1a422a8b43cf..4c7c2d819ce7 100644
@@ -153,7 +153,7 @@ void ioat_stop(struct ioatdma_chan *ioat_chan)
 	tasklet_kill(&ioat_chan->cleanup_task);
 
 	/* final cleanup now that everything is quiesced and can't re-arm */
-	ioat_cleanup_event((unsigned long)&ioat_chan->dma_chan);
+	ioat_cleanup_event(&ioat_chan->cleanup_task);
 }
 
 static void __ioat_issue_pending(struct ioatdma_chan *ioat_chan)
@@ -674,9 +674,9 @@ static void ioat_cleanup(struct ioatdma_chan *ioat_chan)
 	spin_unlock_bh(&ioat_chan->cleanup_lock);
 }
 
-void ioat_cleanup_event(unsigned long data)
+void ioat_cleanup_event(struct tasklet_struct *t)
 {
-	struct ioatdma_chan *ioat_chan = to_ioat_chan((void *)data);
+	struct ioatdma_chan *ioat_chan = from_tasklet(ioat_chan, t, cleanup_task);
 
 	ioat_cleanup(ioat_chan);
 	if (!test_bit(IOAT_RUN, &ioat_chan->state))
drivers/dma/ioat/dma.h +1 -1
index b8e8e0b9693c..c1bafbfa38c2 100644
@@ -393,7 +393,7 @@ int ioat_reset_hw(struct ioatdma_chan *ioat_chan);
 enum dma_status
 ioat_tx_status(struct dma_chan *c, dma_cookie_t cookie,
 		struct dma_tx_state *txstate);
-void ioat_cleanup_event(unsigned long data);
+void ioat_cleanup_event(struct tasklet_struct *t);
 void ioat_timer_event(struct timer_list *t);
 int ioat_check_space_lock(struct ioatdma_chan *ioat_chan, int num_descs);
 void ioat_issue_pending(struct dma_chan *chan);
drivers/dma/ioat/init.c +1 -1
index a6a6dc432db8..63cc6e2cc92d 100644
@@ -778,7 +778,7 @@ ioat_init_channel(struct ioatdma_device *ioat_dma,
 	list_add_tail(&ioat_chan->dma_chan.device_node, &dma->channels);
 	ioat_dma->idx[idx] = ioat_chan;
 	timer_setup(&ioat_chan->timer, ioat_timer_event, 0);
-	tasklet_init(&ioat_chan->cleanup_task, ioat_cleanup_event, data);
+	tasklet_setup(&ioat_chan->cleanup_task, ioat_cleanup_event);
 }
 
 #define IOAT_NUM_SRC_TEST 6 /* must be <= 8 */
drivers/dma/iop-adma.c +4 -4
index a3f942a6a946..f6bb76428153 100644
@@ -238,9 +238,10 @@ iop_adma_slot_cleanup(struct iop_adma_chan *iop_chan)
 	spin_unlock_bh(&iop_chan->lock);
 }
 
-static void iop_adma_tasklet(unsigned long data)
+static void iop_adma_tasklet(struct tasklet_struct *t)
 {
-	struct iop_adma_chan *iop_chan = (struct iop_adma_chan *) data;
+	struct iop_adma_chan *iop_chan = from_tasklet(iop_chan, t,
+						      irq_tasklet);
 
 	/* lockdep will flag depedency submissions as potentially
 	 * recursive locking, this is not the case as a dependency
@@ -1352,8 +1353,7 @@ static int iop_adma_probe(struct platform_device *pdev)
 		ret = -ENOMEM;
 		goto err_free_iop_chan;
 	}
-	tasklet_init(&iop_chan->irq_tasklet, iop_adma_tasklet, (unsigned long)
-		iop_chan);
+	tasklet_setup(&iop_chan->irq_tasklet, iop_adma_tasklet);
 
 	/* clear errors before enabling interrupts */
 	iop_adma_device_clear_err_status(iop_chan);
drivers/dma/ipu/ipu_idmac.c +3 -3
index 0457b1f26540..38036db284cb 100644
@@ -1299,9 +1299,9 @@ static irqreturn_t idmac_interrupt(int irq, void *dev_id)
 	return IRQ_HANDLED;
 }
 
-static void ipu_gc_tasklet(unsigned long arg)
+static void ipu_gc_tasklet(struct tasklet_struct *t)
 {
-	struct ipu *ipu = (struct ipu *)arg;
+	struct ipu *ipu = from_tasklet(ipu, t, tasklet);
 	int i;
 
 	for (i = 0; i < IPU_CHANNELS_NUM; i++) {
@@ -1740,7 +1740,7 @@ static int __init ipu_probe(struct platform_device *pdev)
 	if (ret < 0)
 		goto err_idmac_init;
 
-	tasklet_init(&ipu_data.tasklet, ipu_gc_tasklet, (unsigned long)&ipu_data);
+	tasklet_setup(&ipu_data.tasklet, ipu_gc_tasklet);
 
 	ipu_data.dev = &pdev->dev;
 
drivers/dma/k3dma.c +3 -3
index 4b36c8810517..43d6162429c7 100644
@@ -291,9 +291,9 @@ static int k3_dma_start_txd(struct k3_dma_chan *c)
 	return -EAGAIN;
 }
 
-static void k3_dma_tasklet(unsigned long arg)
+static void k3_dma_tasklet(struct tasklet_struct *t)
 {
-	struct k3_dma_dev *d = (struct k3_dma_dev *)arg;
+	struct k3_dma_dev *d = from_tasklet(d, t, task);
 	struct k3_dma_phy *p;
 	struct k3_dma_chan *c, *cn;
 	unsigned pch, pch_alloc = 0;
@@ -961,7 +961,7 @@ static int k3_dma_probe(struct platform_device *op)
 
 	spin_lock_init(&d->lock);
 	INIT_LIST_HEAD(&d->chan_pending);
-	tasklet_init(&d->task, k3_dma_tasklet, (unsigned long)d);
+	tasklet_setup(&d->task, k3_dma_tasklet);
 	platform_set_drvdata(op, d);
 	dev_info(&op->dev, "initialized\n");
 
drivers/dma/mediatek/mtk-cqdma.c +3 -4
index 723b11c190b3..bcdfc81eb163 100644
@@ -356,9 +356,9 @@ static struct mtk_cqdma_vdesc
 	return ret;
 }
 
-static void mtk_cqdma_tasklet_cb(unsigned long data)
+static void mtk_cqdma_tasklet_cb(struct tasklet_struct *t)
 {
-	struct mtk_cqdma_pchan *pc = (struct mtk_cqdma_pchan *)data;
+	struct mtk_cqdma_pchan *pc = from_tasklet(pc, t, tasklet);
 	struct mtk_cqdma_vdesc *cvd = NULL;
 	unsigned long flags;
 
@@ -886,8 +886,7 @@ static int mtk_cqdma_probe(struct platform_device *pdev)
 
 	/* initialize tasklet for each PC */
 	for (i = 0; i < cqdma->dma_channels; ++i)
-		tasklet_init(&cqdma->pc[i]->tasklet, mtk_cqdma_tasklet_cb,
-			     (unsigned long)cqdma->pc[i]);
+		tasklet_setup(&cqdma->pc[i]->tasklet, mtk_cqdma_tasklet_cb);
 
 	dev_info(&pdev->dev, "MediaTek CQDMA driver registered\n");
 
drivers/dma/mmp_pdma.c +3 -3
index 7fe494fc50d4..545434654130 100644
@@ -873,9 +873,9 @@ static void mmp_pdma_issue_pending(struct dma_chan *dchan)
  * Do call back
  * Start pending list
  */
-static void dma_do_tasklet(unsigned long data)
+static void dma_do_tasklet(struct tasklet_struct *t)
 {
-	struct mmp_pdma_chan *chan = (struct mmp_pdma_chan *)data;
+	struct mmp_pdma_chan *chan = from_tasklet(chan, t, tasklet);
 	struct mmp_pdma_desc_sw *desc, *_desc;
 	LIST_HEAD(chain_cleanup);
 	unsigned long flags;
@@ -991,7 +991,7 @@ static int mmp_pdma_chan_init(struct mmp_pdma_device *pdev, int idx, int irq)
 	spin_lock_init(&chan->desc_lock);
 	chan->dev = pdev->dev;
 	chan->chan.device = &pdev->device;
-	tasklet_init(&chan->tasklet, dma_do_tasklet, (unsigned long)chan);
+	tasklet_setup(&chan->tasklet, dma_do_tasklet);
 	INIT_LIST_HEAD(&chan->chain_pending);
 	INIT_LIST_HEAD(&chan->chain_running);
 
drivers/dma/mmp_tdma.c +3 -3
index e7d1e12bf464..db8e822eb32e 100644
@@ -346,9 +346,9 @@ static irqreturn_t mmp_tdma_int_handler(int irq, void *dev_id)
 		return IRQ_NONE;
 }
 
-static void dma_do_tasklet(unsigned long data)
+static void dma_do_tasklet(struct tasklet_struct *t)
 {
-	struct mmp_tdma_chan *tdmac = (struct mmp_tdma_chan *)data;
+	struct mmp_tdma_chan *tdmac = from_tasklet(tdmac, t, tasklet);
 
 	dmaengine_desc_get_callback_invoke(&tdmac->desc, NULL);
 }
@@ -573,7 +573,7 @@ static int mmp_tdma_chan_init(struct mmp_tdma_device *tdev,
 	tdmac->pool	   = pool;
 	tdmac->status = DMA_COMPLETE;
 	tdev->tdmac[tdmac->idx] = tdmac;
-	tasklet_init(&tdmac->tasklet, dma_do_tasklet, (unsigned long)tdmac);
+	tasklet_setup(&tdmac->tasklet, dma_do_tasklet);
 
 	/* add the channel to tdma_chan list */
 	list_add_tail(&tdmac->chan.device_node,
drivers/dma/mpc512x_dma.c +3 -3
index dc2cae7bcf69..c1a69149c8bf 100644
@@ -414,9 +414,9 @@ static void mpc_dma_process_completed(struct mpc_dma *mdma)
 }
 
 /* DMA Tasklet */
-static void mpc_dma_tasklet(unsigned long data)
+static void mpc_dma_tasklet(struct tasklet_struct *t)
 {
-	struct mpc_dma *mdma = (void *)data;
+	struct mpc_dma *mdma = from_tasklet(mdma, t, tasklet);
 	unsigned long flags;
 	uint es;
 
@@ -1009,7 +1009,7 @@ static int mpc_dma_probe(struct platform_device *op)
 		list_add_tail(&mchan->chan.device_node, &dma->channels);
 	}
 
-	tasklet_init(&mdma->tasklet, mpc_dma_tasklet, (unsigned long)mdma);
+	tasklet_setup(&mdma->tasklet, mpc_dma_tasklet);
 
 	/*
 	 * Configure DMA Engine:
drivers/dma/mv_xor.c +3 -4
index 0ac8e7b34e12..00cd1335eeba 100644
@@ -336,9 +336,9 @@ static void mv_chan_slot_cleanup(struct mv_xor_chan *mv_chan)
 		mv_chan->dmachan.completed_cookie = cookie;
 }
 
-static void mv_xor_tasklet(unsigned long data)
+static void mv_xor_tasklet(struct tasklet_struct *t)
 {
-	struct mv_xor_chan *chan = (struct mv_xor_chan *) data;
+	struct mv_xor_chan *chan = from_tasklet(chan, t, irq_tasklet);
 
 	spin_lock(&chan->lock);
 	mv_chan_slot_cleanup(chan);
@@ -1097,8 +1097,7 @@ mv_xor_channel_add(struct mv_xor_device *xordev,
 
 	mv_chan->mmr_base = xordev->xor_base;
 	mv_chan->mmr_high_base = xordev->xor_high_base;
-	tasklet_init(&mv_chan->irq_tasklet, mv_xor_tasklet, (unsigned long)
-		     mv_chan);
+	tasklet_setup(&mv_chan->irq_tasklet, mv_xor_tasklet);
 
 	/* clear errors before enabling interrupts */
 	mv_chan_clear_err_status(mv_chan);
drivers/dma/mv_xor_v2.c +4 -4
index e3850f04f676..a8b74cbe0371 100644
@@ -549,9 +549,10 @@ int mv_xor_v2_get_pending_params(struct mv_xor_v2_device *xor_dev,
 /*
  * handle the descriptors after HW process
  */
-static void mv_xor_v2_tasklet(unsigned long data)
+static void mv_xor_v2_tasklet(struct tasklet_struct *t)
 {
-	struct mv_xor_v2_device *xor_dev = (struct mv_xor_v2_device *) data;
+	struct mv_xor_v2_device *xor_dev = from_tasklet(xor_dev, t,
+							irq_tasklet);
 	int pending_ptr, num_of_pending, i;
 	struct mv_xor_v2_sw_desc *next_pending_sw_desc = NULL;
 
@@ -776,8 +777,7 @@ static int mv_xor_v2_probe(struct platform_device *pdev)
 	if (ret)
 		goto free_msi_irqs;
 
-	tasklet_init(&xor_dev->irq_tasklet, mv_xor_v2_tasklet,
-		     (unsigned long) xor_dev);
+	tasklet_setup(&xor_dev->irq_tasklet, mv_xor_v2_tasklet);
 
 	xor_dev->desc_size = mv_xor_v2_set_desc_size(xor_dev);
 
drivers/dma/mxs-dma.c +3 -4
index 3039bba0e4d5..6f296a137543 100644
@@ -320,9 +320,9 @@ static dma_cookie_t mxs_dma_tx_submit(struct dma_async_tx_descriptor *tx)
 	return dma_cookie_assign(tx);
 }
 
-static void mxs_dma_tasklet(unsigned long data)
+static void mxs_dma_tasklet(struct tasklet_struct *t)
 {
-	struct mxs_dma_chan *mxs_chan = (struct mxs_dma_chan *) data;
+	struct mxs_dma_chan *mxs_chan = from_tasklet(mxs_chan, t, tasklet);
 
 	dmaengine_desc_get_callback_invoke(&mxs_chan->desc, NULL);
 }
@@ -812,8 +812,7 @@ static int __init mxs_dma_probe(struct platform_device *pdev)
 		mxs_chan->chan.device = &mxs_dma->dma_device;
 		dma_cookie_init(&mxs_chan->chan);
 
-		tasklet_init(&mxs_chan->tasklet, mxs_dma_tasklet,
-			     (unsigned long) mxs_chan);
+		tasklet_setup(&mxs_chan->tasklet, mxs_dma_tasklet);
 
 
 		/* Add the channel to mxs_chan list */
drivers/dma/nbpfaxi.c +3 -3
index 594409a6e975..f6980009d347 100644
@@ -1106,9 +1106,9 @@ static struct dma_chan *nbpf_of_xlate(struct of_phandle_args *dma_spec,
 	return dchan;
 }
 
-static void nbpf_chan_tasklet(unsigned long data)
+static void nbpf_chan_tasklet(struct tasklet_struct *t)
 {
-	struct nbpf_channel *chan = (struct nbpf_channel *)data;
+	struct nbpf_channel *chan = from_tasklet(chan, t, tasklet);
 	struct nbpf_desc *desc, *tmp;
 	struct dmaengine_desc_callback cb;
 
@@ -1253,7 +1253,7 @@ static int nbpf_chan_probe(struct nbpf_device *nbpf, int n)
 
 	snprintf(chan->name, sizeof(chan->name), "nbpf %d", n);
 
-	tasklet_init(&chan->tasklet, nbpf_chan_tasklet, (unsigned long)chan);
+	tasklet_setup(&chan->tasklet, nbpf_chan_tasklet);
 	ret = devm_request_irq(dma_dev->dev, chan->irq,
 			nbpf_chan_irq, IRQF_SHARED,
 			chan->name, chan);
drivers/dma/pch_dma.c +3 -4
index 581e7a290d98..75660beae932 100644
@@ -670,9 +670,9 @@ static int pd_device_terminate_all(struct dma_chan *chan)
 	return 0;
 }
 
-static void pdc_tasklet(unsigned long data)
+static void pdc_tasklet(struct tasklet_struct *t)
 {
-	struct pch_dma_chan *pd_chan = (struct pch_dma_chan *)data;
+	struct pch_dma_chan *pd_chan = from_tasklet(pd_chan, t, tasklet);
 	unsigned long flags;
 
 	if (!pdc_is_idle(pd_chan)) {
@@ -898,8 +898,7 @@ static int pch_dma_probe(struct pci_dev *pdev,
 		INIT_LIST_HEAD(&pd_chan->queue);
 		INIT_LIST_HEAD(&pd_chan->free_list);
 
-		tasklet_init(&pd_chan->tasklet, pdc_tasklet,
-			     (unsigned long)pd_chan);
+		tasklet_setup(&pd_chan->tasklet, pdc_tasklet);
 		list_add_tail(&pd_chan->chan.device_node, &pd->dma.channels);
 	}
 
drivers/dma/pl330.c +6 -6
index 6cce9ef61b29..c70ccd46176a 100644
@@ -1565,9 +1565,9 @@ static void dma_pl330_rqcb(struct dma_pl330_desc *desc, enum pl330_op_err err)
 	tasklet_schedule(&pch->task);
 }
 
-static void pl330_dotask(unsigned long data)
+static void pl330_dotask(struct tasklet_struct *t)
 {
-	struct pl330_dmac *pl330 = (struct pl330_dmac *) data;
+	struct pl330_dmac *pl330 = from_tasklet(pl330, t, tasks);
 	unsigned long flags;
 	int i;
 
@@ -1971,7 +1971,7 @@ static int pl330_add(struct pl330_dmac *pl330)
 		return ret;
 	}
 
-	tasklet_init(&pl330->tasks, pl330_dotask, (unsigned long) pl330);
+	tasklet_setup(&pl330->tasks, pl330_dotask);
 
 	pl330->state = INIT;
 
@@ -2054,9 +2054,9 @@ static inline void fill_queue(struct dma_pl330_chan *pch)
 	}
 }
 
-static void pl330_tasklet(unsigned long data)
+static void pl330_tasklet(struct tasklet_struct *t)
 {
-	struct dma_pl330_chan *pch = (struct dma_pl330_chan *)data;
+	struct dma_pl330_chan *pch = from_tasklet(pch, t, task);
 	struct dma_pl330_desc *desc, *_dt;
 	unsigned long flags;
 	bool power_down = false;
@@ -2164,7 +2164,7 @@ static int pl330_alloc_chan_resources(struct dma_chan *chan)
 		return -ENOMEM;
 	}
 
-	tasklet_init(&pch->task, pl330_tasklet, (unsigned long) pch);
+	tasklet_setup(&pch->task, pl330_tasklet);
 
 	spin_unlock_irqrestore(&pl330->lock, flags);
 
drivers/dma/ppc4xx/adma.c +3 -4
index fbabd2e88a18..2c0dc645c447 100644
@@ -1660,9 +1660,9 @@ static void __ppc440spe_adma_slot_cleanup(struct ppc440spe_adma_chan *chan)
 /**
  * ppc440spe_adma_tasklet - clean up watch-dog initiator
  */
-static void ppc440spe_adma_tasklet(unsigned long data)
+static void ppc440spe_adma_tasklet(struct tasklet_struct *t)
 {
-	struct ppc440spe_adma_chan *chan = (struct ppc440spe_adma_chan *) data;
+	struct ppc440spe_adma_chan *chan = from_tasklet(chan, t, irq_tasklet);
 
 	spin_lock_nested(&chan->lock, SINGLE_DEPTH_NESTING);
 	__ppc440spe_adma_slot_cleanup(chan);
@@ -4141,8 +4141,7 @@ static int ppc440spe_adma_probe(struct platform_device *ofdev)
 	chan->common.device = &adev->common;
 	dma_cookie_init(&chan->common);
 	list_add_tail(&chan->common.device_node, &adev->common.channels);
-	tasklet_init(&chan->irq_tasklet, ppc440spe_adma_tasklet,
-		     (unsigned long)chan);
+	tasklet_setup(&chan->irq_tasklet, ppc440spe_adma_tasklet);
 
 	/* allocate and map helper pages for async validation or
 	 * async_mult/async_sum_product operations on DMA0/1.
drivers/dma/qcom/bam_dma.c +3 -3
index 8e90a405939d..38e16d3fd8ec 100644
@@ -1056,9 +1056,9 @@ static void bam_start_dma(struct bam_chan *bchan)
  *
  * Sets up next DMA operation and then processes all completed transactions
  */
-static void dma_tasklet(unsigned long data)
+static void dma_tasklet(struct tasklet_struct *t)
 {
-	struct bam_device *bdev = (struct bam_device *)data;
+	struct bam_device *bdev = from_tasklet(bdev, t, task);
 	struct bam_chan *bchan;
 	unsigned long flags;
 	unsigned int i;
@@ -1274,7 +1274,7 @@ static int bam_dma_probe(struct platform_device *pdev)
 	if (ret)
 		goto err_disable_clk;
 
-	tasklet_init(&bdev->task, dma_tasklet, (unsigned long)bdev);
+	tasklet_setup(&bdev->task, dma_tasklet);
 
 	bdev->channels = devm_kcalloc(bdev->dev, bdev->num_channels,
 				sizeof(*bdev->channels), GFP_KERNEL);
drivers/dma/qcom/hidma.c +3 -3
index 411f91fde734..af575852a6b7 100644
@@ -224,9 +224,9 @@ static int hidma_chan_init(struct hidma_dev *dmadev, u32 dma_sig)
 	return 0;
 }
 
-static void hidma_issue_task(unsigned long arg)
+static void hidma_issue_task(struct tasklet_struct *t)
 {
-	struct hidma_dev *dmadev = (struct hidma_dev *)arg;
+	struct hidma_dev *dmadev = from_tasklet(dmadev, t, task);
 
 	pm_runtime_get_sync(dmadev->ddev.dev);
 	hidma_ll_start(dmadev->lldev);
@@ -885,7 +885,7 @@ static int hidma_probe(struct platform_device *pdev)
 		goto uninit;
 
 	dmadev->irq = chirq;
-	tasklet_init(&dmadev->task, hidma_issue_task, (unsigned long)dmadev);
+	tasklet_setup(&dmadev->task, hidma_issue_task);
 	hidma_debug_init(dmadev);
 	hidma_sysfs_init(dmadev);
 	dev_info(&pdev->dev, "HI-DMA engine driver registration complete\n");
drivers/dma/qcom/hidma_ll.c +3 -3
index bb4471e84e48..53244e0e34a3 100644
@@ -173,9 +173,9 @@ int hidma_ll_request(struct hidma_lldev *lldev, u32 sig, const char *dev_name,
 /*
  * Multiple TREs may be queued and waiting in the pending queue.
  */
-static void hidma_ll_tre_complete(unsigned long arg)
+static void hidma_ll_tre_complete(struct tasklet_struct *t)
 {
-	struct hidma_lldev *lldev = (struct hidma_lldev *)arg;
+	struct hidma_lldev *lldev = from_tasklet(lldev, t, task);
 	struct hidma_tre *tre;
 
 	while (kfifo_out(&lldev->handoff_fifo, &tre, 1)) {
@@ -792,7 +792,7 @@ struct hidma_lldev *hidma_ll_init(struct device *dev, u32 nr_tres,
 		return NULL;
 
 	spin_lock_init(&lldev->lock);
-	tasklet_init(&lldev->task, hidma_ll_tre_complete, (unsigned long)lldev);
+	tasklet_setup(&lldev->task, hidma_ll_tre_complete);
 	lldev->initialized = 1;
 	writel(ENABLE_IRQS, lldev->evca + HIDMA_EVCA_IRQ_EN_REG);
 	return lldev;
drivers/dma/sa11x0-dma.c +3 -3
index afb68055ed1b..d972f63f5736 100644
@@ -323,9 +323,9 @@ static void sa11x0_dma_start_txd(struct sa11x0_dma_chan *c)
 	}
 }
 
-static void sa11x0_dma_tasklet(unsigned long arg)
+static void sa11x0_dma_tasklet(struct tasklet_struct *t)
 {
-	struct sa11x0_dma_dev *d = (struct sa11x0_dma_dev *)arg;
+	struct sa11x0_dma_dev *d = from_tasklet(d, t, task);
 	struct sa11x0_dma_phy *p;
 	struct sa11x0_dma_chan *c;
 	unsigned pch, pch_alloc = 0;
@@ -928,7 +928,7 @@ static int sa11x0_dma_probe(struct platform_device *pdev)
 		goto err_ioremap;
 	}
 
-	tasklet_init(&d->task, sa11x0_dma_tasklet, (unsigned long)d);
+	tasklet_setup(&d->task, sa11x0_dma_tasklet);
 
 	for (i = 0; i < NR_PHY_CHAN; i++) {
 		struct sa11x0_dma_phy *p = &d->phy[i];
drivers/dma/sirf-dma.c +3 -3
index 30064689d67f..a5c2843384fd 100644
@@ -393,9 +393,9 @@ static void sirfsoc_dma_process_completed(struct sirfsoc_dma *sdma)
 }
 
 /* DMA Tasklet */
-static void sirfsoc_dma_tasklet(unsigned long data)
+static void sirfsoc_dma_tasklet(struct tasklet_struct *t)
 {
-	struct sirfsoc_dma *sdma = (void *)data;
+	struct sirfsoc_dma *sdma = from_tasklet(sdma, t, tasklet);
 
 	sirfsoc_dma_process_completed(sdma);
 }
@@ -938,7 +938,7 @@ static int sirfsoc_dma_probe(struct platform_device *op)
 		list_add_tail(&schan->chan.device_node, &dma->channels);
 	}
 
-	tasklet_init(&sdma->tasklet, sirfsoc_dma_tasklet, (unsigned long)sdma);
+	tasklet_setup(&sdma->tasklet, sirfsoc_dma_tasklet);
 
 	/* Register DMA engine */
 	dev_set_drvdata(dev, sdma);
drivers/dma/ste_dma40.c +3 -4
index de8bfd9a76e9..3b684e0ebe13 100644
@@ -1571,9 +1571,9 @@ static void dma_tc_handle(struct d40_chan *d40c)
 
 }
 
-static void dma_tasklet(unsigned long data)
+static void dma_tasklet(struct tasklet_struct *t)
 {
-	struct d40_chan *d40c = (struct d40_chan *) data;
+	struct d40_chan *d40c = from_tasklet(d40c, t, tasklet);
 	struct d40_desc *d40d;
 	unsigned long flags;
 	bool callback_active;
@@ -2804,8 +2804,7 @@ static void __init d40_chan_init(struct d40_base *base, struct dma_device *dma,
 		INIT_LIST_HEAD(&d40c->client);
 		INIT_LIST_HEAD(&d40c->prepare_queue);
 
-		tasklet_init(&d40c->tasklet, dma_tasklet,
-			     (unsigned long) d40c);
+		tasklet_setup(&d40c->tasklet, dma_tasklet);
 
 		list_add_tail(&d40c->chan.device_node,
 			      &dma->channels);
drivers/dma/sun6i-dma.c +3 -3
index 06cd7f867f7c..f5f9c86c50bc 100644
@@ -467,9 +467,9 @@ static int sun6i_dma_start_desc(struct sun6i_vchan *vchan)
 	return 0;
 }
 
-static void sun6i_dma_tasklet(unsigned long data)
+static void sun6i_dma_tasklet(struct tasklet_struct *t)
 {
-	struct sun6i_dma_dev *sdev = (struct sun6i_dma_dev *)data;
+	struct sun6i_dma_dev *sdev = from_tasklet(sdev, t, task);
 	struct sun6i_vchan *vchan;
 	struct sun6i_pchan *pchan;
 	unsigned int pchan_alloc = 0;
@@ -1343,7 +1343,7 @@ static int sun6i_dma_probe(struct platform_device *pdev)
 	if (!sdc->vchans)
 		return -ENOMEM;
 
-	tasklet_init(&sdc->task, sun6i_dma_tasklet, (unsigned long)sdc);
+	tasklet_setup(&sdc->task, sun6i_dma_tasklet);
 
 	for (i = 0; i < sdc->num_pchans; i++) {
 		struct sun6i_pchan *pchan = &sdc->pchans[i];
drivers/dma/tegra20-apb-dma.c +3 -4
index 3a45079d11ec..74e1f5e5fa32 100644
@@ -653,9 +653,9 @@ static void handle_cont_sngl_cycle_dma_done(struct tegra_dma_channel *tdc,
 	}
 }
 
-static void tegra_dma_tasklet(unsigned long data)
+static void tegra_dma_tasklet(struct tasklet_struct *t)
 {
-	struct tegra_dma_channel *tdc = (struct tegra_dma_channel *)data;
+	struct tegra_dma_channel *tdc = from_tasklet(tdc, t, tasklet);
 	struct dmaengine_desc_callback cb;
 	struct tegra_dma_desc *dma_desc;
 	unsigned long flags;
@@ -1476,8 +1476,7 @@ static int tegra_dma_probe(struct platform_device *pdev)
 		tdc->id = i;
 		tdc->slave_id = TEGRA_APBDMA_SLAVE_ID_INVALID;
 
-		tasklet_init(&tdc->tasklet, tegra_dma_tasklet,
-				(unsigned long)tdc);
+		tasklet_setup(&tdc->tasklet, tegra_dma_tasklet);
 		spin_lock_init(&tdc->lock);
 
 		INIT_LIST_HEAD(&tdc->pending_sg_req);
drivers/dma/timb_dma.c +3 -3
index 39382694fdfc..936c639d7ca7 100644
@@ -563,9 +563,9 @@ static int td_terminate_all(struct dma_chan *chan)
 	return 0;
 }
 
-static void td_tasklet(unsigned long data)
+static void td_tasklet(struct tasklet_struct *t)
 {
-	struct timb_dma *td = (struct timb_dma *)data;
+	struct timb_dma *td = from_tasklet(td, t, tasklet);
 	u32 isr;
 	u32 ipr;
 	u32 ier;
@@ -658,7 +658,7 @@ static int td_probe(struct platform_device *pdev)
 	iowrite32(0x0, td->membase + TIMBDMA_IER);
 	iowrite32(0xFFFFFFFF, td->membase + TIMBDMA_ISR);
 
-	tasklet_init(&td->tasklet, td_tasklet, (unsigned long)td);
+	tasklet_setup(&td->tasklet, td_tasklet);
 
 	err = request_irq(irq, td_irq, IRQF_SHARED, DRIVER_NAME, td);
 	if (err) {
drivers/dma/txx9dmac.c +6 -8
index 628bdf4430c7..5b6b375a257e 100644
@@ -601,13 +601,13 @@ static void txx9dmac_scan_descriptors(struct txx9dmac_chan *dc)
 	}
 }
 
-static void txx9dmac_chan_tasklet(unsigned long data)
+static void txx9dmac_chan_tasklet(struct tasklet_struct *t)
 {
 	int irq;
 	u32 csr;
 	struct txx9dmac_chan *dc;
 
-	dc = (struct txx9dmac_chan *)data;
+	dc = from_tasklet(dc, t, tasklet);
 	csr = channel_readl(dc, CSR);
 	dev_vdbg(chan2dev(&dc->chan), "tasklet: status=%x\n", csr);
 
@@ -638,13 +638,13 @@ static irqreturn_t txx9dmac_chan_interrupt(int irq, void *dev_id)
 	return IRQ_HANDLED;
 }
 
-static void txx9dmac_tasklet(unsigned long data)
+static void txx9dmac_tasklet(struct tasklet_struct *t)
 {
 	int irq;
 	u32 csr;
 	struct txx9dmac_chan *dc;
 
-	struct txx9dmac_dev *ddev = (struct txx9dmac_dev *)data;
+	struct txx9dmac_dev *ddev = from_tasklet(ddev, t, tasklet);
 	u32 mcr;
 	int i;
 
@@ -1113,8 +1113,7 @@ static int __init txx9dmac_chan_probe(struct platform_device *pdev)
 		irq = platform_get_irq(pdev, 0);
 		if (irq < 0)
 			return irq;
-		tasklet_init(&dc->tasklet, txx9dmac_chan_tasklet,
-				(unsigned long)dc);
+		tasklet_setup(&dc->tasklet, txx9dmac_chan_tasklet);
 		dc->irq = irq;
 		err = devm_request_irq(&pdev->dev, dc->irq,
 			txx9dmac_chan_interrupt, 0, dev_name(&pdev->dev), dc);
@@ -1200,8 +1199,7 @@ static int __init txx9dmac_probe(struct platform_device *pdev)
 
 	ddev->irq = platform_get_irq(pdev, 0);
 	if (ddev->irq >= 0) {
-		tasklet_init(&ddev->tasklet, txx9dmac_tasklet,
-				(unsigned long)ddev);
+		tasklet_setup(&ddev->tasklet, txx9dmac_tasklet);
 		err = devm_request_irq(&pdev->dev, ddev->irq,
 			txx9dmac_interrupt, 0, dev_name(&pdev->dev), ddev);
 		if (err)
drivers/dma/virt-dma.c +3 -3
index ec4adf4260a0..fad88a41b657 100644
@@ -80,9 +80,9 @@ EXPORT_SYMBOL_GPL(vchan_find_desc);
  * This tasklet handles the completion of a DMA descriptor by
  * calling its callback and freeing it.
  */
-static void vchan_complete(unsigned long arg)
+static void vchan_complete(struct tasklet_struct *t)
 {
-	struct virt_dma_chan *vc = (struct virt_dma_chan *)arg;
+	struct virt_dma_chan *vc = from_tasklet(vc, t, task);
 	struct virt_dma_desc *vd, *_vd;
 	struct dmaengine_desc_callback cb;
 	LIST_HEAD(head);
@@ -136,7 +136,7 @@ void vchan_init(struct virt_dma_chan *vc, struct dma_device *dmadev)
 	INIT_LIST_HEAD(&vc->desc_issued);
 	INIT_LIST_HEAD(&vc->desc_completed);
 
-	tasklet_init(&vc->task, vchan_complete, (unsigned long)vc);
+	tasklet_setup(&vc->task, vchan_complete);
 
 	vc->chan.device = dmadev;
 	list_add_tail(&vc->chan.device_node, &dmadev->channels);
drivers/dma/xgene-dma.c +3 -4
index cd60fa6d6750..1c70b74c25d1 100644
@@ -973,9 +973,9 @@ static enum dma_status xgene_dma_tx_status(struct dma_chan *dchan,
 	return dma_cookie_status(dchan, cookie, txstate);
 }
 
-static void xgene_dma_tasklet_cb(unsigned long data)
+static void xgene_dma_tasklet_cb(struct tasklet_struct *t)
 {
-	struct xgene_dma_chan *chan = (struct xgene_dma_chan *)data;
+	struct xgene_dma_chan *chan = from_tasklet(chan, t, tasklet);
 
 	/* Run all cleanup for descriptors which have been completed */
 	xgene_dma_cleanup_descriptors(chan);
@@ -1537,8 +1537,7 @@ static int xgene_dma_async_register(struct xgene_dma *pdma, int id)
 	INIT_LIST_HEAD(&chan->ld_pending);
 	INIT_LIST_HEAD(&chan->ld_running);
 	INIT_LIST_HEAD(&chan->ld_completed);
-	tasklet_init(&chan->tasklet, xgene_dma_tasklet_cb,
-		     (unsigned long)chan);
+	tasklet_setup(&chan->tasklet, xgene_dma_tasklet_cb);
 
 	chan->pending = 0;
 	chan->desc_pool = NULL;
drivers/dma/xilinx/xilinx_dma.c +3 -4
index e7dc3c4dc8e0..3a8d9d4c0056 100644
@@ -850,9 +850,9 @@ static void xilinx_dma_chan_desc_cleanup(struct xilinx_dma_chan *chan)
  * xilinx_dma_do_tasklet - Schedule completion tasklet
  * @data: Pointer to the Xilinx DMA channel structure
  */
-static void xilinx_dma_do_tasklet(unsigned long data)
+static void xilinx_dma_do_tasklet(struct tasklet_struct *t)
 {
-	struct xilinx_dma_chan *chan = (struct xilinx_dma_chan *)data;
+	struct xilinx_dma_chan *chan = from_tasklet(chan, t, tasklet);
 
 	xilinx_dma_chan_desc_cleanup(chan);
 }
@@ -2499,8 +2499,7 @@ static int xilinx_dma_chan_probe(struct xilinx_dma_device *xdev,
 	}
 
 	/* Initialize the tasklet */
-	tasklet_init(&chan->tasklet, xilinx_dma_do_tasklet,
-			(unsigned long)chan);
+	tasklet_setup(&chan->tasklet, xilinx_dma_do_tasklet);
 
 	/*
 	 * Initialize the DMA channel and add it to the DMA engine channels
drivers/dma/xilinx/zynqmp_dma.c +3 -3
index 9c845c07b107..968fa7538aaa 100644
@@ -739,9 +739,9 @@ static irqreturn_t zynqmp_dma_irq_handler(int irq, void *data)
  * zynqmp_dma_do_tasklet - Schedule completion tasklet
  * @data: Pointer to the ZynqMP DMA channel structure
  */
-static void zynqmp_dma_do_tasklet(unsigned long data)
+static void zynqmp_dma_do_tasklet(struct tasklet_struct *t)
 {
-	struct zynqmp_dma_chan *chan = (struct zynqmp_dma_chan *)data;
+	struct zynqmp_dma_chan *chan = from_tasklet(chan, t, tasklet);
 	u32 count;
 	unsigned long irqflags;
 
@@ -903,7 +903,7 @@ static int zynqmp_dma_chan_probe(struct zynqmp_dma_device *zdev,
 
 	chan->is_dmacoherent =  of_property_read_bool(node, "dma-coherent");
 	zdev->chan = chan;
-	tasklet_init(&chan->tasklet, zynqmp_dma_do_tasklet, (ulong)chan);
+	tasklet_setup(&chan->tasklet, zynqmp_dma_do_tasklet);
 	spin_lock_init(&chan->lock);
 	INIT_LIST_HEAD(&chan->active_list);
 	INIT_LIST_HEAD(&chan->pending_list);
drivers/firewire/ohci.c +8 -8
index 522f3addb5bd..3887ea7c2e03 100644
@@ -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(&ctx->tasklet, ar_context_tasklet, (unsigned long)ctx);
+	tasklet_setup(&ctx->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(&ctx->tasklet, context_tasklet, (unsigned long)ctx);
+	tasklet_setup(&ctx->tasklet, context_tasklet);
 	ctx->callback = callback;
 
 	/*
@@ -1420,7 +1420,7 @@ static void at_context_flush(struct context *ctx)
 	tasklet_disable(&ctx->tasklet);
 
 	ctx->flushing = true;
-	context_tasklet((unsigned long)ctx);
+	context_tasklet(&ctx->tasklet);
 	ctx->flushing = false;
 
 	tasklet_enable(&ctx->tasklet);
@@ -3472,7 +3472,7 @@ static int ohci_flush_iso_completions(struct fw_iso_context *base)
 	tasklet_disable(&ctx->context.tasklet);
 
 	if (!test_and_set_bit_lock(0, &ctx->flushing_completions)) {
-		context_tasklet((unsigned long)&ctx->context);
+		context_tasklet(&ctx->context.tasklet);
 
 		switch (base->type) {
 		case FW_ISO_CONTEXT_TRANSMIT:
drivers/gpu/drm/i915/gt/intel_lrc.c +12 -14
index e09404f2de79..d630dbc953ad 100644
@@ -1600,9 +1600,9 @@ static void __execlists_submission_tasklet(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);
 	unsigned long flags;
 
 	process_csb(engine);
@@ -1637,7 +1637,7 @@ static void __submit_queue_imm(struct intel_engine_cs *engine)
 	if (reset_in_progress(execlists))
 		return; /* defer until we restart the engine following reset */
 
-	if (execlists->tasklet.func == execlists_submission_tasklet)
+	if (execlists->tasklet.func == (TASKLET_FUNC_TYPE)execlists_submission_tasklet)
 		__execlists_submission_tasklet(engine);
 	else
 		tasklet_hi_schedule(&execlists->tasklet);
@@ -2518,7 +2518,7 @@ static void execlists_reset(struct intel_engine_cs *engine, bool stalled)
 	spin_unlock_irqrestore(&engine->active.lock, flags);
 }
 
-static void nop_submission_tasklet(unsigned long data)
+static void nop_submission_tasklet(struct tasklet_struct *unused)
 {
 	/* The driver is wedged; don't process any more events. */
 }
@@ -2600,7 +2600,7 @@ static void execlists_cancel_requests(struct intel_engine_cs *engine)
 	execlists->queue = RB_ROOT_CACHED;
 
 	GEM_BUG_ON(__tasklet_is_enabled(&execlists->tasklet));
-	execlists->tasklet.func = nop_submission_tasklet;
+	execlists->tasklet.func = (TASKLET_FUNC_TYPE)nop_submission_tasklet;
 
 	spin_unlock_irqrestore(&engine->active.lock, flags);
 }
@@ -2956,7 +2956,7 @@ void intel_execlists_set_default_submission(struct intel_engine_cs *engine)
 	engine->submit_request = execlists_submit_request;
 	engine->cancel_requests = execlists_cancel_requests;
 	engine->schedule = i915_schedule;
-	engine->execlists.tasklet.func = execlists_submission_tasklet;
+	engine->execlists.tasklet.func = (TASKLET_FUNC_TYPE)execlists_submission_tasklet;
 
 	engine->reset.prepare = execlists_reset_prepare;
 	engine->reset.reset = execlists_reset;
@@ -3056,8 +3056,8 @@ static void rcs_submission_override(struct intel_engine_cs *engine)
 
 int intel_execlists_submission_setup(struct intel_engine_cs *engine)
 {
-	tasklet_init(&engine->execlists.tasklet,
-		     execlists_submission_tasklet, (unsigned long)engine);
+	tasklet_setup(&engine->execlists.tasklet,
+		      execlists_submission_tasklet);
 	timer_setup(&engine->execlists.timer, execlists_submission_timer, 0);
 
 	logical_ring_default_vfuncs(engine);
@@ -3510,9 +3510,9 @@ 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 = ve->base.execlists.queue_priority_hint;
 	intel_engine_mask_t mask;
 	unsigned int n;
@@ -3700,9 +3700,7 @@ intel_execlists_create_virtual(struct i915_gem_context *ctx,
 
 	INIT_LIST_HEAD(virtual_queue(ve));
 	ve->base.execlists.queue_priority_hint = INT_MIN;
-	tasklet_init(&ve->base.execlists.tasklet,
-		     virtual_submission_tasklet,
-		     (unsigned long)ve);
+	tasklet_setup(&ve->base.execlists.tasklet, virtual_submission_tasklet);
 
 	intel_context_init(&ve->context, ctx, &ve->base);
 
@@ -3725,7 +3723,7 @@ intel_execlists_create_virtual(struct i915_gem_context *ctx,
 		 * submitting a copy into each backend.
 		 */
 		if (sibling->execlists.tasklet.func !=
-		    execlists_submission_tasklet) {
+		    (TASKLET_FUNC_TYPE)execlists_submission_tasklet) {
 			err = -ENODEV;
 			goto err_put;
 		}
drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c +4 -3
index f325d3dd564f..615ed19d2aeb 100644
@@ -594,9 +594,10 @@ static void __guc_dequeue(struct intel_engine_cs *engine)
 	execlists->active = execlists->inflight;
 }
 
-static void guc_submission_tasklet(unsigned long data)
+static void guc_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);
 	struct intel_engine_execlists * const execlists = &engine->execlists;
 	struct i915_request **port, *rq;
 	unsigned long flags;
@@ -1089,7 +1090,7 @@ static void guc_set_default_submission(struct intel_engine_cs *engine)
 	 */
 	intel_execlists_set_default_submission(engine);
 
-	engine->execlists.tasklet.func = guc_submission_tasklet;
+	engine->execlists.tasklet.func = (TASKLET_FUNC_TYPE)guc_submission_tasklet;
 
 	/* do not use execlists park/unpark */
 	engine->park = engine->unpark = NULL;
drivers/hsi/clients/nokia-modem.c +5 -4
index cd7ebf4c2e2f..1936314d3bed 100644
@@ -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(&modem->nokia_modem_rst_ind_tasklet,
-			do_nokia_modem_rst_ind_tasklet, (unsigned long)modem);
+	tasklet_setup(&modem->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) {
drivers/hsi/controllers/omap_ssi_core.c +4 -5
index 4bc4a201f0f6..317e9b162681 100644
@@ -215,10 +215,10 @@ static void ssi_gdd_complete(struct hsi_controller *ssi, unsigned int lch)
 	msg->actual_len = sg_dma_len(msg->sgt.sgl);
 }
 
-static void ssi_gdd_tasklet(unsigned long dev)
+static void ssi_gdd_tasklet(struct tasklet_struct *t)
 {
-	struct hsi_controller *ssi = (struct hsi_controller *)dev;
-	struct omap_ssi_controller *omap_ssi = hsi_controller_drvdata(ssi);
+	struct omap_ssi_controller *omap_ssi = from_tasklet(omap_ssi, t, gdd_tasklet);
+	struct hsi_controller *ssi = container_of(omap_ssi->dev, typeof(*ssi), device);
 	void __iomem *sys = omap_ssi->sys;
 	unsigned int lch;
 	u32 status_reg;
@@ -373,8 +373,7 @@ static int ssi_add_controller(struct hsi_controller *ssi,
 	if (err < 0)
 		goto out_err;
 	omap_ssi->gdd_irq = err;
-	tasklet_init(&omap_ssi->gdd_tasklet, ssi_gdd_tasklet,
-							(unsigned long)ssi);
+	tasklet_setup(&omap_ssi->gdd_tasklet, ssi_gdd_tasklet);
 	err = devm_request_irq(&ssi->device, omap_ssi->gdd_irq, ssi_gdd_isr,
 						0, "gdd_mpu", ssi);
 	if (err < 0) {
drivers/hv/channel_mgmt.c +1 -2
index 8eb167540b4f..15b70de05f3b 100644
@@ -321,8 +321,7 @@ static struct vmbus_channel *alloc_channel(void)
 	INIT_LIST_HEAD(&channel->sc_list);
 	INIT_LIST_HEAD(&channel->percpu_list);
 
-	tasklet_init(&channel->callback_event,
-		     vmbus_on_event, (unsigned long)channel);
+	tasklet_setup(&channel->callback_event, vmbus_on_event);
 
 	hv_ringbuffer_pre_init(channel);
 
drivers/hv/connection.c +2 -2
index 6e4c015783ff..78c219a2dfbb 100644
@@ -354,9 +354,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);
drivers/hv/hv.c +1 -2
index fcc52797c169..7815c966e099 100644
@@ -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(&hv_cpu->msg_dpc,
-			     vmbus_on_msg_dpc, (unsigned long) hv_cpu);
+		tasklet_setup(&hv_cpu->msg_dpc, vmbus_on_msg_dpc);
 
 		hv_cpu->synic_message_page =
 			(void *)get_zeroed_page(GFP_ATOMIC);
drivers/hv/hyperv_vmbus.h +2 -2
index af9379a3bf89..7a93ea02609c 100644
@@ -347,8 +347,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);
drivers/hv/vmbus_drv.c +2 -2
index 391f0b225c9a..f885f62d8c5c 100644
@@ -1004,9 +1004,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;
drivers/infiniband/hw/bnxt_re/qplib_fp.c +3 -4
index 958c1ff9c515..4289c82271dd 100644
@@ -233,9 +233,9 @@ static int bnxt_qplib_alloc_qp_hdr_buf(struct bnxt_qplib_res *res,
 	return rc;
 }
 
-static void bnxt_qplib_service_nq(unsigned long data)
+static void bnxt_qplib_service_nq(struct tasklet_struct *t)
 {
-	struct bnxt_qplib_nq *nq = (struct bnxt_qplib_nq *)data;
+	struct bnxt_qplib_nq *nq = from_tasklet(nq, t, worker);
 	struct bnxt_qplib_hwq *hwq = &nq->hwq;
 	struct nq_base *nqe, **nq_ptr;
 	struct bnxt_qplib_cq *cq;
@@ -387,8 +387,7 @@ int bnxt_qplib_nq_start_irq(struct bnxt_qplib_nq *nq, int nq_indx,
 
 	nq->vector = msix_vector;
 	if (need_init)
-		tasklet_init(&nq->worker, bnxt_qplib_service_nq,
-			     (unsigned long)nq);
+		tasklet_setup(&nq->worker, bnxt_qplib_service_nq);
 	else
 		tasklet_enable(&nq->worker);
 
drivers/infiniband/hw/bnxt_re/qplib_rcfw.c +5 -6
index 60c8f76aab33..53d3c68e5ce8 100644
@@ -50,7 +50,7 @@
 #include "qplib_sp.h"
 #include "qplib_fp.h"
 
-static void bnxt_qplib_service_creq(unsigned long data);
+static void bnxt_qplib_service_creq(struct tasklet_struct *t);
 
 /* Hardware communication channel */
 static int __wait_for_resp(struct bnxt_qplib_rcfw *rcfw, u16 cookie)
@@ -75,7 +75,7 @@ static int __block_for_resp(struct bnxt_qplib_rcfw *rcfw, u16 cookie)
 		goto done;
 	do {
 		mdelay(1); /* 1m sec */
-		bnxt_qplib_service_creq((unsigned long)rcfw);
+		bnxt_qplib_service_creq(&rcfw->worker);
 	} while (test_bit(cbit, rcfw->cmdq_bitmap) && --count);
 done:
 	return count ? 0 : -ETIMEDOUT;
@@ -362,9 +362,9 @@ static int bnxt_qplib_process_qp_event(struct bnxt_qplib_rcfw *rcfw,
 }
 
 /* SP - CREQ Completion handlers */
-static void bnxt_qplib_service_creq(unsigned long data)
+static void bnxt_qplib_service_creq(struct tasklet_struct *t)
 {
-	struct bnxt_qplib_rcfw *rcfw = (struct bnxt_qplib_rcfw *)data;
+	struct bnxt_qplib_rcfw *rcfw = from_tasklet(rcfw, t, worker);
 	bool gen_p5 = bnxt_qplib_is_chip_gen_p5(rcfw->res->cctx);
 	struct bnxt_qplib_hwq *creq = &rcfw->creq;
 	u32 type, budget = CREQ_ENTRY_POLL_BUDGET;
@@ -671,8 +671,7 @@ int bnxt_qplib_rcfw_start_irq(struct bnxt_qplib_rcfw *rcfw, int msix_vector,
 
 	rcfw->vector = msix_vector;
 	if (need_init)
-		tasklet_init(&rcfw->worker,
-			     bnxt_qplib_service_creq, (unsigned long)rcfw);
+		tasklet_setup(&rcfw->worker, bnxt_qplib_service_creq);
 	else
 		tasklet_enable(&rcfw->worker);
 	rc = request_irq(rcfw->vector, bnxt_qplib_creq_irq, 0,
drivers/infiniband/hw/hfi1/sdma.c +10 -10
index 2395fd4233a7..6b9d055353e4 100644
@@ -231,11 +231,11 @@ static const struct sdma_set_state_action sdma_action_table[] = {
 static void sdma_complete(struct kref *);
 static void sdma_finalput(struct sdma_state *);
 static void sdma_get(struct sdma_state *);
-static void sdma_hw_clean_up_task(unsigned long);
+static void sdma_hw_clean_up_task(struct tasklet_struct *);
 static void sdma_put(struct sdma_state *);
 static void sdma_set_state(struct sdma_engine *, enum sdma_states);
 static void sdma_start_hw_clean_up(struct sdma_engine *);
-static void sdma_sw_clean_up_task(unsigned long);
+static void sdma_sw_clean_up_task(struct tasklet_struct *);
 static void sdma_sendctrl(struct sdma_engine *, unsigned);
 static void init_sdma_regs(struct sdma_engine *, u32, uint);
 static void sdma_process_event(
@@ -544,9 +544,9 @@ static void sdma_err_progress_check(struct timer_list *t)
 	schedule_work(&sde->err_halt_worker);
 }
 
-static void sdma_hw_clean_up_task(unsigned long opaque)
+static void sdma_hw_clean_up_task(struct tasklet_struct *t)
 {
-	struct sdma_engine *sde = (struct sdma_engine *)opaque;
+	struct sdma_engine *sde = from_tasklet(sde, t, sdma_hw_clean_up_task);
 	u64 statuscsr;
 
 	while (1) {
@@ -603,9 +603,9 @@ static void sdma_flush_descq(struct sdma_engine *sde)
 		sdma_desc_avail(sde, sdma_descq_freecnt(sde));
 }
 
-static void sdma_sw_clean_up_task(unsigned long opaque)
+static void sdma_sw_clean_up_task(struct tasklet_struct *t)
 {
-	struct sdma_engine *sde = (struct sdma_engine *)opaque;
+	struct sdma_engine *sde = from_tasklet(sde, t, sdma_sw_clean_up_task);
 	unsigned long flags;
 
 	spin_lock_irqsave(&sde->tail_lock, flags);
@@ -1453,11 +1453,11 @@ int sdma_init(struct hfi1_devdata *dd, u8 port)
 		sde->tail_csr =
 			get_kctxt_csr_addr(dd, this_idx, SD(TAIL));
 
-		tasklet_init(&sde->sdma_hw_clean_up_task, sdma_hw_clean_up_task,
-			     (unsigned long)sde);
+		tasklet_setup(&sde->sdma_hw_clean_up_task,
+			      sdma_hw_clean_up_task);
 
-		tasklet_init(&sde->sdma_sw_clean_up_task, sdma_sw_clean_up_task,
-			     (unsigned long)sde);
+		tasklet_setup(&sde->sdma_sw_clean_up_task,
+			      sdma_sw_clean_up_task);
 		INIT_WORK(&sde->err_halt_worker, sdma_err_halt_wait);
 		INIT_WORK(&sde->flush_worker, sdma_field_flush);
 
drivers/infiniband/hw/i40iw/i40iw_main.c +7 -7
index d44cf33df81a..494ef2e5d3de 100644
@@ -192,9 +192,9 @@ static void i40iw_enable_intr(struct i40iw_sc_dev *dev, u32 msix_id)
  * i40iw_dpc - tasklet for aeq and ceq 0
  * @data: iwarp device
  */
-static void i40iw_dpc(unsigned long data)
+static void i40iw_dpc(struct tasklet_struct *t)
 {
-	struct i40iw_device *iwdev = (struct i40iw_device *)data;
+	struct i40iw_device *iwdev = from_tasklet(iwdev, t, dpc_tasklet);
 
 	if (iwdev->msix_shared)
 		i40iw_process_ceq(iwdev, iwdev->ceqlist);
@@ -206,9 +206,9 @@ static void i40iw_dpc(unsigned long data)
  * i40iw_ceq_dpc - dpc handler for CEQ
  * @data: data points to CEQ
  */
-static void i40iw_ceq_dpc(unsigned long data)
+static void i40iw_ceq_dpc(struct tasklet_struct *t)
 {
-	struct i40iw_ceq *iwceq = (struct i40iw_ceq *)data;
+	struct i40iw_ceq *iwceq = from_tasklet(iwceq, t, dpc_tasklet);
 	struct i40iw_device *iwdev = iwceq->iwdev;
 
 	i40iw_process_ceq(iwdev, iwceq);
@@ -689,10 +689,10 @@ static enum i40iw_status_code i40iw_configure_ceq_vector(struct i40iw_device *iw
 	enum i40iw_status_code status;
 
 	if (iwdev->msix_shared && !ceq_id) {
-		tasklet_init(&iwdev->dpc_tasklet, i40iw_dpc, (unsigned long)iwdev);
+		tasklet_setup(&iwdev->dpc_tasklet, i40iw_dpc);
 		status = request_irq(msix_vec->irq, i40iw_irq_handler, 0, "AEQCEQ", iwdev);
 	} else {
-		tasklet_init(&iwceq->dpc_tasklet, i40iw_ceq_dpc, (unsigned long)iwceq);
+		tasklet_setup(&iwceq->dpc_tasklet, i40iw_ceq_dpc);
 		status = request_irq(msix_vec->irq, i40iw_ceq_handler, 0, "CEQ", iwceq);
 	}
 
@@ -841,7 +841,7 @@ static enum i40iw_status_code i40iw_configure_aeq_vector(struct i40iw_device *iw
 	u32 ret = 0;
 
 	if (!iwdev->msix_shared) {
-		tasklet_init(&iwdev->dpc_tasklet, i40iw_dpc, (unsigned long)iwdev);
+		tasklet_setup(&iwdev->dpc_tasklet, i40iw_dpc);
 		ret = request_irq(msix_vec->irq, i40iw_irq_handler, 0, "i40iw", iwdev);
 	}
 	if (ret) {
drivers/infiniband/hw/qib/qib_iba7322.c +3 -4
index dd4843379f51..88544c638c41 100644
@@ -1733,9 +1733,9 @@ static noinline void handle_7322_errors(struct qib_devdata *dd)
 	return;
 }
 
-static void qib_error_tasklet(unsigned long data)
+static void qib_error_tasklet(struct tasklet_struct *t)
 {
-	struct qib_devdata *dd = (struct qib_devdata *)data;
+	struct qib_devdata *dd = from_tasklet(dd, t, error_tasklet);
 
 	handle_7322_errors(dd);
 	qib_write_kreg(dd, kr_errmask, dd->cspec->errormask);
@@ -3538,8 +3538,7 @@ static void qib_setup_7322_interrupt(struct qib_devdata *dd, int clearpend)
 	for (i = 0; i < ARRAY_SIZE(redirect); i++)
 		qib_write_kreg(dd, kr_intredirect + i, redirect[i]);
 	dd->cspec->main_int_mask = mask;
-	tasklet_init(&dd->error_tasklet, qib_error_tasklet,
-		(unsigned long)dd);
+	tasklet_setup(&dd->error_tasklet, qib_error_tasklet);
 }
 
 /**
drivers/infiniband/hw/qib/qib_sdma.c +5 -5
index 99e11c347130..eece0d4ce6c7 100644
@@ -62,7 +62,7 @@ static void sdma_get(struct qib_sdma_state *);
 static void sdma_put(struct qib_sdma_state *);
 static void sdma_set_state(struct qib_pportdata *, enum qib_sdma_states);
 static void sdma_start_sw_clean_up(struct qib_pportdata *);
-static void sdma_sw_clean_up_task(unsigned long);
+static void sdma_sw_clean_up_task(struct tasklet_struct *);
 static void unmap_desc(struct qib_pportdata *, unsigned);
 
 static void sdma_get(struct qib_sdma_state *ss)
@@ -119,9 +119,10 @@ static void clear_sdma_activelist(struct qib_pportdata *ppd)
 	}
 }
 
-static void sdma_sw_clean_up_task(unsigned long opaque)
+static void sdma_sw_clean_up_task(struct tasklet_struct *t)
 {
-	struct qib_pportdata *ppd = (struct qib_pportdata *) opaque;
+	struct qib_pportdata *ppd = from_tasklet(ppd, t,
+						 sdma_sw_clean_up_task);
 	unsigned long flags;
 
 	spin_lock_irqsave(&ppd->sdma_lock, flags);
@@ -436,8 +437,7 @@ int qib_setup_sdma(struct qib_pportdata *ppd)
 
 	INIT_LIST_HEAD(&ppd->sdma_activelist);
 
-	tasklet_init(&ppd->sdma_sw_clean_up_task, sdma_sw_clean_up_task,
-		(unsigned long)ppd);
+	tasklet_setup(&ppd->sdma_sw_clean_up_task, sdma_sw_clean_up_task);
 
 	ret = dd->f_init_sdma_regs(ppd);
 	if (ret)
drivers/infiniband/sw/rxe/rxe_cq.c +3 -3
index ad3090131126..f232fd03d19a 100644
@@ -66,9 +66,9 @@ int rxe_cq_chk_attr(struct rxe_dev *rxe, struct rxe_cq *cq,
 	return -EINVAL;
 }
 
-static void rxe_send_complete(unsigned long data)
+static void rxe_send_complete(struct tasklet_struct *t)
 {
-	struct rxe_cq *cq = (struct rxe_cq *)data;
+	struct rxe_cq *cq = from_tasklet(cq, t, comp_task);
 	unsigned long flags;
 
 	spin_lock_irqsave(&cq->cq_lock, flags);
@@ -107,7 +107,7 @@ int rxe_cq_from_init(struct rxe_dev *rxe, struct rxe_cq *cq, int cqe,
 
 	cq->is_dying = false;
 
-	tasklet_init(&cq->comp_task, rxe_send_complete, (unsigned long)cq);
+	tasklet_setup(&cq->comp_task, rxe_send_complete);
 
 	spin_lock_init(&cq->cq_lock);
 	cq->ibcq.cqe = cqe;
drivers/infiniband/sw/rxe/rxe_task.c +4 -4
index 08f05ac5f5d5..f7c944d2f987 100644
@@ -55,12 +55,12 @@ int __rxe_do_task(struct rxe_task *task)
  * a second caller finds the task already running
  * but looks just after the last call to func
  */
-void rxe_do_task(unsigned long data)
+void rxe_do_task(struct tasklet_struct *t)
 {
 	int cont;
 	int ret;
 	unsigned long flags;
-	struct rxe_task *task = (struct rxe_task *)data;
+	struct rxe_task *task = from_tasklet(task, t, tasklet);
 
 	spin_lock_irqsave(&task->state_lock, flags);
 	switch (task->state) {
@@ -123,7 +123,7 @@ int rxe_init_task(void *obj, struct rxe_task *task,
 	snprintf(task->name, sizeof(task->name), "%s", name);
 	task->destroyed	= false;
 
-	tasklet_init(&task->tasklet, rxe_do_task, (unsigned long)task);
+	tasklet_setup(&task->tasklet, rxe_do_task);
 
 	task->state = TASK_STATE_START;
 	spin_lock_init(&task->state_lock);
@@ -159,7 +159,7 @@ void rxe_run_task(struct rxe_task *task, int sched)
 	if (sched)
 		tasklet_schedule(&task->tasklet);
 	else
-		rxe_do_task((unsigned long)task);
+		rxe_do_task(&task->tasklet);
 }
 
 void rxe_disable_task(struct rxe_task *task)
drivers/infiniband/sw/rxe/rxe_task.h +1 -1
index 08ff42d451c6..f69fbb2dd09f 100644
@@ -80,7 +80,7 @@ int __rxe_do_task(struct rxe_task *task);
  * work to do someone must reschedule the task before
  * leaving
  */
-void rxe_do_task(unsigned long data);
+void rxe_do_task(struct tasklet_struct *t);
 
 /* run a task, else schedule it to run as a tasklet, The decision
  * to run or schedule tasklet is based on the parameter sched.
drivers/input/serio/hp_sdc.c +2 -2
index 654252361653..60ba94abde86 100644
@@ -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(&hp_sdc.rtq_lock);
 
@@ -890,7 +890,7 @@ static int __init hp_sdc_init(void)
 	hp_sdc_status_in8();
 	hp_sdc_data_in8();
 
-	tasklet_init(&hp_sdc.task, hp_sdc_tasklet, 0);
+	tasklet_setup(&hp_sdc.task, hp_sdc_tasklet);
 
 	/* Sync the output buffer registers, thus scheduling hp_sdc_tasklet. */
 	t_sync.actidx	= 0;
drivers/mailbox/bcm-pdc-mailbox.c +3 -3
index fcb3b18a0678..5c9375f9ab64 100644
@@ -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(&pdcs->rx_tasklet, pdc_tasklet_cb, (unsigned long)pdcs);
+	tasklet_setup(&pdcs->rx_tasklet, pdc_tasklet_cb);
 
 	err = pdc_interrupts_init(pdcs);
 	if (err)
drivers/mailbox/imx-mailbox.c +3 -4
index 9f74dee1a58c..14ce3875f576 100644
@@ -97,9 +97,9 @@ static u32 imx_mu_xcr_rmw(struct imx_mu_priv *priv, u32 set, u32 clr)
 	return val;
 }
 
-static void imx_mu_txdb_tasklet(unsigned long data)
+static void imx_mu_txdb_tasklet(struct tasklet_struct *t)
 {
-	struct imx_mu_con_priv *cp = (struct imx_mu_con_priv *)data;
+	struct imx_mu_con_priv *cp = from_tasklet(cp, t, txdb_tasklet);
 
 	mbox_chan_txdone(cp->chan, 0);
 }
@@ -182,8 +182,7 @@ static int imx_mu_startup(struct mbox_chan *chan)
 
 	if (cp->type == IMX_MU_TYPE_TXDB) {
 		/* Tx doorbell don't have ACK support */
-		tasklet_init(&cp->txdb_tasklet, imx_mu_txdb_tasklet,
-			     (unsigned long)cp);
+		tasklet_setup(&cp->txdb_tasklet, imx_mu_txdb_tasklet);
 		return 0;
 	}
 
drivers/media/pci/bt8xx/dvb-bt8xx.c +4 -3
index 02ebd43e672e..4cb890b949c3 100644
@@ -39,9 +39,10 @@ DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
 
 #define IF_FREQUENCYx6 217    /* 6 * 36.16666666667MHz */
 
-static void dvb_bt8xx_task(unsigned long data)
+static void dvb_bt8xx_task(struct tasklet_struct *t)
 {
-	struct dvb_bt8xx_card *card = (struct dvb_bt8xx_card *)data;
+	struct bt878 *bt = from_tasklet(bt, t, tasklet);
+	struct dvb_bt8xx_card *card = dev_get_drvdata(&bt->adapter->dev);
 
 	dprintk("%d\n", card->bt->finished_block);
 
@@ -777,7 +778,7 @@ static int dvb_bt8xx_load_card(struct dvb_bt8xx_card *card, u32 type)
 		goto err_disconnect_frontend;
 	}
 
-	tasklet_init(&card->bt->tasklet, dvb_bt8xx_task, (unsigned long) card);
+	tasklet_setup(&card->bt->tasklet, dvb_bt8xx_task);
 
 	frontend_init(card, type);
 
drivers/media/pci/mantis/mantis_dma.c +2 -2
index affc5977387f..4df571ff272b 100644
@@ -200,9 +200,9 @@ void mantis_dma_stop(struct mantis_pci *mantis)
 }
 
 
-void mantis_dma_xfer(unsigned long data)
+void mantis_dma_xfer(struct tasklet_struct *t)
 {
-	struct mantis_pci *mantis = (struct mantis_pci *) data;
+	struct mantis_pci *mantis = from_tasklet(mantis, t, tasklet);
 	struct mantis_hwconfig *config = mantis->hwconfig;
 
 	while (mantis->last_block != mantis->busy_block) {
drivers/media/pci/mantis/mantis_dma.h +1 -1
index 421663443d62..37da982c9c29 100644
@@ -13,6 +13,6 @@ extern int mantis_dma_init(struct mantis_pci *mantis);
 extern int mantis_dma_exit(struct mantis_pci *mantis);
 extern void mantis_dma_start(struct mantis_pci *mantis);
 extern void mantis_dma_stop(struct mantis_pci *mantis);
-extern void mantis_dma_xfer(unsigned long data);
+extern void mantis_dma_xfer(struct tasklet_struct *t);
 
 #endif /* __MANTIS_DMA_H */
drivers/media/pci/mantis/mantis_dvb.c +1 -1
index e78ca1f26e68..6d41b87dd382 100644
@@ -205,7 +205,7 @@ int mantis_dvb_init(struct mantis_pci *mantis)
 	}
 
 	dvb_net_init(&mantis->dvb_adapter, &mantis->dvbnet, &mantis->demux.dmx);
-	tasklet_init(&mantis->tasklet, mantis_dma_xfer, (unsigned long) mantis);
+	tasklet_setup(&mantis->tasklet, mantis_dma_xfer);
 	tasklet_disable(&mantis->tasklet);
 	if (mantis->hwconfig) {
 		result = config->frontend_init(mantis, mantis->fe);
drivers/media/pci/ngene/ngene-core.c +6 -6
index af15ca1c501b..f9f94f47d76b 100644
@@ -50,9 +50,9 @@ DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
 /* nGene interrupt handler **************************************************/
 /****************************************************************************/
 
-static void event_tasklet(unsigned long data)
+static void event_tasklet(struct tasklet_struct *t)
 {
-	struct ngene *dev = (struct ngene *)data;
+	struct ngene *dev = from_tasklet(dev, t, event_tasklet);
 
 	while (dev->EventQueueReadIndex != dev->EventQueueWriteIndex) {
 		struct EVENT_BUFFER Event =
@@ -68,9 +68,9 @@ static void event_tasklet(unsigned long data)
 	}
 }
 
-static void demux_tasklet(unsigned long data)
+static void demux_tasklet(struct tasklet_struct *t)
 {
-	struct ngene_channel *chan = (struct ngene_channel *)data;
+	struct ngene_channel *chan = from_tasklet(chan, t, demux_tasklet);
 	struct device *pdev = &chan->dev->pci_dev->dev;
 	struct SBufferHeader *Cur = chan->nextBuffer;
 
@@ -1181,7 +1181,7 @@ static void ngene_init(struct ngene *dev)
 	struct device *pdev = &dev->pci_dev->dev;
 	int i;
 
-	tasklet_init(&dev->event_tasklet, event_tasklet, (unsigned long)dev);
+	tasklet_setup(&dev->event_tasklet, event_tasklet);
 
 	memset_io(dev->iomem + 0xc000, 0x00, 0x220);
 	memset_io(dev->iomem + 0xc400, 0x00, 0x100);
@@ -1445,7 +1445,7 @@ static int init_channel(struct ngene_channel *chan)
 	struct ngene_info *ni = dev->card_info;
 	int io = ni->io_type[nr];
 
-	tasklet_init(&chan->demux_tasklet, demux_tasklet, (unsigned long)chan);
+	tasklet_setup(&chan->demux_tasklet, demux_tasklet);
 	chan->users = 0;
 	chan->type = io;
 	chan->mode = chan->type;	/* for now only one mode */
drivers/media/pci/smipcie/smipcie-main.c +3 -3
index 1fb78462e081..21e4624b2794 100644
@@ -280,9 +280,9 @@ static void smi_port_clearInterrupt(struct smi_port *port)
 }
 
 /* tasklet handler: DMA data to dmx.*/
-static void smi_dma_xfer(unsigned long data)
+static void smi_dma_xfer(struct tasklet_struct *t)
 {
-	struct smi_port *port = (struct smi_port *) data;
+	struct smi_port *port = from_tasklet(port, t, tasklet);
 	struct smi_dev *dev = port->dev;
 	u32 intr_status, finishedData, dmaManagement;
 	u8 dmaChan0State, dmaChan1State;
@@ -422,7 +422,7 @@ static int smi_port_init(struct smi_port *port, int dmaChanUsed)
 	}
 
 	smi_port_disableInterrupt(port);
-	tasklet_init(&port->tasklet, smi_dma_xfer, (unsigned long)port);
+	tasklet_setup(&port->tasklet, smi_dma_xfer);
 	tasklet_disable(&port->tasklet);
 	port->enable = 1;
 	return 0;
drivers/media/pci/ttpci/av7110.c +10 -10
index d0cdee1c6eb0..6d3698cfd512 100644
@@ -357,9 +357,9 @@ static inline void start_debi_dma(struct av7110 *av7110, int dir,
 		irdebi(av7110, DEBISWAB, addr, 0, len);
 }
 
-static void debiirq(unsigned long cookie)
+static void debiirq(struct tasklet_struct *t)
 {
-	struct av7110 *av7110 = (struct av7110 *)cookie;
+	struct av7110 *av7110 = from_tasklet(av7110, t, debi_tasklet);
 	int type = av7110->debitype;
 	int handle = (type >> 8) & 0x1f;
 	unsigned int xfer = 0;
@@ -457,9 +457,9 @@ static void debiirq(unsigned long cookie)
 }
 
 /* irq from av7110 firmware writing the mailbox register in the DPRAM */
-static void gpioirq(unsigned long cookie)
+static void gpioirq(struct tasklet_struct *t)
 {
-	struct av7110 *av7110 = (struct av7110 *)cookie;
+	struct av7110 *av7110 = from_tasklet(av7110, t, gpio_tasklet);
 	u32 rxbuf, txbuf;
 	int len;
 
@@ -1229,9 +1229,9 @@ static int budget_stop_feed(struct dvb_demux_feed *feed)
 	return status;
 }
 
-static void vpeirq(unsigned long cookie)
+static void vpeirq(struct tasklet_struct *t)
 {
-	struct av7110 *budget = (struct av7110 *)cookie;
+	struct av7110 *budget = from_tasklet(budget, t, vpe_tasklet);
 	u8 *mem = (u8 *) (budget->grabbing);
 	u32 olddma = budget->ttbp;
 	u32 newdma = saa7146_read(budget->dev, PCI_VDP3);
@@ -2517,7 +2517,7 @@ static int av7110_attach(struct saa7146_dev* dev,
 		saa7146_write(dev, NUM_LINE_BYTE3, (TS_HEIGHT << 16) | TS_WIDTH);
 		saa7146_write(dev, MC2, MASK_04 | MASK_20);
 
-		tasklet_init(&av7110->vpe_tasklet, vpeirq, (unsigned long) av7110);
+		tasklet_setup(&av7110->vpe_tasklet, vpeirq);
 
 	} else if (budgetpatch) {
 		spin_lock_init(&av7110->feedlock1);
@@ -2598,7 +2598,7 @@ static int av7110_attach(struct saa7146_dev* dev,
 		saa7146_write(dev, MC1, (MASK_13 | MASK_29));
 
 		/* end of budgetpatch register initialization */
-		tasklet_init (&av7110->vpe_tasklet,  vpeirq,  (unsigned long) av7110);
+		tasklet_setup(&av7110->vpe_tasklet, vpeirq);
 	} else {
 		saa7146_write(dev, PCI_BT_V1, 0x1c00101f);
 		saa7146_write(dev, BCS_CTRL, 0x80400040);
@@ -2613,8 +2613,8 @@ static int av7110_attach(struct saa7146_dev* dev,
 		saa7146_write(dev, GPIO_CTRL, 0x000000);
 	}
 
-	tasklet_init (&av7110->debi_tasklet, debiirq, (unsigned long) av7110);
-	tasklet_init (&av7110->gpio_tasklet, gpioirq, (unsigned long) av7110);
+	tasklet_setup(&av7110->debi_tasklet, debiirq);
+	tasklet_setup(&av7110->gpio_tasklet, gpioirq);
 
 	mutex_init(&av7110->pid_mutex);
 
drivers/media/pci/ttpci/budget-ci.c +9 -7
index 77b102b8a013..98e832f31943 100644
@@ -99,9 +99,10 @@ struct budget_ci {
 	u8 tuner_pll_address; /* used for philips_tdm1316l configs */
 };
 
-static void msp430_ir_interrupt(unsigned long data)
+static void msp430_ir_interrupt(struct tasklet_struct *t)
 {
-	struct budget_ci *budget_ci = (struct budget_ci *) data;
+	struct budget_ci_ir *ir = from_tasklet(ir, t, msp430_irq_tasklet);
+	struct budget_ci *budget_ci = container_of(ir, typeof(*budget_ci), ir);
 	struct rc_dev *dev = budget_ci->ir.dev;
 	u32 command = ttpci_budget_debiread(&budget_ci->budget, DEBINOSWAP, DEBIADDR_IR, 2, 1, 0) >> 8;
 
@@ -229,8 +230,7 @@ static int msp430_ir_init(struct budget_ci *budget_ci)
 
 	budget_ci->ir.dev = dev;
 
-	tasklet_init(&budget_ci->ir.msp430_irq_tasklet, msp430_ir_interrupt,
-		     (unsigned long) budget_ci);
+	tasklet_setup(&budget_ci->ir.msp430_irq_tasklet, msp430_ir_interrupt);
 
 	SAA7146_IER_ENABLE(saa, MASK_06);
 	saa7146_setgpio(saa, 3, SAA7146_GPIO_IRQHI);
@@ -348,9 +348,10 @@ static int ciintf_slot_ts_enable(struct dvb_ca_en50221 *ca, int slot)
 	return 0;
 }
 
-static void ciintf_interrupt(unsigned long data)
+static void ciintf_interrupt(struct tasklet_struct *t)
 {
-	struct budget_ci *budget_ci = (struct budget_ci *) data;
+	struct budget_ci *budget_ci = from_tasklet(budget_ci, t,
+						   ciintf_irq_tasklet);
 	struct saa7146_dev *saa = budget_ci->budget.dev;
 	unsigned int flags;
 
@@ -491,7 +492,8 @@ static int ciintf_init(struct budget_ci *budget_ci)
 
 	// Setup CI slot IRQ
 	if (budget_ci->ci_irq) {
-		tasklet_init(&budget_ci->ciintf_irq_tasklet, ciintf_interrupt, (unsigned long) budget_ci);
+		tasklet_setup(&budget_ci->ciintf_irq_tasklet,
+			      ciintf_interrupt);
 		if (budget_ci->slot_status != SLOTSTATUS_NONE) {
 			saa7146_setgpio(saa, 0, SAA7146_GPIO_IRQLO);
 		} else {
drivers/media/pci/ttpci/budget-core.c +3 -3
index fadbdeeb4495..fd3187bdb8e6 100644
@@ -171,9 +171,9 @@ static int budget_read_fe_status(struct dvb_frontend *fe,
 	return ret;
 }
 
-static void vpeirq(unsigned long data)
+static void vpeirq(struct tasklet_struct *t)
 {
-	struct budget *budget = (struct budget *) data;
+	struct budget *budget = from_tasklet(budget, t, vpe_tasklet);
 	u8 *mem = (u8 *) (budget->grabbing);
 	u32 olddma = budget->ttbp;
 	u32 newdma = saa7146_read(budget->dev, PCI_VDP3);
@@ -514,7 +514,7 @@ int ttpci_budget_init(struct budget *budget, struct saa7146_dev *dev,
 	/* upload all */
 	saa7146_write(dev, GPIO_CTRL, 0x000000);
 
-	tasklet_init(&budget->vpe_tasklet, vpeirq, (unsigned long) budget);
+	tasklet_setup(&budget->vpe_tasklet, vpeirq);
 
 	/* frontend power on */
 	if (bi->type != BUDGET_FS_ACTIVY)
drivers/media/pci/tw5864/tw5864-video.c +4 -5
index 09732eed7eb4..0e70b28bf816 100644
@@ -175,7 +175,7 @@ static const unsigned int intra4x4_lambda3[] = {
 static v4l2_std_id tw5864_get_v4l2_std(enum tw5864_vid_std std);
 static enum tw5864_vid_std tw5864_from_v4l2_std(v4l2_std_id v4l2_std);
 
-static void tw5864_handle_frame_task(unsigned long data);
+static void tw5864_handle_frame_task(struct tasklet_struct *t);
 static void tw5864_handle_frame(struct tw5864_h264_frame *frame);
 static void tw5864_frame_interval_set(struct tw5864_input *input);
 
@@ -1057,8 +1057,7 @@ int tw5864_video_init(struct tw5864_dev *dev, int *video_nr)
 	dev->irqmask |= TW5864_INTR_VLC_DONE | TW5864_INTR_TIMER;
 	tw5864_irqmask_apply(dev);
 
-	tasklet_init(&dev->tasklet, tw5864_handle_frame_task,
-		     (unsigned long)dev);
+	tasklet_setup(&dev->tasklet, tw5864_handle_frame_task);
 
 	for (i = 0; i < TW5864_INPUTS; i++) {
 		dev->inputs[i].root = dev;
@@ -1313,9 +1312,9 @@ static int tw5864_is_motion_triggered(struct tw5864_h264_frame *frame)
 	return detected;
 }
 
-static void tw5864_handle_frame_task(unsigned long data)
+static void tw5864_handle_frame_task(struct tasklet_struct *t)
 {
-	struct tw5864_dev *dev = (struct tw5864_dev *)data;
+	struct tw5864_dev *dev = from_tasklet(dev, t, tasklet);
 	unsigned long flags;
 	int batch_size = H264_BUF_CNT;
 
drivers/media/platform/marvell-ccic/mcam-core.c +3 -4
index 803baf97f06e..03d20d307524 100644
@@ -438,9 +438,9 @@ static void mcam_ctlr_dma_vmalloc(struct mcam_camera *cam)
 /*
  * Copy data out to user space in the vmalloc case
  */
-static void mcam_frame_tasklet(unsigned long data)
+static void mcam_frame_tasklet(struct tasklet_struct *t)
 {
-	struct mcam_camera *cam = (struct mcam_camera *) data;
+	struct mcam_camera *cam = from_tasklet(cam, t, s_tasklet);
 	int i;
 	unsigned long flags;
 	struct mcam_vb_buffer *buf;
@@ -1323,8 +1323,7 @@ static int mcam_setup_vb2(struct mcam_camera *cam)
 		break;
 	case B_vmalloc:
 #ifdef MCAM_MODE_VMALLOC
-		tasklet_init(&cam->s_tasklet, mcam_frame_tasklet,
-				(unsigned long) cam);
+		tasklet_setup(&cam->s_tasklet, mcam_frame_tasklet);
 		vq->ops = &mcam_vb2_ops;
 		vq->mem_ops = &vb2_vmalloc_memops;
 		cam->dma_setup = mcam_ctlr_dma_vmalloc;
drivers/media/platform/pxa_camera.c +3 -3
index 8d47ea0c33f8..9a1257276a5c 100644
@@ -1186,9 +1186,9 @@ static void pxa_camera_deactivate(struct pxa_camera_dev *pcdev)
 	clk_disable_unprepare(pcdev->clk);
 }
 
-static void pxa_camera_eof(unsigned long arg)
+static void pxa_camera_eof(struct tasklet_struct *t)
 {
-	struct pxa_camera_dev *pcdev = (struct pxa_camera_dev *)arg;
+	struct pxa_camera_dev *pcdev = from_tasklet(pcdev, t, task_eof);
 	unsigned long cifr;
 	struct pxa_buffer *buf;
 
@@ -2478,7 +2478,7 @@ static int pxa_camera_probe(struct platform_device *pdev)
 		goto exit_free_dma;
 	}
 
-	tasklet_init(&pcdev->task_eof, pxa_camera_eof, (unsigned long)pcdev);
+	tasklet_setup(&pcdev->task_eof, pxa_camera_eof);
 
 	pxa_camera_activate(pcdev);
 
drivers/media/platform/sti/c8sectpfe/c8sectpfe-core.c +4 -6
index 5baada4f65e5..dbe7788083a4 100644
@@ -77,9 +77,9 @@ static void c8sectpfe_timer_interrupt(struct timer_list *t)
 	add_timer(&fei->timer);
 }
 
-static void channel_swdemux_tsklet(unsigned long data)
+static void channel_swdemux_tsklet(struct tasklet_struct *t)
 {
-	struct channel_info *channel = (struct channel_info *)data;
+	struct channel_info *channel = from_tasklet(channel, t, tsklet);
 	struct c8sectpfei *fei;
 	unsigned long wp, rp;
 	int pos, num_packets, n, size;
@@ -208,8 +208,7 @@ static int c8sectpfe_start_feed(struct dvb_demux_feed *dvbdmxfeed)
 
 		dev_dbg(fei->dev, "Starting channel=%p\n", channel);
 
-		tasklet_init(&channel->tsklet, channel_swdemux_tsklet,
-			     (unsigned long) channel);
+		tasklet_setup(&channel->tsklet, channel_swdemux_tsklet);
 
 		/* Reset the internal inputblock sram pointers */
 		writel(channel->fifo,
@@ -638,8 +637,7 @@ static int configure_memdma_and_inputblock(struct c8sectpfei *fei,
 	writel(tsin->back_buffer_busaddr, tsin->irec + DMA_PRDS_BUSRP_TP(0));
 
 	/* initialize tasklet */
-	tasklet_init(&tsin->tsklet, channel_swdemux_tsklet,
-		(unsigned long) tsin);
+	tasklet_setup(&tsin->tsklet, channel_swdemux_tsklet);
 
 	return 0;
 
drivers/media/radio/wl128x/fmdrv_common.c +6 -6
index cce97c9d5409..dc0cc7a0da60 100644
@@ -244,7 +244,7 @@ void fmc_update_region_info(struct fmdev *fmdev, u8 region_to_set)
  * FM common sub-module will schedule this tasklet whenever it receives
  * FM packet from ST driver.
  */
-static void recv_tasklet(unsigned long arg)
+static void recv_tasklet(struct tasklet_struct *t)
 {
 	struct fmdev *fmdev;
 	struct fm_irq *irq_info;
@@ -253,7 +253,7 @@ static void recv_tasklet(unsigned long arg)
 	u8 num_fm_hci_cmds;
 	unsigned long flags;
 
-	fmdev = (struct fmdev *)arg;
+	fmdev = from_tasklet(fmdev, t, rx_task);
 	irq_info = &fmdev->irq_info;
 	/* Process all packets in the RX queue */
 	while ((skb = skb_dequeue(&fmdev->rx_q))) {
@@ -328,13 +328,13 @@ static void recv_tasklet(unsigned long arg)
 }
 
 /* FM send tasklet: is scheduled when FM packet has to be sent to chip */
-static void send_tasklet(unsigned long arg)
+static void send_tasklet(struct tasklet_struct *t)
 {
 	struct fmdev *fmdev;
 	struct sk_buff *skb;
 	int len;
 
-	fmdev = (struct fmdev *)arg;
+	fmdev = from_tasklet(fmdev, t, tx_task);
 
 	if (!atomic_read(&fmdev->tx_cnt))
 		return;
@@ -1535,11 +1535,11 @@ int fmc_prepare(struct fmdev *fmdev)
 
 	/* Initialize TX queue and TX tasklet */
 	skb_queue_head_init(&fmdev->tx_q);
-	tasklet_init(&fmdev->tx_task, send_tasklet, (unsigned long)fmdev);
+	tasklet_setup(&fmdev->tx_task, send_tasklet);
 
 	/* Initialize RX Queue and RX tasklet */
 	skb_queue_head_init(&fmdev->rx_q);
-	tasklet_init(&fmdev->rx_task, recv_tasklet, (unsigned long)fmdev);
+	tasklet_setup(&fmdev->rx_task, recv_tasklet);
 
 	fmdev->irq_info.stage = 0;
 	atomic_set(&fmdev->tx_cnt, 1);
drivers/media/usb/ttusb-dec/ttusb_dec.c +3 -4
index 3198f9624b7c..3f03cfee3bf7 100644
@@ -768,9 +768,9 @@ static void ttusb_dec_process_urb_frame(struct ttusb_dec *dec, u8 *b,
 	}
 }
 
-static void ttusb_dec_process_urb_frame_list(unsigned long data)
+static void ttusb_dec_process_urb_frame_list(struct tasklet_struct *t)
 {
-	struct ttusb_dec *dec = (struct ttusb_dec *)data;
+	struct ttusb_dec *dec = from_tasklet(dec, t, urb_tasklet);
 	struct list_head *item;
 	struct urb_frame *frame;
 	unsigned long flags;
@@ -1208,8 +1208,7 @@ static void ttusb_dec_init_tasklet(struct ttusb_dec *dec)
 {
 	spin_lock_init(&dec->urb_frame_list_lock);
 	INIT_LIST_HEAD(&dec->urb_frame_list);
-	tasklet_init(&dec->urb_tasklet, ttusb_dec_process_urb_frame_list,
-		     (unsigned long)dec);
+	tasklet_setup(&dec->urb_tasklet, ttusb_dec_process_urb_frame_list);
 }
 
 static int ttusb_init_rc( struct ttusb_dec *dec)
drivers/memstick/host/jmb38x_ms.c +4 -4
index 32747425297d..a3fb91b0ec68 100644
@@ -603,10 +603,10 @@ static void jmb38x_ms_abort(struct timer_list *t)
 	spin_unlock_irqrestore(&host->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;
 
@@ -885,7 +885,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(&host->notify, jmb38x_ms_req_tasklet, (unsigned long)msh);
+	tasklet_setup(&host->notify, jmb38x_ms_req_tasklet);
 	msh->request = jmb38x_ms_submit_req;
 	msh->set_param = jmb38x_ms_set_param;
 
drivers/memstick/host/tifm_ms.c +4 -4
index 5b966b54d6e9..4bc4256008a4 100644
@@ -452,11 +452,11 @@ static void tifm_ms_card_event(struct tifm_dev *sock)
 	return;
 }
 
-static void tifm_ms_req_tasklet(unsigned long data)
+static void tifm_ms_req_tasklet(struct tasklet_struct *t)
 {
-	struct memstick_host *msh = (struct memstick_host *)data;
-	struct tifm_ms *host = memstick_priv(msh);
+	struct tifm_ms *host = from_tasklet(host, t, notify);
 	struct tifm_dev *sock = host->dev;
+	struct memstick_host *msh = tifm_get_drvdata(sock);
 	unsigned long flags;
 	int rc;
 
@@ -571,7 +571,7 @@ static int tifm_ms_probe(struct tifm_dev *sock)
 	host->timeout_jiffies = msecs_to_jiffies(1000);
 
 	timer_setup(&host->timer, tifm_ms_abort, 0);
-	tasklet_init(&host->notify, tifm_ms_req_tasklet, (unsigned long)msh);
+	tasklet_setup(&host->notify, tifm_ms_req_tasklet);
 
 	msh->request = tifm_ms_submit_req;
 	msh->set_param = tifm_ms_set_param;
drivers/misc/ibmvmc.c +4 -4
index 2ed23c99f59f..46359aa26c73 100644
@@ -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(&queue->lock);
 
-	tasklet_init(&adapter->work_task, ibmvmc_task, (unsigned long)adapter);
+	tasklet_setup(&adapter->work_task, ibmvmc_task);
 
 	if (request_irq(vdev->irq,
 			ibmvmc_handle_event,
drivers/misc/vmw_vmci/vmci_guest.c +7 -8
index 7a84a48c75da..3d43a8441295 100644
@@ -205,9 +205,10 @@ static int vmci_check_host_caps(struct pci_dev *pdev)
  * This function assumes that it has exclusive access to the data
  * in port for the duration of the call.
  */
-static void vmci_dispatch_dgs(unsigned long data)
+static void vmci_dispatch_dgs(struct tasklet_struct *t)
 {
-	struct vmci_guest_device *vmci_dev = (struct vmci_guest_device *)data;
+	struct vmci_guest_device *vmci_dev = from_tasklet(vmci_dev, t,
+							  datagram_tasklet);
 	u8 *dg_in_buffer = vmci_dev->data_buffer;
 	struct vmci_datagram *dg;
 	size_t dg_in_buffer_size = VMCI_MAX_DG_SIZE;
@@ -352,9 +353,9 @@ static void vmci_dispatch_dgs(unsigned long data)
  * Scans the notification bitmap for raised flags, clears them
  * and handles the notifications.
  */
-static void vmci_process_bitmap(unsigned long data)
+static void vmci_process_bitmap(struct tasklet_struct *t)
 {
-	struct vmci_guest_device *dev = (struct vmci_guest_device *)data;
+	struct vmci_guest_device *dev = from_tasklet(dev, t, bm_tasklet);
 
 	if (!dev->notification_bitmap) {
 		dev_dbg(dev->dev, "No bitmap present in %s\n", __func__);
@@ -467,10 +468,8 @@ static int vmci_guest_probe_device(struct pci_dev *pdev,
 	vmci_dev->exclusive_vectors = false;
 	vmci_dev->iobase = iobase;
 
-	tasklet_init(&vmci_dev->datagram_tasklet,
-		     vmci_dispatch_dgs, (unsigned long)vmci_dev);
-	tasklet_init(&vmci_dev->bm_tasklet,
-		     vmci_process_bitmap, (unsigned long)vmci_dev);
+	tasklet_setup(&vmci_dev->datagram_tasklet, vmci_dispatch_dgs);
+	tasklet_setup(&vmci_dev->bm_tasklet, vmci_process_bitmap);
 
 	vmci_dev->data_buffer = vmalloc(VMCI_MAX_DG_SIZE);
 	if (!vmci_dev->data_buffer) {
drivers/mmc/host/atmel-mci.c +3 -3
index c26fbe5f2222..26671441ff9b 100644
@@ -1713,9 +1713,9 @@ static void atmci_detect_change(struct timer_list *t)
 	}
 }
 
-static void atmci_tasklet_func(unsigned long priv)
+static void atmci_tasklet_func(struct tasklet_struct *t)
 {
-	struct atmel_mci	*host = (struct atmel_mci *)priv;
+	struct atmel_mci *host = from_tasklet(host, t, tasklet);
 	struct mmc_request	*mrq = host->mrq;
 	struct mmc_data		*data = host->data;
 	enum atmel_mci_state	state = host->state;
@@ -2491,7 +2491,7 @@ static int atmci_probe(struct platform_device *pdev)
 
 	host->mapbase = regs->start;
 
-	tasklet_init(&host->tasklet, atmci_tasklet_func, (unsigned long)host);
+	tasklet_setup(&host->tasklet, atmci_tasklet_func);
 
 	ret = request_irq(irq, atmci_interrupt, 0, dev_name(&pdev->dev), host);
 	if (ret) {
drivers/mmc/host/au1xmmc.c +6 -8
index bc8aeb47a7b4..4de6bf45d382 100644
@@ -253,9 +253,9 @@ static void au1xmmc_finish_request(struct au1xmmc_host *host)
 	mmc_request_done(host->mmc, mrq);
 }
 
-static void au1xmmc_tasklet_finish(unsigned long param)
+static void au1xmmc_tasklet_finish(struct tasklet_struct *t)
 {
-	struct au1xmmc_host *host = (struct au1xmmc_host *) param;
+	struct au1xmmc_host *host = from_tasklet(host, t, finish_task);
 	au1xmmc_finish_request(host);
 }
 
@@ -379,9 +379,9 @@ static void au1xmmc_data_complete(struct au1xmmc_host *host, u32 status)
 	au1xmmc_finish_request(host);
 }
 
-static void au1xmmc_tasklet_data(unsigned long param)
+static void au1xmmc_tasklet_data(struct tasklet_struct *t)
 {
-	struct au1xmmc_host *host = (struct au1xmmc_host *)param;
+	struct au1xmmc_host *host = from_tasklet(host, t, data_task);
 
 	u32 status = __raw_readl(HOST_STATUS(host));
 	au1xmmc_data_complete(host, status);
@@ -1056,11 +1056,9 @@ static int au1xmmc_probe(struct platform_device *pdev)
 	if (host->platdata)
 		mmc->caps &= ~(host->platdata->mask_host_caps);
 
-	tasklet_init(&host->data_task, au1xmmc_tasklet_data,
-			(unsigned long)host);
+	tasklet_setup(&host->data_task, au1xmmc_tasklet_data);
 
-	tasklet_init(&host->finish_task, au1xmmc_tasklet_finish,
-			(unsigned long)host);
+	tasklet_setup(&host->finish_task, au1xmmc_tasklet_finish);
 
 	if (has_dbdma()) {
 		ret = au1xmmc_dbdma_init(host);
drivers/mmc/host/cb710-mmc.c +5 -5
index e33270e40539..927857e3b6d9 100644
@@ -644,11 +644,11 @@ static int cb710_mmc_irq_handler(struct cb710_slot *slot)
 	return 1;
 }
 
-static void cb710_mmc_finish_request_tasklet(unsigned long data)
+static void cb710_mmc_finish_request_tasklet(struct tasklet_struct *t)
 {
-	struct mmc_host *mmc = (void *)data;
-	struct cb710_mmc_reader *reader = mmc_priv(mmc);
+	struct cb710_mmc_reader *reader = from_tasklet(reader, t, finish_req_tasklet);
 	struct mmc_request *mrq = reader->mrq;
+	struct mmc_host *mmc = mrq->host;
 
 	reader->mrq = NULL;
 	mmc_request_done(mmc, mrq);
@@ -710,8 +710,8 @@ static int cb710_mmc_init(struct platform_device *pdev)
 
 	reader = mmc_priv(mmc);
 
-	tasklet_init(&reader->finish_req_tasklet,
-		cb710_mmc_finish_request_tasklet, (unsigned long)mmc);
+	tasklet_setup(&reader->finish_req_tasklet,
+		      cb710_mmc_finish_request_tasklet);
 	spin_lock_init(&reader->irq_lock);
 	cb710_dump_regs(chip, CB710_DUMP_REGS_MMC);
 
drivers/mmc/host/dw_mmc.c +3 -3
index 79c55c7b4afd..b90e90435a90 100644
@@ -1951,9 +1951,9 @@ static bool dw_mci_clear_pending_data_complete(struct dw_mci *host)
 	return true;
 }
 
-static void dw_mci_tasklet_func(unsigned long priv)
+static void dw_mci_tasklet_func(struct tasklet_struct *t)
 {
[… more lines in the raw message]

Lines of this file are not shown. View the raw message.

drivers/mmc/host/omap.c +3 -4
index d74e73c95fdf..5684b9eece22 100644

Lines of this file are not shown. View the raw message.

drivers/mmc/host/renesas_sdhi_internal_dmac.c +9 -10
index a66f8d6d61d1..4731632039b8 100644

Lines of this file are not shown. View the raw message.

drivers/mmc/host/renesas_sdhi_sys_dmac.c +4 -5
index 13ff023fbee9..e96af5f25c89 100644

Lines of this file are not shown. View the raw message.

drivers/mmc/host/s3cmci.c +3 -3
index bce9c33bc4b5..569fa5cca12c 100644

Lines of this file are not shown. View the raw message.

drivers/mmc/host/tifm_sd.c +3 -4
index 54271b92ee59..ae7046b4d6bf 100644

Lines of this file are not shown. View the raw message.

drivers/mmc/host/uniphier-sd.c +6 -8
index 0c72ec5546c3..01087006edcb 100644

Lines of this file are not shown. View the raw message.

drivers/mmc/host/via-sdmmc.c +3 -4
index f4ac064ff471..dae831544ee0 100644

Lines of this file are not shown. View the raw message.

drivers/mmc/host/wbsd.c +15 -20
index 740179f42cf2..0d94beb37123 100644

Lines of this file are not shown. View the raw message.

drivers/net/arcnet/arcnet.c +3 -4
index 8459115d9d4e..8dc181f3745a 100644

Lines of this file are not shown. View the raw message.

drivers/net/caif/caif_virtio.c +3 -5
index eb426822ad06..a8b62e32872d 100644

Lines of this file are not shown. View the raw message.

drivers/net/ethernet/alteon/acenic.c +5 -4
index 46b4207d3266..ab7678e60984 100644

Lines of this file are not shown. View the raw message.

drivers/net/ethernet/alteon/acenic.h +1 -1
index c670067b1541..4b02c705859c 100644

Lines of this file are not shown. View the raw message.

drivers/net/ethernet/amd/xgbe/xgbe-drv.c +9 -10
index 98f8f2033154..fdbba19319b7 100644

Lines of this file are not shown. View the raw message.

drivers/net/ethernet/amd/xgbe/xgbe-i2c.c +5 -6
index 4d9062d35930..22d4fc547a0a 100644

Lines of this file are not shown. View the raw message.

drivers/net/ethernet/amd/xgbe/xgbe-mdio.c +5 -6
index 8a3a60bb2688..93ef5a30cb8d 100644

Lines of this file are not shown. View the raw message.

drivers/net/ethernet/broadcom/cnic.c +8 -10
index 155599dcee76..3112c807c3e8 100644

Lines of this file are not shown. View the raw message.

drivers/net/ethernet/cadence/macb_main.c +3 -4
index 35b59b5edf0f..84e820799ab5 100644

Lines of this file are not shown. View the raw message.

drivers/net/ethernet/cavium/liquidio/lio_main.c +4 -6
index 283e1461257d..433eb8fa607d 100644

Lines of this file are not shown. View the raw message.

drivers/net/ethernet/cavium/octeon/octeon_mgmt.c +3 -4
index 0e5de88fd6e8..bf3ee371f07c 100644

Lines of this file are not shown. View the raw message.

drivers/net/ethernet/cavium/thunder/nicvf_main.c +4 -6
index 40a44dcb3d9b..2e6a71b05d49 100644

Lines of this file are not shown. View the raw message.

drivers/net/ethernet/cavium/thunder/nicvf_queues.c +2 -2
index 4ab57d33a87e..b54b61094d40 100644

Lines of this file are not shown. View the raw message.

drivers/net/ethernet/cavium/thunder/nicvf_queues.h +1 -1
index bc2427c49b89..63ac0fc664dc 100644

Lines of this file are not shown. View the raw message.

drivers/net/ethernet/chelsio/cxgb/sge.c +5 -4
index b6c656e15801..be9e28fbbacf 100644

Lines of this file are not shown. View the raw message.

drivers/net/ethernet/chelsio/cxgb3/sge.c +7 -9
index 6dabbf1502c7..8f04bad877d5 100644

Lines of this file are not shown. View the raw message.

drivers/net/ethernet/chelsio/cxgb4/sge.c +6 -6
index b3da81e90132..04e0534325e3 100644

Lines of this file are not shown. View the raw message.

drivers/net/ethernet/dlink/sundance.c +9 -10
index 4a37a69764ce..d7fdc5bc32ca 100644

Lines of this file are not shown. View the raw message.

drivers/net/ethernet/huawei/hinic/hinic_hw_eqs.c +3 -4
index 79243b626ddb..714c9fd320e7 100644

Lines of this file are not shown. View the raw message.

drivers/net/ethernet/ibm/ehea/ehea_main.c +3 -4
index 13e30eba5349..cb0c8f88d851 100644

Lines of this file are not shown. View the raw message.

drivers/net/ethernet/ibm/ibmvnic.c +3 -4
index 2e5172f61564..f5ab7f493b25 100644

Lines of this file are not shown. View the raw message.

drivers/net/ethernet/jme.c +16 -27

43 lines not on this page · raw message

drivers/net/ethernet/marvell/skge.c +3 -3
index 0a2ec387a482..85d26fd2e3ba 100644

Lines of this file are not shown. View the raw message.

drivers/net/ethernet/mellanox/mlx4/cq.c +2 -2
index 65f8a4b6ed0c..3b8576b9c2f9 100644

Lines of this file are not shown. View the raw message.

drivers/net/ethernet/mellanox/mlx4/eq.c +1 -2
index c790a5fcea73..da2956e50118 100644

Lines of this file are not shown. View the raw message.

drivers/net/ethernet/mellanox/mlx4/mlx4.h +1 -1
index 527b52e48276..64bed7ac3836 100644

Lines of this file are not shown. View the raw message.

drivers/net/ethernet/mellanox/mlx5/core/cq.c +2 -2
index 818edc63e428..84686fc9a55b 100644

Lines of this file are not shown. View the raw message.

drivers/net/ethernet/mellanox/mlx5/core/eq.c +1 -2
index 580c71cb9dfa..4afdb9d7385f 100644

Lines of this file are not shown. View the raw message.

drivers/net/ethernet/mellanox/mlx5/core/fpga/conn.c +3 -4
index 4c50efe4e7f1..2d674c3505df 100644

Lines of this file are not shown. View the raw message.

drivers/net/ethernet/mellanox/mlx5/core/lib/eq.h +1 -1
index 4be4d2d36218..93cd9a3f1708 100644

Lines of this file are not shown. View the raw message.

drivers/net/ethernet/mellanox/mlxsw/pci.c +6 -6
index 615455a21567..3c65cb537d63 100644

Lines of this file are not shown. View the raw message.

drivers/net/ethernet/micrel/ks8842.c +10 -9
index da329ca115cc..6a795c0db704 100644

Lines of this file are not shown. View the raw message.

drivers/net/ethernet/micrel/ksz884x.c +6 -8
index e102e1560ac7..7ce9bd09401f 100644

Lines of this file are not shown. View the raw message.

drivers/net/ethernet/natsemi/ns83820.c +4 -4
index 6af9a7eee114..b41f15d81661 100644

Lines of this file are not shown. View the raw message.

drivers/net/ethernet/netronome/nfp/nfp_net_common.c +3 -4
index 61aabffc8888..4dfef6256e05 100644

Lines of this file are not shown. View the raw message.

drivers/net/ethernet/ni/nixge.c +3 -4
index 0b384f97d2fd..f2c70907c7b3 100644

Lines of this file are not shown. View the raw message.

drivers/net/ethernet/qlogic/qed/qed_int.c +3 -4
index 7e1ef7b281b5..4cb548809281 100644

Lines of this file are not shown. View the raw message.

drivers/net/ethernet/qlogic/qed/qed_int.h +1 -1
index d473b522afc5..4f945f253a8d 100644

Lines of this file are not shown. View the raw message.

drivers/net/ethernet/silan/sc92031.c +6 -5
index c7641a236eb8..eb4a1ec30e15 100644

Lines of this file are not shown. View the raw message.

drivers/net/ethernet/smsc/smc91x.c +4 -4
index 3a6761131f4c..771e978ff93a 100644

Lines of this file are not shown. View the raw message.

drivers/net/ethernet/xilinx/xilinx_axienet_main.c +4 -5
index 4fc627fb4d11..f24f392e9031 100644

Lines of this file are not shown. View the raw message.

drivers/net/ifb.c +3 -4
index 242b9b0943f8..c921d95a7ef6 100644

Lines of this file are not shown. View the raw message.

drivers/net/ppp/ppp_async.c +4 -4
index a7b9cf3269bf..b9211c1719d5 100644

Lines of this file are not shown. View the raw message.

drivers/net/ppp/ppp_synctty.c +4 -4
index 0f338752c38b..86ee5149f4f2 100644

Lines of this file are not shown. View the raw message.

drivers/net/usb/cdc_ncm.c +4 -4
index 50c05d0f44cb..0c2cfc706423 100644

Lines of this file are not shown. View the raw message.

drivers/net/usb/hso.c +4 -4
index ce78714f536f..811d4250c3f0 100644

Lines of this file are not shown. View the raw message.

drivers/net/usb/lan78xx.c +3 -3
index 58f5a219fb65..ea966aa47119 100644

Lines of this file are not shown. View the raw message.

drivers/net/usb/pegasus.c +3 -3
index f7d117d80cfb..221b46f66082 100644

Lines of this file are not shown. View the raw message.

drivers/net/usb/r8152.c +3 -5
index 08726090570e..421e4f075670 100644

Lines of this file are not shown. View the raw message.

drivers/net/usb/rtl8150.c +3 -3
index 13e51ccf0214..3a5c628f79b7 100644

Lines of this file are not shown. View the raw message.

drivers/net/usb/usbnet.c +2 -2
index 58952a79b05f..1c4817c05d3c 100644

Lines of this file are not shown. View the raw message.

drivers/net/wireless/ath/ath5k/base.c +12 -12
index 65a4c142640d..2781dcd534a9 100644

Lines of this file are not shown. View the raw message.

drivers/net/wireless/ath/ath5k/rfkill.c +3 -5
index 270a319f3aeb..4861a716cb29 100644

Lines of this file are not shown. View the raw message.

drivers/net/wireless/ath/ath9k/ath9k.h +2 -2
index a412b352182c..e06b74a54a69 100644

Lines of this file are not shown. View the raw message.

drivers/net/wireless/ath/ath9k/beacon.c +2 -2
index e36f947e19fc..4876bff2dc2c 100644

Lines of this file are not shown. View the raw message.

drivers/net/wireless/ath/ath9k/htc.h +2 -2
index 9f64e32381f9..0a1634238e67 100644

Lines of this file are not shown. View the raw message.

drivers/net/wireless/ath/ath9k/htc_drv_init.c +2 -4
index d961095ab01f..b795081a4da7 100644

Lines of this file are not shown. View the raw message.

drivers/net/wireless/ath/ath9k/htc_drv_txrx.c +4 -4
index 4e8e80ac8341..f738835d5bf5 100644

Lines of this file are not shown. View the raw message.

drivers/net/wireless/ath/ath9k/init.c +2 -3
index 17c318902cb8..0427c64d210a 100644

Lines of this file are not shown. View the raw message.

drivers/net/wireless/ath/ath9k/main.c +2 -2
index 34121fbf32e3..4a369a3751f4 100644

Lines of this file are not shown. View the raw message.

drivers/net/wireless/ath/ath9k/wmi.c +3 -4
index cdc146091194..0b206779f631 100644

Lines of this file are not shown. View the raw message.

drivers/net/wireless/ath/ath9k/wmi.h +1 -1
index 380175d5ecd7..9bafd2ee32ec 100644

Lines of this file are not shown. View the raw message.

drivers/net/wireless/ath/carl9170/usb.c +3 -4
index 486957a04bd1..149abb4a1eed 100644

Lines of this file are not shown. View the raw message.

drivers/net/wireless/atmel/at76c50x-usb.c +4 -4
index db2c3b8d491e..3a66538a0853 100644

Lines of this file are not shown. View the raw message.

drivers/net/wireless/broadcom/b43legacy/main.c +3 -4
index 4325e91736eb..414105580902 100644

Lines of this file are not shown. View the raw message.

drivers/net/wireless/broadcom/b43legacy/pio.c +3 -4
index cbb761378619..aac413d0f629 100644

Lines of this file are not shown. View the raw message.

drivers/net/wireless/broadcom/brcm80211/brcmsmac/mac80211_if.c +3 -3
index 6188275b17e5..8ecd25ff32da 100644

Lines of this file are not shown. View the raw message.

drivers/net/wireless/broadcom/brcm80211/brcmsmac/mac80211_if.h +1 -1
index 198053dfc310..eaf926a96a88 100644

Lines of this file are not shown. View the raw message.

drivers/net/wireless/intel/ipw2x00/ipw2100.c +4 -4
index 8dfbaff2d1fe..4420c95b84d6 100644

Lines of this file are not shown. View the raw message.

drivers/net/wireless/intel/ipw2x00/ipw2200.c +3 -3
index ed0f06532d5e..74ef15fb701d 100644

Lines of this file are not shown. View the raw message.

drivers/net/wireless/intel/iwlegacy/3945-mac.c +3 -4
index 4fbcc7fba3cc..bbeed63d7141 100644

Lines of this file are not shown. View the raw message.

drivers/net/wireless/intel/iwlegacy/4965-mac.c +3 -4
index ffb705b18fb1..94587592909a 100644

Lines of this file are not shown. View the raw message.

drivers/net/wireless/intersil/hostap/hostap_hw.c +9 -9
index 158a3d762e55..187095e13294 100644

Lines of this file are not shown. View the raw message.

drivers/net/wireless/intersil/orinoco/main.c +3 -4
index 28dac36d7c4c..c01ce6a5ccd0 100644

Lines of this file are not shown. View the raw message.

drivers/net/wireless/intersil/p54/p54pci.c +4 -4
index 80ad0b7eaef4..3d2070d9e523 100644

Lines of this file are not shown. View the raw message.

drivers/net/wireless/marvell/mwl8k.c +8 -8
index c4db6417748f..305da73e6940 100644

Lines of this file are not shown. View the raw message.

drivers/net/wireless/mediatek/mt76/mac80211.c +1 -1
index 1a2c143b34d0..75abbfc1bb7f 100644

Lines of this file are not shown. View the raw message.

drivers/net/wireless/mediatek/mt76/mt76.h +1 -1
index 570c159515a0..c0dabc269074 100644

Lines of this file are not shown. View the raw message.

drivers/net/wireless/mediatek/mt76/mt7603/beacon.c +2 -2
index 7a41cdf1c4ae..ab6771c6d2a6 100644

Lines of this file are not shown. View the raw message.

drivers/net/wireless/mediatek/mt76/mt7603/init.c +1 -2
index ad2ccdbe7258..c27e7a1a1e86 100644

Lines of this file are not shown. View the raw message.

drivers/net/wireless/mediatek/mt76/mt7603/mt7603.h +1 -1
index 257300fec4f8..83262870f7c5 100644

Lines of this file are not shown. View the raw message.

drivers/net/wireless/mediatek/mt76/mt76x02_dfs.c +4 -5
index 5dec33ed8527..b454177ed6df 100644

Lines of this file are not shown. View the raw message.

drivers/net/wireless/mediatek/mt76/mt76x02_mmio.c +6 -8
index dc773070481d..83296955ce4f 100644

Lines of this file are not shown. View the raw message.

drivers/net/wireless/mediatek/mt76/tx.c +2 -2
index c22a05f06fd0..8c85d9acacd9 100644

Lines of this file are not shown. View the raw message.

drivers/net/wireless/mediatek/mt76/usb.c +6 -6
index 20c6fe510e9d..bb5ee441f3b4 100644

Lines of this file are not shown. View the raw message.

drivers/net/wireless/mediatek/mt7601u/dma.c +6 -6
index f6a0454abe04..abeffeb388b7 100644

Lines of this file are not shown. View the raw message.

drivers/net/wireless/quantenna/qtnfmac/pcie/pearl_pcie.c +3 -4
index 3aa3714d4dfd..147cc41d0b0c 100644

Lines of this file are not shown. View the raw message.

drivers/net/wireless/quantenna/qtnfmac/pcie/topaz_pcie.c +3 -4
index 9a4380ed7f1b..09ae5f925572 100644

Lines of this file are not shown. View the raw message.

drivers/net/wireless/ralink/rt2x00/rt2400pci.c +8 -6
index 4d44509e2ce3..3b8eb2e5726d 100644

Lines of this file are not shown. View the raw message.

drivers/net/wireless/ralink/rt2x00/rt2500pci.c +8 -6
index 4620990a94cf..cadd3ac829bb 100644

Lines of this file are not shown. View the raw message.

drivers/net/wireless/ralink/rt2x00/rt2800mmio.c +15 -10
index 110bb391c372..18f84c94b53c 100644

Lines of this file are not shown. View the raw message.

drivers/net/wireless/ralink/rt2x00/rt2800mmio.h +5 -5
index adcd9d54ac1c..05708950f24d 100644

Lines of this file are not shown. View the raw message.

drivers/net/wireless/ralink/rt2x00/rt2x00.h +5 -5
index 2b216edd0c7d..eb6fd6a9dc76 100644

Lines of this file are not shown. View the raw message.

drivers/net/wireless/ralink/rt2x00/rt2x00dev.c +2 -3
index c3eab767bc21..379613a566c7 100644

Lines of this file are not shown. View the raw message.

drivers/net/wireless/ralink/rt2x00/rt61pci.c +11 -8
index d83288bef2fc..21c35d3434d0 100644

Lines of this file are not shown. View the raw message.

drivers/net/wireless/realtek/rtlwifi/pci.c +11 -9
index 6087ec7a90a6..6e97ebd70215 100644

Lines of this file are not shown. View the raw message.

drivers/net/wireless/realtek/rtlwifi/usb.c +5 -5
index 4b59f3b46b28..aae5c5aa1769 100644

Lines of this file are not shown. View the raw message.

drivers/net/wireless/zydas/zd1211rw/zd_usb.c +4 -4
index 4e44ea8c652d..0ebbd727a452 100644

Lines of this file are not shown. View the raw message.

drivers/ntb/ntb_transport.c +4 -5
index 00a5d5764993..59400d3b680e 100644

Lines of this file are not shown. View the raw message.

drivers/platform/goldfish/goldfish_pipe.c +3 -4
index cef0133aa47a..9bad04014906 100644

Lines of this file are not shown. View the raw message.

drivers/rapidio/devices/tsi721_dma.c +3 -4
index d375c02059f3..4a2bb6d7c692 100644

Lines of this file are not shown. View the raw message.

drivers/s390/block/dasd.c +8 -10
index 6cca72782af6..b292c7806e5a 100644

Lines of this file are not shown. View the raw message.

drivers/s390/char/con3215.c +3 -3
index e7cf0a1d4f71..eb32ee817f21 100644

Lines of this file are not shown. View the raw message.

drivers/s390/char/con3270.c +3 -4
index e17364e13d2f..b1d4b7e69d0f 100644

Lines of this file are not shown. View the raw message.

drivers/s390/char/tty3270.c +7 -8
index 98d7fc152e32..07157f33abaf 100644

Lines of this file are not shown. View the raw message.

drivers/s390/cio/qdio.h +3 -3
index a58b45df95d7..d28c0d3b02d1 100644

Lines of this file are not shown. View the raw message.

drivers/s390/cio/qdio_main.c +6 -6
index 5b63c505a2f7..925b0fd4e2ab 100644

Lines of this file are not shown. View the raw message.

drivers/s390/cio/qdio_setup.c +3 -6
index f4ca1d29d61b..4eff37f90091 100644

Lines of this file are not shown. View the raw message.

drivers/s390/net/ctcm_main.c +4 -5
index 437a6d822105..f1f42622c7e5 100644

Lines of this file are not shown. View the raw message.

drivers/s390/net/ctcm_mpc.c +8 -8
index ab316baa8284..049b6ca0789f 100644

Lines of this file are not shown. View the raw message.

drivers/s390/net/ctcm_mpc.h +3 -3
index 441d7b211f0f..80c772326178 100644

Lines of this file are not shown. View the raw message.

drivers/scsi/aic94xx/aic94xx_hwi.c +4 -5
index c5a46c59d4f8..a28700b74d67 100644

Lines of this file are not shown. View the raw message.

drivers/scsi/esas2r/esas2r.h +1 -1
index 7f43b95f4e94..d3bf68b2fb1d 100644

Lines of this file are not shown. View the raw message.

drivers/scsi/esas2r/esas2r_init.c +1 -3
index eb7d139ffc00..55387c14fb8d 100644

Lines of this file are not shown. View the raw message.

drivers/scsi/esas2r/esas2r_main.c +2 -2
index 80c5a235d193..ead267dd687d 100644

Lines of this file are not shown. View the raw message.

drivers/scsi/hisi_sas/hisi_sas_v2_hw.c +3 -3
index 8e96a257e439..bc4a687ec60e 100644

Lines of this file are not shown. View the raw message.

drivers/scsi/hisi_sas/hisi_sas_v3_hw.c +3 -3
index cb8d087762db..10130c8ebf7c 100644

Lines of this file are not shown. View the raw message.

drivers/scsi/ibmvscsi/ibmvfc.c +3 -3
index df897df5cafe..c7277401367d 100644

Lines of this file are not shown. View the raw message.

drivers/scsi/ibmvscsi/ibmvscsi.c +4 -4
index 7f66a7783209..e6877d9ec6c5 100644

Lines of this file are not shown. View the raw message.

drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c +3 -4
index a929fe76102b..2c7d1e4e64aa 100644

Lines of this file are not shown. View the raw message.

drivers/scsi/isci/host.c +2 -2
index 7b5deae68d33..599adebd039e 100644

Lines of this file are not shown. View the raw message.

drivers/scsi/isci/host.h +1 -1
index 6bc3f022630a..6abe23682d9b 100644

Lines of this file are not shown. View the raw message.

drivers/scsi/isci/init.c +2 -2
index 1727d0c71b12..e036f08c39a5 100644

Lines of this file are not shown. View the raw message.

drivers/scsi/megaraid/megaraid_mbox.c +5 -6
index f6ac819e6e96..f0cfae886e1a 100644

Lines of this file are not shown. View the raw message.

drivers/scsi/megaraid/megaraid_sas.h +1 -1
index a6e788c02ff4..4431cd4c91da 100644

Lines of this file are not shown. View the raw message.

drivers/scsi/megaraid/megaraid_sas_base.c +7 -9
index 42cf38c1ea99..447e67436dff 100644

Lines of this file are not shown. View the raw message.

drivers/scsi/megaraid/megaraid_sas_fusion.c +6 -7
index e301458bcbae..778db8e95f31 100644

Lines of this file are not shown. View the raw message.

drivers/scsi/mvsas/mv_init.c +4 -4
index da719b0694dc..34b866c5b281 100644

Lines of this file are not shown. View the raw message.

drivers/scsi/pm8001/pm8001_init.c +12 -13
index f508e8314188..65a6573f4aec 100644

Lines of this file are not shown. View the raw message.

drivers/scsi/pmcraid.c +10 -11
index 2e44e3954bb0..7730aae67076 100644

Lines of this file are not shown. View the raw message.

drivers/spi/spi-pl022.c +3 -4
index 7fedea67159c..96ed75f995fe 100644

Lines of this file are not shown. View the raw message.

drivers/staging/isdn/gigaset/bas-gigaset.c +10 -12
index a3febefde39b..5285311d7a1c 100644

Lines of this file are not shown. View the raw message.

drivers/staging/isdn/gigaset/common.c +1 -2
index 3bb8092858ab..a0f16907e030 100644

Lines of this file are not shown. View the raw message.

drivers/staging/isdn/gigaset/ev-layer.c +2 -2
index f8bb1869c600..0f2335226a2d 100644

Lines of this file are not shown. View the raw message.

drivers/staging/isdn/gigaset/gigaset.h +1 -1
index df745c7bf57c..6946a26e45d0 100644

Lines of this file are not shown. View the raw message.

drivers/staging/isdn/gigaset/interface.c +3 -3
index 17fa615a8c68..a2f79e7dcbee 100644

Lines of this file are not shown. View the raw message.

drivers/staging/isdn/gigaset/ser-gigaset.c +3 -4
index 5587e9e7fc73..746b5bdd6d83 100644

Lines of this file are not shown. View the raw message.

drivers/staging/isdn/gigaset/usb-gigaset.c +3 -4
index 1b9b43659bdf..a5f628acb238 100644

Lines of this file are not shown. View the raw message.

drivers/staging/ks7010/ks7010_sdio.c +3 -3
index 4b379542ecd5..9f5e80b65dcf 100644

Lines of this file are not shown. View the raw message.

drivers/staging/ks7010/ks_hostif.c +3 -3
index 2666f9e30c15..26fc11a8aec9 100644

Lines of this file are not shown. View the raw message.

drivers/staging/mt7621-dma/mtk-hsdma.c +3 -3
index d964642d95a3..bf1e47a3bfc7 100644

Lines of this file are not shown. View the raw message.

drivers/staging/ralink-gdma/ralink-gdma.c +3 -3
index 900424db9b97..b9c88e71b312 100644

Lines of this file are not shown. View the raw message.

drivers/staging/rtl8188eu/hal/rtl8188eu_recv.c +1 -3
index c0d51ba70a75..1c0350dfc5a0 100644

Lines of this file are not shown. View the raw message.

drivers/staging/rtl8188eu/hal/rtl8188eu_xmit.c +2 -3
index ab94ad9d608a..d848cdb09eee 100644

Lines of this file are not shown. View the raw message.

drivers/staging/rtl8188eu/include/rtl8188e_recv.h +1 -1
index c2c7ef974dc5..fea1119c426e 100644

Lines of this file are not shown. View the raw message.

drivers/staging/rtl8188eu/include/rtl8188e_xmit.h +1 -1
index 421e9f45306f..77fd699a80ba 100644

Lines of this file are not shown. View the raw message.

drivers/staging/rtl8188eu/os_dep/usb_ops_linux.c +4 -4
index aaab0d577453..644aa09b0ae3 100644

Lines of this file are not shown. View the raw message.

drivers/staging/rtl8192e/rtl8192e/rtl_core.c +15 -14
index f932cb15e4e5..f5b41baa0f85 100644

Lines of this file are not shown. View the raw message.

drivers/staging/rtl8192e/rtllib_softmac.c +3 -5
index f2f7529e7c80..51c6ba7269f0 100644

Lines of this file are not shown. View the raw message.

drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c +3 -4
index 33a6af7aad22..b684c8a5f583 100644

Lines of this file are not shown. View the raw message.

drivers/staging/rtl8192u/r8192U_core.c +4 -5
index 2821411878ce..f076ba6c36a7 100644

Lines of this file are not shown. View the raw message.

drivers/staging/rtl8712/rtl8712_recv.c +4 -6
index 9901815604f4..d332b529a29a 100644

Lines of this file are not shown. View the raw message.

drivers/staging/rtl8712/rtl871x_xmit.c +1 -3
index cc5809e49e35..c7f2c00aa8b9 100644

Lines of this file are not shown. View the raw message.

drivers/staging/rtl8712/rtl871x_xmit.h +1 -1
index b14da38bf652..36008478062a 100644

Lines of this file are not shown. View the raw message.

drivers/staging/rtl8712/usb_ops_linux.c +2 -2
index 9d290bc2fdb7..acf828101401 100644

Lines of this file are not shown. View the raw message.

drivers/staging/rtl8723bs/hal/rtl8723bs_recv.c +5 -8
index 0f3301091258..638fb6ff3962 100644

Lines of this file are not shown. View the raw message.

drivers/staging/wlan-ng/hfa384x_usb.c +8 -10
index 28d372a0663a..62cbc7c900d1 100644

Lines of this file are not shown. View the raw message.

drivers/staging/wlan-ng/p80211netdev.c +3 -4
index a70fb84f38f1..89827be85461 100644

Lines of this file are not shown. View the raw message.

drivers/tty/ipwireless/hardware.c +3 -3
index 6bbf35682d53..f5d3e68f5750 100644

Lines of this file are not shown. View the raw message.

drivers/tty/serial/atmel_serial.c +8 -10
index a8dc8af83f39..1fc46d5c3ca6 100644

Lines of this file are not shown. View the raw message.

drivers/tty/serial/ifx6x60.c +3 -4
index ffefd218761e..23d69d94c799 100644

Lines of this file are not shown. View the raw message.

drivers/tty/serial/timbuart.c +3 -3
index 19d38b504e27..2126e6e6dfd1 100644

Lines of this file are not shown. View the raw message.

drivers/usb/atm/usbatm.c +6 -6
index dbea28495e1d..d102db9ca9b1 100644

Lines of this file are not shown. View the raw message.

drivers/usb/c67x00/c67x00-sched.c +3 -4
index 633c52de3bb3..9bd194ba4965 100644

Lines of this file are not shown. View the raw message.

drivers/usb/core/hcd.c +3 -3
index f225eaa98ff8..f5c9077a8041 100644

Lines of this file are not shown. View the raw message.

drivers/usb/gadget/function/f_midi.c +3 -3
index 46af0aa07e2e..85cb15734aa8 100644

Lines of this file are not shown. View the raw message.

drivers/usb/gadget/udc/fsl_qe_udc.c +3 -4
index 2707be628298..fa66449b3907 100644

Lines of this file are not shown. View the raw message.

drivers/usb/host/xhci-dbgtty.c +3 -3
index be726c791323..49cce47394cf 100644

Lines of this file are not shown. View the raw message.

drivers/usb/serial/mos7720.c +3 -4
index 18110225d506..af3bab46cf57 100644

Lines of this file are not shown. View the raw message.

drivers/vme/bridges/vme_fake.c +4 -5
index 3208a4409e44..3a5e705ec0e5 100644

Lines of this file are not shown. View the raw message.

net/dccp/timer.c +5 -4
index c0b3672637c4..80cb7558d04d 100644

Lines of this file are not shown. View the raw message.

net/ipv4/tcp_output.c +3 -5
index fec6d67bfd14..e8018ff49bf0 100644

Lines of this file are not shown. View the raw message.

net/mac80211/ieee80211_i.h +2 -2
index 05406e9c05b3..fd20d0ead959 100644

Lines of this file are not shown. View the raw message.

net/mac80211/main.c +5 -9
index aba094b4ccfc..8781769223fc 100644

Lines of this file are not shown. View the raw message.

net/mac80211/tx.c +2 -2
index 1fa422782905..1705e3b08f15 100644

Lines of this file are not shown. View the raw message.

net/mac80211/util.c +2 -2
index 051a02ddcb85..8a558ed04859 100644

Lines of this file are not shown. View the raw message.

net/mac802154/main.c +3 -5
index 06ea0f8bfd5c..520cedc594e1 100644

Lines of this file are not shown. View the raw message.

net/rds/ib_cm.c +6 -8
index 233f1368162b..aa67a0c2c24a 100644

Lines of this file are not shown. View the raw message.

net/sched/sch_atm.c +4 -4
index f4f9b8cdbffb..4ddca34e4297 100644

Lines of this file are not shown. View the raw message.

net/smc/smc_cdc.c +3 -3
index d0b0f4c865b4..390b87132c5a 100644

Lines of this file are not shown. View the raw message.

net/smc/smc_wr.c +6 -8
index 253aa75dc2b6..30004026038f 100644

Lines of this file are not shown. View the raw message.

net/xfrm/xfrm_input.c +3 -4
index 6088bc2dc11e..5d43fc6783f1 100644

Lines of this file are not shown. View the raw message.

sound/core/timer.c +3 -4
index 5c9fbf3f4340..ac93bcf838dc 100644

Lines of this file are not shown. View the raw message.

sound/firewire/amdtp-stream.c +4 -4
index e50e28f77e74..af76a712d024 100644

Lines of this file are not shown. View the raw message.

sound/pci/asihpi/asihpi.c +4 -5
index 2a21a3d99719..58141942f2ef 100644

Lines of this file are not shown. View the raw message.

sound/pci/riptide/riptide.c +3 -3
index 58771ae0ed63..55493d00ba3c 100644

Lines of this file are not shown. View the raw message.

sound/pci/rme9652/hdsp.c +3 -3
index 5cbdc9be9c7e..c41154d3c339 100644

Lines of this file are not shown. View the raw message.

sound/pci/rme9652/hdspm.c +3 -4
index 81a6f4b2bd3c..ccc3c8eafd82 100644

Lines of this file are not shown. View the raw message.

sound/soc/fsl/fsl_esai.c +3 -4
index a78e4ab478df..2d65d36061e9 100644

Lines of this file are not shown. View the raw message.

sound/soc/sh/siu_pcm.c +4 -6
index 78c3145b4109..e777cb7d6d2f 100644

Lines of this file are not shown. View the raw message.

sound/soc/txx9/txx9aclc.c +3 -4
index 66044559f70f..dbdeae9d4519 100644

Lines of this file are not shown. View the raw message.

sound/usb/midi.c +3 -4
index b737f0ec77d0..6861c362d756 100644

Lines of this file are not shown. View the raw message.

sound/usb/misc/ua101.c +3 -4
index 307b72d5fffa..70b0fef7cf08 100644

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

Signature · 1 line
2.23.0

Part of the diff is not shown here. View the raw message.

#18 lore raw

PATCH 13/16 tasklet: Pass tasklet_struct pointer to callbacks unconditionally

In reply to Romain Perier

From: Romain Perier <[email protected]>

Now that all tasklet callbacks are already taking their struct tasklet_struct pointer as the callback argument, just do this unconditionally and remove the .data field. It converts all runtime code, init functions and the DECLARE_TASKLET() macros to get rid of the .data argument. Moreover, all remaining use or assignment of the .data field are removed in a single shot.

---
 drivers/gpu/drm/i915/gt/intel_engine_cs.c        | 2 +-
 drivers/gpu/drm/i915/gt/intel_lrc.c              | 2 +-
 drivers/net/usb/usbnet.c                         | 1 -
 drivers/net/wireless/atmel/at76c50x-usb.c        | 1 -
 drivers/net/wireless/intersil/hostap/hostap_hw.c | 2 +-
 drivers/net/wireless/realtek/rtlwifi/usb.c       | 1 -
 drivers/net/wireless/zydas/zd1211rw/zd_usb.c     | 1 -
 drivers/staging/most/dim2/dim2.c                 | 1 -
 drivers/usb/gadget/udc/snps_udc_core.c           | 1 -
 include/linux/interrupt.h                        | 9 ++++-----
 kernel/softirq.c                                 | 5 ++---
 net/atm/pppoatm.c                                | 1 -
 12 files changed, 9 insertions(+), 18 deletions(-)
drivers/gpu/drm/i915/gt/intel_engine_cs.c +1 -1
index 82630db0394b..357d14ae32d0 100644
@@ -1057,7 +1057,7 @@ bool intel_engine_is_idle(struct intel_engine_cs *engine)
 		if (tasklet_trylock(t)) {
 			/* Must wait for any GPU reset in progress. */
 			if (__tasklet_is_enabled(t))
-				t->func(t->data);
+				t->func(t);
 			tasklet_unlock(t);
 		}
 		local_bh_enable();
drivers/gpu/drm/i915/gt/intel_lrc.c +1 -1
index d630dbc953ad..99f39047e49f 100644
@@ -2616,7 +2616,7 @@ static void execlists_reset_finish(struct intel_engine_cs *engine)
 	 */
 	GEM_BUG_ON(!reset_in_progress(execlists));
 	if (!RB_EMPTY_ROOT(&execlists->queue.rb_root))
-		execlists->tasklet.func(execlists->tasklet.data);
+		execlists->tasklet.func(&execlists->tasklet);
 
 	if (__tasklet_enable(&execlists->tasklet))
 		/* And kick in case we missed a new request submission. */
drivers/net/usb/usbnet.c +0 -1
index 1c4817c05d3c..14cedee27f2f 100644
@@ -1693,7 +1693,6 @@ usbnet_probe (struct usb_interface *udev, const struct usb_device_id *prod)
 	skb_queue_head_init (&dev->done);
 	skb_queue_head_init(&dev->rxq_pause);
 	dev->bh.func = (TASKLET_FUNC_TYPE)usbnet_bh;
-	dev->bh.data = (TASKLET_DATA_TYPE)&dev->delay;
 	INIT_WORK (&dev->kevent, usbnet_deferred_kevent);
 	init_usb_anchor(&dev->deferred);
 	timer_setup(&dev->delay, usbnet_bh, 0);
drivers/net/wireless/atmel/at76c50x-usb.c +0 -1
index 3a66538a0853..fd796a32c71d 100644
@@ -1199,7 +1199,6 @@ static void at76_rx_callback(struct urb *urb)
 {
 	struct at76_priv *priv = urb->context;
 
-	priv->rx_tasklet.data = (unsigned long)urb;
 	tasklet_schedule(&priv->rx_tasklet);
 }
 
drivers/net/wireless/intersil/hostap/hostap_hw.c +1 -1
index 187095e13294..ae656563a82d 100644
@@ -3183,7 +3183,7 @@ prism2_init_local_data(struct prism2_helper_functions *funcs, int card_idx,
 	/* Initialize tasklets for handling hardware IRQ related operations
 	 * outside hw IRQ handler */
 #define HOSTAP_TASKLET_INIT(q, f, d) \
-do { memset((q), 0, sizeof(*(q))); (q)->func = (TASKLET_FUNC_TYPE)(f); (q)->data = (TASKLET_DATA_TYPE)(q); } \
+do { memset((q), 0, sizeof(*(q))); (q)->func = (TASKLET_FUNC_TYPE)(f); } \
 while (0)
 	HOSTAP_TASKLET_INIT(&local->bap_tasklet, hostap_bap_tasklet,
 			    (unsigned long) local);
drivers/net/wireless/realtek/rtlwifi/usb.c +0 -1
index aae5c5aa1769..7e9bdbd2a6f4 100644
@@ -311,7 +311,6 @@ static int _rtl_usb_init_rx(struct ieee80211_hw *hw)
 
 	skb_queue_head_init(&rtlusb->rx_queue);
 	rtlusb->rx_work_tasklet.func = (TASKLET_FUNC_TYPE)_rtl_rx_work;
-	rtlusb->rx_work_tasklet.data = (TASKLET_DATA_TYPE)&rtlusb->rx_work_tasklet;
 
 	return 0;
 }
drivers/net/wireless/zydas/zd1211rw/zd_usb.c +0 -1
index 0ebbd727a452..4275549f4d98 100644
@@ -1181,7 +1181,6 @@ static inline void init_usb_rx(struct zd_usb *usb)
 	ZD_ASSERT(rx->fragment_length == 0);
 	INIT_DELAYED_WORK(&rx->idle_work, zd_rx_idle_timer_handler);
 	rx->reset_timer_tasklet.func = (TASKLET_FUNC_TYPE)zd_usb_reset_rx_idle_timer_tasklet;
-	rx->reset_timer_tasklet.data = (TASKLET_DATA_TYPE)&rx->reset_timer_tasklet;
 }
 
 static inline void init_usb_tx(struct zd_usb *usb)
drivers/staging/most/dim2/dim2.c +0 -1
index 98f0acca5c06..70040562af45 100644
@@ -740,7 +740,6 @@ static int dim2_probe(struct platform_device *pdev)
 
 	dev->atx_idx = -1;
 	dev->dim2_tasklet = dim2_tasklet;
-	dev->dim2_tasklet.data = (TASKLET_DATA_TYPE)&dev->dim2_tasklet;
 
 	platform_set_drvdata(pdev, dev);
 
drivers/usb/gadget/udc/snps_udc_core.c +0 -1
index c9f29b7ad986..b2d5ad004b0f 100644
@@ -3187,7 +3187,6 @@ int udc_probe(struct udc *dev)
 	udc = dev;
 
 	dev->disconnect_tasklet = disconnect_tasklet;
-	dev->disconnect_tasklet.data = (TASKLET_DATA_TYPE)&dev->disconnect_tasklet;
 
 	retval = usb_add_gadget_udc_release(udc->dev, &dev->gadget,
 					    gadget_release);
include/linux/interrupt.h +4 -5
index 949bbaeaff0e..a01dea0a90bb 100644
@@ -595,17 +595,16 @@ struct tasklet_struct
 	unsigned long state;
 	atomic_t count;
 	void (*func)(unsigned long);
-	unsigned long data;
 };
 
 #define TASKLET_DATA_TYPE		unsigned long
 #define TASKLET_FUNC_TYPE		void (*)(TASKLET_DATA_TYPE)
 
 #define DECLARE_TASKLET(name, func, data) \
-struct tasklet_struct name = { NULL, 0, ATOMIC_INIT(0), (TASKLET_FUNC_TYPE)func, (TASKLET_DATA_TYPE)&name }
+struct tasklet_struct name = { NULL, 0, ATOMIC_INIT(0), (TASKLET_FUNC_TYPE)func }
 
 #define DECLARE_TASKLET_DISABLED(name, func, data) \
-struct tasklet_struct name = { NULL, 0, ATOMIC_INIT(1), (TASKLET_FUNC_TYPE)func, (TASKLET_DATA_TYPE)&name }
+struct tasklet_struct name = { NULL, 0, ATOMIC_INIT(1), (TASKLET_FUNC_TYPE)func }
 
 
 enum
@@ -674,7 +673,7 @@ static inline void tasklet_enable(struct tasklet_struct *t)
 extern void tasklet_kill(struct tasklet_struct *t);
 extern void tasklet_kill_immediate(struct tasklet_struct *t, unsigned int cpu);
 extern void tasklet_init(struct tasklet_struct *t,
-			 void (*func)(unsigned long), unsigned long data);
+			 void (*func)(unsigned long));
 
 #define from_tasklet(var, callback_tasklet, tasklet_fieldname) \
 	container_of(callback_tasklet, typeof(*var), tasklet_fieldname)
@@ -682,7 +681,7 @@ extern void tasklet_init(struct tasklet_struct *t,
 static inline void tasklet_setup(struct tasklet_struct *t,
 				 void (*callback)(struct tasklet_struct *))
 {
-	tasklet_init(t, (TASKLET_FUNC_TYPE)callback, (TASKLET_DATA_TYPE)t);
+	tasklet_init(t, (TASKLET_FUNC_TYPE)callback);
 }
 
 /*
kernel/softirq.c +2 -3
index 0427a86743a4..feb9ac8e6f0b 100644
@@ -520,7 +520,7 @@ static void tasklet_action_common(struct softirq_action *a,
 				if (!test_and_clear_bit(TASKLET_STATE_SCHED,
 							&t->state))
 					BUG();
-				t->func(t->data);
+				t->func((TASKLET_DATA_TYPE)t);
 				tasklet_unlock(t);
 				continue;
 			}
@@ -547,13 +547,12 @@ static __latent_entropy void tasklet_hi_action(struct softirq_action *a)
 }
 
 void tasklet_init(struct tasklet_struct *t,
-		  void (*func)(unsigned long), unsigned long data)
+		  void (*func)(unsigned long))
 {
 	t->next = NULL;
 	t->state = 0;
 	atomic_set(&t->count, 0);
 	t->func = func;
-	t->data = data;
 }
 EXPORT_SYMBOL(tasklet_init);
 
net/atm/pppoatm.c +0 -1
index fe45fba20be2..1d9274194dc0 100644
@@ -417,7 +417,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 = (TASKLET_DATA_TYPE)&pvcc->wakeup_tasklet;
 	err = ppp_register_channel(&pvcc->chan);
 	if (err != 0) {
 		kfree(pvcc);
Signature · 1 line
2.23.0
#20 lore raw

PATCH 14/16 tasklet: Remove the data argument from DECLARE_TASKLET() macros

In reply to Romain Perier

Now that the .data field is removed from the tasklet_struct data structure and the DECLARE_TASKLET() macros body, we can change its API and remove the data argument. This commit updates the API of these macros by removing the data argument, it also update all the calls to these macros in a single shot.

---
 drivers/net/wan/farsync.c              | 4 ++--
 drivers/staging/most/dim2/dim2.c       | 2 +-
 drivers/staging/octeon/ethernet-tx.c   | 2 +-
 drivers/tty/vt/keyboard.c              | 2 +-
 drivers/usb/gadget/udc/snps_udc_core.c | 2 +-
 include/linux/interrupt.h              | 4 ++--
 kernel/backtracetest.c                 | 2 +-
 kernel/debug/debug_core.c              | 2 +-
 kernel/irq/resend.c                    | 2 +-
 net/atm/pppoatm.c                      | 2 +-
 sound/drivers/pcsp/pcsp_lib.c          | 2 +-
 11 files changed, 13 insertions(+), 13 deletions(-)
drivers/net/wan/farsync.c +2 -2
index d2da087191ba..093c520c6972 100644
@@ -569,8 +569,8 @@ static void do_bottom_half_rx(struct fst_card_info *card);
 static void fst_process_tx_work_q(struct tasklet_struct *work_q);
 static void fst_process_int_work_q(struct tasklet_struct *work_q);
 
-static DECLARE_TASKLET(fst_tx_task, fst_process_tx_work_q, 0);
-static DECLARE_TASKLET(fst_int_task, fst_process_int_work_q, 0);
+static DECLARE_TASKLET(fst_tx_task, fst_process_tx_work_q);
+static DECLARE_TASKLET(fst_int_task, fst_process_int_work_q);
 
 static struct fst_card_info *fst_card_array[FST_MAX_CARDS];
 static spinlock_t fst_work_q_lock;
drivers/staging/most/dim2/dim2.c +1 -1
index 70040562af45..d4ab9abc6456 100644
@@ -730,7 +730,7 @@ static int dim2_probe(struct platform_device *pdev)
 	int ret, i;
 	u8 hal_ret;
 	int irq;
-	DECLARE_TASKLET(dim2_tasklet, dim2_tasklet_fn, 0);
+	DECLARE_TASKLET(dim2_tasklet, dim2_tasklet_fn);
 
 	enum { MLB_INT_IDX, AHB0_INT_IDX };
 
drivers/staging/octeon/ethernet-tx.c +1 -1
index acb32a7c8b1d..f954f48e90ec 100644
@@ -41,7 +41,7 @@
 #endif
 
 static void cvm_oct_tx_do_cleanup(struct tasklet_struct *unused);
-static DECLARE_TASKLET(cvm_oct_tx_cleanup_tasklet, cvm_oct_tx_do_cleanup, 0);
+static DECLARE_TASKLET(cvm_oct_tx_cleanup_tasklet, cvm_oct_tx_do_cleanup);
 
 /* Maximum number of SKBs to try to free per xmit packet. */
 #define MAX_SKB_TO_FREE (MAX_OUT_QUEUE_DEPTH * 2)
drivers/tty/vt/keyboard.c +1 -1
index 06e54abcfac6..7d8f6a3688b1 100644
@@ -1230,7 +1230,7 @@ static void kbd_bh(struct tasklet_struct *unused)
 	}
 }
 
-DECLARE_TASKLET_DISABLED(keyboard_tasklet, kbd_bh, 0);
+DECLARE_TASKLET_DISABLED(keyboard_tasklet, kbd_bh);
 
 #if defined(CONFIG_X86) || defined(CONFIG_IA64) || defined(CONFIG_ALPHA) ||\
     defined(CONFIG_MIPS) || defined(CONFIG_PPC) || defined(CONFIG_SPARC) ||\
drivers/usb/gadget/udc/snps_udc_core.c +1 -1
index b2d5ad004b0f..43e9b5a549b5 100644
@@ -3151,7 +3151,7 @@ int udc_probe(struct udc *dev)
 	char		tmp[128];
 	u32		reg;
 	int		retval;
-	DECLARE_TASKLET(disconnect_tasklet, udc_tasklet_disconnect, 0);
+	DECLARE_TASKLET(disconnect_tasklet, udc_tasklet_disconnect);
 
 	/* device struct setup */
 	dev->gadget.ops = &udc_ops;
include/linux/interrupt.h +2 -2
index a01dea0a90bb..b5ac24b7fea2 100644
@@ -600,10 +600,10 @@ struct tasklet_struct
 #define TASKLET_DATA_TYPE		unsigned long
 #define TASKLET_FUNC_TYPE		void (*)(TASKLET_DATA_TYPE)
 
-#define DECLARE_TASKLET(name, func, data) \
+#define DECLARE_TASKLET(name, func) \
 struct tasklet_struct name = { NULL, 0, ATOMIC_INIT(0), (TASKLET_FUNC_TYPE)func }
 
-#define DECLARE_TASKLET_DISABLED(name, func, data) \
+#define DECLARE_TASKLET_DISABLED(name, func) \
 struct tasklet_struct name = { NULL, 0, ATOMIC_INIT(1), (TASKLET_FUNC_TYPE)func }
 
 
kernel/backtracetest.c +1 -1
index b5b9e16f0083..02c6bc523697 100644
@@ -29,7 +29,7 @@ static void backtrace_test_irq_callback(struct tasklet_struct *unused)
 	complete(&backtrace_work);
 }
 
-static DECLARE_TASKLET(backtrace_tasklet, &backtrace_test_irq_callback, 0);
+static DECLARE_TASKLET(backtrace_tasklet, &backtrace_test_irq_callback);
 
 static void backtrace_test_irq(void)
 {
kernel/debug/debug_core.c +1 -1
index ceac3a21cf41..2358a924f157 100644
@@ -1004,7 +1004,7 @@ static void kgdb_tasklet_bpt(struct tasklet_struct *unused)
 	atomic_set(&kgdb_break_tasklet_var, 0);
 }
 
-static DECLARE_TASKLET(kgdb_tasklet_breakpoint, kgdb_tasklet_bpt, 0);
+static DECLARE_TASKLET(kgdb_tasklet_breakpoint, kgdb_tasklet_bpt);
 
 void kgdb_schedule_breakpoint(void)
 {
kernel/irq/resend.c +1 -1
index 7edb88afebb5..b82588c966d8 100644
@@ -45,7 +45,7 @@ static void resend_irqs(struct tasklet_struct *unused)
 }
 
 /* Tasklet to handle resend: */
-static DECLARE_TASKLET(resend_tasklet, resend_irqs, 0);
+static DECLARE_TASKLET(resend_tasklet, resend_irqs);
 
 #endif
 
net/atm/pppoatm.c +1 -1
index 1d9274194dc0..5c0452feeb48 100644
@@ -394,7 +394,7 @@ static int pppoatm_assign_vcc(struct atm_vcc *atmvcc, void __user *arg)
 	 * Each PPPoATM instance has its own tasklet - this is just a
 	 * prototypical one used to initialize them
 	 */
-	static const DECLARE_TASKLET(tasklet_proto, pppoatm_wakeup_sender, 0);
+	static const DECLARE_TASKLET(tasklet_proto, pppoatm_wakeup_sender);
 	if (copy_from_user(&be, arg, sizeof be))
 		return -EFAULT;
 	if (be.encaps != PPPOATM_ENCAPS_AUTODETECT &&
sound/drivers/pcsp/pcsp_lib.c +1 -1
index fbeeecaac8d4..9e7a51fa6f07 100644
@@ -36,7 +36,7 @@ static void pcsp_call_pcm_elapsed(struct tasklet_struct *unused)
 	}
 }
 
-static DECLARE_TASKLET(pcsp_pcm_tasklet, pcsp_call_pcm_elapsed, 0);
+static DECLARE_TASKLET(pcsp_pcm_tasklet, pcsp_call_pcm_elapsed);
 
 /* write the port and returns the next expire time in ns;
  * called at the trigger-start and in hrtimer callback
Signature · 1 line
2.23.0
#22 lore raw

PATCH 15/16 tasklet: convert callbacks prototype for using struct tasklet_struct * arguments

In reply to Romain Perier

Now that everything has been converted, we can use the new prototype of the callbacks. This converts the cast macros, the handler field and the tasklet initialization functions to the new prototype.

---
 include/linux/interrupt.h | 10 +++++-----
 kernel/softirq.c          |  4 ++--
 2 files changed, 7 insertions(+), 7 deletions(-)
include/linux/interrupt.h +5 -5
index b5ac24b7fea2..506300396db9 100644
@@ -594,17 +594,17 @@ struct tasklet_struct
 	struct tasklet_struct *next;
 	unsigned long state;
 	atomic_t count;
-	void (*func)(unsigned long);
+	void (*func)(struct tasklet_struct *);
 };
 
-#define TASKLET_DATA_TYPE		unsigned long
+#define TASKLET_DATA_TYPE		struct tasklet_struct *
 #define TASKLET_FUNC_TYPE		void (*)(TASKLET_DATA_TYPE)
 
 #define DECLARE_TASKLET(name, func) \
-struct tasklet_struct name = { NULL, 0, ATOMIC_INIT(0), (TASKLET_FUNC_TYPE)func }
+struct tasklet_struct name = { NULL, 0, ATOMIC_INIT(0), func }
 
 #define DECLARE_TASKLET_DISABLED(name, func) \
-struct tasklet_struct name = { NULL, 0, ATOMIC_INIT(1), (TASKLET_FUNC_TYPE)func }
+struct tasklet_struct name = { NULL, 0, ATOMIC_INIT(1), func }
 
 
 enum
@@ -673,7 +673,7 @@ static inline void tasklet_enable(struct tasklet_struct *t)
 extern void tasklet_kill(struct tasklet_struct *t);
 extern void tasklet_kill_immediate(struct tasklet_struct *t, unsigned int cpu);
 extern void tasklet_init(struct tasklet_struct *t,
-			 void (*func)(unsigned long));
+			 void (*func)(struct tasklet_struct *));
 
 #define from_tasklet(var, callback_tasklet, tasklet_fieldname) \
 	container_of(callback_tasklet, typeof(*var), tasklet_fieldname)
kernel/softirq.c +2 -2
index feb9ac8e6f0b..7415a7c4b494 100644
@@ -520,7 +520,7 @@ static void tasklet_action_common(struct softirq_action *a,
 				if (!test_and_clear_bit(TASKLET_STATE_SCHED,
 							&t->state))
 					BUG();
-				t->func((TASKLET_DATA_TYPE)t);
+				t->func(t);
 				tasklet_unlock(t);
 				continue;
 			}
@@ -547,7 +547,7 @@ static __latent_entropy void tasklet_hi_action(struct softirq_action *a)
 }
 
 void tasklet_init(struct tasklet_struct *t,
-		  void (*func)(unsigned long))
+		  void (*func)(struct tasklet_struct *))
 {
 	t->next = NULL;
 	t->state = 0;
Signature · 1 line
2.23.0
#23 lore raw

PATCH 16/16 tasklet: Add the new initialization function permanently

In reply to Romain Perier

Now that everything has been converted to the new API, we can remove tasklet_init() and replace it by tasklet_setup().

---
 include/linux/interrupt.h | 9 +--------
 kernel/softirq.c          | 4 ++--
 2 files changed, 3 insertions(+), 10 deletions(-)
include/linux/interrupt.h +1 -8
index 506300396db9..0e8f6bca45a4 100644
@@ -672,18 +672,11 @@ static inline void tasklet_enable(struct tasklet_struct *t)
 
 extern void tasklet_kill(struct tasklet_struct *t);
 extern void tasklet_kill_immediate(struct tasklet_struct *t, unsigned int cpu);
-extern void tasklet_init(struct tasklet_struct *t,
+extern void tasklet_setup(struct tasklet_struct *t,
 			 void (*func)(struct tasklet_struct *));
 
 #define from_tasklet(var, callback_tasklet, tasklet_fieldname) \
 	container_of(callback_tasklet, typeof(*var), tasklet_fieldname)
-
-static inline void tasklet_setup(struct tasklet_struct *t,
-				 void (*callback)(struct tasklet_struct *))
-{
-	tasklet_init(t, (TASKLET_FUNC_TYPE)callback);
-}
-
 /*
  * Autoprobing for irqs:
  *
kernel/softirq.c +2 -2
index 7415a7c4b494..179dce78fff8 100644
@@ -546,7 +546,7 @@ static __latent_entropy void tasklet_hi_action(struct softirq_action *a)
 	tasklet_action_common(a, this_cpu_ptr(&tasklet_hi_vec), HI_SOFTIRQ);
 }
 
-void tasklet_init(struct tasklet_struct *t,
+void tasklet_setup(struct tasklet_struct *t,
 		  void (*func)(struct tasklet_struct *))
 {
 	t->next = NULL;
@@ -554,7 +554,7 @@ void tasklet_init(struct tasklet_struct *t,
 	atomic_set(&t->count, 0);
 	t->func = func;
 }
-EXPORT_SYMBOL(tasklet_init);
+EXPORT_SYMBOL(tasklet_setup);
 
 void tasklet_kill(struct tasklet_struct *t)
 {
Signature · 1 line
2.23.0
#3 lore raw

Re: [PRE-REVIEW PATCH 02/16] crypto: ccp - Prepare to use the new tasklet API

In reply to Romain Perier
Quoted 27 lines · Romain Perier

Currently, the tasklet and its "tdata" has no relationship. The future tasklet API, will no longer allow to pass an arbitrary "unsigned long" data parameter. The tasklet data structure will need to be embedded into a data structure that will be retrieved from the tasklet handler (most of the time, it is the driver data structure). This commit prepares the driver to this change. For doing so, it embeds "tasklet" into "tdata". Then, "tdata" will be recoverable from its "tasklet" field, with the tasklet API.

---
 drivers/crypto/ccp/ccp-dev.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/crypto/ccp/ccp-dev.c +1 -0
index 73acf0fdb793..d0d180176f45 100644
@@ -44,6 +44,7 @@ MODULE_PARM_DESC(max_devs, "Maximum number of CCPs to enable (default: all; 0 di
 struct ccp_tasklet_data {
 	struct completion completion;
 	struct ccp_cmd *cmd;
+	struct tasklet_struct tasklet;
 };
 
 /* Human-readable error strings */

drivers/crypto/ccp/ccp-dev.c int ccp_cmd_queue_thread(void *data) · line 441

Quoted 7 lines
drivers/crypto/ccp/ccp-dev.c +1 -2
@@ -436,9 +437,8 @@ int ccp_cmd_queue_thread(void *data)
 	struct ccp_cmd_queue *cmd_q = (struct ccp_cmd_queue *)data;
 	struct ccp_cmd *cmd;
 	struct ccp_tasklet_data tdata;
-	struct tasklet_struct tasklet;
 
-	tasklet_init(&tasklet, ccp_do_cmd_complete, (unsigned long)&tdata);
+	tasklet_init(&tdata.tasklet, ccp_do_cmd_complete, (unsigned long)&tdata);

Why not switch to tasklet_setup() here to avoid changing this again later?

-Kees

Quoted 15 lines
drivers/crypto/ccp/ccp-dev.c +1 -1
 	set_current_state(TASK_INTERRUPTIBLE);
 	while (!kthread_should_stop()) {
@@ -458,7 +458,7 @@ int ccp_cmd_queue_thread(void *data)
 		/* Schedule the completion callback */
 		tdata.cmd = cmd;
 		init_completion(&tdata.completion);
-		tasklet_schedule(&tasklet);
+		tasklet_schedule(&tdata.tasklet);
 		wait_for_completion(&tdata.completion);
 	}
 
Signature · 1 line
2.23.0
Signature · 1 line
Kees Cook
#17 lore raw

Re: [PRE-REVIEW PATCH 12/16] tasklet: Pass tasklet_struct pointer as .data in DECLARE_TASKLET

In reply to Romain Perier
Quoted 4 lines · Romain Perier

Now that all tasklet initializations have been replaced, this updates the core of the DECLARE_TASKLET macros by passing the pointer of the tasklet structure as .data, so current static tasklets will continue to work by deadling with the tasklet_struct pointer in their handler,

typo: dealing

Quoted 4 lines

without have to change the API of the macro. It also updates all callbacks of all tasklets statically allocated via DECLARE_TASKLET() for extracting the the parent data structure of the tasklet by using from_tasklet().

I think this patch needs to be broken up... the users of DECLARE_TASKLET() shouldn't need to be changed along with DECLARE_TASKLET() since there are casts protecting the arguments.

Quoted 23 lines

[...]

include/linux/interrupt.h +5 -2
index f5332ae2dbeb..949bbaeaff0e 100644
@@ -598,11 +598,14 @@ struct tasklet_struct
 	unsigned long data;
 };
 
+#define TASKLET_DATA_TYPE		unsigned long
+#define TASKLET_FUNC_TYPE		void (*)(TASKLET_DATA_TYPE)
+
 #define DECLARE_TASKLET(name, func, data) \
-struct tasklet_struct name = { NULL, 0, ATOMIC_INIT(0), func, data }
+struct tasklet_struct name = { NULL, 0, ATOMIC_INIT(0), (TASKLET_FUNC_TYPE)func, (TASKLET_DATA_TYPE)&name }
 
 #define DECLARE_TASKLET_DISABLED(name, func, data) \
-struct tasklet_struct name = { NULL, 0, ATOMIC_INIT(1), func, data }
+struct tasklet_struct name = { NULL, 0, ATOMIC_INIT(1), (TASKLET_FUNC_TYPE)func, (TASKLET_DATA_TYPE)&name }
 
 
 enum

include/linux/interrupt.h extern void tasklet_kill_immediate(struct tasklet_struct *t, unsigned int cpu); · line 678

Quoted 6 lines
include/linux/interrupt.h +0 -3
@@ -673,9 +676,6 @@ extern void tasklet_kill_immediate(struct tasklet_struct *t, unsigned int cpu);
 extern void tasklet_init(struct tasklet_struct *t,
 			 void (*func)(unsigned long), unsigned long data);
 
-#define TASKLET_DATA_TYPE		unsigned long
-#define TASKLET_FUNC_TYPE		void (*)(TASKLET_DATA_TYPE)
-

This patch feels like it should be combined with the first one, and only make the changes to the macros. (And keep them one place: we shouldn't have to move them later.)

Quoted 8 lines
include/linux/interrupt.h +0 -0
 #define from_tasklet(var, callback_tasklet, tasklet_fieldname) \
 	container_of(callback_tasklet, typeof(*var), tasklet_fieldname)
 
kernel/backtracetest.c +0 -0
index a2a97fa3071b..b5b9e16f0083 100644

kernel/backtracetest.c static void backtrace_test_normal(void) · line 29

Quoted 8 lines
kernel/backtracetest.c +1 -1
@@ -23,7 +23,7 @@ static void backtrace_test_normal(void)
 
 static DECLARE_COMPLETION(backtrace_work);
 
-static void backtrace_test_irq_callback(unsigned long data)
+static void backtrace_test_irq_callback(struct tasklet_struct *unused)
 {
 	dump_stack();
 	complete(&backtrace_work);

And all these other changes should be separated out in a different pass.

Signature · 1 line
Kees Cook
#13 lore raw

Re: [PRE-REVIEW PATCH 11/16] treewide: Globally replace tasklet_init() by tasklet_setup()

In reply to Romain Perier
Quoted 7 lines · Romain Perier

This converts all remaining cases of the old tasklet_init() API into tasklet_setup(), where the callback argument is the structure already holding the struct tasklet_struct. These should have no behavioral changes, since they just change which pointer is passed into the callback with the same available pointers after conversion. Moreover, all callbacks that were not passing a pointer of structure holding the struct tasklet_struct has already been converted.

Was this done mechanically with Coccinelle or manually? (If done with Coccinelle, please include the script in the commit log.) To land a treewide change like this usually you'll need to separate the mechanical from the manual as Linus likes to run those changes himself sometimes.

Signature · 1 line
Kees Cook
#19 lore raw

Re: [PRE-REVIEW PATCH 13/16] tasklet: Pass tasklet_struct pointer to callbacks unconditionally

In reply to Romain Perier
Quoted 10 lines · Romain Perier

From: Romain Perier <[email protected]>

Now that all tasklet callbacks are already taking their struct tasklet_struct pointer as the callback argument, just do this unconditionally and remove the .data field. It converts all runtime code, init functions and the DECLARE_TASKLET() macros to get rid of the .data argument. Moreover, all remaining use or assignment of the .data field are removed in a single shot.

Quoted 14 lines
---
 drivers/gpu/drm/i915/gt/intel_engine_cs.c        | 2 +-
 drivers/gpu/drm/i915/gt/intel_lrc.c              | 2 +-
 drivers/net/usb/usbnet.c                         | 1 -
 drivers/net/wireless/atmel/at76c50x-usb.c        | 1 -
 drivers/net/wireless/intersil/hostap/hostap_hw.c | 2 +-
 drivers/net/wireless/realtek/rtlwifi/usb.c       | 1 -
 drivers/net/wireless/zydas/zd1211rw/zd_usb.c     | 1 -
 drivers/staging/most/dim2/dim2.c                 | 1 -
 drivers/usb/gadget/udc/snps_udc_core.c           | 1 -
 include/linux/interrupt.h                        | 9 ++++-----
 kernel/softirq.c                                 | 5 ++---
 net/atm/pppoatm.c                                | 1 -
 12 files changed, 9 insertions(+), 18 deletions(-)

Similar to the other suggestions, I would split out the individual changes that that touch the .data assignments. This makes those "unusual" cases easier to review.

Quoted 44 lines
drivers/gpu/drm/i915/gt/intel_engine_cs.c +1 -1
index 82630db0394b..357d14ae32d0 100644
@@ -1057,7 +1057,7 @@ bool intel_engine_is_idle(struct intel_engine_cs *engine)
 		if (tasklet_trylock(t)) {
 			/* Must wait for any GPU reset in progress. */
 			if (__tasklet_is_enabled(t))
-				t->func(t->data);
+				t->func(t);
 			tasklet_unlock(t);
 		}
 		local_bh_enable();
drivers/gpu/drm/i915/gt/intel_lrc.c +1 -1
index d630dbc953ad..99f39047e49f 100644
@@ -2616,7 +2616,7 @@ static void execlists_reset_finish(struct intel_engine_cs *engine)
 	 */
 	GEM_BUG_ON(!reset_in_progress(execlists));
 	if (!RB_EMPTY_ROOT(&execlists->queue.rb_root))
-		execlists->tasklet.func(execlists->tasklet.data);
+		execlists->tasklet.func(&execlists->tasklet);
 
 	if (__tasklet_enable(&execlists->tasklet))
 		/* And kick in case we missed a new request submission. */
drivers/net/usb/usbnet.c +0 -1
index 1c4817c05d3c..14cedee27f2f 100644
@@ -1693,7 +1693,6 @@ usbnet_probe (struct usb_interface *udev, const struct usb_device_id *prod)
 	skb_queue_head_init (&dev->done);
 	skb_queue_head_init(&dev->rxq_pause);
 	dev->bh.func = (TASKLET_FUNC_TYPE)usbnet_bh;
-	dev->bh.data = (TASKLET_DATA_TYPE)&dev->delay;
 	INIT_WORK (&dev->kevent, usbnet_deferred_kevent);
 	init_usb_anchor(&dev->deferred);
 	timer_setup(&dev->delay, usbnet_bh, 0);
drivers/net/wireless/atmel/at76c50x-usb.c +0 -0
index 3a66538a0853..fd796a32c71d 100644

drivers/net/wireless/atmel/at76c50x-usb.c static void at76_rx_callback(struct urb *urb) · line 1202

Quoted 4 lines
drivers/net/wireless/atmel/at76c50x-usb.c +0 -1
@@ -1199,7 +1199,6 @@ static void at76_rx_callback(struct urb *urb)
 {
 	struct at76_priv *priv = urb->context;
 
-	priv->rx_tasklet.data = (unsigned long)urb;

Some of these looks very strange -- how are the urb and tasklet associated, etc?

Quoted 33 lines
drivers/net/wireless/atmel/at76c50x-usb.c +0 -0
 	tasklet_schedule(&priv->rx_tasklet);
 }
 
drivers/net/wireless/intersil/hostap/hostap_hw.c +1 -1
index 187095e13294..ae656563a82d 100644
@@ -3183,7 +3183,7 @@ prism2_init_local_data(struct prism2_helper_functions *funcs, int card_idx,
 	/* Initialize tasklets for handling hardware IRQ related operations
 	 * outside hw IRQ handler */
 #define HOSTAP_TASKLET_INIT(q, f, d) \
-do { memset((q), 0, sizeof(*(q))); (q)->func = (TASKLET_FUNC_TYPE)(f); (q)->data = (TASKLET_DATA_TYPE)(q); } \
+do { memset((q), 0, sizeof(*(q))); (q)->func = (TASKLET_FUNC_TYPE)(f); } \
 while (0)
 	HOSTAP_TASKLET_INIT(&local->bap_tasklet, hostap_bap_tasklet,
 			    (unsigned long) local);
drivers/net/wireless/realtek/rtlwifi/usb.c +0 -1
index aae5c5aa1769..7e9bdbd2a6f4 100644
@@ -311,7 +311,6 @@ static int _rtl_usb_init_rx(struct ieee80211_hw *hw)
 
 	skb_queue_head_init(&rtlusb->rx_queue);
 	rtlusb->rx_work_tasklet.func = (TASKLET_FUNC_TYPE)_rtl_rx_work;
-	rtlusb->rx_work_tasklet.data = (TASKLET_DATA_TYPE)&rtlusb->rx_work_tasklet;
 
 	return 0;
 }
drivers/net/wireless/zydas/zd1211rw/zd_usb.c +0 -0
index 0ebbd727a452..4275549f4d98 100644

drivers/net/wireless/zydas/zd1211rw/zd_usb.c static inline void init_usb_rx(struct zd_usb *usb) · line 1184

Quoted 4 lines
drivers/net/wireless/zydas/zd1211rw/zd_usb.c +0 -1
@@ -1181,7 +1181,6 @@ static inline void init_usb_rx(struct zd_usb *usb)
 	ZD_ASSERT(rx->fragment_length == 0);
 	INIT_DELAYED_WORK(&rx->idle_work, zd_rx_idle_timer_handler);
 	rx->reset_timer_tasklet.func = (TASKLET_FUNC_TYPE)zd_usb_reset_rx_idle_timer_tasklet;
-	rx->reset_timer_tasklet.data = (TASKLET_DATA_TYPE)&rx->reset_timer_tasklet;

These look like open-coded tasklet initializations?

Signature · 1 line
Kees Cook
#21 lore raw

Re: [PRE-REVIEW PATCH 14/16] tasklet: Remove the data argument from DECLARE_TASKLET() macros

In reply to Romain Perier
Quoted 7 lines · Romain Perier

Now that the .data field is removed from the tasklet_struct data structure and the DECLARE_TASKLET() macros body, we can change its API and remove the data argument. This commit updates the API of these macros by removing the data argument, it also update all the calls to these macros in a single shot.

Quoted 13 lines
---
 drivers/net/wan/farsync.c              | 4 ++--
 drivers/staging/most/dim2/dim2.c       | 2 +-
 drivers/staging/octeon/ethernet-tx.c   | 2 +-
 drivers/tty/vt/keyboard.c              | 2 +-
 drivers/usb/gadget/udc/snps_udc_core.c | 2 +-
 include/linux/interrupt.h              | 4 ++--
 kernel/backtracetest.c                 | 2 +-
 kernel/debug/debug_core.c              | 2 +-
 kernel/irq/resend.c                    | 2 +-
 net/atm/pppoatm.c                      | 2 +-
 sound/drivers/pcsp/pcsp_lib.c          | 2 +-
 11 files changed, 13 insertions(+), 13 deletions(-)

I'm glad there are so few users of the DECLARE_TASKLET() macros. :)

Signature · 1 line
Kees Cook
#24 lore raw

Re: [PRE-REVIEW PATCH 16/16] tasklet: Add the new initialization function permanently

In reply to Romain Perier
Quoted 4 lines · Romain Perier

Now that everything has been converted to the new API, we can remove tasklet_init() and replace it by tasklet_setup().

If this is the last user of TASKLET_*_TYPE casts, those should get dropped here too.

-Kees

Quoted 54 lines
---
 include/linux/interrupt.h | 9 +--------
 kernel/softirq.c          | 4 ++--
 2 files changed, 3 insertions(+), 10 deletions(-)
include/linux/interrupt.h +1 -8
index 506300396db9..0e8f6bca45a4 100644
@@ -672,18 +672,11 @@ static inline void tasklet_enable(struct tasklet_struct *t)
 
 extern void tasklet_kill(struct tasklet_struct *t);
 extern void tasklet_kill_immediate(struct tasklet_struct *t, unsigned int cpu);
-extern void tasklet_init(struct tasklet_struct *t,
+extern void tasklet_setup(struct tasklet_struct *t,
 			 void (*func)(struct tasklet_struct *));
 
 #define from_tasklet(var, callback_tasklet, tasklet_fieldname) \
 	container_of(callback_tasklet, typeof(*var), tasklet_fieldname)
-
-static inline void tasklet_setup(struct tasklet_struct *t,
-				 void (*callback)(struct tasklet_struct *))
-{
-	tasklet_init(t, (TASKLET_FUNC_TYPE)callback);
-}
-
 /*
  * Autoprobing for irqs:
  *
kernel/softirq.c +2 -2
index 7415a7c4b494..179dce78fff8 100644
@@ -546,7 +546,7 @@ static __latent_entropy void tasklet_hi_action(struct softirq_action *a)
 	tasklet_action_common(a, this_cpu_ptr(&tasklet_hi_vec), HI_SOFTIRQ);
 }
 
-void tasklet_init(struct tasklet_struct *t,
+void tasklet_setup(struct tasklet_struct *t,
 		  void (*func)(struct tasklet_struct *))
 {
 	t->next = NULL;
@@ -554,7 +554,7 @@ void tasklet_init(struct tasklet_struct *t,
 	atomic_set(&t->count, 0);
 	t->func = func;
 }
-EXPORT_SYMBOL(tasklet_init);
+EXPORT_SYMBOL(tasklet_setup);
 
 void tasklet_kill(struct tasklet_struct *t)
 {
Signature · 1 line
2.23.0
Signature · 1 line
Kees Cook
#26 lore raw
In reply to Romain Perier
Quoted 28 lines · Romain Perier

Hello,

Nowadays, modern kernel subsystems that use callbacks pass the data structure associated with a given callback as argument to the callback. The data structure specific to the driver or subsystem that uses this callback framework is usually "derivated" from the data structure that is passed as argument to the callback.

The tasklet subsystem remains the one to pass callback argument as an arbitrary unsigned long argument (This has several issues that are explained in the first commit).

This series aims to improve the tasklet API and converts all the code that is using it. It is based on the series for timer_list at [1].

1. https://lore.kernel.org/patchwork/patch/835464

Romain Perier (16):
tasklet: Prepare to change tasklet callback argument type
crypto: ccp - Prepare to use the new tasklet API
mmc: renesas_sdhi: Prepare to use the new tasklet API
net: liquidio: Prepare to use the new tasklet API
chelsio: Prepare to use the new tasklet API
net: mvpp2: Prepare to use the new tasklet API
qed: Prepare to use the new tasklet API
isdn: Prepare to use the new tasklet API
scsi: pm8001: Prepare to use the new tasklet API

Quoted 8 lines

scsi: pmcraid: Prepare to use the new tasklet API
treewide: Globally replace tasklet_init() by tasklet_setup()
tasklet: Pass tasklet_struct pointer as .data in DECLARE_TASKLET
tasklet: Pass tasklet_struct pointer to callbacks unconditionally
tasklet: Remove the data argument from DECLARE_TASKLET() macros
tasklet: convert callbacks prototype for using struct tasklet_struct *
arguments
tasklet: Add the new initialization function permanently

This is looking really good; thank you! I think for easier review it would make sense to break out the "special" cases (where you're changing structures, etc) into their own patches (and not as a bulk change -- they need review by different subsystem maintainers, etc).

Then the patch phases can be:

1) Introduce new APIs and casts
2) Convert special cases include passing the tasklet as their .data (while also changing the prototypes and replacing tasklet_init() with tasklet_setup())
3) Convert DECLARE_TASKLET() users to the same
4) Manual one-off conversions of tasklet_init() -> tasklet_setup()
5) Mechanical mass conversion of tasklet_init() -> tasklet_setup()
6) Mass removal of .data argument from DECLARE_TASKLET()
7) tasklet API internal swap and removal of .data
8) tasklet_init() and helper cast removals.

Step 1 needs to happen in an -rc1 (e.g. v5.5-rc1).

Then steps 2, 3, and 4 can happen simultaneously across all the maintainers that need to be aware of it and land in the next release (the linux-next for v5.6).

Finally steps 5, 6, 7, and 8 happen in the next release's -rc1 (v5.6-rc1).

If we can get the "phase 1" patch ready quick, maybe we can get into -rc2 for v5.4 and move things up by a release...

-Kees

Signature · 1 line
Kees Cook
#14 lore raw

Re: [PRE-REVIEW PATCH 11/16] treewide: Globally replace tasklet_init() by tasklet_setup()

In reply to Kees Cook
Quoted 9 lines · Kees Cook
Quoted 7 lines · Romain Perier

This converts all remaining cases of the old tasklet_init() API into tasklet_setup(), where the callback argument is the structure already holding the struct tasklet_struct. These should have no behavioral changes, since they just change which pointer is passed into the callback with the same available pointers after conversion. Moreover, all callbacks that were not passing a pointer of structure holding the struct tasklet_struct has already been converted.

Quoted 4 lines

Was this done mechanically with Coccinelle or manually? (If done with Coccinelle, please include the script in the commit log.) To land a treewide change like this usually you'll need to separate the mechanical from the manual as Linus likes to run those changes himself sometimes.

Hi,

This was done with both technics mechanically with a "buggy" Coccinelle script, after what I have fixed building errors and mismatches (even if it's clearly super powerful, it was my first complex cocci script). 80% of trivial replacements were done with a Cocci script, the rest was done manually. That's complicated to remember which one was mechanically or manually to be honnest :=D

What I can propose is the following:

- A commit for trivial tasklet_init() -> tasklet_setup() replacements:
it would contain basic replacements of the calls "tasklet_init() -> tasklet_setup()" and addition of "from_tasklet()" without any other changes.

- A second commit for more complicated replacements:
It would contain replacements of functions that are in different modules, or modules that use function pointer for tasklet handlers etc... Basically everything that is not covered by the first commit

What do you think ?
Moreover, the cocci script I have used is... ugly... so I don't want to see Linus's eyes bleed :=D

PS: I can try to recover the cocci script in my git repo by using "git reflog". And put the cocci script in the first commit (for trivial replacements), in the worst case...

Regards,
Romain

#25 lore raw

Re: [PRE-REVIEW PATCH 16/16] tasklet: Add the new initialization function permanently

In reply to Kees Cook
Quoted 10 lines · Kees Cook
Quoted 4 lines · Romain Perier

Now that everything has been converted to the new API, we can remove tasklet_init() and replace it by tasklet_setup().

If this is the last user of TASKLET_*_TYPE casts, those should get dropped here too.

-Kees

Good catch ! I will squash the change to this commit

Romain

#27 lore raw
In reply to Kees Cook
Quoted 2 lines · Kees Cook

On Sun, Sep 29, 2019 at 06:30:12PM +0200, Romain Perier wrote:
This is looking really good; thank you!

Glad to read this :)

Quoted 11 lines

I think for easier review it
would make sense to break out the "special" cases (where you're changing structures, etc) into their own patches (and not as a bulk change -- they need review by different subsystem maintainers, etc).

Then the patch phases can be:

1) Introduce new APIs and casts
2) Convert special cases include passing the tasklet as their .data (while also changing the prototypes and replacing tasklet_init() with tasklet_setup())

=> So, one commit per driver for preparing the data structure to own a sub "struct tasklet_struct" + tasklet_init() -> tasklet_setup() with use of "from_tasklet" in the same commit. Right ?

For example:
the commit "[PRE-REVIEW PATCH 03/16] mmc:
renesas_sdhi: Prepare to use the new tasklet API"

would contain changes for preparing the driver to use a "struct tasklet_struct" correctly + convert the driver to the new API (tasklet_init() -> tasklet_setup())

Same for commit "[PRE-REVIEW PATCH 04/16] net: liquidio: Prepare to use the new tasklet API".

This is what you had in mind ?

Quoted 1 line

3) Convert DECLARE_TASKLET() users to the same

Yeah, this is what you explain in reply to "[PRE-REVIEW PATCH 12/16]
tasklet: Pass tasklet_struct pointer as .data in DECLARE_TASKLET", right ?

Quoted 2 lines

4) Manual one-off conversions of tasklet_init() -> tasklet_setup()
5) Mechanical mass conversion of tasklet_init() -> tasklet_setup()

See the reply to the commit "treewide:" about this

Quoted 3 lines

6) Mass removal of .data argument from DECLARE_TASKLET()
7) tasklet API internal swap and removal of .data
8) tasklet_init() and helper cast removals.

Ack

Quoted 12 lines

Step 1 needs to happen in an -rc1 (e.g. v5.5-rc1).

Then steps 2, 3, and 4 can happen simultaneously across all the maintainers that need to be aware of it and land in the next release (the linux-next for v5.6).

Finally steps 5, 6, 7, and 8 happen in the next release's -rc1 (v5.6-rc1).

If we can get the "phase 1" patch ready quick, maybe we can get into

Review

Quoted 3 lines
(quoted diff) +0 -2
-rc2 for v5.4 and move things up by a release...
 
-Kees

Thanks for your time,

Regards,
Romain

Quoted 2 lines
Signature · 1 line
Kees Cook
#15 lore raw

Re: [PRE-REVIEW PATCH 11/16] treewide: Globally replace tasklet_init() by tasklet_setup()

In reply to Romain Perier
Quoted 24 lines · Romain Perier
Quoted 9 lines · Kees Cook
Quoted 7 lines · Romain Perier

This converts all remaining cases of the old tasklet_init() API into tasklet_setup(), where the callback argument is the structure already holding the struct tasklet_struct. These should have no behavioral changes, since they just change which pointer is passed into the callback with the same available pointers after conversion. Moreover, all callbacks that were not passing a pointer of structure holding the struct tasklet_struct has already been converted.

Quoted 4 lines

Was this done mechanically with Coccinelle or manually? (If done with Coccinelle, please include the script in the commit log.) To land a treewide change like this usually you'll need to separate the mechanical from the manual as Linus likes to run those changes himself sometimes.

Hi,

This was done with both technics mechanically with a "buggy" Coccinelle script, after what I have fixed building errors and mismatches (even if it's clearly super powerful, it was my first complex cocci script). 80% of trivial replacements were done with a Cocci script, the rest was done manually. That's complicated to remember which one was mechanically or manually to be honnest :=D

Quoted 6 lines

What I can propose is the following:

- A commit for trivial tasklet_init() -> tasklet_setup() replacements:
it would contain basic replacements of the calls "tasklet_init() -> tasklet_setup()" and addition of "from_tasklet()" without any other changes.

Right -- the manual ones might need to be split up by subsystem or driver.

Quoted 4 lines

- A second commit for more complicated replacements:
It would contain replacements of functions that are in different modules, or modules that use function pointer for tasklet handlers etc... Basically everything that is not covered by the first commit

Same for this if it can't be automated.

Quoted 3 lines

What do you think ?
Moreover, the cocci script I have used is... ugly... so I don't want to see Linus's eyes bleed :=D

Heh. Well, the timer_struct Cocci script was ugly too. The idea is that maintainers will likely want per-driver patches, so the more you can automate with a script to put in a single commit for Linus would be better for your own sanity. :)

Quoted 3 lines

PS: I can try to recover the cocci script in my git repo by using "git reflog". And put the cocci script in the first commit (for trivial replacements), in the worst case...

Probably it is only needed in the commit log.

Signature · 1 line
Kees Cook
#28 lore raw
In reply to Romain Perier
Quoted 9 lines · Romain Perier

=> So, one commit per driver for preparing the data structure to own a sub "struct tasklet_struct" + tasklet_init() -> tasklet_setup() with use of "from_tasklet" in the same commit. Right ?

For example:
the commit "[PRE-REVIEW PATCH 03/16] mmc:
renesas_sdhi: Prepare to use the new tasklet API"

Quoted 8 lines

would contain changes for preparing the driver to use a "struct tasklet_struct" correctly + convert the driver to the new API (tasklet_init() -> tasklet_setup())

Same for commit "[PRE-REVIEW PATCH 04/16] net: liquidio: Prepare to use the new tasklet API".

This is what you had in mind ?

Right -- the commit would be complete from a "touch-once" perspective. The one commit completely swaps to the new API and nothing will ever have to poke this file again. (The exception being any explicit casts that might be rarely needed for weird direct initialization, etc: most patches should be entirely self-contained, though they depend on the new API from patch #1.)

Quoted 5 lines
Quoted 1 line

3) Convert DECLARE_TASKLET() users to the same

Yeah, this is what you explain in reply to "[PRE-REVIEW PATCH 12/16]
tasklet: Pass tasklet_struct pointer as .data in DECLARE_TASKLET", right ?

Right -- after all the other stuff, do the the DECLARE_TASKLET changes, with a final mechanical patch that drops the unused .data argument from all the users.

This is all a normally thankless set of patches, so I'll go out of my way to say again: thank you for working on this! I know how tedious it can be from when I did timer_struct. :)

Signature · 1 line
Kees Cook
#29 lore raw

Romain,

Quoted 4 lines

This is all a normally thankless set of patches, so I'll go out of my way to say again: thank you for working on this! I know how tedious it can be from when I did timer_struct. :)

First of all Romain, nice work. I started working on this
set a few months back, but could only carve out limited time.

I sent out RFC for this sometime in May[1]. And my approach
was a little different when compared to what you have sent on the list.

Well, I have pushed my work to github[2], only thing I could
think of as an improvement in your patch set it to break it down into smaller chunk so that it's easier to review. I have made each occurrence of tasklet_init() into a commit[3] which I thought would make it easier to review. I'll leave that decision to you and kees.

Let me know if I could help in any way.

[1] https://www.openwall.com/lists/kernel-hardening/2019/05/06/1
[2] https://github.com/allenpais/tasklet
[3] Sample list of patches:
5d0b728649b6 atm/solos-pci: Convert tasklets to use new tasklet_init API e5144c3c16d8 atm: Convert tasklets to use new tasklet_init API 71028976d3ed arch/um: Convert tasklets to use new tasklet_init API c9a39c23b78c xfrm: Convert tasklets to use new tasklet_init API 91d93fe12bbc mac80211: Convert tasklets to use new tasklet_init API d68f1e9e4531 ipv4: Convert tasklets to use new tasklet_init API 4f9379dcd8ad sound/timer: Convert tasklets to use new tasklet_init API b4519111b75e drivers/usb: Convert tasklets to use new tasklet_init API 52f04bf54a5a drivers:vt/keyboard: Convert tasklets to use new tasklet_init API 295de7c9812c dma/virt-dma: Convert tasklets to use new tasklet_init API 6c713c83b58f dma/dw: Convert tasklets to use new tasklet_init API eaaaaba8a4a7 debug:Convert tasklets to use new tasklet_init API b23f4ff5021b tasklet: prepare to change tasklet API

Thanks,
- Allen

#30 lore raw
Quoted 19 lines · Allen

Romain,

Quoted 1 line

First of all Romain, nice work. I started working on this
set a few months back, but could only carve out limited time.

I sent out RFC for this sometime in May[1]. And my approach
was a little different when compared to what you have sent on the list.

Well, I have pushed my work to github[2], only thing I could
think of as an improvement in your patch set it to break it down into smaller chunk so that it's easier to review. I have made each occurrence of tasklet_init() into a commit[3] which I thought would make it easier to review. I'll leave that decision to you and kees.

Let me know if I could help in any way.

Quoted 16 lines

[1] https://www.openwall.com/lists/kernel-hardening/2019/05/06/1
[2] https://github.com/allenpais/tasklet
[3] Sample list of patches:
5d0b728649b6 atm/solos-pci: Convert tasklets to use new tasklet_init API e5144c3c16d8 atm: Convert tasklets to use new tasklet_init API 71028976d3ed arch/um: Convert tasklets to use new tasklet_init API c9a39c23b78c xfrm: Convert tasklets to use new tasklet_init API 91d93fe12bbc mac80211: Convert tasklets to use new tasklet_init API d68f1e9e4531 ipv4: Convert tasklets to use new tasklet_init API 4f9379dcd8ad sound/timer: Convert tasklets to use new tasklet_init API b4519111b75e drivers/usb: Convert tasklets to use new tasklet_init API 52f04bf54a5a drivers:vt/keyboard: Convert tasklets to use new tasklet_init API 295de7c9812c dma/virt-dma: Convert tasklets to use new tasklet_init API 6c713c83b58f dma/dw: Convert tasklets to use new tasklet_init API eaaaaba8a4a7 debug:Convert tasklets to use new tasklet_init API b23f4ff5021b tasklet: prepare to change tasklet API

From experience, this is better to group bunch of commits like we currently do with Kees on this series, instead to have one commit per change (I mean for huge patchset)
Mainly because you have too much replacements with this API change, and it will be really complicated to merge.

Last time I have proposed an API change for removing "pci_pool" , it was a patchset of 20 commits (something like this), it tooks 6 months to be merged :) (with a fine grain granularity on each commit)

This is better to be the more atomic as possible. If we split the "one massive tasklet_init replacement" commit into many commit, I am sure that we find old tasklet API for months in the kernel... it is not something we want , imho. + treewide commits are common in the kernel tree, for important API changes :)

@Kees: agreed ?

I think that the timer_list approach is good. You can help by providing feedbacks and by testing if you want.

Regards,
Romain

Quoted 3 lines

Thanks,
- Allen

#31 lore raw
Quoted 53 lines · Romain Perier
Quoted 19 lines · Allen

Romain,

Quoted 1 line

First of all Romain, nice work. I started working on this
set a few months back, but could only carve out limited time.

I sent out RFC for this sometime in May[1]. And my approach
was a little different when compared to what you have sent on the list.

Well, I have pushed my work to github[2], only thing I could
think of as an improvement in your patch set it to break it down into smaller chunk so that it's easier to review. I have made each occurrence of tasklet_init() into a commit[3] which I thought would make it easier to review. I'll leave that decision to you and kees.

Let me know if I could help in any way.

Quoted 16 lines

[1] https://www.openwall.com/lists/kernel-hardening/2019/05/06/1
[2] https://github.com/allenpais/tasklet
[3] Sample list of patches:
5d0b728649b6 atm/solos-pci: Convert tasklets to use new tasklet_init API e5144c3c16d8 atm: Convert tasklets to use new tasklet_init API 71028976d3ed arch/um: Convert tasklets to use new tasklet_init API c9a39c23b78c xfrm: Convert tasklets to use new tasklet_init API 91d93fe12bbc mac80211: Convert tasklets to use new tasklet_init API d68f1e9e4531 ipv4: Convert tasklets to use new tasklet_init API 4f9379dcd8ad sound/timer: Convert tasklets to use new tasklet_init API b4519111b75e drivers/usb: Convert tasklets to use new tasklet_init API 52f04bf54a5a drivers:vt/keyboard: Convert tasklets to use new tasklet_init API 295de7c9812c dma/virt-dma: Convert tasklets to use new tasklet_init API 6c713c83b58f dma/dw: Convert tasklets to use new tasklet_init API eaaaaba8a4a7 debug:Convert tasklets to use new tasklet_init API b23f4ff5021b tasklet: prepare to change tasklet API

From experience, this is better to group bunch of commits like we currently do with Kees on this series, instead to have one commit per change (I mean for huge patchset)
Mainly because you have too much replacements with this API change, and it will be really complicated to merge.

Last time I have proposed an API change for removing "pci_pool" , it was a patchset of 20 commits (something like this), it tooks 6 months to be merged :) (with a fine grain granularity on each commit)

This is better to be the more atomic as possible. If we split the "one massive tasklet_init replacement" commit into many commit, I am sure that we find old tasklet API for months in the kernel... it is not something we want , imho. + treewide commits are common in the kernel tree, for important API changes :)

Quoted 4 lines

@Kees: agreed ?

I think that the timer_list approach is good. You can help by providing feedbacks and by testing if you want.

It worked well the last time. :)

I think splitting the non-mechanical changes and landing those first is the right approach. Then we can land a massive treewide for all the "easy" cases without trickling them in over months.

-Kees

Signature · 1 line
Kees Cook