Re: [PATCH 1/3] dmaengine: convert to subsys_platform_driver()

From: Frank Li

Date: Mon Nov 16 2026 - 15:43:54 EST


On Fri, Nov 06, 2026 at 07:06:08PM -0500, Brian Masney wrote:
> Reduce boilerplate code in these drivers and convert them over to use
> the macro subsys_platform_driver().
>
> Signed-off-by: Brian Masney <bmasney@xxxxxxxxxx>
> ---

Reviewed-by: Frank Li <Frank.Li@xxxxxxx>

> drivers/dma/at_xdmac.c | 12 +-----------
> drivers/dma/bestcomm/bestcomm.c | 18 +-----------------
> drivers/dma/dma-jz4780.c | 12 +-----------
> drivers/dma/dw/platform.c | 12 +-----------
> drivers/dma/fsl-edma-main.c | 12 +-----------
> drivers/dma/mcf-edma-main.c | 12 +-----------
> drivers/dma/moxart-dma.c | 12 +-----------
> drivers/dma/owl-dma.c | 12 +-----------
> drivers/dma/sa11x0-dma.c | 12 +-----------
> drivers/dma/sf-pdma/sf-pdma.c | 14 +-------------
> drivers/dma/ti/omap-dma.c | 12 +-----------
> 11 files changed, 11 insertions(+), 129 deletions(-)
>
> diff --git a/drivers/dma/at_xdmac.c b/drivers/dma/at_xdmac.c
> index d40a8b40dddc..8b19d46ac812 100644
> --- a/drivers/dma/at_xdmac.c
> +++ b/drivers/dma/at_xdmac.c
> @@ -2488,17 +2488,7 @@ static struct platform_driver at_xdmac_driver = {
> }
> };
>
> -static int __init at_xdmac_init(void)
> -{
> - return platform_driver_register(&at_xdmac_driver);
> -}
> -subsys_initcall(at_xdmac_init);
> -
> -static void __exit at_xdmac_exit(void)
> -{
> - platform_driver_unregister(&at_xdmac_driver);
> -}
> -module_exit(at_xdmac_exit);
> +subsys_platform_driver(at_xdmac_driver);
>
> MODULE_DESCRIPTION("Atmel Extended DMA Controller driver");
> MODULE_AUTHOR("Ludovic Desroches <ludovic.desroches@xxxxxxxxx>");
> diff --git a/drivers/dma/bestcomm/bestcomm.c b/drivers/dma/bestcomm/bestcomm.c
> index 241a91936fe8..1dadcc259382 100644
> --- a/drivers/dma/bestcomm/bestcomm.c
> +++ b/drivers/dma/bestcomm/bestcomm.c
> @@ -474,23 +474,7 @@ static struct platform_driver mpc52xx_bcom_of_platform_driver = {
> /* Module */
> /* ======================================================================== */
>
> -static int __init
> -mpc52xx_bcom_init(void)
> -{
> - return platform_driver_register(&mpc52xx_bcom_of_platform_driver);
> -}
> -
> -static void __exit
> -mpc52xx_bcom_exit(void)
> -{
> - platform_driver_unregister(&mpc52xx_bcom_of_platform_driver);
> -}
> -
> -/* If we're not a module, we must make sure everything is setup before */
> -/* anyone tries to use us ... that's why we use subsys_initcall instead */
> -/* of module_init. */
> -subsys_initcall(mpc52xx_bcom_init);
> -module_exit(mpc52xx_bcom_exit);
> +subsys_platform_driver(mpc52xx_bcom_of_platform_driver);
>
> MODULE_DESCRIPTION("Freescale MPC52xx BestComm DMA");
> MODULE_AUTHOR("Sylvain Munaut <tnt@xxxxxxxxxx>");
> diff --git a/drivers/dma/dma-jz4780.c b/drivers/dma/dma-jz4780.c
> index ac2094e65ecf..32a40c17e0cd 100644
> --- a/drivers/dma/dma-jz4780.c
> +++ b/drivers/dma/dma-jz4780.c
> @@ -1129,17 +1129,7 @@ static struct platform_driver jz4780_dma_driver = {
> },
> };
>
> -static int __init jz4780_dma_init(void)
> -{
> - return platform_driver_register(&jz4780_dma_driver);
> -}
> -subsys_initcall(jz4780_dma_init);
> -
> -static void __exit jz4780_dma_exit(void)
> -{
> - platform_driver_unregister(&jz4780_dma_driver);
> -}
> -module_exit(jz4780_dma_exit);
> +subsys_platform_driver(jz4780_dma_driver);
>
> MODULE_AUTHOR("Alex Smith <alex@xxxxxxxxxxxxxxxx>");
> MODULE_DESCRIPTION("Ingenic JZ4780 DMA controller driver");
> diff --git a/drivers/dma/dw/platform.c b/drivers/dma/dw/platform.c
> index 5c1c97eb28a4..7576ad255343 100644
> --- a/drivers/dma/dw/platform.c
> +++ b/drivers/dma/dw/platform.c
> @@ -195,17 +195,7 @@ static struct platform_driver dw_driver = {
> },
> };
>
> -static int __init dw_init(void)
> -{
> - return platform_driver_register(&dw_driver);
> -}
> -subsys_initcall(dw_init);
> -
> -static void __exit dw_exit(void)
> -{
> - platform_driver_unregister(&dw_driver);
> -}
> -module_exit(dw_exit);
> +subsys_platform_driver(dw_driver);
>
> MODULE_LICENSE("GPL v2");
> MODULE_DESCRIPTION("Synopsys DesignWare DMA Controller platform driver");
> diff --git a/drivers/dma/fsl-edma-main.c b/drivers/dma/fsl-edma-main.c
> index 630285c85482..c731104c3306 100644
> --- a/drivers/dma/fsl-edma-main.c
> +++ b/drivers/dma/fsl-edma-main.c
> @@ -978,17 +978,7 @@ static struct platform_driver fsl_edma_driver = {
> .remove = fsl_edma_remove,
> };
>
> -static int __init fsl_edma_init(void)
> -{
> - return platform_driver_register(&fsl_edma_driver);
> -}
> -subsys_initcall(fsl_edma_init);
> -
> -static void __exit fsl_edma_exit(void)
> -{
> - platform_driver_unregister(&fsl_edma_driver);
> -}
> -module_exit(fsl_edma_exit);
> +subsys_platform_driver(fsl_edma_driver);
>
> MODULE_DESCRIPTION("Freescale eDMA engine driver");
> MODULE_LICENSE("GPL v2");
> diff --git a/drivers/dma/mcf-edma-main.c b/drivers/dma/mcf-edma-main.c
> index 9e1c6400c77b..fb6c06d4a8d1 100644
> --- a/drivers/dma/mcf-edma-main.c
> +++ b/drivers/dma/mcf-edma-main.c
> @@ -282,17 +282,7 @@ bool mcf_edma_filter_fn(struct dma_chan *chan, void *param)
> }
> EXPORT_SYMBOL(mcf_edma_filter_fn);
>
> -static int __init mcf_edma_init(void)
> -{
> - return platform_driver_register(&mcf_edma_driver);
> -}
> -subsys_initcall(mcf_edma_init);
> -
> -static void __exit mcf_edma_exit(void)
> -{
> - platform_driver_unregister(&mcf_edma_driver);
> -}
> -module_exit(mcf_edma_exit);
> +subsys_platform_driver(mcf_edma_driver);
>
> MODULE_ALIAS("platform:mcf-edma");
> MODULE_DESCRIPTION("Freescale eDMA engine driver, ColdFire family");
> diff --git a/drivers/dma/moxart-dma.c b/drivers/dma/moxart-dma.c
> index 28be93eed4cc..d33733afce9d 100644
> --- a/drivers/dma/moxart-dma.c
> +++ b/drivers/dma/moxart-dma.c
> @@ -646,17 +646,7 @@ static struct platform_driver moxart_driver = {
> },
> };
>
> -static int moxart_init(void)
> -{
> - return platform_driver_register(&moxart_driver);
> -}
> -subsys_initcall(moxart_init);
> -
> -static void __exit moxart_exit(void)
> -{
> - platform_driver_unregister(&moxart_driver);
> -}
> -module_exit(moxart_exit);
> +subsys_platform_driver(moxart_driver);
>
> MODULE_AUTHOR("Jonas Jensen <jonas.jensen@xxxxxxxxx>");
> MODULE_DESCRIPTION("MOXART DMA engine driver");
> diff --git a/drivers/dma/owl-dma.c b/drivers/dma/owl-dma.c
> index 9dc88d804a2e..c13c449ad05b 100644
> --- a/drivers/dma/owl-dma.c
> +++ b/drivers/dma/owl-dma.c
> @@ -1254,17 +1254,7 @@ static struct platform_driver owl_dma_driver = {
> },
> };
>
> -static int owl_dma_init(void)
> -{
> - return platform_driver_register(&owl_dma_driver);
> -}
> -subsys_initcall(owl_dma_init);
> -
> -static void __exit owl_dma_exit(void)
> -{
> - platform_driver_unregister(&owl_dma_driver);
> -}
> -module_exit(owl_dma_exit);
> +subsys_platform_driver(owl_dma_driver);
>
> MODULE_AUTHOR("David Liu <liuwei@xxxxxxxxxxxxxxxx>");
> MODULE_AUTHOR("Manivannan Sadhasivam <manivannan.sadhasivam@xxxxxxxxxx>");
> diff --git a/drivers/dma/sa11x0-dma.c b/drivers/dma/sa11x0-dma.c
> index a6fa431530e3..70b191519053 100644
> --- a/drivers/dma/sa11x0-dma.c
> +++ b/drivers/dma/sa11x0-dma.c
> @@ -1080,17 +1080,7 @@ static struct platform_driver sa11x0_dma_driver = {
> .remove = sa11x0_dma_remove,
> };
>
> -static int __init sa11x0_dma_init(void)
> -{
> - return platform_driver_register(&sa11x0_dma_driver);
> -}
> -subsys_initcall(sa11x0_dma_init);
> -
> -static void __exit sa11x0_dma_exit(void)
> -{
> - platform_driver_unregister(&sa11x0_dma_driver);
> -}
> -module_exit(sa11x0_dma_exit);
> +subsys_platform_driver(sa11x0_dma_driver);
>
> MODULE_AUTHOR("Russell King");
> MODULE_DESCRIPTION("SA-11x0 DMA driver");
> diff --git a/drivers/dma/sf-pdma/sf-pdma.c b/drivers/dma/sf-pdma/sf-pdma.c
> index 6f79cc28703e..d62563f6c7f0 100644
> --- a/drivers/dma/sf-pdma/sf-pdma.c
> +++ b/drivers/dma/sf-pdma/sf-pdma.c
> @@ -639,19 +639,7 @@ static struct platform_driver sf_pdma_driver = {
> },
> };
>
> -static int __init sf_pdma_init(void)
> -{
> - return platform_driver_register(&sf_pdma_driver);
> -}
> -
> -static void __exit sf_pdma_exit(void)
> -{
> - platform_driver_unregister(&sf_pdma_driver);
> -}
> -
> -/* do early init */
> -subsys_initcall(sf_pdma_init);
> -module_exit(sf_pdma_exit);
> +subsys_platform_driver(sf_pdma_driver);
>
> MODULE_LICENSE("GPL v2");
> MODULE_DESCRIPTION("SiFive Platform DMA driver");
> diff --git a/drivers/dma/ti/omap-dma.c b/drivers/dma/ti/omap-dma.c
> index 55ece7fd0d99..da1f4eec9eb2 100644
> --- a/drivers/dma/ti/omap-dma.c
> +++ b/drivers/dma/ti/omap-dma.c
> @@ -1941,17 +1941,7 @@ static bool omap_dma_filter_fn(struct dma_chan *chan, void *param)
> return false;
> }
>
> -static int omap_dma_init(void)
> -{
> - return platform_driver_register(&omap_dma_driver);
> -}
> -subsys_initcall(omap_dma_init);
> -
> -static void __exit omap_dma_exit(void)
> -{
> - platform_driver_unregister(&omap_dma_driver);
> -}
> -module_exit(omap_dma_exit);
> +subsys_platform_driver(omap_dma_driver);
>
> MODULE_AUTHOR("Russell King");
> MODULE_DESCRIPTION("Texas Instruments sDMA DMAengine support");
>
> --
> 2.56.0
>
>