Skip to content

added helper macros to remove duplicate code from probe functions of the platform drivers

Satendra Singh Thakur dmaengine linux-arm-kernel linux-arm-msm linux-mediatek lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest9 patches 3 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/9probe/dma : added helper macros to remove redundant/duplicate code from probe functions of the dma controller driversinclude/linux/probe-helper.h+179 -00 replies
2/9probe/dma/jz4740: removed redundant code from jz4740 dma controller's probe functiondrivers/dma/dma-jz4740.c+13 -200 replies
3/9probe/dma/zx: removed redundant code from zx dma controller's probe functiondrivers/dma/zx_dma.c+10 -250 replies
4/9probe/dma/qcom-bam: removed redundant code from qcom bam dma controller's probe functiondrivers/dma/qcom/bam_dma.c+29 -420 replies
5/9probe/dma/mtk-hs: removed redundant code from mediatek hs dma controller's probe functiondrivers/dma/mediatek/mtk-hsdma.c+12 -260 replies
6/9probe/dma/sun6i: removed redundant code from sun6i dma controller's probe functiondrivers/dma/sun6i-dma.c+9 -210 replies
7/9probe/dma/sun4i: removed redundant code from sun4i dma controller's probe functiondrivers/dma/sun4i-dma.c+9 -210 replies
8/9probe/dma/axi: removed redundant code from axi dma controller's probe functiondrivers/dma/dma-axi-dmac.c+10 -180 replies
9/9probe/dma/owl: removed redundant code from owl dma controller's probe functiondrivers/dma/owl-dma.c+9 -200 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/9] added helper macros to remove duplicate code from probe functions of the platform drivers

1. For most of the platform drivers's probe include following steps

-memory allocation for driver's private structure
-getting io resources
-io remapping resources
-getting irq number
-registering irq
-setting driver's private data
-getting clock
-preparing and enabling clock

2. We have defined a set of macros to combine some or all of the above mentioned steps. This will remove redundant/duplicate code in drivers' probe functions of platform drivers.

devm_platform_probe_helper(pdev, priv, clk_name); devm_platform_probe_helper_clk(pdev, priv, clk_name); devm_platform_probe_helper_irq(pdev, priv, clk_name, irq_hndlr, irq_flags, irq_name, irq_devid); devm_platform_probe_helper_all(pdev, priv, clk_name, irq_hndlr, irq_flags, irq_name, irq_devid); devm_platform_probe_helper_all_data(pdev, priv, clk_name, irq_hndlr, irq_flags, irq_name, irq_devid);

3. Code is made devres compatible (wherever required) The functions: clk_get, request_irq, kzalloc, platform_get_resource are replaced with their devm_* counterparts.

4. Few bugs are also fixed.

Satendra Singh Thakur (9):
probe/dma : added helper macros to remove redundant/duplicate code
from probe functions of the dma controller drivers
probe/dma/jz4740: removed redundant code from jz4740 dma controller's
probe function
probe/dma/zx: removed redundant code from zx dma controller's probe
function
probe/dma/qcom-bam: removed redundant code from qcom bam dma
controller's probe function
probe/dma/mtk-hs: removed redundant code from mediatek hs dma
controller's probe function
probe/dma/sun6i: removed redundant code from sun6i dma controller's
probe function
probe/dma/sun4i: removed redundant code from sun4i dma controller's
probe function
probe/dma/axi: removed redundant code from axi dma controller's probe
function
probe/dma/owl: removed redundant code from owl dma controller's probe
function

 drivers/dma/dma-axi-dmac.c       |  28 ++---
 drivers/dma/dma-jz4740.c         |  33 +++---
 drivers/dma/mediatek/mtk-hsdma.c |  38 +++----
 drivers/dma/owl-dma.c            |  29 ++---
 drivers/dma/qcom/bam_dma.c       |  71 +++++-------
 drivers/dma/sun4i-dma.c          |  30 ++----
 drivers/dma/sun6i-dma.c          |  30 ++----
 drivers/dma/zx_dma.c             |  35 ++----
 include/linux/probe-helper.h     | 179 +++++++++++++++++++++++++++++++
 9 files changed, 280 insertions(+), 193 deletions(-)
 create mode 100644 include/linux/probe-helper.h
Signature · 1 line
2.17.1