From 8876762f285fff08b1aefeba52c7157a2c9beec1 Mon Sep 17 00:00:00 2001 From: Uwe Kleine-König Date: Tue, 19 Sep 2023 15:31:09 +0200 Subject: dmaengine: altera-msgdma: Convert to platform remove callback returning void MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Eventually after all drivers are converted, .remove_new() is renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König Acked-by: Olivier Dautricourt Link: https://lore.kernel.org/r/20230919133207.1400430-2-u.kleine-koenig@pengutronix.de Signed-off-by: Vinod Koul --- drivers/dma/altera-msgdma.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/dma/altera-msgdma.c b/drivers/dma/altera-msgdma.c index 4153c2edb049..a8e3615235b8 100644 --- a/drivers/dma/altera-msgdma.c +++ b/drivers/dma/altera-msgdma.c @@ -923,7 +923,7 @@ fail: * * Return: Always '0' */ -static int msgdma_remove(struct platform_device *pdev) +static void msgdma_remove(struct platform_device *pdev) { struct msgdma_device *mdev = platform_get_drvdata(pdev); @@ -933,8 +933,6 @@ static int msgdma_remove(struct platform_device *pdev) msgdma_dev_remove(mdev); dev_notice(&pdev->dev, "Altera mSGDMA driver removed\n"); - - return 0; } #ifdef CONFIG_OF @@ -952,7 +950,7 @@ static struct platform_driver msgdma_driver = { .of_match_table = of_match_ptr(msgdma_match), }, .probe = msgdma_probe, - .remove = msgdma_remove, + .remove_new = msgdma_remove, }; module_platform_driver(msgdma_driver); -- cgit v1.2.3 From e7d5aa30c8a19e6d9c4ec19d3b9e501df22e1d1a Mon Sep 17 00:00:00 2001 From: Uwe Kleine-König Date: Tue, 19 Sep 2023 15:31:10 +0200 Subject: dmaengine: apple-admac: Convert to platform remove callback returning void MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Eventually after all drivers are converted, .remove_new() is renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König Link: https://lore.kernel.org/r/20230919133207.1400430-3-u.kleine-koenig@pengutronix.de Signed-off-by: Vinod Koul --- drivers/dma/apple-admac.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/dma/apple-admac.c b/drivers/dma/apple-admac.c index 3af795635c5c..46bb02858561 100644 --- a/drivers/dma/apple-admac.c +++ b/drivers/dma/apple-admac.c @@ -925,7 +925,7 @@ free_reset: return err; } -static int admac_remove(struct platform_device *pdev) +static void admac_remove(struct platform_device *pdev) { struct admac_data *ad = platform_get_drvdata(pdev); @@ -933,8 +933,6 @@ static int admac_remove(struct platform_device *pdev) dma_async_device_unregister(&ad->dma); free_irq(ad->irq, ad); reset_control_rearm(ad->rstc); - - return 0; } static const struct of_device_id admac_of_match[] = { @@ -949,7 +947,7 @@ static struct platform_driver apple_admac_driver = { .of_match_table = admac_of_match, }, .probe = admac_probe, - .remove = admac_remove, + .remove_new = admac_remove, }; module_platform_driver(apple_admac_driver); -- cgit v1.2.3 From ae3f38e495b42494414cbace3b3bd3cb6dc10506 Mon Sep 17 00:00:00 2001 From: Uwe Kleine-König Date: Tue, 19 Sep 2023 15:31:11 +0200 Subject: dmaengine: at_hdmac: Convert to platform remove callback returning void MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Eventually after all drivers are converted, .remove_new() is renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König Link: https://lore.kernel.org/r/20230919133207.1400430-4-u.kleine-koenig@pengutronix.de Signed-off-by: Vinod Koul --- drivers/dma/at_hdmac.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c index b2876f67471f..417a9428a9b6 100644 --- a/drivers/dma/at_hdmac.c +++ b/drivers/dma/at_hdmac.c @@ -2100,7 +2100,7 @@ err_irq: return err; } -static int at_dma_remove(struct platform_device *pdev) +static void at_dma_remove(struct platform_device *pdev) { struct at_dma *atdma = platform_get_drvdata(pdev); struct dma_chan *chan, *_chan; @@ -2122,8 +2122,6 @@ static int at_dma_remove(struct platform_device *pdev) } clk_disable_unprepare(atdma->clk); - - return 0; } static void at_dma_shutdown(struct platform_device *pdev) @@ -2242,7 +2240,7 @@ static const struct dev_pm_ops __maybe_unused at_dma_dev_pm_ops = { }; static struct platform_driver at_dma_driver = { - .remove = at_dma_remove, + .remove_new = at_dma_remove, .shutdown = at_dma_shutdown, .id_table = atdma_devtypes, .driver = { -- cgit v1.2.3 From b13af3c41bad5f4e45a73d6978f31ad48ffc2dee Mon Sep 17 00:00:00 2001 From: Uwe Kleine-König Date: Tue, 19 Sep 2023 15:31:12 +0200 Subject: dmaengine: at_xdmac: Convert to platform remove callback returning void MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Eventually after all drivers are converted, .remove_new() is renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König Link: https://lore.kernel.org/r/20230919133207.1400430-5-u.kleine-koenig@pengutronix.de Signed-off-by: Vinod Koul --- drivers/dma/at_xdmac.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/dma/at_xdmac.c b/drivers/dma/at_xdmac.c index c3b37168b21f..299396121e6d 100644 --- a/drivers/dma/at_xdmac.c +++ b/drivers/dma/at_xdmac.c @@ -2431,7 +2431,7 @@ err_free_irq: return ret; } -static int at_xdmac_remove(struct platform_device *pdev) +static void at_xdmac_remove(struct platform_device *pdev) { struct at_xdmac *atxdmac = (struct at_xdmac *)platform_get_drvdata(pdev); int i; @@ -2452,8 +2452,6 @@ static int at_xdmac_remove(struct platform_device *pdev) tasklet_kill(&atchan->tasklet); at_xdmac_free_chan_resources(&atchan->chan); } - - return 0; } static const struct dev_pm_ops __maybe_unused atmel_xdmac_dev_pm_ops = { @@ -2478,7 +2476,7 @@ MODULE_DEVICE_TABLE(of, atmel_xdmac_dt_ids); static struct platform_driver at_xdmac_driver = { .probe = at_xdmac_probe, - .remove = at_xdmac_remove, + .remove_new = at_xdmac_remove, .driver = { .name = "at_xdmac", .of_match_table = of_match_ptr(atmel_xdmac_dt_ids), -- cgit v1.2.3 From 017df796a3635edee5169a0700634da6dac92f6a Mon Sep 17 00:00:00 2001 From: Uwe Kleine-König Date: Tue, 19 Sep 2023 15:31:13 +0200 Subject: dmaengine: bcm-sba-raid: Convert to platform remove callback returning void MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Eventually after all drivers are converted, .remove_new() is renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König Link: https://lore.kernel.org/r/20230919133207.1400430-6-u.kleine-koenig@pengutronix.de Signed-off-by: Vinod Koul --- drivers/dma/bcm-sba-raid.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/dma/bcm-sba-raid.c b/drivers/dma/bcm-sba-raid.c index 94ea35330eb5..fbaacb4c19b2 100644 --- a/drivers/dma/bcm-sba-raid.c +++ b/drivers/dma/bcm-sba-raid.c @@ -1734,7 +1734,7 @@ fail_free_mchan: return ret; } -static int sba_remove(struct platform_device *pdev) +static void sba_remove(struct platform_device *pdev) { struct sba_device *sba = platform_get_drvdata(pdev); @@ -1745,8 +1745,6 @@ static int sba_remove(struct platform_device *pdev) sba_freeup_channel_resources(sba); mbox_free_channel(sba->mchan); - - return 0; } static const struct of_device_id sba_of_match[] = { @@ -1758,7 +1756,7 @@ MODULE_DEVICE_TABLE(of, sba_of_match); static struct platform_driver sba_driver = { .probe = sba_probe, - .remove = sba_remove, + .remove_new = sba_remove, .driver = { .name = "bcm-sba-raid", .of_match_table = sba_of_match, -- cgit v1.2.3 From 8f63a2da288454e9228f6b438b86627f6ceae36b Mon Sep 17 00:00:00 2001 From: Uwe Kleine-König Date: Tue, 19 Sep 2023 15:31:14 +0200 Subject: dmaengine: bcm2835-dma: Convert to platform remove callback returning void MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Eventually after all drivers are converted, .remove_new() is renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König Link: https://lore.kernel.org/r/20230919133207.1400430-7-u.kleine-koenig@pengutronix.de Signed-off-by: Vinod Koul --- drivers/dma/bcm2835-dma.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/dma/bcm2835-dma.c b/drivers/dma/bcm2835-dma.c index 0807fb9eb262..9d74fe97452e 100644 --- a/drivers/dma/bcm2835-dma.c +++ b/drivers/dma/bcm2835-dma.c @@ -1019,19 +1019,17 @@ err_no_dma: return rc; } -static int bcm2835_dma_remove(struct platform_device *pdev) +static void bcm2835_dma_remove(struct platform_device *pdev) { struct bcm2835_dmadev *od = platform_get_drvdata(pdev); dma_async_device_unregister(&od->ddev); bcm2835_dma_free(od); - - return 0; } static struct platform_driver bcm2835_dma_driver = { .probe = bcm2835_dma_probe, - .remove = bcm2835_dma_remove, + .remove_new = bcm2835_dma_remove, .driver = { .name = "bcm2835-dma", .of_match_table = of_match_ptr(bcm2835_dma_of_match), -- cgit v1.2.3 From 7689bca111997e0d7a12cf6457fc26a52b8c800f Mon Sep 17 00:00:00 2001 From: Uwe Kleine-König Date: Tue, 19 Sep 2023 15:31:15 +0200 Subject: dmaengine: bestcomm: bestcomm: Convert to platform remove callback returning void MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Eventually after all drivers are converted, .remove_new() is renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König Link: https://lore.kernel.org/r/20230919133207.1400430-8-u.kleine-koenig@pengutronix.de Signed-off-by: Vinod Koul --- drivers/dma/bestcomm/bestcomm.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/dma/bestcomm/bestcomm.c b/drivers/dma/bestcomm/bestcomm.c index 80096f94032d..0bbaa7620bdd 100644 --- a/drivers/dma/bestcomm/bestcomm.c +++ b/drivers/dma/bestcomm/bestcomm.c @@ -455,7 +455,7 @@ error_ofput: } -static int mpc52xx_bcom_remove(struct platform_device *op) +static void mpc52xx_bcom_remove(struct platform_device *op) { /* Clean up the engine */ bcom_engine_cleanup(); @@ -473,8 +473,6 @@ static int mpc52xx_bcom_remove(struct platform_device *op) /* Release memory */ kfree(bcom_eng); bcom_eng = NULL; - - return 0; } static const struct of_device_id mpc52xx_bcom_of_match[] = { @@ -488,7 +486,7 @@ MODULE_DEVICE_TABLE(of, mpc52xx_bcom_of_match); static struct platform_driver mpc52xx_bcom_of_platform_driver = { .probe = mpc52xx_bcom_probe, - .remove = mpc52xx_bcom_remove, + .remove_new = mpc52xx_bcom_remove, .driver = { .name = DRIVER_NAME, .of_match_table = mpc52xx_bcom_of_match, -- cgit v1.2.3 From b5f095a70117629c3abb49bcb07dfa954d275e99 Mon Sep 17 00:00:00 2001 From: Uwe Kleine-König Date: Tue, 19 Sep 2023 15:31:16 +0200 Subject: dmaengine: dma-axi-dmac: Convert to platform remove callback returning void MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Eventually after all drivers are converted, .remove_new() is renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König Link: https://lore.kernel.org/r/20230919133207.1400430-9-u.kleine-koenig@pengutronix.de Signed-off-by: Vinod Koul --- drivers/dma/dma-axi-dmac.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/dma/dma-axi-dmac.c b/drivers/dma/dma-axi-dmac.c index fc7cdad37161..a6d235bc8444 100644 --- a/drivers/dma/dma-axi-dmac.c +++ b/drivers/dma/dma-axi-dmac.c @@ -1029,7 +1029,7 @@ err_clk_disable: return ret; } -static int axi_dmac_remove(struct platform_device *pdev) +static void axi_dmac_remove(struct platform_device *pdev) { struct axi_dmac *dmac = platform_get_drvdata(pdev); @@ -1038,8 +1038,6 @@ static int axi_dmac_remove(struct platform_device *pdev) tasklet_kill(&dmac->chan.vchan.task); dma_async_device_unregister(&dmac->dma_dev); clk_disable_unprepare(dmac->clk); - - return 0; } static const struct of_device_id axi_dmac_of_match_table[] = { @@ -1054,7 +1052,7 @@ static struct platform_driver axi_dmac_driver = { .of_match_table = axi_dmac_of_match_table, }, .probe = axi_dmac_probe, - .remove = axi_dmac_remove, + .remove_new = axi_dmac_remove, }; module_platform_driver(axi_dmac_driver); -- cgit v1.2.3 From a8c85540bee12d492904a430c0c1105a4b7b101c Mon Sep 17 00:00:00 2001 From: Uwe Kleine-König Date: Tue, 19 Sep 2023 15:31:17 +0200 Subject: dmaengine: dma-jz4780: Convert to platform remove callback returning void MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Eventually after all drivers are converted, .remove_new() is renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Paul Cercueil Link: https://lore.kernel.org/r/20230919133207.1400430-10-u.kleine-koenig@pengutronix.de Signed-off-by: Vinod Koul --- drivers/dma/dma-jz4780.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/dma/dma-jz4780.c b/drivers/dma/dma-jz4780.c index adbd47bd6adf..c9cfa341db51 100644 --- a/drivers/dma/dma-jz4780.c +++ b/drivers/dma/dma-jz4780.c @@ -1008,7 +1008,7 @@ err_disable_clk: return ret; } -static int jz4780_dma_remove(struct platform_device *pdev) +static void jz4780_dma_remove(struct platform_device *pdev) { struct jz4780_dma_dev *jzdma = platform_get_drvdata(pdev); int i; @@ -1020,8 +1020,6 @@ static int jz4780_dma_remove(struct platform_device *pdev) for (i = 0; i < jzdma->soc_data->nb_channels; i++) tasklet_kill(&jzdma->chan[i].vchan.task); - - return 0; } static const struct jz4780_dma_soc_data jz4740_dma_soc_data = { @@ -1124,7 +1122,7 @@ MODULE_DEVICE_TABLE(of, jz4780_dma_dt_match); static struct platform_driver jz4780_dma_driver = { .probe = jz4780_dma_probe, - .remove = jz4780_dma_remove, + .remove_new = jz4780_dma_remove, .driver = { .name = "jz4780-dma", .of_match_table = jz4780_dma_dt_match, -- cgit v1.2.3 From c689a2fd2a3f2a0a9e775c59c0f02ea64677c254 Mon Sep 17 00:00:00 2001 From: Uwe Kleine-König Date: Tue, 19 Sep 2023 15:31:18 +0200 Subject: dmaengine: dw-axi-dmac: dw-axi-dmac-platform: Convert to platform remove callback returning void MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Eventually after all drivers are converted, .remove_new() is renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König Link: https://lore.kernel.org/r/20230919133207.1400430-11-u.kleine-koenig@pengutronix.de Signed-off-by: Vinod Koul --- drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c b/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c index dd02f84e404d..974da2fda2e4 100644 --- a/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c +++ b/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c @@ -1535,7 +1535,7 @@ err_pm_disable: return ret; } -static int dw_remove(struct platform_device *pdev) +static void dw_remove(struct platform_device *pdev) { struct axi_dma_chip *chip = platform_get_drvdata(pdev); struct dw_axi_dma *dw = chip->dw; @@ -1564,8 +1564,6 @@ static int dw_remove(struct platform_device *pdev) list_del(&chan->vc.chan.device_node); tasklet_kill(&chan->vc.task); } - - return 0; } static const struct dev_pm_ops dw_axi_dma_pm_ops = { @@ -1588,7 +1586,7 @@ MODULE_DEVICE_TABLE(of, dw_dma_of_id_table); static struct platform_driver dw_driver = { .probe = dw_probe, - .remove = dw_remove, + .remove_new = dw_remove, .driver = { .name = KBUILD_MODNAME, .of_match_table = dw_dma_of_id_table, -- cgit v1.2.3 From 67572bfe2e35c232c3497b3fc8babbfe62600ce0 Mon Sep 17 00:00:00 2001 From: Uwe Kleine-König Date: Tue, 19 Sep 2023 15:31:19 +0200 Subject: dmaengine: dw: platform: Convert to platform remove callback returning void MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Eventually after all drivers are converted, .remove_new() is renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König Acked-by: Viresh Kumar Link: https://lore.kernel.org/r/20230919133207.1400430-12-u.kleine-koenig@pengutronix.de Signed-off-by: Vinod Koul --- drivers/dma/dw/platform.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/dma/dw/platform.c b/drivers/dma/dw/platform.c index 47f2292dba98..7d9d4c951724 100644 --- a/drivers/dma/dw/platform.c +++ b/drivers/dma/dw/platform.c @@ -93,7 +93,7 @@ err_dw_dma_probe: return err; } -static int dw_remove(struct platform_device *pdev) +static void dw_remove(struct platform_device *pdev) { struct dw_dma_chip_pdata *data = platform_get_drvdata(pdev); struct dw_dma_chip *chip = data->chip; @@ -109,8 +109,6 @@ static int dw_remove(struct platform_device *pdev) pm_runtime_disable(&pdev->dev); clk_disable_unprepare(chip->clk); - - return 0; } static void dw_shutdown(struct platform_device *pdev) @@ -193,7 +191,7 @@ static const struct dev_pm_ops dw_dev_pm_ops = { static struct platform_driver dw_driver = { .probe = dw_probe, - .remove = dw_remove, + .remove_new = dw_remove, .shutdown = dw_shutdown, .driver = { .name = DRV_NAME, -- cgit v1.2.3 From fa13c3ef3f45bca5a1474755dac57bfaf28ef61b Mon Sep 17 00:00:00 2001 From: Uwe Kleine-König Date: Tue, 19 Sep 2023 15:31:20 +0200 Subject: dmaengine: fsl-edma-main: Convert to platform remove callback returning void MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Eventually after all drivers are converted, .remove_new() is renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König Link: https://lore.kernel.org/r/20230919133207.1400430-13-u.kleine-koenig@pengutronix.de Signed-off-by: Vinod Koul --- drivers/dma/fsl-edma-main.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/dma/fsl-edma-main.c b/drivers/dma/fsl-edma-main.c index 63d48d046f04..11da143955b3 100644 --- a/drivers/dma/fsl-edma-main.c +++ b/drivers/dma/fsl-edma-main.c @@ -615,7 +615,7 @@ static int fsl_edma_probe(struct platform_device *pdev) return 0; } -static int fsl_edma_remove(struct platform_device *pdev) +static void fsl_edma_remove(struct platform_device *pdev) { struct device_node *np = pdev->dev.of_node; struct fsl_edma_engine *fsl_edma = platform_get_drvdata(pdev); @@ -625,8 +625,6 @@ static int fsl_edma_remove(struct platform_device *pdev) of_dma_controller_free(np); dma_async_device_unregister(&fsl_edma->dma_dev); fsl_disable_clocks(fsl_edma, fsl_edma->drvdata->dmamuxs); - - return 0; } static int fsl_edma_suspend_late(struct device *dev) @@ -690,7 +688,7 @@ static struct platform_driver fsl_edma_driver = { .pm = &fsl_edma_pm_ops, }, .probe = fsl_edma_probe, - .remove = fsl_edma_remove, + .remove_new = fsl_edma_remove, }; static int __init fsl_edma_init(void) -- cgit v1.2.3 From fe3d44cdaea41173e50833440db84982e2a8d2a7 Mon Sep 17 00:00:00 2001 From: Uwe Kleine-König Date: Tue, 19 Sep 2023 15:31:21 +0200 Subject: dmaengine: fsl-qdma: Convert to platform remove callback returning void MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Eventually after all drivers are converted, .remove_new() is renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König Link: https://lore.kernel.org/r/20230919133207.1400430-14-u.kleine-koenig@pengutronix.de Signed-off-by: Vinod Koul --- drivers/dma/fsl-qdma.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/dma/fsl-qdma.c b/drivers/dma/fsl-qdma.c index a8cc8a4bc610..47cb28468049 100644 --- a/drivers/dma/fsl-qdma.c +++ b/drivers/dma/fsl-qdma.c @@ -1266,7 +1266,7 @@ static void fsl_qdma_cleanup_vchan(struct dma_device *dmadev) } } -static int fsl_qdma_remove(struct platform_device *pdev) +static void fsl_qdma_remove(struct platform_device *pdev) { int i; struct fsl_qdma_queue *status; @@ -1283,7 +1283,6 @@ static int fsl_qdma_remove(struct platform_device *pdev) dma_free_coherent(&pdev->dev, sizeof(struct fsl_qdma_format) * status->n_cq, status->cq, status->bus_addr); } - return 0; } static const struct of_device_id fsl_qdma_dt_ids[] = { @@ -1298,7 +1297,7 @@ static struct platform_driver fsl_qdma_driver = { .of_match_table = fsl_qdma_dt_ids, }, .probe = fsl_qdma_probe, - .remove = fsl_qdma_remove, + .remove_new = fsl_qdma_remove, }; module_platform_driver(fsl_qdma_driver); -- cgit v1.2.3 From 37b24b50c5f8ad9037fbe81f1ee43f5e16fb5334 Mon Sep 17 00:00:00 2001 From: Uwe Kleine-König Date: Tue, 19 Sep 2023 15:31:22 +0200 Subject: dmaengine: fsl_raid: Convert to platform remove callback returning void MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Eventually after all drivers are converted, .remove_new() is renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König Link: https://lore.kernel.org/r/20230919133207.1400430-15-u.kleine-koenig@pengutronix.de Signed-off-by: Vinod Koul --- drivers/dma/fsl_raid.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/dma/fsl_raid.c b/drivers/dma/fsl_raid.c index 0b9ca93ce3dc..014ff523d5ec 100644 --- a/drivers/dma/fsl_raid.c +++ b/drivers/dma/fsl_raid.c @@ -857,7 +857,7 @@ static void fsl_re_remove_chan(struct fsl_re_chan *chan) chan->oub_phys_addr); } -static int fsl_re_remove(struct platform_device *ofdev) +static void fsl_re_remove(struct platform_device *ofdev) { struct fsl_re_drv_private *re_priv; struct device *dev; @@ -872,8 +872,6 @@ static int fsl_re_remove(struct platform_device *ofdev) /* Unregister the driver */ dma_async_device_unregister(&re_priv->dma_dev); - - return 0; } static const struct of_device_id fsl_re_ids[] = { @@ -888,7 +886,7 @@ static struct platform_driver fsl_re_driver = { .of_match_table = fsl_re_ids, }, .probe = fsl_re_probe, - .remove = fsl_re_remove, + .remove_new = fsl_re_remove, }; module_platform_driver(fsl_re_driver); -- cgit v1.2.3 From d69f80110da5d0e665d7f2872bf2185fe7f14409 Mon Sep 17 00:00:00 2001 From: Uwe Kleine-König Date: Tue, 19 Sep 2023 15:31:23 +0200 Subject: dmaengine: fsldma: Convert to platform remove callback returning void MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Eventually after all drivers are converted, .remove_new() is renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König Link: https://lore.kernel.org/r/20230919133207.1400430-16-u.kleine-koenig@pengutronix.de Signed-off-by: Vinod Koul --- drivers/dma/fsldma.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/dma/fsldma.c b/drivers/dma/fsldma.c index ddcf736d283d..18a6c4bf6275 100644 --- a/drivers/dma/fsldma.c +++ b/drivers/dma/fsldma.c @@ -1306,7 +1306,7 @@ out_return: return err; } -static int fsldma_of_remove(struct platform_device *op) +static void fsldma_of_remove(struct platform_device *op) { struct fsldma_device *fdev; unsigned int i; @@ -1324,8 +1324,6 @@ static int fsldma_of_remove(struct platform_device *op) iounmap(fdev->regs); kfree(fdev); - - return 0; } #ifdef CONFIG_PM @@ -1406,7 +1404,7 @@ static struct platform_driver fsldma_of_driver = { #endif }, .probe = fsldma_of_probe, - .remove = fsldma_of_remove, + .remove_new = fsldma_of_remove, }; /*----------------------------------------------------------------------------*/ -- cgit v1.2.3 From e8da277fbb8701308cfd2337afb13d34cc233349 Mon Sep 17 00:00:00 2001 From: Uwe Kleine-König Date: Tue, 19 Sep 2023 15:31:24 +0200 Subject: dmaengine: idma64: Convert to platform remove callback returning void MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Eventually after all drivers are converted, .remove_new() is renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König Link: https://lore.kernel.org/r/20230919133207.1400430-17-u.kleine-koenig@pengutronix.de Signed-off-by: Vinod Koul --- drivers/dma/idma64.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/dma/idma64.c b/drivers/dma/idma64.c index 0ac634a51c5e..78a938969d7d 100644 --- a/drivers/dma/idma64.c +++ b/drivers/dma/idma64.c @@ -660,13 +660,11 @@ static int idma64_platform_probe(struct platform_device *pdev) return 0; } -static int idma64_platform_remove(struct platform_device *pdev) +static void idma64_platform_remove(struct platform_device *pdev) { struct idma64_chip *chip = platform_get_drvdata(pdev); idma64_remove(chip); - - return 0; } static int __maybe_unused idma64_pm_suspend(struct device *dev) @@ -691,7 +689,7 @@ static const struct dev_pm_ops idma64_dev_pm_ops = { static struct platform_driver idma64_platform_driver = { .probe = idma64_platform_probe, - .remove = idma64_platform_remove, + .remove_new = idma64_platform_remove, .driver = { .name = LPSS_IDMA64_DRIVER_NAME, .pm = &idma64_dev_pm_ops, -- cgit v1.2.3 From 6e1b4a907e860071d957baee688a30a0bff102ef Mon Sep 17 00:00:00 2001 From: Uwe Kleine-König Date: Tue, 19 Sep 2023 15:31:25 +0200 Subject: dmaengine: img-mdc-dma: Convert to platform remove callback returning void MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Eventually after all drivers are converted, .remove_new() is renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König Link: https://lore.kernel.org/r/20230919133207.1400430-18-u.kleine-koenig@pengutronix.de Signed-off-by: Vinod Koul --- drivers/dma/img-mdc-dma.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/dma/img-mdc-dma.c b/drivers/dma/img-mdc-dma.c index 9be0d3226e19..0532dd2640dc 100644 --- a/drivers/dma/img-mdc-dma.c +++ b/drivers/dma/img-mdc-dma.c @@ -1017,7 +1017,7 @@ suspend: return ret; } -static int mdc_dma_remove(struct platform_device *pdev) +static void mdc_dma_remove(struct platform_device *pdev) { struct mdc_dma *mdma = platform_get_drvdata(pdev); struct mdc_chan *mchan, *next; @@ -1037,8 +1037,6 @@ static int mdc_dma_remove(struct platform_device *pdev) pm_runtime_disable(&pdev->dev); if (!pm_runtime_status_suspended(&pdev->dev)) img_mdc_runtime_suspend(&pdev->dev); - - return 0; } #ifdef CONFIG_PM_SLEEP @@ -1078,7 +1076,7 @@ static struct platform_driver mdc_dma_driver = { .of_match_table = of_match_ptr(mdc_dma_of_match), }, .probe = mdc_dma_probe, - .remove = mdc_dma_remove, + .remove_new = mdc_dma_remove, }; module_platform_driver(mdc_dma_driver); -- cgit v1.2.3 From 14c49dd0c34e457d71494b04290c27d7a14584d7 Mon Sep 17 00:00:00 2001 From: Uwe Kleine-König Date: Tue, 19 Sep 2023 15:31:26 +0200 Subject: dmaengine: imx-dma: Convert to platform remove callback returning void MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Eventually after all drivers are converted, .remove_new() is renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König Link: https://lore.kernel.org/r/20230919133207.1400430-19-u.kleine-koenig@pengutronix.de Signed-off-by: Vinod Koul --- drivers/dma/imx-dma.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/dma/imx-dma.c b/drivers/dma/imx-dma.c index 114f254b9f50..ebf7c115d553 100644 --- a/drivers/dma/imx-dma.c +++ b/drivers/dma/imx-dma.c @@ -1216,7 +1216,7 @@ static void imxdma_free_irq(struct platform_device *pdev, struct imxdma_engine * } } -static int imxdma_remove(struct platform_device *pdev) +static void imxdma_remove(struct platform_device *pdev) { struct imxdma_engine *imxdma = platform_get_drvdata(pdev); @@ -1229,8 +1229,6 @@ static int imxdma_remove(struct platform_device *pdev) clk_disable_unprepare(imxdma->dma_ipg); clk_disable_unprepare(imxdma->dma_ahb); - - return 0; } static struct platform_driver imxdma_driver = { @@ -1238,7 +1236,7 @@ static struct platform_driver imxdma_driver = { .name = "imx-dma", .of_match_table = imx_dma_of_dev_id, }, - .remove = imxdma_remove, + .remove_new = imxdma_remove, }; static int __init imxdma_module_init(void) -- cgit v1.2.3 From 06e4f653fafdeec7b13958b771226efa1cdf76d2 Mon Sep 17 00:00:00 2001 From: Uwe Kleine-König Date: Tue, 19 Sep 2023 15:31:27 +0200 Subject: dmaengine: imx-sdma: Convert to platform remove callback returning void MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Eventually after all drivers are converted, .remove_new() is renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König Link: https://lore.kernel.org/r/20230919133207.1400430-20-u.kleine-koenig@pengutronix.de Signed-off-by: Vinod Koul --- drivers/dma/imx-sdma.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/dma/imx-sdma.c b/drivers/dma/imx-sdma.c index 51012bd39900..f81ecf5863e8 100644 --- a/drivers/dma/imx-sdma.c +++ b/drivers/dma/imx-sdma.c @@ -2358,7 +2358,7 @@ err_clk: return ret; } -static int sdma_remove(struct platform_device *pdev) +static void sdma_remove(struct platform_device *pdev) { struct sdma_engine *sdma = platform_get_drvdata(pdev); int i; @@ -2377,7 +2377,6 @@ static int sdma_remove(struct platform_device *pdev) } platform_set_drvdata(pdev, NULL); - return 0; } static struct platform_driver sdma_driver = { @@ -2385,7 +2384,7 @@ static struct platform_driver sdma_driver = { .name = "imx-sdma", .of_match_table = sdma_dt_ids, }, - .remove = sdma_remove, + .remove_new = sdma_remove, .probe = sdma_probe, }; -- cgit v1.2.3 From 3faf902cb808163e9e65bf568c235a272215aed2 Mon Sep 17 00:00:00 2001 From: Uwe Kleine-König Date: Tue, 19 Sep 2023 15:31:28 +0200 Subject: dmaengine: k3dma: Convert to platform remove callback returning void MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Eventually after all drivers are converted, .remove_new() is renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König Link: https://lore.kernel.org/r/20230919133207.1400430-21-u.kleine-koenig@pengutronix.de Signed-off-by: Vinod Koul --- drivers/dma/k3dma.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/dma/k3dma.c b/drivers/dma/k3dma.c index ecdaada95120..22b37b525a48 100644 --- a/drivers/dma/k3dma.c +++ b/drivers/dma/k3dma.c @@ -974,7 +974,7 @@ dma_async_register_fail: return ret; } -static int k3_dma_remove(struct platform_device *op) +static void k3_dma_remove(struct platform_device *op) { struct k3_dma_chan *c, *cn; struct k3_dma_dev *d = platform_get_drvdata(op); @@ -990,7 +990,6 @@ static int k3_dma_remove(struct platform_device *op) } tasklet_kill(&d->task); clk_disable_unprepare(d->clk); - return 0; } #ifdef CONFIG_PM_SLEEP @@ -1034,7 +1033,7 @@ static struct platform_driver k3_pdma_driver = { .of_match_table = k3_pdma_dt_ids, }, .probe = k3_dma_probe, - .remove = k3_dma_remove, + .remove_new = k3_dma_remove, }; module_platform_driver(k3_pdma_driver); -- cgit v1.2.3 From 48236cb8314238917788f73353290dd1afb9a7c6 Mon Sep 17 00:00:00 2001 From: Uwe Kleine-König Date: Tue, 19 Sep 2023 15:31:29 +0200 Subject: dmaengine: mcf-edma-main: Convert to platform remove callback returning void MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Eventually after all drivers are converted, .remove_new() is renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König Link: https://lore.kernel.org/r/20230919133207.1400430-22-u.kleine-koenig@pengutronix.de Signed-off-by: Vinod Koul --- drivers/dma/mcf-edma-main.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/dma/mcf-edma-main.c b/drivers/dma/mcf-edma-main.c index b359421ee9ea..ab21455d9c3a 100644 --- a/drivers/dma/mcf-edma-main.c +++ b/drivers/dma/mcf-edma-main.c @@ -255,15 +255,13 @@ static int mcf_edma_probe(struct platform_device *pdev) return 0; } -static int mcf_edma_remove(struct platform_device *pdev) +static void mcf_edma_remove(struct platform_device *pdev) { struct fsl_edma_engine *mcf_edma = platform_get_drvdata(pdev); mcf_edma_irq_free(pdev, mcf_edma); fsl_edma_cleanup_vchan(&mcf_edma->dma_dev); dma_async_device_unregister(&mcf_edma->dma_dev); - - return 0; } static struct platform_driver mcf_edma_driver = { @@ -271,7 +269,7 @@ static struct platform_driver mcf_edma_driver = { .name = "mcf-edma", }, .probe = mcf_edma_probe, - .remove = mcf_edma_remove, + .remove_new = mcf_edma_remove, }; bool mcf_edma_filter_fn(struct dma_chan *chan, void *param) -- cgit v1.2.3 From bdeb61f5180efc920cf55b966a2a30bc2336d6d4 Mon Sep 17 00:00:00 2001 From: Uwe Kleine-König Date: Tue, 19 Sep 2023 15:31:30 +0200 Subject: dmaengine: mediatek: mtk-cqdma: Convert to platform remove callback returning void MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Eventually after all drivers are converted, .remove_new() is renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König Reviewed-by: AngeloGioacchino Del Regno Link: https://lore.kernel.org/r/20230919133207.1400430-23-u.kleine-koenig@pengutronix.de Signed-off-by: Vinod Koul --- drivers/dma/mediatek/mtk-cqdma.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/dma/mediatek/mtk-cqdma.c b/drivers/dma/mediatek/mtk-cqdma.c index 324b7387b1b9..529100c5b9f5 100644 --- a/drivers/dma/mediatek/mtk-cqdma.c +++ b/drivers/dma/mediatek/mtk-cqdma.c @@ -885,7 +885,7 @@ err_unregister: return err; } -static int mtk_cqdma_remove(struct platform_device *pdev) +static void mtk_cqdma_remove(struct platform_device *pdev) { struct mtk_cqdma_device *cqdma = platform_get_drvdata(pdev); struct mtk_cqdma_vchan *vc; @@ -918,13 +918,11 @@ static int mtk_cqdma_remove(struct platform_device *pdev) dma_async_device_unregister(&cqdma->ddev); of_dma_controller_free(pdev->dev.of_node); - - return 0; } static struct platform_driver mtk_cqdma_driver = { .probe = mtk_cqdma_probe, - .remove = mtk_cqdma_remove, + .remove_new = mtk_cqdma_remove, .driver = { .name = KBUILD_MODNAME, .of_match_table = mtk_cqdma_match, -- cgit v1.2.3 From 97283173effa6e53ea698726ea5d07f7ca06e5cf Mon Sep 17 00:00:00 2001 From: Uwe Kleine-König Date: Tue, 19 Sep 2023 15:31:31 +0200 Subject: dmaengine: mediatek: mtk-hsdma: Convert to platform remove callback returning void MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Eventually after all drivers are converted, .remove_new() is renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König Reviewed-by: AngeloGioacchino Del Regno Link: https://lore.kernel.org/r/20230919133207.1400430-24-u.kleine-koenig@pengutronix.de Signed-off-by: Vinod Koul --- drivers/dma/mediatek/mtk-hsdma.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/dma/mediatek/mtk-hsdma.c b/drivers/dma/mediatek/mtk-hsdma.c index 64120767d983..36ff11e909ea 100644 --- a/drivers/dma/mediatek/mtk-hsdma.c +++ b/drivers/dma/mediatek/mtk-hsdma.c @@ -1009,7 +1009,7 @@ err_unregister: return err; } -static int mtk_hsdma_remove(struct platform_device *pdev) +static void mtk_hsdma_remove(struct platform_device *pdev) { struct mtk_hsdma_device *hsdma = platform_get_drvdata(pdev); struct mtk_hsdma_vchan *vc; @@ -1034,13 +1034,11 @@ static int mtk_hsdma_remove(struct platform_device *pdev) dma_async_device_unregister(&hsdma->ddev); of_dma_controller_free(pdev->dev.of_node); - - return 0; } static struct platform_driver mtk_hsdma_driver = { .probe = mtk_hsdma_probe, - .remove = mtk_hsdma_remove, + .remove_new = mtk_hsdma_remove, .driver = { .name = KBUILD_MODNAME, .of_match_table = mtk_hsdma_match, -- cgit v1.2.3 From 4db30945a001ac97b5044db2aa2990b8e7df9452 Mon Sep 17 00:00:00 2001 From: Uwe Kleine-König Date: Tue, 19 Sep 2023 15:31:32 +0200 Subject: dmaengine: mediatek: mtk-uart-apdma: Convert to platform remove callback returning void MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Eventually after all drivers are converted, .remove_new() is renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König Reviewed-by: AngeloGioacchino Del Regno Link: https://lore.kernel.org/r/20230919133207.1400430-25-u.kleine-koenig@pengutronix.de Signed-off-by: Vinod Koul --- drivers/dma/mediatek/mtk-uart-apdma.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/dma/mediatek/mtk-uart-apdma.c b/drivers/dma/mediatek/mtk-uart-apdma.c index c51dc017b48a..8552531b4d64 100644 --- a/drivers/dma/mediatek/mtk-uart-apdma.c +++ b/drivers/dma/mediatek/mtk-uart-apdma.c @@ -573,7 +573,7 @@ err_no_dma: return rc; } -static int mtk_uart_apdma_remove(struct platform_device *pdev) +static void mtk_uart_apdma_remove(struct platform_device *pdev) { struct mtk_uart_apdmadev *mtkd = platform_get_drvdata(pdev); @@ -584,8 +584,6 @@ static int mtk_uart_apdma_remove(struct platform_device *pdev) dma_async_device_unregister(&mtkd->ddev); pm_runtime_disable(&pdev->dev); - - return 0; } #ifdef CONFIG_PM_SLEEP @@ -640,7 +638,7 @@ static const struct dev_pm_ops mtk_uart_apdma_pm_ops = { static struct platform_driver mtk_uart_apdma_driver = { .probe = mtk_uart_apdma_probe, - .remove = mtk_uart_apdma_remove, + .remove_new = mtk_uart_apdma_remove, .driver = { .name = KBUILD_MODNAME, .pm = &mtk_uart_apdma_pm_ops, -- cgit v1.2.3 From c0f0d93fc1da36de564da9b3f0462b5bdc4b1948 Mon Sep 17 00:00:00 2001 From: Uwe Kleine-König Date: Tue, 19 Sep 2023 15:31:33 +0200 Subject: dmaengine: mmp_pdma: Convert to platform remove callback returning void MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Eventually after all drivers are converted, .remove_new() is renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König Link: https://lore.kernel.org/r/20230919133207.1400430-26-u.kleine-koenig@pengutronix.de Signed-off-by: Vinod Koul --- drivers/dma/mmp_pdma.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/dma/mmp_pdma.c b/drivers/dma/mmp_pdma.c index ebdfdcbb4f7a..492ec491a59b 100644 --- a/drivers/dma/mmp_pdma.c +++ b/drivers/dma/mmp_pdma.c @@ -932,7 +932,7 @@ static void dma_do_tasklet(struct tasklet_struct *t) } } -static int mmp_pdma_remove(struct platform_device *op) +static void mmp_pdma_remove(struct platform_device *op) { struct mmp_pdma_device *pdev = platform_get_drvdata(op); struct mmp_pdma_phy *phy; @@ -958,7 +958,6 @@ static int mmp_pdma_remove(struct platform_device *op) } dma_async_device_unregister(&pdev->device); - return 0; } static int mmp_pdma_chan_init(struct mmp_pdma_device *pdev, int idx, int irq) @@ -1141,7 +1140,7 @@ static struct platform_driver mmp_pdma_driver = { }, .id_table = mmp_pdma_id_table, .probe = mmp_pdma_probe, - .remove = mmp_pdma_remove, + .remove_new = mmp_pdma_remove, }; module_platform_driver(mmp_pdma_driver); -- cgit v1.2.3 From f543b251500a0de589bc4c97da45b88410bf7c56 Mon Sep 17 00:00:00 2001 From: Uwe Kleine-König Date: Tue, 19 Sep 2023 15:31:34 +0200 Subject: dmaengine: mmp_tdma: Convert to platform remove callback returning void MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Eventually after all drivers are converted, .remove_new() is renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König Link: https://lore.kernel.org/r/20230919133207.1400430-27-u.kleine-koenig@pengutronix.de Signed-off-by: Vinod Koul --- drivers/dma/mmp_tdma.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/dma/mmp_tdma.c b/drivers/dma/mmp_tdma.c index d49fa6bc6775..f039e07181f7 100644 --- a/drivers/dma/mmp_tdma.c +++ b/drivers/dma/mmp_tdma.c @@ -552,12 +552,10 @@ static void mmp_tdma_issue_pending(struct dma_chan *chan) mmp_tdma_enable_chan(tdmac); } -static int mmp_tdma_remove(struct platform_device *pdev) +static void mmp_tdma_remove(struct platform_device *pdev) { if (pdev->dev.of_node) of_dma_controller_free(pdev->dev.of_node); - - return 0; } static int mmp_tdma_chan_init(struct mmp_tdma_device *tdev, @@ -753,7 +751,7 @@ static struct platform_driver mmp_tdma_driver = { }, .id_table = mmp_tdma_id_table, .probe = mmp_tdma_probe, - .remove = mmp_tdma_remove, + .remove_new = mmp_tdma_remove, }; module_platform_driver(mmp_tdma_driver); -- cgit v1.2.3 From 1a65831fa037457114ca75ea262d87fbde3158f0 Mon Sep 17 00:00:00 2001 From: Uwe Kleine-König Date: Tue, 19 Sep 2023 15:31:35 +0200 Subject: dmaengine: moxart-dma: Convert to platform remove callback returning void MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Eventually after all drivers are converted, .remove_new() is renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König Link: https://lore.kernel.org/r/20230919133207.1400430-28-u.kleine-koenig@pengutronix.de Signed-off-by: Vinod Koul --- drivers/dma/moxart-dma.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/dma/moxart-dma.c b/drivers/dma/moxart-dma.c index 7565ad98ba66..a03953b3016b 100644 --- a/drivers/dma/moxart-dma.c +++ b/drivers/dma/moxart-dma.c @@ -630,7 +630,7 @@ static int moxart_probe(struct platform_device *pdev) return 0; } -static int moxart_remove(struct platform_device *pdev) +static void moxart_remove(struct platform_device *pdev) { struct moxart_dmadev *m = platform_get_drvdata(pdev); @@ -640,8 +640,6 @@ static int moxart_remove(struct platform_device *pdev) if (pdev->dev.of_node) of_dma_controller_free(pdev->dev.of_node); - - return 0; } static const struct of_device_id moxart_dma_match[] = { @@ -652,7 +650,7 @@ MODULE_DEVICE_TABLE(of, moxart_dma_match); static struct platform_driver moxart_driver = { .probe = moxart_probe, - .remove = moxart_remove, + .remove_new = moxart_remove, .driver = { .name = "moxart-dma-engine", .of_match_table = moxart_dma_match, -- cgit v1.2.3 From 80d0159bbe80d8de6f64c0a8554b4066c66eb378 Mon Sep 17 00:00:00 2001 From: Uwe Kleine-König Date: Tue, 19 Sep 2023 15:31:36 +0200 Subject: dmaengine: mpc512x_dma: Convert to platform remove callback returning void MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Eventually after all drivers are converted, .remove_new() is renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König Link: https://lore.kernel.org/r/20230919133207.1400430-29-u.kleine-koenig@pengutronix.de Signed-off-by: Vinod Koul --- drivers/dma/mpc512x_dma.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/dma/mpc512x_dma.c b/drivers/dma/mpc512x_dma.c index 1104017320b8..68c247a46321 100644 --- a/drivers/dma/mpc512x_dma.c +++ b/drivers/dma/mpc512x_dma.c @@ -1084,7 +1084,7 @@ err: return retval; } -static int mpc_dma_remove(struct platform_device *op) +static void mpc_dma_remove(struct platform_device *op) { struct device *dev = &op->dev; struct mpc_dma *mdma = dev_get_drvdata(dev); @@ -1099,8 +1099,6 @@ static int mpc_dma_remove(struct platform_device *op) free_irq(mdma->irq, mdma); irq_dispose_mapping(mdma->irq); tasklet_kill(&mdma->tasklet); - - return 0; } static const struct of_device_id mpc_dma_match[] = { @@ -1112,7 +1110,7 @@ MODULE_DEVICE_TABLE(of, mpc_dma_match); static struct platform_driver mpc_dma_driver = { .probe = mpc_dma_probe, - .remove = mpc_dma_remove, + .remove_new = mpc_dma_remove, .driver = { .name = DRV_NAME, .of_match_table = mpc_dma_match, -- cgit v1.2.3 From 733dbb8d62f33448c0d7470ba06ce39bdd790ddd Mon Sep 17 00:00:00 2001 From: Uwe Kleine-König Date: Tue, 19 Sep 2023 15:31:37 +0200 Subject: dmaengine: mv_xor_v2: Convert to platform remove callback returning void MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Eventually after all drivers are converted, .remove_new() is renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König Link: https://lore.kernel.org/r/20230919133207.1400430-30-u.kleine-koenig@pengutronix.de Signed-off-by: Vinod Koul --- drivers/dma/mv_xor_v2.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/dma/mv_xor_v2.c b/drivers/dma/mv_xor_v2.c index 0e1e9ca1c005..1ebfbe88e733 100644 --- a/drivers/dma/mv_xor_v2.c +++ b/drivers/dma/mv_xor_v2.c @@ -855,7 +855,7 @@ free_msi_irqs: return ret; } -static int mv_xor_v2_remove(struct platform_device *pdev) +static void mv_xor_v2_remove(struct platform_device *pdev) { struct mv_xor_v2_device *xor_dev = platform_get_drvdata(pdev); @@ -870,8 +870,6 @@ static int mv_xor_v2_remove(struct platform_device *pdev) platform_msi_domain_free_irqs(&pdev->dev); tasklet_kill(&xor_dev->irq_tasklet); - - return 0; } #ifdef CONFIG_OF @@ -886,7 +884,7 @@ static struct platform_driver mv_xor_v2_driver = { .probe = mv_xor_v2_probe, .suspend = mv_xor_v2_suspend, .resume = mv_xor_v2_resume, - .remove = mv_xor_v2_remove, + .remove_new = mv_xor_v2_remove, .driver = { .name = "mv_xor_v2", .of_match_table = of_match_ptr(mv_xor_v2_dt_ids), -- cgit v1.2.3 From 44d5338c4a5d7f3f1ef07d502b9db22a29a8756a Mon Sep 17 00:00:00 2001 From: Uwe Kleine-König Date: Tue, 19 Sep 2023 15:31:38 +0200 Subject: dmaengine: nbpfaxi: Convert to platform remove callback returning void MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Eventually after all drivers are converted, .remove_new() is renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König Link: https://lore.kernel.org/r/20230919133207.1400430-31-u.kleine-koenig@pengutronix.de Signed-off-by: Vinod Koul --- drivers/dma/nbpfaxi.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/dma/nbpfaxi.c b/drivers/dma/nbpfaxi.c index 0b2f96fd8bf0..c08916339aa7 100644 --- a/drivers/dma/nbpfaxi.c +++ b/drivers/dma/nbpfaxi.c @@ -1454,7 +1454,7 @@ e_clk_off: return ret; } -static int nbpf_remove(struct platform_device *pdev) +static void nbpf_remove(struct platform_device *pdev) { struct nbpf_device *nbpf = platform_get_drvdata(pdev); int i; @@ -1472,8 +1472,6 @@ static int nbpf_remove(struct platform_device *pdev) of_dma_controller_free(pdev->dev.of_node); dma_async_device_unregister(&nbpf->dma_dev); clk_disable_unprepare(nbpf->clk); - - return 0; } static const struct platform_device_id nbpf_ids[] = { @@ -1517,7 +1515,7 @@ static struct platform_driver nbpf_driver = { }, .id_table = nbpf_ids, .probe = nbpf_probe, - .remove = nbpf_remove, + .remove_new = nbpf_remove, }; module_platform_driver(nbpf_driver); -- cgit v1.2.3 From 1260486a347567c33e0118626bb8778e342e6080 Mon Sep 17 00:00:00 2001 From: Uwe Kleine-König Date: Tue, 19 Sep 2023 15:31:39 +0200 Subject: dmaengine: owl-dma: Convert to platform remove callback returning void MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Eventually after all drivers are converted, .remove_new() is renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König Link: https://lore.kernel.org/r/20230919133207.1400430-32-u.kleine-koenig@pengutronix.de Signed-off-by: Vinod Koul --- drivers/dma/owl-dma.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/dma/owl-dma.c b/drivers/dma/owl-dma.c index 384476757c5e..4e76c4ec2d39 100644 --- a/drivers/dma/owl-dma.c +++ b/drivers/dma/owl-dma.c @@ -1231,7 +1231,7 @@ err_pool_free: return ret; } -static int owl_dma_remove(struct platform_device *pdev) +static void owl_dma_remove(struct platform_device *pdev) { struct owl_dma *od = platform_get_drvdata(pdev); @@ -1248,13 +1248,11 @@ static int owl_dma_remove(struct platform_device *pdev) clk_disable_unprepare(od->clk); dma_pool_destroy(od->lli_pool); - - return 0; } static struct platform_driver owl_dma_driver = { .probe = owl_dma_probe, - .remove = owl_dma_remove, + .remove_new = owl_dma_remove, .driver = { .name = "dma-owl", .of_match_table = of_match_ptr(owl_dma_match), -- cgit v1.2.3 From 5f8f212fb416dc3600046955fb008732a512fa5c Mon Sep 17 00:00:00 2001 From: Uwe Kleine-König Date: Tue, 19 Sep 2023 15:31:40 +0200 Subject: dmaengine: ppc4xx: adma: Convert to platform remove callback returning void MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Eventually after all drivers are converted, .remove_new() is renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König Link: https://lore.kernel.org/r/20230919133207.1400430-33-u.kleine-koenig@pengutronix.de Signed-off-by: Vinod Koul --- drivers/dma/ppc4xx/adma.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/dma/ppc4xx/adma.c b/drivers/dma/ppc4xx/adma.c index f9b82dff3387..bbb60a970dab 100644 --- a/drivers/dma/ppc4xx/adma.c +++ b/drivers/dma/ppc4xx/adma.c @@ -4230,7 +4230,7 @@ out: /** * ppc440spe_adma_remove - remove the asynch device */ -static int ppc440spe_adma_remove(struct platform_device *ofdev) +static void ppc440spe_adma_remove(struct platform_device *ofdev) { struct ppc440spe_adma_device *adev = platform_get_drvdata(ofdev); struct device_node *np = ofdev->dev.of_node; @@ -4278,7 +4278,6 @@ static int ppc440spe_adma_remove(struct platform_device *ofdev) of_address_to_resource(np, 0, &res); release_mem_region(res.start, resource_size(&res)); kfree(adev); - return 0; } /* @@ -4550,7 +4549,7 @@ MODULE_DEVICE_TABLE(of, ppc440spe_adma_of_match); static struct platform_driver ppc440spe_adma_driver = { .probe = ppc440spe_adma_probe, - .remove = ppc440spe_adma_remove, + .remove_new = ppc440spe_adma_remove, .driver = { .name = "PPC440SP(E)-ADMA", .of_match_table = ppc440spe_adma_of_match, -- cgit v1.2.3 From 44ea88715d37dc31145b7712b5474808258bab5f Mon Sep 17 00:00:00 2001 From: Uwe Kleine-König Date: Tue, 19 Sep 2023 15:31:41 +0200 Subject: dmaengine: pxa_dma: Convert to platform remove callback returning void MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Eventually after all drivers are converted, .remove_new() is renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König Link: https://lore.kernel.org/r/20230919133207.1400430-34-u.kleine-koenig@pengutronix.de Signed-off-by: Vinod Koul --- drivers/dma/pxa_dma.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/dma/pxa_dma.c b/drivers/dma/pxa_dma.c index 1b046d9a3a26..3c574dc0613b 100644 --- a/drivers/dma/pxa_dma.c +++ b/drivers/dma/pxa_dma.c @@ -1221,13 +1221,12 @@ static void pxad_free_channels(struct dma_device *dmadev) } } -static int pxad_remove(struct platform_device *op) +static void pxad_remove(struct platform_device *op) { struct pxad_device *pdev = platform_get_drvdata(op); pxad_cleanup_debugfs(pdev); pxad_free_channels(&pdev->slave); - return 0; } static int pxad_init_phys(struct platform_device *op, @@ -1444,7 +1443,7 @@ static struct platform_driver pxad_driver = { }, .id_table = pxad_id_table, .probe = pxad_probe, - .remove = pxad_remove, + .remove_new = pxad_remove, }; static bool pxad_filter_fn(struct dma_chan *chan, void *param) -- cgit v1.2.3 From 8d0f1ca5e4037f671cee43a4a582c0f8c6e8e31d Mon Sep 17 00:00:00 2001 From: Uwe Kleine-König Date: Tue, 19 Sep 2023 15:31:42 +0200 Subject: dmaengine: qcom: bam_dma: Convert to platform remove callback returning void MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Eventually after all drivers are converted, .remove_new() is renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König Reviewed-by: Konrad Dybcio Link: https://lore.kernel.org/r/20230919133207.1400430-35-u.kleine-koenig@pengutronix.de Signed-off-by: Vinod Koul --- drivers/dma/qcom/bam_dma.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/dma/qcom/bam_dma.c b/drivers/dma/qcom/bam_dma.c index 4c3eb972039d..c4f8d17d0c68 100644 --- a/drivers/dma/qcom/bam_dma.c +++ b/drivers/dma/qcom/bam_dma.c @@ -1386,7 +1386,7 @@ err_disable_clk: return ret; } -static int bam_dma_remove(struct platform_device *pdev) +static void bam_dma_remove(struct platform_device *pdev) { struct bam_device *bdev = platform_get_drvdata(pdev); u32 i; @@ -1416,8 +1416,6 @@ static int bam_dma_remove(struct platform_device *pdev) tasklet_kill(&bdev->task); clk_disable_unprepare(bdev->bamclk); - - return 0; } static int __maybe_unused bam_dma_runtime_suspend(struct device *dev) @@ -1475,7 +1473,7 @@ static const struct dev_pm_ops bam_dma_pm_ops = { static struct platform_driver bam_dma_driver = { .probe = bam_dma_probe, - .remove = bam_dma_remove, + .remove_new = bam_dma_remove, .driver = { .name = "bam-dma-engine", .pm = &bam_dma_pm_ops, -- cgit v1.2.3 From af9bc3c26b08714eb2309dcbf9a74a6c7af6327f Mon Sep 17 00:00:00 2001 From: Uwe Kleine-König Date: Tue, 19 Sep 2023 15:31:43 +0200 Subject: dmaengine: qcom: hidma: Convert to platform remove callback returning void MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Eventually after all drivers are converted, .remove_new() is renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König Reviewed-by: Konrad Dybcio Link: https://lore.kernel.org/r/20230919133207.1400430-36-u.kleine-koenig@pengutronix.de Signed-off-by: Vinod Koul --- drivers/dma/qcom/hidma.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/dma/qcom/hidma.c b/drivers/dma/qcom/hidma.c index 834ae519c15d..f4659553945b 100644 --- a/drivers/dma/qcom/hidma.c +++ b/drivers/dma/qcom/hidma.c @@ -915,7 +915,7 @@ static void hidma_shutdown(struct platform_device *pdev) } -static int hidma_remove(struct platform_device *pdev) +static void hidma_remove(struct platform_device *pdev) { struct hidma_dev *dmadev = platform_get_drvdata(pdev); @@ -935,8 +935,6 @@ static int hidma_remove(struct platform_device *pdev) dev_info(&pdev->dev, "HI-DMA engine removed\n"); pm_runtime_put_sync_suspend(&pdev->dev); pm_runtime_disable(&pdev->dev); - - return 0; } #if IS_ENABLED(CONFIG_ACPI) @@ -960,7 +958,7 @@ MODULE_DEVICE_TABLE(of, hidma_match); static struct platform_driver hidma_driver = { .probe = hidma_probe, - .remove = hidma_remove, + .remove_new = hidma_remove, .shutdown = hidma_shutdown, .driver = { .name = "hidma", -- cgit v1.2.3 From 1a6d1c87542d6bb178db5bc2befc9abf99447684 Mon Sep 17 00:00:00 2001 From: Uwe Kleine-König Date: Tue, 19 Sep 2023 15:31:44 +0200 Subject: dmaengine: qcom: qcom_adm: Convert to platform remove callback returning void MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Eventually after all drivers are converted, .remove_new() is renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König Reviewed-by: Konrad Dybcio Link: https://lore.kernel.org/r/20230919133207.1400430-37-u.kleine-koenig@pengutronix.de Signed-off-by: Vinod Koul --- drivers/dma/qcom/qcom_adm.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/dma/qcom/qcom_adm.c b/drivers/dma/qcom/qcom_adm.c index d56caf1681ff..53f4273b657c 100644 --- a/drivers/dma/qcom/qcom_adm.c +++ b/drivers/dma/qcom/qcom_adm.c @@ -904,7 +904,7 @@ err_disable_core_clk: return ret; } -static int adm_dma_remove(struct platform_device *pdev) +static void adm_dma_remove(struct platform_device *pdev) { struct adm_device *adev = platform_get_drvdata(pdev); struct adm_chan *achan; @@ -927,8 +927,6 @@ static int adm_dma_remove(struct platform_device *pdev) clk_disable_unprepare(adev->core_clk); clk_disable_unprepare(adev->iface_clk); - - return 0; } static const struct of_device_id adm_of_match[] = { @@ -939,7 +937,7 @@ MODULE_DEVICE_TABLE(of, adm_of_match); static struct platform_driver adm_dma_driver = { .probe = adm_dma_probe, - .remove = adm_dma_remove, + .remove_new = adm_dma_remove, .driver = { .name = "adm-dma-engine", .of_match_table = adm_of_match, -- cgit v1.2.3 From d6798037fa1c01e6b9486cc1fbe1b5a272dde477 Mon Sep 17 00:00:00 2001 From: Uwe Kleine-König Date: Tue, 19 Sep 2023 15:31:45 +0200 Subject: dmaengine: sa11x0-dma: Convert to platform remove callback returning void MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Eventually after all drivers are converted, .remove_new() is renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König Link: https://lore.kernel.org/r/20230919133207.1400430-38-u.kleine-koenig@pengutronix.de Signed-off-by: Vinod Koul --- drivers/dma/sa11x0-dma.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/dma/sa11x0-dma.c b/drivers/dma/sa11x0-dma.c index a29c13cae716..488408e6826a 100644 --- a/drivers/dma/sa11x0-dma.c +++ b/drivers/dma/sa11x0-dma.c @@ -984,7 +984,7 @@ static int sa11x0_dma_probe(struct platform_device *pdev) return ret; } -static int sa11x0_dma_remove(struct platform_device *pdev) +static void sa11x0_dma_remove(struct platform_device *pdev) { struct sa11x0_dma_dev *d = platform_get_drvdata(pdev); unsigned pch; @@ -997,8 +997,6 @@ static int sa11x0_dma_remove(struct platform_device *pdev) tasklet_kill(&d->task); iounmap(d->base); kfree(d); - - return 0; } static __maybe_unused int sa11x0_dma_suspend(struct device *dev) @@ -1081,7 +1079,7 @@ static struct platform_driver sa11x0_dma_driver = { .pm = &sa11x0_dma_pm_ops, }, .probe = sa11x0_dma_probe, - .remove = sa11x0_dma_remove, + .remove_new = sa11x0_dma_remove, }; static int __init sa11x0_dma_init(void) -- cgit v1.2.3 From 3d97deeb3b3077b3a6f9636f3ea312fef7f54059 Mon Sep 17 00:00:00 2001 From: Uwe Kleine-König Date: Tue, 19 Sep 2023 15:31:46 +0200 Subject: dmaengine: sf-pdma: sf-pdma: Convert to platform remove callback returning void MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Eventually after all drivers are converted, .remove_new() is renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König Link: https://lore.kernel.org/r/20230919133207.1400430-39-u.kleine-koenig@pengutronix.de Signed-off-by: Vinod Koul --- drivers/dma/sf-pdma/sf-pdma.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/dma/sf-pdma/sf-pdma.c b/drivers/dma/sf-pdma/sf-pdma.c index d1c6956af452..3125a2f162b4 100644 --- a/drivers/dma/sf-pdma/sf-pdma.c +++ b/drivers/dma/sf-pdma/sf-pdma.c @@ -566,7 +566,7 @@ static int sf_pdma_probe(struct platform_device *pdev) return 0; } -static int sf_pdma_remove(struct platform_device *pdev) +static void sf_pdma_remove(struct platform_device *pdev) { struct sf_pdma *pdma = platform_get_drvdata(pdev); struct sf_pdma_chan *ch; @@ -584,8 +584,6 @@ static int sf_pdma_remove(struct platform_device *pdev) } dma_async_device_unregister(&pdma->dma_dev); - - return 0; } static const struct of_device_id sf_pdma_dt_ids[] = { @@ -597,7 +595,7 @@ MODULE_DEVICE_TABLE(of, sf_pdma_dt_ids); static struct platform_driver sf_pdma_driver = { .probe = sf_pdma_probe, - .remove = sf_pdma_remove, + .remove_new = sf_pdma_remove, .driver = { .name = "sf-pdma", .of_match_table = sf_pdma_dt_ids, -- cgit v1.2.3 From 8ca342994ab8abda069c4b918aab5fa6b8c1614f Mon Sep 17 00:00:00 2001 From: Uwe Kleine-König Date: Tue, 19 Sep 2023 15:31:47 +0200 Subject: dmaengine: sh: rcar-dmac: Convert to platform remove callback returning void MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Eventually after all drivers are converted, .remove_new() is renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König Link: https://lore.kernel.org/r/20230919133207.1400430-40-u.kleine-koenig@pengutronix.de Signed-off-by: Vinod Koul --- drivers/dma/sh/rcar-dmac.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/dma/sh/rcar-dmac.c b/drivers/dma/sh/rcar-dmac.c index 641d689d17ff..40482cb73d79 100644 --- a/drivers/dma/sh/rcar-dmac.c +++ b/drivers/dma/sh/rcar-dmac.c @@ -1990,7 +1990,7 @@ err_pm_disable: return ret; } -static int rcar_dmac_remove(struct platform_device *pdev) +static void rcar_dmac_remove(struct platform_device *pdev) { struct rcar_dmac *dmac = platform_get_drvdata(pdev); @@ -1998,8 +1998,6 @@ static int rcar_dmac_remove(struct platform_device *pdev) dma_async_device_unregister(&dmac->engine); pm_runtime_disable(&pdev->dev); - - return 0; } static void rcar_dmac_shutdown(struct platform_device *pdev) @@ -2041,7 +2039,7 @@ static struct platform_driver rcar_dmac_driver = { .of_match_table = rcar_dmac_of_ids, }, .probe = rcar_dmac_probe, - .remove = rcar_dmac_remove, + .remove_new = rcar_dmac_remove, .shutdown = rcar_dmac_shutdown, }; -- cgit v1.2.3 From bd4205f52310a158c78171d3a5f68c7301a532fd Mon Sep 17 00:00:00 2001 From: Uwe Kleine-König Date: Tue, 19 Sep 2023 15:31:48 +0200 Subject: dmaengine: sh: rz-dmac: Convert to platform remove callback returning void MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Eventually after all drivers are converted, .remove_new() is renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König Reviewed-by: Geert Uytterhoeven Link: https://lore.kernel.org/r/20230919133207.1400430-41-u.kleine-koenig@pengutronix.de Signed-off-by: Vinod Koul --- drivers/dma/sh/rz-dmac.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/dma/sh/rz-dmac.c b/drivers/dma/sh/rz-dmac.c index f777addda8ba..fea5bda34bc2 100644 --- a/drivers/dma/sh/rz-dmac.c +++ b/drivers/dma/sh/rz-dmac.c @@ -969,7 +969,7 @@ err_pm_disable: return ret; } -static int rz_dmac_remove(struct platform_device *pdev) +static void rz_dmac_remove(struct platform_device *pdev) { struct rz_dmac *dmac = platform_get_drvdata(pdev); unsigned int i; @@ -987,8 +987,6 @@ static int rz_dmac_remove(struct platform_device *pdev) reset_control_assert(dmac->rstc); pm_runtime_put(&pdev->dev); pm_runtime_disable(&pdev->dev); - - return 0; } static const struct of_device_id of_rz_dmac_match[] = { @@ -1003,7 +1001,7 @@ static struct platform_driver rz_dmac_driver = { .of_match_table = of_rz_dmac_match, }, .probe = rz_dmac_probe, - .remove = rz_dmac_remove, + .remove_new = rz_dmac_remove, }; module_platform_driver(rz_dmac_driver); -- cgit v1.2.3 From 384ba9a683d3ba9f2f598b4c5fbf6f79a9213e94 Mon Sep 17 00:00:00 2001 From: Uwe Kleine-König Date: Tue, 19 Sep 2023 15:31:49 +0200 Subject: dmaengine: sh: shdmac: Convert to platform remove callback returning void MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Eventually after all drivers are converted, .remove_new() is renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König Link: https://lore.kernel.org/r/20230919133207.1400430-42-u.kleine-koenig@pengutronix.de Signed-off-by: Vinod Koul --- drivers/dma/sh/shdmac.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/dma/sh/shdmac.c b/drivers/dma/sh/shdmac.c index 00067b29e232..7cc9eb2217e8 100644 --- a/drivers/dma/sh/shdmac.c +++ b/drivers/dma/sh/shdmac.c @@ -882,7 +882,7 @@ eshdma: return err; } -static int sh_dmae_remove(struct platform_device *pdev) +static void sh_dmae_remove(struct platform_device *pdev) { struct sh_dmae_device *shdev = platform_get_drvdata(pdev); struct dma_device *dma_dev = &shdev->shdma_dev.dma_dev; @@ -899,8 +899,6 @@ static int sh_dmae_remove(struct platform_device *pdev) shdma_cleanup(&shdev->shdma_dev); synchronize_rcu(); - - return 0; } static struct platform_driver sh_dmae_driver = { @@ -908,7 +906,7 @@ static struct platform_driver sh_dmae_driver = { .pm = &sh_dmae_pm, .name = SH_DMAE_DRV_NAME, }, - .remove = sh_dmae_remove, + .remove_new = sh_dmae_remove, }; static int __init sh_dmae_init(void) -- cgit v1.2.3 From 9f2812a7fe47c422a367ef95e418dd63fced7238 Mon Sep 17 00:00:00 2001 From: Uwe Kleine-König Date: Tue, 19 Sep 2023 15:31:50 +0200 Subject: dmaengine: sh: usb-dmac: Convert to platform remove callback returning void MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Eventually after all drivers are converted, .remove_new() is renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König Link: https://lore.kernel.org/r/20230919133207.1400430-43-u.kleine-koenig@pengutronix.de Signed-off-by: Vinod Koul --- drivers/dma/sh/usb-dmac.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/dma/sh/usb-dmac.c b/drivers/dma/sh/usb-dmac.c index b14cf350b669..d8c93faa424d 100644 --- a/drivers/dma/sh/usb-dmac.c +++ b/drivers/dma/sh/usb-dmac.c @@ -866,7 +866,7 @@ static void usb_dmac_chan_remove(struct usb_dmac *dmac, devm_free_irq(dmac->dev, uchan->irq, uchan); } -static int usb_dmac_remove(struct platform_device *pdev) +static void usb_dmac_remove(struct platform_device *pdev) { struct usb_dmac *dmac = platform_get_drvdata(pdev); int i; @@ -877,8 +877,6 @@ static int usb_dmac_remove(struct platform_device *pdev) dma_async_device_unregister(&dmac->engine); pm_runtime_disable(&pdev->dev); - - return 0; } static void usb_dmac_shutdown(struct platform_device *pdev) @@ -901,7 +899,7 @@ static struct platform_driver usb_dmac_driver = { .of_match_table = usb_dmac_of_ids, }, .probe = usb_dmac_probe, - .remove = usb_dmac_remove, + .remove_new = usb_dmac_remove, .shutdown = usb_dmac_shutdown, }; -- cgit v1.2.3 From 8d82eb85a74246afb9b4bc69abf6e79014b06d4f Mon Sep 17 00:00:00 2001 From: Uwe Kleine-König Date: Tue, 19 Sep 2023 15:31:51 +0200 Subject: dmaengine: sprd-dma: Convert to platform remove callback returning void MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Eventually after all drivers are converted, .remove_new() is renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König Link: https://lore.kernel.org/r/20230919133207.1400430-44-u.kleine-koenig@pengutronix.de Signed-off-by: Vinod Koul --- drivers/dma/sprd-dma.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/dma/sprd-dma.c b/drivers/dma/sprd-dma.c index 168aa0bd73a0..97e3dedb6c12 100644 --- a/drivers/dma/sprd-dma.c +++ b/drivers/dma/sprd-dma.c @@ -1232,7 +1232,7 @@ err_rpm: return ret; } -static int sprd_dma_remove(struct platform_device *pdev) +static void sprd_dma_remove(struct platform_device *pdev) { struct sprd_dma_dev *sdev = platform_get_drvdata(pdev); struct sprd_dma_chn *c, *cn; @@ -1255,7 +1255,6 @@ static int sprd_dma_remove(struct platform_device *pdev) pm_runtime_put_noidle(&pdev->dev); pm_runtime_disable(&pdev->dev); - return 0; } static const struct of_device_id sprd_dma_match[] = { @@ -1292,7 +1291,7 @@ static const struct dev_pm_ops sprd_dma_pm_ops = { static struct platform_driver sprd_dma_driver = { .probe = sprd_dma_probe, - .remove = sprd_dma_remove, + .remove_new = sprd_dma_remove, .driver = { .name = "sprd-dma", .of_match_table = sprd_dma_match, -- cgit v1.2.3 From 9c52ffa09f580c49df1cc0b1998d7ea8fdf2c0b4 Mon Sep 17 00:00:00 2001 From: Uwe Kleine-König Date: Tue, 19 Sep 2023 15:31:52 +0200 Subject: dmaengine: st_fdma: Convert to platform remove callback returning void MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Eventually after all drivers are converted, .remove_new() is renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König Link: https://lore.kernel.org/r/20230919133207.1400430-45-u.kleine-koenig@pengutronix.de Signed-off-by: Vinod Koul --- drivers/dma/st_fdma.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/dma/st_fdma.c b/drivers/dma/st_fdma.c index d95c421877fb..145bd0f2496e 100644 --- a/drivers/dma/st_fdma.c +++ b/drivers/dma/st_fdma.c @@ -849,15 +849,13 @@ err: return ret; } -static int st_fdma_remove(struct platform_device *pdev) +static void st_fdma_remove(struct platform_device *pdev) { struct st_fdma_dev *fdev = platform_get_drvdata(pdev); devm_free_irq(&pdev->dev, fdev->irq, fdev); st_slim_rproc_put(fdev->slim_rproc); of_dma_controller_free(pdev->dev.of_node); - - return 0; } static struct platform_driver st_fdma_platform_driver = { @@ -866,7 +864,7 @@ static struct platform_driver st_fdma_platform_driver = { .of_match_table = st_fdma_match, }, .probe = st_fdma_probe, - .remove = st_fdma_remove, + .remove_new = st_fdma_remove, }; module_platform_driver(st_fdma_platform_driver); -- cgit v1.2.3 From 2db76471c8f45837efafdd7d57633aa9f194d787 Mon Sep 17 00:00:00 2001 From: Uwe Kleine-König Date: Tue, 19 Sep 2023 15:31:53 +0200 Subject: dmaengine: sun4i-dma: Convert to platform remove callback returning void MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Eventually after all drivers are converted, .remove_new() is renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König Acked-by: Jernej Skrabec Link: https://lore.kernel.org/r/20230919133207.1400430-46-u.kleine-koenig@pengutronix.de Signed-off-by: Vinod Koul --- drivers/dma/sun4i-dma.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/dma/sun4i-dma.c b/drivers/dma/sun4i-dma.c index e86c8829513a..2e7f9b07fdd2 100644 --- a/drivers/dma/sun4i-dma.c +++ b/drivers/dma/sun4i-dma.c @@ -1271,7 +1271,7 @@ err_clk_disable: return ret; } -static int sun4i_dma_remove(struct platform_device *pdev) +static void sun4i_dma_remove(struct platform_device *pdev) { struct sun4i_dma_dev *priv = platform_get_drvdata(pdev); @@ -1282,8 +1282,6 @@ static int sun4i_dma_remove(struct platform_device *pdev) dma_async_device_unregister(&priv->slave); clk_disable_unprepare(priv->clk); - - return 0; } static const struct of_device_id sun4i_dma_match[] = { @@ -1294,7 +1292,7 @@ MODULE_DEVICE_TABLE(of, sun4i_dma_match); static struct platform_driver sun4i_dma_driver = { .probe = sun4i_dma_probe, - .remove = sun4i_dma_remove, + .remove_new = sun4i_dma_remove, .driver = { .name = "sun4i-dma", .of_match_table = sun4i_dma_match, -- cgit v1.2.3 From 7d6ef7550a4577ae943194421dea73f3df084265 Mon Sep 17 00:00:00 2001 From: Uwe Kleine-König Date: Tue, 19 Sep 2023 15:31:54 +0200 Subject: dmaengine: sun6i-dma: Convert to platform remove callback returning void MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Eventually after all drivers are converted, .remove_new() is renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König Acked-by: Jernej Skrabec Link: https://lore.kernel.org/r/20230919133207.1400430-47-u.kleine-koenig@pengutronix.de Signed-off-by: Vinod Koul --- drivers/dma/sun6i-dma.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/dma/sun6i-dma.c b/drivers/dma/sun6i-dma.c index 2469efddf540..583bf49031cf 100644 --- a/drivers/dma/sun6i-dma.c +++ b/drivers/dma/sun6i-dma.c @@ -1470,7 +1470,7 @@ err_chan_free: return ret; } -static int sun6i_dma_remove(struct platform_device *pdev) +static void sun6i_dma_remove(struct platform_device *pdev) { struct sun6i_dma_dev *sdc = platform_get_drvdata(pdev); @@ -1484,13 +1484,11 @@ static int sun6i_dma_remove(struct platform_device *pdev) reset_control_assert(sdc->rstc); sun6i_dma_free(sdc); - - return 0; } static struct platform_driver sun6i_dma_driver = { .probe = sun6i_dma_probe, - .remove = sun6i_dma_remove, + .remove_new = sun6i_dma_remove, .driver = { .name = "sun6i-dma", .of_match_table = sun6i_dma_match, -- cgit v1.2.3 From d669b198efac1ea97fa39d6f8be59aefe5f39171 Mon Sep 17 00:00:00 2001 From: Uwe Kleine-König Date: Tue, 19 Sep 2023 15:31:55 +0200 Subject: dmaengine: tegra186-gpc-dma: Convert to platform remove callback returning void MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Eventually after all drivers are converted, .remove_new() is renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König Link: https://lore.kernel.org/r/20230919133207.1400430-48-u.kleine-koenig@pengutronix.de Signed-off-by: Vinod Koul --- drivers/dma/tegra186-gpc-dma.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/dma/tegra186-gpc-dma.c b/drivers/dma/tegra186-gpc-dma.c index 33b101001100..868c18cc72b1 100644 --- a/drivers/dma/tegra186-gpc-dma.c +++ b/drivers/dma/tegra186-gpc-dma.c @@ -1473,14 +1473,12 @@ static int tegra_dma_probe(struct platform_device *pdev) return 0; } -static int tegra_dma_remove(struct platform_device *pdev) +static void tegra_dma_remove(struct platform_device *pdev) { struct tegra_dma *tdma = platform_get_drvdata(pdev); of_dma_controller_free(pdev->dev.of_node); dma_async_device_unregister(&tdma->dma_dev); - - return 0; } static int __maybe_unused tegra_dma_pm_suspend(struct device *dev) @@ -1533,7 +1531,7 @@ static struct platform_driver tegra_dma_driver = { .of_match_table = tegra_dma_of_match, }, .probe = tegra_dma_probe, - .remove = tegra_dma_remove, + .remove_new = tegra_dma_remove, }; module_platform_driver(tegra_dma_driver); -- cgit v1.2.3 From afd1ac2e1b9b39040bb5eedd94b2b152020994e0 Mon Sep 17 00:00:00 2001 From: Uwe Kleine-König Date: Tue, 19 Sep 2023 15:31:56 +0200 Subject: dmaengine: tegra20-apb-dma: Convert to platform remove callback returning void MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Eventually after all drivers are converted, .remove_new() is renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König Link: https://lore.kernel.org/r/20230919133207.1400430-49-u.kleine-koenig@pengutronix.de Signed-off-by: Vinod Koul --- drivers/dma/tegra20-apb-dma.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/dma/tegra20-apb-dma.c b/drivers/dma/tegra20-apb-dma.c index 063022f9df76..ac69778827f2 100644 --- a/drivers/dma/tegra20-apb-dma.c +++ b/drivers/dma/tegra20-apb-dma.c @@ -1581,7 +1581,7 @@ err_clk_unprepare: return ret; } -static int tegra_dma_remove(struct platform_device *pdev) +static void tegra_dma_remove(struct platform_device *pdev) { struct tegra_dma *tdma = platform_get_drvdata(pdev); @@ -1589,8 +1589,6 @@ static int tegra_dma_remove(struct platform_device *pdev) dma_async_device_unregister(&tdma->dma_dev); pm_runtime_disable(&pdev->dev); clk_unprepare(tdma->dma_clk); - - return 0; } static int __maybe_unused tegra_dma_runtime_suspend(struct device *dev) @@ -1677,7 +1675,7 @@ static struct platform_driver tegra_dmac_driver = { .of_match_table = tegra_dma_of_match, }, .probe = tegra_dma_probe, - .remove = tegra_dma_remove, + .remove_new = tegra_dma_remove, }; module_platform_driver(tegra_dmac_driver); -- cgit v1.2.3 From 1a3fa3e369bf54bef0021a8c840567622f52354f Mon Sep 17 00:00:00 2001 From: Uwe Kleine-König Date: Tue, 19 Sep 2023 15:31:57 +0200 Subject: dmaengine: tegra210-adma: Convert to platform remove callback returning void MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Eventually after all drivers are converted, .remove_new() is renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König Link: https://lore.kernel.org/r/20230919133207.1400430-50-u.kleine-koenig@pengutronix.de Signed-off-by: Vinod Koul --- drivers/dma/tegra210-adma.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/dma/tegra210-adma.c b/drivers/dma/tegra210-adma.c index e557bada1510..60111d40325e 100644 --- a/drivers/dma/tegra210-adma.c +++ b/drivers/dma/tegra210-adma.c @@ -949,7 +949,7 @@ irq_dispose: return ret; } -static int tegra_adma_remove(struct platform_device *pdev) +static void tegra_adma_remove(struct platform_device *pdev) { struct tegra_adma *tdma = platform_get_drvdata(pdev); int i; @@ -961,8 +961,6 @@ static int tegra_adma_remove(struct platform_device *pdev) irq_dispose_mapping(tdma->channels[i].irq); pm_runtime_disable(&pdev->dev); - - return 0; } static const struct dev_pm_ops tegra_adma_dev_pm_ops = { @@ -979,7 +977,7 @@ static struct platform_driver tegra_admac_driver = { .of_match_table = tegra_adma_of_match, }, .probe = tegra_adma_probe, - .remove = tegra_adma_remove, + .remove_new = tegra_adma_remove, }; module_platform_driver(tegra_admac_driver); -- cgit v1.2.3 From 36a7e98c36a598c2865daf748a7d9d889a34aaf3 Mon Sep 17 00:00:00 2001 From: Uwe Kleine-König Date: Tue, 19 Sep 2023 15:31:58 +0200 Subject: dmaengine: ti: cppi41: Convert to platform remove callback returning void MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Eventually after all drivers are converted, .remove_new() is renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König Reviewed-by: Peter Ujfalusi Link: https://lore.kernel.org/r/20230919133207.1400430-51-u.kleine-koenig@pengutronix.de Signed-off-by: Vinod Koul --- drivers/dma/ti/cppi41.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/dma/ti/cppi41.c b/drivers/dma/ti/cppi41.c index c3555cfb0681..7e0b06b5dff0 100644 --- a/drivers/dma/ti/cppi41.c +++ b/drivers/dma/ti/cppi41.c @@ -1156,7 +1156,7 @@ err_get_sync: return ret; } -static int cppi41_dma_remove(struct platform_device *pdev) +static void cppi41_dma_remove(struct platform_device *pdev) { struct cppi41_dd *cdd = platform_get_drvdata(pdev); int error; @@ -1173,7 +1173,6 @@ static int cppi41_dma_remove(struct platform_device *pdev) pm_runtime_dont_use_autosuspend(&pdev->dev); pm_runtime_put_sync(&pdev->dev); pm_runtime_disable(&pdev->dev); - return 0; } static int __maybe_unused cppi41_suspend(struct device *dev) @@ -1244,7 +1243,7 @@ static const struct dev_pm_ops cppi41_pm_ops = { static struct platform_driver cpp41_dma_driver = { .probe = cppi41_dma_probe, - .remove = cppi41_dma_remove, + .remove_new = cppi41_dma_remove, .driver = { .name = "cppi41-dma-engine", .pm = &cppi41_pm_ops, -- cgit v1.2.3 From 68bcaf5c4e03ada2696b4fbd03ee775781945034 Mon Sep 17 00:00:00 2001 From: Uwe Kleine-König Date: Tue, 19 Sep 2023 15:31:59 +0200 Subject: dmaengine: ti: edma: Convert to platform remove callback returning void MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Eventually after all drivers are converted, .remove_new() is renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König Acked-by: Peter Ujfalusi Link: https://lore.kernel.org/r/20230919133207.1400430-52-u.kleine-koenig@pengutronix.de Signed-off-by: Vinod Koul --- drivers/dma/ti/edma.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/dma/ti/edma.c b/drivers/dma/ti/edma.c index aa8e2e8ac260..3ed022918ec0 100644 --- a/drivers/dma/ti/edma.c +++ b/drivers/dma/ti/edma.c @@ -2550,7 +2550,7 @@ static void edma_cleanupp_vchan(struct dma_device *dmadev) } } -static int edma_remove(struct platform_device *pdev) +static void edma_remove(struct platform_device *pdev) { struct device *dev = &pdev->dev; struct edma_cc *ecc = dev_get_drvdata(dev); @@ -2568,8 +2568,6 @@ static int edma_remove(struct platform_device *pdev) edma_free_slot(ecc, ecc->dummy_slot); pm_runtime_put_sync(dev); pm_runtime_disable(dev); - - return 0; } #ifdef CONFIG_PM_SLEEP @@ -2628,7 +2626,7 @@ static const struct dev_pm_ops edma_pm_ops = { static struct platform_driver edma_driver = { .probe = edma_probe, - .remove = edma_remove, + .remove_new = edma_remove, .driver = { .name = "edma", .pm = &edma_pm_ops, -- cgit v1.2.3 From 5ea68dc1cee00e5ecf174f2a3ef13d63520971cb Mon Sep 17 00:00:00 2001 From: Uwe Kleine-König Date: Tue, 19 Sep 2023 15:32:00 +0200 Subject: dmaengine: ti: omap-dma: Convert to platform remove callback returning void MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Eventually after all drivers are converted, .remove_new() is renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König Acked-by: Peter Ujfalusi Link: https://lore.kernel.org/r/20230919133207.1400430-53-u.kleine-koenig@pengutronix.de Signed-off-by: Vinod Koul --- drivers/dma/ti/omap-dma.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/dma/ti/omap-dma.c b/drivers/dma/ti/omap-dma.c index cf96cf915c0c..76db0fc19524 100644 --- a/drivers/dma/ti/omap-dma.c +++ b/drivers/dma/ti/omap-dma.c @@ -1844,7 +1844,7 @@ static int omap_dma_probe(struct platform_device *pdev) return rc; } -static int omap_dma_remove(struct platform_device *pdev) +static void omap_dma_remove(struct platform_device *pdev) { struct omap_dmadev *od = platform_get_drvdata(pdev); int irq; @@ -1869,8 +1869,6 @@ static int omap_dma_remove(struct platform_device *pdev) dma_pool_destroy(od->desc_pool); omap_dma_free(od); - - return 0; } static const struct omap_dma_config omap2420_data = { @@ -1918,7 +1916,7 @@ MODULE_DEVICE_TABLE(of, omap_dma_match); static struct platform_driver omap_dma_driver = { .probe = omap_dma_probe, - .remove = omap_dma_remove, + .remove_new = omap_dma_remove, .driver = { .name = "omap-dma-engine", .of_match_table = omap_dma_match, -- cgit v1.2.3 From 4f339d6efa6a74a16f77fd9a06adf01d9df84734 Mon Sep 17 00:00:00 2001 From: Uwe Kleine-König Date: Tue, 19 Sep 2023 15:32:01 +0200 Subject: dmaengine: timb_dma: Convert to platform remove callback returning void MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Eventually after all drivers are converted, .remove_new() is renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König Link: https://lore.kernel.org/r/20230919133207.1400430-54-u.kleine-koenig@pengutronix.de Signed-off-by: Vinod Koul --- drivers/dma/timb_dma.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/dma/timb_dma.c b/drivers/dma/timb_dma.c index 3f524be69efb..7410025605e0 100644 --- a/drivers/dma/timb_dma.c +++ b/drivers/dma/timb_dma.c @@ -740,7 +740,7 @@ err_release_region: } -static int td_remove(struct platform_device *pdev) +static void td_remove(struct platform_device *pdev) { struct timb_dma *td = platform_get_drvdata(pdev); struct resource *iomem = platform_get_resource(pdev, IORESOURCE_MEM, 0); @@ -754,7 +754,6 @@ static int td_remove(struct platform_device *pdev) release_mem_region(iomem->start, resource_size(iomem)); dev_dbg(&pdev->dev, "Removed...\n"); - return 0; } static struct platform_driver td_driver = { @@ -762,7 +761,7 @@ static struct platform_driver td_driver = { .name = DRIVER_NAME, }, .probe = td_probe, - .remove = td_remove, + .remove_new = td_remove, }; module_platform_driver(td_driver); -- cgit v1.2.3 From a3b4af719e571bd899b7952626c2b4d8ec7c0c77 Mon Sep 17 00:00:00 2001 From: Uwe Kleine-König Date: Tue, 19 Sep 2023 15:32:02 +0200 Subject: dmaengine: txx9dmac: Convert to platform remove callback returning void MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Eventually after all drivers are converted, .remove_new() is renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König Link: https://lore.kernel.org/r/20230919133207.1400430-55-u.kleine-koenig@pengutronix.de Signed-off-by: Vinod Koul --- drivers/dma/txx9dmac.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/drivers/dma/txx9dmac.c b/drivers/dma/txx9dmac.c index 5b6b375a257e..44ba377b4b5a 100644 --- a/drivers/dma/txx9dmac.c +++ b/drivers/dma/txx9dmac.c @@ -1151,7 +1151,7 @@ static int __init txx9dmac_chan_probe(struct platform_device *pdev) return 0; } -static int txx9dmac_chan_remove(struct platform_device *pdev) +static void txx9dmac_chan_remove(struct platform_device *pdev) { struct txx9dmac_chan *dc = platform_get_drvdata(pdev); @@ -1162,7 +1162,6 @@ static int txx9dmac_chan_remove(struct platform_device *pdev) tasklet_kill(&dc->tasklet); } dc->ddev->chan[pdev->id % TXX9_DMA_MAX_NR_CHANNELS] = NULL; - return 0; } static int __init txx9dmac_probe(struct platform_device *pdev) @@ -1215,7 +1214,7 @@ static int __init txx9dmac_probe(struct platform_device *pdev) return 0; } -static int txx9dmac_remove(struct platform_device *pdev) +static void txx9dmac_remove(struct platform_device *pdev) { struct txx9dmac_dev *ddev = platform_get_drvdata(pdev); @@ -1224,7 +1223,6 @@ static int txx9dmac_remove(struct platform_device *pdev) devm_free_irq(&pdev->dev, ddev->irq, ddev); tasklet_kill(&ddev->tasklet); } - return 0; } static void txx9dmac_shutdown(struct platform_device *pdev) @@ -1262,14 +1260,14 @@ static const struct dev_pm_ops txx9dmac_dev_pm_ops = { }; static struct platform_driver txx9dmac_chan_driver = { - .remove = txx9dmac_chan_remove, + .remove_new = txx9dmac_chan_remove, .driver = { .name = "txx9dmac-chan", }, }; static struct platform_driver txx9dmac_driver = { - .remove = txx9dmac_remove, + .remove_new = txx9dmac_remove, .shutdown = txx9dmac_shutdown, .driver = { .name = "txx9dmac", -- cgit v1.2.3 From 2c9d879fae9ab1be3d4926ebea5e85305998cf93 Mon Sep 17 00:00:00 2001 From: Uwe Kleine-König Date: Tue, 19 Sep 2023 15:32:03 +0200 Subject: dmaengine: xgene-dma: Convert to platform remove callback returning void MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Eventually after all drivers are converted, .remove_new() is renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König Link: https://lore.kernel.org/r/20230919133207.1400430-56-u.kleine-koenig@pengutronix.de Signed-off-by: Vinod Koul --- drivers/dma/xgene-dma.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/dma/xgene-dma.c b/drivers/dma/xgene-dma.c index bb4ff8c86733..fd4397adeb79 100644 --- a/drivers/dma/xgene-dma.c +++ b/drivers/dma/xgene-dma.c @@ -1776,7 +1776,7 @@ err_clk_enable: return ret; } -static int xgene_dma_remove(struct platform_device *pdev) +static void xgene_dma_remove(struct platform_device *pdev) { struct xgene_dma *pdma = platform_get_drvdata(pdev); struct xgene_dma_chan *chan; @@ -1797,8 +1797,6 @@ static int xgene_dma_remove(struct platform_device *pdev) if (!IS_ERR(pdma->clk)) clk_disable_unprepare(pdma->clk); - - return 0; } #ifdef CONFIG_ACPI @@ -1817,7 +1815,7 @@ MODULE_DEVICE_TABLE(of, xgene_dma_of_match_ptr); static struct platform_driver xgene_dma_driver = { .probe = xgene_dma_probe, - .remove = xgene_dma_remove, + .remove_new = xgene_dma_remove, .driver = { .name = "X-Gene-DMA", .of_match_table = xgene_dma_of_match_ptr, -- cgit v1.2.3 From 78369eb5dc8881d78f163434ee2788a800b89219 Mon Sep 17 00:00:00 2001 From: Uwe Kleine-König Date: Tue, 19 Sep 2023 15:32:04 +0200 Subject: dmaengine: xilinx: xdma: Convert to platform remove callback returning void MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Eventually after all drivers are converted, .remove_new() is renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König Link: https://lore.kernel.org/r/20230919133207.1400430-57-u.kleine-koenig@pengutronix.de Signed-off-by: Vinod Koul --- drivers/dma/xilinx/xdma.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/dma/xilinx/xdma.c b/drivers/dma/xilinx/xdma.c index e0bfd129d563..459e7b9838ed 100644 --- a/drivers/dma/xilinx/xdma.c +++ b/drivers/dma/xilinx/xdma.c @@ -841,7 +841,7 @@ EXPORT_SYMBOL(xdma_get_user_irq); * xdma_remove - Driver remove function * @pdev: Pointer to the platform_device structure */ -static int xdma_remove(struct platform_device *pdev) +static void xdma_remove(struct platform_device *pdev) { struct xdma_device *xdev = platform_get_drvdata(pdev); @@ -850,8 +850,6 @@ static int xdma_remove(struct platform_device *pdev) if (xdev->status & XDMA_DEV_STATUS_REG_DMA) dma_async_device_unregister(&xdev->dma_dev); - - return 0; } /** @@ -966,7 +964,7 @@ static struct platform_driver xdma_driver = { }, .id_table = xdma_id_table, .probe = xdma_probe, - .remove = xdma_remove, + .remove_new = xdma_remove, }; module_platform_driver(xdma_driver); -- cgit v1.2.3 From cc99582d46b428ba4c2cb7ecd05df4569b02d1f4 Mon Sep 17 00:00:00 2001 From: Uwe Kleine-König Date: Tue, 19 Sep 2023 15:32:05 +0200 Subject: dmaengine: xilinx: xilinx_dma: Convert to platform remove callback returning void MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Eventually after all drivers are converted, .remove_new() is renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König Link: https://lore.kernel.org/r/20230919133207.1400430-58-u.kleine-koenig@pengutronix.de Signed-off-by: Vinod Koul --- drivers/dma/xilinx/xilinx_dma.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/dma/xilinx/xilinx_dma.c b/drivers/dma/xilinx/xilinx_dma.c index 0a3b2e22f23d..0c363a1ed853 100644 --- a/drivers/dma/xilinx/xilinx_dma.c +++ b/drivers/dma/xilinx/xilinx_dma.c @@ -3245,7 +3245,7 @@ disable_clks: * * Return: Always '0' */ -static int xilinx_dma_remove(struct platform_device *pdev) +static void xilinx_dma_remove(struct platform_device *pdev) { struct xilinx_dma_device *xdev = platform_get_drvdata(pdev); int i; @@ -3259,8 +3259,6 @@ static int xilinx_dma_remove(struct platform_device *pdev) xilinx_dma_chan_remove(xdev->chan[i]); xdma_disable_allclks(xdev); - - return 0; } static struct platform_driver xilinx_vdma_driver = { @@ -3269,7 +3267,7 @@ static struct platform_driver xilinx_vdma_driver = { .of_match_table = xilinx_dma_of_ids, }, .probe = xilinx_dma_probe, - .remove = xilinx_dma_remove, + .remove_new = xilinx_dma_remove, }; module_platform_driver(xilinx_vdma_driver); -- cgit v1.2.3 From c962eca73c5cce72936a8b3bd23a24b29852ea97 Mon Sep 17 00:00:00 2001 From: Uwe Kleine-König Date: Tue, 19 Sep 2023 15:32:06 +0200 Subject: dmaengine: xilinx: xilinx_dpdma: Convert to platform remove callback returning void MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Eventually after all drivers are converted, .remove_new() is renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König Link: https://lore.kernel.org/r/20230919133207.1400430-59-u.kleine-koenig@pengutronix.de Signed-off-by: Vinod Koul --- drivers/dma/xilinx/xilinx_dpdma.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/dma/xilinx/xilinx_dpdma.c b/drivers/dma/xilinx/xilinx_dpdma.c index 84dc5240a807..69587d85a7cd 100644 --- a/drivers/dma/xilinx/xilinx_dpdma.c +++ b/drivers/dma/xilinx/xilinx_dpdma.c @@ -1736,7 +1736,7 @@ error: return ret; } -static int xilinx_dpdma_remove(struct platform_device *pdev) +static void xilinx_dpdma_remove(struct platform_device *pdev) { struct xilinx_dpdma_device *xdev = platform_get_drvdata(pdev); unsigned int i; @@ -1751,8 +1751,6 @@ static int xilinx_dpdma_remove(struct platform_device *pdev) for (i = 0; i < ARRAY_SIZE(xdev->chan); i++) xilinx_dpdma_chan_remove(xdev->chan[i]); - - return 0; } static const struct of_device_id xilinx_dpdma_of_match[] = { @@ -1763,7 +1761,7 @@ MODULE_DEVICE_TABLE(of, xilinx_dpdma_of_match); static struct platform_driver xilinx_dpdma_driver = { .probe = xilinx_dpdma_probe, - .remove = xilinx_dpdma_remove, + .remove_new = xilinx_dpdma_remove, .driver = { .name = "xilinx-zynqmp-dpdma", .of_match_table = xilinx_dpdma_of_match, -- cgit v1.2.3 From b1c50ac25425385b576dd58b7b38c1c5963dde85 Mon Sep 17 00:00:00 2001 From: Uwe Kleine-König Date: Tue, 19 Sep 2023 15:32:07 +0200 Subject: dmaengine: xilinx: zynqmp_dma: Convert to platform remove callback returning void MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Eventually after all drivers are converted, .remove_new() is renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König Link: https://lore.kernel.org/r/20230919133207.1400430-60-u.kleine-koenig@pengutronix.de Signed-off-by: Vinod Koul --- drivers/dma/xilinx/zynqmp_dma.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/dma/xilinx/zynqmp_dma.c b/drivers/dma/xilinx/zynqmp_dma.c index bd8c3cc2eaab..f31631bef961 100644 --- a/drivers/dma/xilinx/zynqmp_dma.c +++ b/drivers/dma/xilinx/zynqmp_dma.c @@ -1147,7 +1147,7 @@ err_disable_pm: * * Return: Always '0' */ -static int zynqmp_dma_remove(struct platform_device *pdev) +static void zynqmp_dma_remove(struct platform_device *pdev) { struct zynqmp_dma_device *zdev = platform_get_drvdata(pdev); @@ -1158,8 +1158,6 @@ static int zynqmp_dma_remove(struct platform_device *pdev) pm_runtime_disable(zdev->dev); if (!pm_runtime_enabled(zdev->dev)) zynqmp_dma_runtime_suspend(zdev->dev); - - return 0; } static const struct of_device_id zynqmp_dma_of_match[] = { @@ -1175,7 +1173,7 @@ static struct platform_driver zynqmp_dma_driver = { .pm = &zynqmp_dma_dev_pm_ops, }, .probe = zynqmp_dma_probe, - .remove = zynqmp_dma_remove, + .remove_new = zynqmp_dma_remove, }; module_platform_driver(zynqmp_dma_driver); -- cgit v1.2.3 From 555921feb2ac03d88647ccc62015e68f157c30a2 Mon Sep 17 00:00:00 2001 From: Dave Jiang Date: Sat, 23 Sep 2023 17:23:47 -0700 Subject: dmaengine: idxd: rate limit printk in misc interrupt thread Add rate limit to the dev_warn() call in the misc interrupt thread. This limits dmesg getting spammed if a descriptor submitter is spamming bad descriptors with invalid completion records and resulting the errors being continuously reported by the misc interrupt handling thread. Reported-by: Sanjay Kumar Signed-off-by: Dave Jiang Reviewed-by: Fenghua Yu Acked-by: Lijun Pan Link: https://lore.kernel.org/r/20230924002347.1117757-1-fenghua.yu@intel.com Signed-off-by: Vinod Koul --- drivers/dma/idxd/irq.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/dma/idxd/irq.c b/drivers/dma/idxd/irq.c index b501320a9c7a..2183d7f9cdbd 100644 --- a/drivers/dma/idxd/irq.c +++ b/drivers/dma/idxd/irq.c @@ -434,8 +434,8 @@ irqreturn_t idxd_misc_thread(int vec, void *data) val |= IDXD_INTC_ERR; for (i = 0; i < 4; i++) - dev_warn(dev, "err[%d]: %#16.16llx\n", - i, idxd->sw_err.bits[i]); + dev_warn_ratelimited(dev, "err[%d]: %#16.16llx\n", + i, idxd->sw_err.bits[i]); err = true; } -- cgit v1.2.3 From 88928addeec577386e8c83b48b5bc24d28ba97fd Mon Sep 17 00:00:00 2001 From: Fenghua Yu Date: Sun, 24 Sep 2023 09:22:32 -0700 Subject: dmaengine: idxd: Register dsa_bus_type before registering idxd sub-drivers idxd sub-drivers belong to bus dsa_bus_type. Thus, dsa_bus_type must be registered in dsa bus init before idxd drivers can be registered. But the order is wrong when both idxd and idxd_bus are builtin drivers. In this case, idxd driver is compiled and linked before idxd_bus driver. Since the initcall order is determined by the link order, idxd sub-drivers are registered in idxd initcall before dsa_bus_type is registered in idxd_bus initcall. idxd initcall fails: [ 21.562803] calling idxd_init_module+0x0/0x110 @ 1 [ 21.570761] Driver 'idxd' was unable to register with bus_type 'dsa' because the bus was not initialized. [ 21.586475] initcall idxd_init_module+0x0/0x110 returned -22 after 15717 usecs [ 21.597178] calling dsa_bus_init+0x0/0x20 @ 1 To fix the issue, compile and link idxd_bus driver before idxd driver to ensure the right registration order. Fixes: d9e5481fca74 ("dmaengine: dsa: move dsa_bus_type out of idxd driver to standalone") Reported-by: Michael Prinke Signed-off-by: Fenghua Yu Reviewed-by: Dave Jiang Reviewed-by: Lijun Pan Tested-by: Lijun Pan Link: https://lore.kernel.org/r/20230924162232.1409454-1-fenghua.yu@intel.com Signed-off-by: Vinod Koul --- drivers/dma/idxd/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/dma/idxd/Makefile b/drivers/dma/idxd/Makefile index dc096839ac63..c5e679070e46 100644 --- a/drivers/dma/idxd/Makefile +++ b/drivers/dma/idxd/Makefile @@ -1,12 +1,12 @@ ccflags-y += -DDEFAULT_SYMBOL_NAMESPACE=IDXD +obj-$(CONFIG_INTEL_IDXD_BUS) += idxd_bus.o +idxd_bus-y := bus.o + obj-$(CONFIG_INTEL_IDXD) += idxd.o idxd-y := init.o irq.o device.o sysfs.o submit.o dma.o cdev.o debugfs.o idxd-$(CONFIG_INTEL_IDXD_PERFMON) += perfmon.o -obj-$(CONFIG_INTEL_IDXD_BUS) += idxd_bus.o -idxd_bus-y := bus.o - obj-$(CONFIG_INTEL_IDXD_COMPAT) += idxd_compat.o idxd_compat-y := compat.o -- cgit v1.2.3 From 65b87548041ad70a8e26af08c0dda0b5893baf6b Mon Sep 17 00:00:00 2001 From: Jonathan Neuschäfer Date: Sun, 24 Sep 2023 17:23:32 +0200 Subject: dmaengine: hisi: Simplify preconditions of CONFIG_K3_DMA MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Commit e39a2329cfb09 ("Kconfig: Allow k3dma driver to be selected for more then HISI3xx platforms") expanded the "depends on" line of K3_DMA from "ARCH_HI3xxx" to "ARCH_HI3xxx || ARCH_HISI || COMPILE_TEST". However, ARCH_HI3xxx implies ARCH_HISI, so it's unnecessary to list both. Instead, just list ARCH_HISI, which covers all HiSilicon platforms. Signed-off-by: Jonathan Neuschäfer Link: https://lore.kernel.org/r/20230924152332.2254305-1-j.neuschaefer@gmx.net Signed-off-by: Vinod Koul --- drivers/dma/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/dma/Kconfig b/drivers/dma/Kconfig index 4ccae1a3b884..70ba506dabab 100644 --- a/drivers/dma/Kconfig +++ b/drivers/dma/Kconfig @@ -362,7 +362,7 @@ config INTEL_IOATDMA config K3_DMA tristate "Hisilicon K3 DMA support" - depends on ARCH_HI3xxx || ARCH_HISI || COMPILE_TEST + depends on ARCH_HISI || COMPILE_TEST select DMA_ENGINE select DMA_VIRTUAL_CHANNELS help -- cgit v1.2.3 From 83c5d35bf9112577da097c1b4fbfedef93b951e6 Mon Sep 17 00:00:00 2001 From: Kees Cook Date: Thu, 17 Aug 2023 16:58:38 -0700 Subject: dmaengine: apple-admac: Annotate struct admac_data with __counted_by Prepare for the coming implementation by GCC and Clang of the __counted_by attribute. Flexible array members annotated with __counted_by can have their accesses bounds-checked at run-time checking via CONFIG_UBSAN_BOUNDS (for array indexing) and CONFIG_FORTIFY_SOURCE (for strcpy/memcpy-family functions). As found with Coccinelle[1], add __counted_by for struct admac_data. [1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci Cc: Vinod Koul Cc: Hector Martin Cc: Sven Peter Cc: Alyssa Rosenzweig Cc: asahi@lists.linux.dev Cc: linux-arm-kernel@lists.infradead.org Cc: dmaengine@vger.kernel.org Signed-off-by: Kees Cook Reviewed-by: "Gustavo A. R. Silva" Link: https://lore.kernel.org/r/20230817235859.49846-1-keescook@chromium.org Signed-off-by: Vinod Koul --- drivers/dma/apple-admac.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/dma/apple-admac.c b/drivers/dma/apple-admac.c index 46bb02858561..5b63996640d9 100644 --- a/drivers/dma/apple-admac.c +++ b/drivers/dma/apple-admac.c @@ -128,7 +128,7 @@ struct admac_data { int irq; int irq_index; int nchannels; - struct admac_chan channels[]; + struct admac_chan channels[] __counted_by(nchannels); }; struct admac_tx { -- cgit v1.2.3 From 81cd3cb3b3dd37df1fc45c5b6443a07bc2a7fee4 Mon Sep 17 00:00:00 2001 From: Kees Cook Date: Thu, 17 Aug 2023 16:58:39 -0700 Subject: dmaengine: at_hdmac: Annotate struct at_desc with __counted_by Prepare for the coming implementation by GCC and Clang of the __counted_by attribute. Flexible array members annotated with __counted_by can have their accesses bounds-checked at run-time checking via CONFIG_UBSAN_BOUNDS (for array indexing) and CONFIG_FORTIFY_SOURCE (for strcpy/memcpy-family functions). As found with Coccinelle[1], add __counted_by for struct at_desc. [1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci Cc: Vinod Koul Cc: Ludovic Desroches Cc: Tudor Ambarus Cc: linux-arm-kernel@lists.infradead.org Cc: dmaengine@vger.kernel.org Signed-off-by: Kees Cook Reviewed-by: Tudor Ambarus Reviewed-by: "Gustavo A. R. Silva" Link: https://lore.kernel.org/r/20230817235859.49846-2-keescook@chromium.org Signed-off-by: Vinod Koul --- drivers/dma/at_hdmac.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c index 417a9428a9b6..fb89ecbf0cc5 100644 --- a/drivers/dma/at_hdmac.c +++ b/drivers/dma/at_hdmac.c @@ -239,7 +239,7 @@ struct at_desc { bool memset_buffer; dma_addr_t memset_paddr; int *memset_vaddr; - struct atdma_sg sg[]; + struct atdma_sg sg[] __counted_by(sglen); }; /*-- Channels --------------------------------------------------------*/ -- cgit v1.2.3 From f1bc0d01cb349da43d55548b57c915ef8fe024c7 Mon Sep 17 00:00:00 2001 From: Kees Cook Date: Thu, 17 Aug 2023 16:58:40 -0700 Subject: dmaengine: axi-dmac: Annotate struct axi_dmac_desc with __counted_by Prepare for the coming implementation by GCC and Clang of the __counted_by attribute. Flexible array members annotated with __counted_by can have their accesses bounds-checked at run-time checking via CONFIG_UBSAN_BOUNDS (for array indexing) and CONFIG_FORTIFY_SOURCE (for strcpy/memcpy-family functions). As found with Coccinelle[1], add __counted_by for struct axi_dmac_desc. Additionally, since the element count member must be set before accessing the annotated flexible array member, move its initialization earlier. [1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci Cc: Vinod Koul Cc: Lars-Peter Clausen Cc: dmaengine@vger.kernel.org Signed-off-by: Kees Cook Reviewed-by: "Gustavo A. R. Silva" Link: https://lore.kernel.org/r/20230817235859.49846-3-keescook@chromium.org Signed-off-by: Vinod Koul --- drivers/dma/dma-axi-dmac.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/dma/dma-axi-dmac.c b/drivers/dma/dma-axi-dmac.c index a6d235bc8444..2457a420c13d 100644 --- a/drivers/dma/dma-axi-dmac.c +++ b/drivers/dma/dma-axi-dmac.c @@ -117,7 +117,7 @@ struct axi_dmac_desc { unsigned int num_submitted; unsigned int num_completed; unsigned int num_sgs; - struct axi_dmac_sg sg[]; + struct axi_dmac_sg sg[] __counted_by(num_sgs); }; struct axi_dmac_chan { @@ -484,12 +484,11 @@ static struct axi_dmac_desc *axi_dmac_alloc_desc(unsigned int num_sgs) desc = kzalloc(struct_size(desc, sg, num_sgs), GFP_NOWAIT); if (!desc) return NULL; + desc->num_sgs = num_sgs; for (i = 0; i < num_sgs; i++) desc->sg[i].id = AXI_DMAC_SG_UNUSED; - desc->num_sgs = num_sgs; - return desc; } -- cgit v1.2.3 From 7d4b82185521538eab8b0532b9bd7b8c8ca3e63b Mon Sep 17 00:00:00 2001 From: Kees Cook Date: Thu, 17 Aug 2023 16:58:42 -0700 Subject: dmaengine: hisilicon: Annotate struct hisi_dma_dev with __counted_by Prepare for the coming implementation by GCC and Clang of the __counted_by attribute. Flexible array members annotated with __counted_by can have their accesses bounds-checked at run-time checking via CONFIG_UBSAN_BOUNDS (for array indexing) and CONFIG_FORTIFY_SOURCE (for strcpy/memcpy-family functions). As found with Coccinelle[1], add __counted_by for struct hisi_dma_dev. [1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci Cc: Vinod Koul Cc: Zhou Wang Cc: Jie Hai Cc: dmaengine@vger.kernel.org Signed-off-by: Kees Cook Reviewed-by: "Gustavo A. R. Silva" Link: https://lore.kernel.org/r/20230817235859.49846-5-keescook@chromium.org Signed-off-by: Vinod Koul --- drivers/dma/hisi_dma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/dma/hisi_dma.c b/drivers/dma/hisi_dma.c index c1350a36fddd..4c47bff81064 100644 --- a/drivers/dma/hisi_dma.c +++ b/drivers/dma/hisi_dma.c @@ -163,7 +163,7 @@ struct hisi_dma_dev { u32 chan_depth; enum hisi_dma_reg_layout reg_layout; void __iomem *queue_base; /* queue region start of register */ - struct hisi_dma_chan chan[]; + struct hisi_dma_chan chan[] __counted_by(chan_num); }; #ifdef CONFIG_DEBUG_FS -- cgit v1.2.3 From fd1cb31a037bf8894a710392c2354281c5276d09 Mon Sep 17 00:00:00 2001 From: Kees Cook Date: Thu, 17 Aug 2023 16:58:43 -0700 Subject: dmaengine: moxart-dma: Annotate struct moxart_desc with __counted_by Prepare for the coming implementation by GCC and Clang of the __counted_by attribute. Flexible array members annotated with __counted_by can have their accesses bounds-checked at run-time checking via CONFIG_UBSAN_BOUNDS (for array indexing) and CONFIG_FORTIFY_SOURCE (for strcpy/memcpy-family functions). As found with Coccinelle[1], add __counted_by for struct moxart_desc. Additionally, since the element count member must be set before accessing the annotated flexible array member, move its initialization earlier. [1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci Cc: Vinod Koul Cc: dmaengine@vger.kernel.org Signed-off-by: Kees Cook Reviewed-by: "Gustavo A. R. Silva" Link: https://lore.kernel.org/r/20230817235859.49846-6-keescook@chromium.org Signed-off-by: Vinod Koul --- drivers/dma/moxart-dma.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/dma/moxart-dma.c b/drivers/dma/moxart-dma.c index a03953b3016b..c48d68cbff92 100644 --- a/drivers/dma/moxart-dma.c +++ b/drivers/dma/moxart-dma.c @@ -124,7 +124,7 @@ struct moxart_desc { unsigned int dma_cycles; struct virt_dma_desc vd; uint8_t es; - struct moxart_sg sg[]; + struct moxart_sg sg[] __counted_by(sglen); }; struct moxart_chan { @@ -309,6 +309,7 @@ static struct dma_async_tx_descriptor *moxart_prep_slave_sg( d = kzalloc(struct_size(d, sg, sg_len), GFP_ATOMIC); if (!d) return NULL; + d->sglen = sg_len; d->dma_dir = dir; d->dev_addr = dev_addr; @@ -319,8 +320,6 @@ static struct dma_async_tx_descriptor *moxart_prep_slave_sg( d->sg[i].len = sg_dma_len(sgent); } - d->sglen = sg_len; - ch->error = 0; return vchan_tx_prep(&ch->vc, &d->vd, tx_flags); -- cgit v1.2.3 From b9fe0bd5903140cc3e1ae4e542ae7ff38c90d011 Mon Sep 17 00:00:00 2001 From: Kees Cook Date: Thu, 17 Aug 2023 16:58:44 -0700 Subject: dmaengine: qcom: bam_dma: Annotate struct bam_async_desc with __counted_by Prepare for the coming implementation by GCC and Clang of the __counted_by attribute. Flexible array members annotated with __counted_by can have their accesses bounds-checked at run-time checking via CONFIG_UBSAN_BOUNDS (for array indexing) and CONFIG_FORTIFY_SOURCE (for strcpy/memcpy-family functions). As found with Coccinelle[1], add __counted_by for struct bam_async_desc. [1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci Cc: Vinod Koul Cc: Andy Gross Cc: Bjorn Andersson Cc: Konrad Dybcio Cc: linux-arm-msm@vger.kernel.org Cc: dmaengine@vger.kernel.org Signed-off-by: Kees Cook Reviewed-by: "Gustavo A. R. Silva" Link: https://lore.kernel.org/r/20230817235859.49846-7-keescook@chromium.org Signed-off-by: Vinod Koul --- drivers/dma/qcom/bam_dma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/dma/qcom/bam_dma.c b/drivers/dma/qcom/bam_dma.c index c4f8d17d0c68..5e7d332731e0 100644 --- a/drivers/dma/qcom/bam_dma.c +++ b/drivers/dma/qcom/bam_dma.c @@ -74,7 +74,7 @@ struct bam_async_desc { struct list_head desc_node; enum dma_transfer_direction dir; size_t length; - struct bam_desc_hw desc[]; + struct bam_desc_hw desc[] __counted_by(num_desc); }; enum bam_reg { -- cgit v1.2.3 From 04b5433b8c0e1b014f081f4bf79767bbc207a7b0 Mon Sep 17 00:00:00 2001 From: Kees Cook Date: Thu, 17 Aug 2023 16:58:45 -0700 Subject: dmaengine: sa11x0: Annotate struct sa11x0_dma_desc with __counted_by Prepare for the coming implementation by GCC and Clang of the __counted_by attribute. Flexible array members annotated with __counted_by can have their accesses bounds-checked at run-time checking via CONFIG_UBSAN_BOUNDS (for array indexing) and CONFIG_FORTIFY_SOURCE (for strcpy/memcpy-family functions). As found with Coccinelle[1], add __counted_by for struct sa11x0_dma_desc. Additionally, since the element count member must be set before accessing the annotated flexible array member, move its initialization earlier. [1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci Cc: Vinod Koul Cc: dmaengine@vger.kernel.org Signed-off-by: Kees Cook Reviewed-by: "Gustavo A. R. Silva" Link: https://lore.kernel.org/r/20230817235859.49846-8-keescook@chromium.org Signed-off-by: Vinod Koul --- drivers/dma/sa11x0-dma.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/dma/sa11x0-dma.c b/drivers/dma/sa11x0-dma.c index 488408e6826a..01e656c69e6c 100644 --- a/drivers/dma/sa11x0-dma.c +++ b/drivers/dma/sa11x0-dma.c @@ -78,7 +78,7 @@ struct sa11x0_dma_desc { bool cyclic; unsigned sglen; - struct sa11x0_dma_sg sg[]; + struct sa11x0_dma_sg sg[] __counted_by(sglen); }; struct sa11x0_dma_phy; @@ -558,6 +558,7 @@ static struct dma_async_tx_descriptor *sa11x0_dma_prep_slave_sg( dev_dbg(chan->device->dev, "vchan %p: kzalloc failed\n", &c->vc); return NULL; } + txd->sglen = j; j = 0; for_each_sg(sg, sgent, sglen, i) { @@ -593,7 +594,6 @@ static struct dma_async_tx_descriptor *sa11x0_dma_prep_slave_sg( txd->ddar = c->ddar; txd->size = size; - txd->sglen = j; dev_dbg(chan->device->dev, "vchan %p: txd %p: size %zu nr %u\n", &c->vc, &txd->vd, txd->size, txd->sglen); @@ -628,6 +628,7 @@ static struct dma_async_tx_descriptor *sa11x0_dma_prep_dma_cyclic( dev_dbg(chan->device->dev, "vchan %p: kzalloc failed\n", &c->vc); return NULL; } + txd->sglen = sglen; for (i = k = 0; i < size / period; i++) { size_t tlen, len = period; @@ -653,7 +654,6 @@ static struct dma_async_tx_descriptor *sa11x0_dma_prep_dma_cyclic( txd->ddar = c->ddar; txd->size = size; - txd->sglen = sglen; txd->cyclic = 1; txd->period = sgperiod; -- cgit v1.2.3 From 1539a22e144106eefc0ef05e7b91f68ad20a71ad Mon Sep 17 00:00:00 2001 From: Kees Cook Date: Thu, 17 Aug 2023 16:58:46 -0700 Subject: dmaengine: sf-pdma: Annotate struct sf_pdma with __counted_by Prepare for the coming implementation by GCC and Clang of the __counted_by attribute. Flexible array members annotated with __counted_by can have their accesses bounds-checked at run-time checking via CONFIG_UBSAN_BOUNDS (for array indexing) and CONFIG_FORTIFY_SOURCE (for strcpy/memcpy-family functions). As found with Coccinelle[1], add __counted_by for struct sf_pdma. [1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci Cc: Vinod Koul Cc: Green Wan Cc: dmaengine@vger.kernel.org Signed-off-by: Kees Cook Reviewed-by: "Gustavo A. R. Silva" Link: https://lore.kernel.org/r/20230817235859.49846-9-keescook@chromium.org Signed-off-by: Vinod Koul --- drivers/dma/sf-pdma/sf-pdma.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/dma/sf-pdma/sf-pdma.h b/drivers/dma/sf-pdma/sf-pdma.h index 5c398a83b491..d05772b5d8d3 100644 --- a/drivers/dma/sf-pdma/sf-pdma.h +++ b/drivers/dma/sf-pdma/sf-pdma.h @@ -113,7 +113,7 @@ struct sf_pdma { void __iomem *membase; void __iomem *mappedbase; u32 n_chans; - struct sf_pdma_chan chans[]; + struct sf_pdma_chan chans[] __counted_by(n_chans); }; #endif /* _SF_PDMA_H */ -- cgit v1.2.3 From 8360c11aef5775745fc10438e24db95ab2329b1d Mon Sep 17 00:00:00 2001 From: Kees Cook Date: Thu, 17 Aug 2023 16:58:47 -0700 Subject: dmaengine: sprd: Annotate struct sprd_dma_dev with __counted_by Prepare for the coming implementation by GCC and Clang of the __counted_by attribute. Flexible array members annotated with __counted_by can have their accesses bounds-checked at run-time checking via CONFIG_UBSAN_BOUNDS (for array indexing) and CONFIG_FORTIFY_SOURCE (for strcpy/memcpy-family functions). As found with Coccinelle[1], add __counted_by for struct sprd_dma_dev. [1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci Cc: Vinod Koul Cc: Orson Zhai Cc: Baolin Wang Cc: Chunyan Zhang Cc: dmaengine@vger.kernel.org Signed-off-by: Kees Cook Acked-by: Chunyan Zhang Reviewed-by: "Gustavo A. R. Silva" Link: https://lore.kernel.org/r/20230817235859.49846-10-keescook@chromium.org Signed-off-by: Vinod Koul --- drivers/dma/sprd-dma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/dma/sprd-dma.c b/drivers/dma/sprd-dma.c index 97e3dedb6c12..0064a5f4f0cb 100644 --- a/drivers/dma/sprd-dma.c +++ b/drivers/dma/sprd-dma.c @@ -212,7 +212,7 @@ struct sprd_dma_dev { struct clk *ashb_clk; int irq; u32 total_chns; - struct sprd_dma_chn channels[]; + struct sprd_dma_chn channels[] __counted_by(total_chns); }; static void sprd_dma_free_desc(struct virt_dma_desc *vd); -- cgit v1.2.3 From 8279f0b476f37c51de2ed8bd70d770b2893dd2fa Mon Sep 17 00:00:00 2001 From: Kees Cook Date: Thu, 17 Aug 2023 16:58:48 -0700 Subject: dmaengine: st_fdma: Annotate struct st_fdma_desc with __counted_by Prepare for the coming implementation by GCC and Clang of the __counted_by attribute. Flexible array members annotated with __counted_by can have their accesses bounds-checked at run-time checking via CONFIG_UBSAN_BOUNDS (for array indexing) and CONFIG_FORTIFY_SOURCE (for strcpy/memcpy-family functions). As found with Coccinelle[1], add __counted_by for struct st_fdma_desc. [1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci Cc: Vinod Koul Cc: Patrice Chotard Cc: linux-arm-kernel@lists.infradead.org Cc: dmaengine@vger.kernel.org Signed-off-by: Kees Cook Reviewed-by: "Gustavo A. R. Silva" Link: https://lore.kernel.org/r/20230817235859.49846-11-keescook@chromium.org Signed-off-by: Vinod Koul --- drivers/dma/st_fdma.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/dma/st_fdma.h b/drivers/dma/st_fdma.h index fa15b97a3bab..f296412e96b6 100644 --- a/drivers/dma/st_fdma.h +++ b/drivers/dma/st_fdma.h @@ -97,7 +97,7 @@ struct st_fdma_desc { struct st_fdma_chan *fchan; bool iscyclic; unsigned int n_nodes; - struct st_fdma_sw_node node[]; + struct st_fdma_sw_node node[] __counted_by(n_nodes); }; enum st_fdma_type { -- cgit v1.2.3 From 195e46df2d996ff4bbf624891b1d3ae8ea9f315d Mon Sep 17 00:00:00 2001 From: Kees Cook Date: Thu, 17 Aug 2023 16:58:49 -0700 Subject: dmaengine: stm32-dma: Annotate struct stm32_dma_desc with __counted_by Prepare for the coming implementation by GCC and Clang of the __counted_by attribute. Flexible array members annotated with __counted_by can have their accesses bounds-checked at run-time checking via CONFIG_UBSAN_BOUNDS (for array indexing) and CONFIG_FORTIFY_SOURCE (for strcpy/memcpy-family functions). As found with Coccinelle[1], add __counted_by for struct stm32_dma_desc. Additionally, since the element count member must be set before accessing the annotated flexible array member, move its initialization earlier. [1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci Cc: Vinod Koul Cc: Maxime Coquelin Cc: Alexandre Torgue Cc: dmaengine@vger.kernel.org Cc: linux-stm32@st-md-mailman.stormreply.com Cc: linux-arm-kernel@lists.infradead.org Signed-off-by: Kees Cook Reviewed-by: "Gustavo A. R. Silva" Link: https://lore.kernel.org/r/20230817235859.49846-12-keescook@chromium.org Signed-off-by: Vinod Koul --- drivers/dma/stm32-dma.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/drivers/dma/stm32-dma.c b/drivers/dma/stm32-dma.c index 5c36811aa134..a732b3807b11 100644 --- a/drivers/dma/stm32-dma.c +++ b/drivers/dma/stm32-dma.c @@ -191,7 +191,7 @@ struct stm32_dma_desc { struct virt_dma_desc vdesc; bool cyclic; u32 num_sgs; - struct stm32_dma_sg_req sg_req[]; + struct stm32_dma_sg_req sg_req[] __counted_by(num_sgs); }; /** @@ -1105,6 +1105,7 @@ static struct dma_async_tx_descriptor *stm32_dma_prep_slave_sg( desc = kzalloc(struct_size(desc, sg_req, sg_len), GFP_NOWAIT); if (!desc) return NULL; + desc->num_sgs = sg_len; /* Set peripheral flow controller */ if (chan->dma_sconfig.device_fc) @@ -1141,8 +1142,6 @@ static struct dma_async_tx_descriptor *stm32_dma_prep_slave_sg( desc->sg_req[i].chan_reg.dma_sm1ar += sg_dma_len(sg); desc->sg_req[i].chan_reg.dma_sndtr = nb_data_items; } - - desc->num_sgs = sg_len; desc->cyclic = false; return vchan_tx_prep(&chan->vchan, &desc->vdesc, flags); @@ -1216,6 +1215,7 @@ static struct dma_async_tx_descriptor *stm32_dma_prep_dma_cyclic( desc = kzalloc(struct_size(desc, sg_req, num_periods), GFP_NOWAIT); if (!desc) return NULL; + desc->num_sgs = num_periods; for (i = 0; i < num_periods; i++) { desc->sg_req[i].len = period_len; @@ -1232,8 +1232,6 @@ static struct dma_async_tx_descriptor *stm32_dma_prep_dma_cyclic( if (!chan->trig_mdma) buf_addr += period_len; } - - desc->num_sgs = num_periods; desc->cyclic = true; return vchan_tx_prep(&chan->vchan, &desc->vdesc, flags); @@ -1254,6 +1252,7 @@ static struct dma_async_tx_descriptor *stm32_dma_prep_dma_memcpy( desc = kzalloc(struct_size(desc, sg_req, num_sgs), GFP_NOWAIT); if (!desc) return NULL; + desc->num_sgs = num_sgs; threshold = chan->threshold; @@ -1283,8 +1282,6 @@ static struct dma_async_tx_descriptor *stm32_dma_prep_dma_memcpy( desc->sg_req[i].chan_reg.dma_sndtr = xfer_count; desc->sg_req[i].len = xfer_count; } - - desc->num_sgs = num_sgs; desc->cyclic = false; return vchan_tx_prep(&chan->vchan, &desc->vdesc, flags); -- cgit v1.2.3 From 035472170a2a21fc62d8258883a9f566943058b7 Mon Sep 17 00:00:00 2001 From: Kees Cook Date: Thu, 17 Aug 2023 16:58:50 -0700 Subject: dmaengine: stm32-mdma: Annotate struct stm32_mdma_desc with __counted_by Prepare for the coming implementation by GCC and Clang of the __counted_by attribute. Flexible array members annotated with __counted_by can have their accesses bounds-checked at run-time checking via CONFIG_UBSAN_BOUNDS (for array indexing) and CONFIG_FORTIFY_SOURCE (for strcpy/memcpy-family functions). As found with Coccinelle[1], add __counted_by for struct stm32_mdma_desc. Additionally, since the element count member must be set before accessing the annotated flexible array member, move its initialization earlier. [1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci Cc: Vinod Koul Cc: Maxime Coquelin Cc: Alexandre Torgue Cc: dmaengine@vger.kernel.org Cc: linux-stm32@st-md-mailman.stormreply.com Cc: linux-arm-kernel@lists.infradead.org Signed-off-by: Kees Cook Reviewed-by: "Gustavo A. R. Silva" Link: https://lore.kernel.org/r/20230817235859.49846-13-keescook@chromium.org Signed-off-by: Vinod Koul --- drivers/dma/stm32-mdma.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/dma/stm32-mdma.c b/drivers/dma/stm32-mdma.c index 0de234022c6d..926d6ecf1274 100644 --- a/drivers/dma/stm32-mdma.c +++ b/drivers/dma/stm32-mdma.c @@ -224,7 +224,7 @@ struct stm32_mdma_desc { u32 ccr; bool cyclic; u32 count; - struct stm32_mdma_desc_node node[]; + struct stm32_mdma_desc_node node[] __counted_by(count); }; struct stm32_mdma_dma_config { @@ -321,6 +321,7 @@ static struct stm32_mdma_desc *stm32_mdma_alloc_desc( desc = kzalloc(struct_size(desc, node, count), GFP_NOWAIT); if (!desc) return NULL; + desc->count = count; for (i = 0; i < count; i++) { desc->node[i].hwdesc = @@ -330,8 +331,6 @@ static struct stm32_mdma_desc *stm32_mdma_alloc_desc( goto err; } - desc->count = count; - return desc; err: -- cgit v1.2.3 From 7ba0035dc02ce0c877004dc4052c6d5f873539db Mon Sep 17 00:00:00 2001 From: Kees Cook Date: Thu, 17 Aug 2023 16:58:51 -0700 Subject: dmaengine: stm32-mdma: Annotate struct stm32_mdma_device with __counted_by Prepare for the coming implementation by GCC and Clang of the __counted_by attribute. Flexible array members annotated with __counted_by can have their accesses bounds-checked at run-time checking via CONFIG_UBSAN_BOUNDS (for array indexing) and CONFIG_FORTIFY_SOURCE (for strcpy/memcpy-family functions). As found with Coccinelle[1], add __counted_by for struct stm32_mdma_device. Additionally, since the element count member must be set before accessing the annotated flexible array member, move its initialization earlier. [1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci Cc: Vinod Koul Cc: Maxime Coquelin Cc: Alexandre Torgue Cc: dmaengine@vger.kernel.org Cc: linux-stm32@st-md-mailman.stormreply.com Cc: linux-arm-kernel@lists.infradead.org Signed-off-by: Kees Cook Reviewed-by: "Gustavo A. R. Silva" Link: https://lore.kernel.org/r/20230817235859.49846-14-keescook@chromium.org Signed-off-by: Vinod Koul --- drivers/dma/stm32-mdma.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/dma/stm32-mdma.c b/drivers/dma/stm32-mdma.c index 926d6ecf1274..0c7d2295856e 100644 --- a/drivers/dma/stm32-mdma.c +++ b/drivers/dma/stm32-mdma.c @@ -256,7 +256,7 @@ struct stm32_mdma_device { u32 nr_ahb_addr_masks; u32 chan_reserved; struct stm32_mdma_chan chan[STM32_MDMA_MAX_CHANNELS]; - u32 ahb_addr_masks[]; + u32 ahb_addr_masks[] __counted_by(nr_ahb_addr_masks); }; static struct stm32_mdma_device *stm32_mdma_get_dev( @@ -1611,13 +1611,13 @@ static int stm32_mdma_probe(struct platform_device *pdev) GFP_KERNEL); if (!dmadev) return -ENOMEM; + dmadev->nr_ahb_addr_masks = count; dmadev->nr_channels = nr_channels; dmadev->nr_requests = nr_requests; device_property_read_u32_array(&pdev->dev, "st,ahb-addr-masks", dmadev->ahb_addr_masks, count); - dmadev->nr_ahb_addr_masks = count; dmadev->base = devm_platform_ioremap_resource(pdev, 0); if (IS_ERR(dmadev->base)) -- cgit v1.2.3 From 32b5e2d7cd14c80de1fa1cdffcc6ec211b615d82 Mon Sep 17 00:00:00 2001 From: Kees Cook Date: Thu, 17 Aug 2023 16:58:52 -0700 Subject: dmaengine: tegra: Annotate struct tegra_dma_desc with __counted_by Prepare for the coming implementation by GCC and Clang of the __counted_by attribute. Flexible array members annotated with __counted_by can have their accesses bounds-checked at run-time checking via CONFIG_UBSAN_BOUNDS (for array indexing) and CONFIG_FORTIFY_SOURCE (for strcpy/memcpy-family functions). As found with Coccinelle[1], add __counted_by for struct tegra_dma_desc. [1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci Cc: Vinod Koul Cc: Laxman Dewangan Cc: Jon Hunter Cc: Thierry Reding Cc: dmaengine@vger.kernel.org Cc: linux-tegra@vger.kernel.org Signed-off-by: Kees Cook Reviewed-by: "Gustavo A. R. Silva" Link: https://lore.kernel.org/r/20230817235859.49846-15-keescook@chromium.org Signed-off-by: Vinod Koul --- drivers/dma/tegra186-gpc-dma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/dma/tegra186-gpc-dma.c b/drivers/dma/tegra186-gpc-dma.c index 868c18cc72b1..fa4d4142a68a 100644 --- a/drivers/dma/tegra186-gpc-dma.c +++ b/drivers/dma/tegra186-gpc-dma.c @@ -221,7 +221,7 @@ struct tegra_dma_desc { unsigned int sg_count; struct virt_dma_desc vd; struct tegra_dma_channel *tdc; - struct tegra_dma_sg_req sg_req[]; + struct tegra_dma_sg_req sg_req[] __counted_by(sg_count); }; /* -- cgit v1.2.3 From 15f2c636dde8c4370db87ceabce5cc8325460d77 Mon Sep 17 00:00:00 2001 From: Kees Cook Date: Thu, 17 Aug 2023 16:58:53 -0700 Subject: dmaengine: tegra210-adma: Annotate struct tegra_adma with __counted_by Prepare for the coming implementation by GCC and Clang of the __counted_by attribute. Flexible array members annotated with __counted_by can have their accesses bounds-checked at run-time checking via CONFIG_UBSAN_BOUNDS (for array indexing) and CONFIG_FORTIFY_SOURCE (for strcpy/memcpy-family functions). As found with Coccinelle[1], add __counted_by for struct tegra_adma. [1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci Cc: Vinod Koul Cc: Laxman Dewangan Cc: Jon Hunter Cc: Thierry Reding Cc: dmaengine@vger.kernel.org Cc: linux-tegra@vger.kernel.org Signed-off-by: Kees Cook Reviewed-by: "Gustavo A. R. Silva" Link: https://lore.kernel.org/r/20230817235859.49846-16-keescook@chromium.org Signed-off-by: Vinod Koul --- drivers/dma/tegra210-adma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/dma/tegra210-adma.c b/drivers/dma/tegra210-adma.c index 60111d40325e..7a0586633bf3 100644 --- a/drivers/dma/tegra210-adma.c +++ b/drivers/dma/tegra210-adma.c @@ -162,7 +162,7 @@ struct tegra_adma { const struct tegra_adma_chip_data *cdata; /* Last member of the structure */ - struct tegra_adma_chan channels[]; + struct tegra_adma_chan channels[] __counted_by(nr_channels); }; static inline void tdma_write(struct tegra_adma *tdma, u32 reg, u32 val) -- cgit v1.2.3 From 5f240e0cdbcb0cc60d6a75ea7d492ce93b7fd52e Mon Sep 17 00:00:00 2001 From: Kees Cook Date: Thu, 17 Aug 2023 16:58:54 -0700 Subject: dmaengine: ti: edma: Annotate struct edma_desc with __counted_by Prepare for the coming implementation by GCC and Clang of the __counted_by attribute. Flexible array members annotated with __counted_by can have their accesses bounds-checked at run-time checking via CONFIG_UBSAN_BOUNDS (for array indexing) and CONFIG_FORTIFY_SOURCE (for strcpy/memcpy-family functions). As found with Coccinelle[1], add __counted_by for struct edma_desc. [1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci Cc: Vinod Koul Cc: Peter Ujfalusi Cc: dmaengine@vger.kernel.org Signed-off-by: Kees Cook Reviewed-by: "Gustavo A. R. Silva" Link: https://lore.kernel.org/r/20230817235859.49846-17-keescook@chromium.org Signed-off-by: Vinod Koul --- drivers/dma/ti/edma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/dma/ti/edma.c b/drivers/dma/ti/edma.c index 3ed022918ec0..fe06288e034b 100644 --- a/drivers/dma/ti/edma.c +++ b/drivers/dma/ti/edma.c @@ -202,7 +202,7 @@ struct edma_desc { u32 residue; u32 residue_stat; - struct edma_pset pset[]; + struct edma_pset pset[] __counted_by(pset_nr); }; struct edma_cc; -- cgit v1.2.3 From b85178611c1156deb3c09e7f8d8cdd662b8df99c Mon Sep 17 00:00:00 2001 From: Kees Cook Date: Thu, 17 Aug 2023 16:58:55 -0700 Subject: dmaengine: ti: omap-dma: Annotate struct omap_desc with __counted_by Prepare for the coming implementation by GCC and Clang of the __counted_by attribute. Flexible array members annotated with __counted_by can have their accesses bounds-checked at run-time checking via CONFIG_UBSAN_BOUNDS (for array indexing) and CONFIG_FORTIFY_SOURCE (for strcpy/memcpy-family functions). As found with Coccinelle[1], add __counted_by for struct omap_desc. Additionally, since the element count member must be set before accessing the annotated flexible array member, move its initialization earlier. [1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci Cc: Vinod Koul Cc: Peter Ujfalusi Cc: dmaengine@vger.kernel.org Signed-off-by: Kees Cook Reviewed-by: "Gustavo A. R. Silva" Link: https://lore.kernel.org/r/20230817235859.49846-18-keescook@chromium.org Signed-off-by: Vinod Koul --- drivers/dma/ti/omap-dma.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/dma/ti/omap-dma.c b/drivers/dma/ti/omap-dma.c index 76db0fc19524..b9e0e22383b7 100644 --- a/drivers/dma/ti/omap-dma.c +++ b/drivers/dma/ti/omap-dma.c @@ -124,7 +124,7 @@ struct omap_desc { uint32_t csdp; /* CSDP value */ unsigned sglen; - struct omap_sg sg[]; + struct omap_sg sg[] __counted_by(sglen); }; enum { @@ -1005,6 +1005,7 @@ static struct dma_async_tx_descriptor *omap_dma_prep_slave_sg( d = kzalloc(struct_size(d, sg, sglen), GFP_ATOMIC); if (!d) return NULL; + d->sglen = sglen; d->dir = dir; d->dev_addr = dev_addr; @@ -1120,8 +1121,6 @@ static struct dma_async_tx_descriptor *omap_dma_prep_slave_sg( } } - d->sglen = sglen; - /* Release the dma_pool entries if one allocation failed */ if (ll_failed) { for (i = 0; i < d->sglen; i++) { -- cgit v1.2.3 From 5a67a8f93f02027e4ac8583715d2f4bd2de20e10 Mon Sep 17 00:00:00 2001 From: Kees Cook Date: Thu, 17 Aug 2023 16:58:56 -0700 Subject: dmaengine: uniphier-xdmac: Annotate struct uniphier_xdmac_desc with __counted_by Prepare for the coming implementation by GCC and Clang of the __counted_by attribute. Flexible array members annotated with __counted_by can have their accesses bounds-checked at run-time checking via CONFIG_UBSAN_BOUNDS (for array indexing) and CONFIG_FORTIFY_SOURCE (for strcpy/memcpy-family functions). As found with Coccinelle[1], add __counted_by for struct uniphier_xdmac_desc. Additionally, since the element count member must be set before accessing the annotated flexible array member, move its initialization earlier. [1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci Cc: Vinod Koul Cc: Kunihiko Hayashi Cc: Masami Hiramatsu Cc: dmaengine@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org Signed-off-by: Kees Cook Reviewed-by: "Gustavo A. R. Silva" Link: https://lore.kernel.org/r/20230817235859.49846-19-keescook@chromium.org Signed-off-by: Vinod Koul --- drivers/dma/uniphier-xdmac.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/dma/uniphier-xdmac.c b/drivers/dma/uniphier-xdmac.c index 290836b7e1be..dd51522879a7 100644 --- a/drivers/dma/uniphier-xdmac.c +++ b/drivers/dma/uniphier-xdmac.c @@ -80,7 +80,7 @@ struct uniphier_xdmac_desc { unsigned int nr_node; unsigned int cur_node; enum dma_transfer_direction dir; - struct uniphier_xdmac_desc_node nodes[]; + struct uniphier_xdmac_desc_node nodes[] __counted_by(nr_node); }; struct uniphier_xdmac_chan { @@ -295,6 +295,7 @@ uniphier_xdmac_prep_dma_memcpy(struct dma_chan *chan, dma_addr_t dst, xd = kzalloc(struct_size(xd, nodes, nr), GFP_NOWAIT); if (!xd) return NULL; + xd->nr_node = nr; for (i = 0; i < nr; i++) { burst_size = min_t(size_t, len, XDMAC_MAX_WORD_SIZE); @@ -309,7 +310,6 @@ uniphier_xdmac_prep_dma_memcpy(struct dma_chan *chan, dma_addr_t dst, } xd->dir = DMA_MEM_TO_MEM; - xd->nr_node = nr; xd->cur_node = 0; return vchan_tx_prep(vc, &xd->vd, flags); @@ -351,6 +351,7 @@ uniphier_xdmac_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl, xd = kzalloc(struct_size(xd, nodes, sg_len), GFP_NOWAIT); if (!xd) return NULL; + xd->nr_node = sg_len; for_each_sg(sgl, sg, sg_len, i) { xd->nodes[i].src = (direction == DMA_DEV_TO_MEM) @@ -385,7 +386,6 @@ uniphier_xdmac_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl, } xd->dir = direction; - xd->nr_node = sg_len; xd->cur_node = 0; return vchan_tx_prep(vc, &xd->vd, flags); -- cgit v1.2.3 From 7935de861aed45f97a4262d9b215d9feb172516b Mon Sep 17 00:00:00 2001 From: Kees Cook Date: Thu, 17 Aug 2023 16:58:57 -0700 Subject: dmaengine: uniphier-xdmac: Annotate struct uniphier_xdmac_device with __counted_by Prepare for the coming implementation by GCC and Clang of the __counted_by attribute. Flexible array members annotated with __counted_by can have their accesses bounds-checked at run-time checking via CONFIG_UBSAN_BOUNDS (for array indexing) and CONFIG_FORTIFY_SOURCE (for strcpy/memcpy-family functions). As found with Coccinelle[1], add __counted_by for struct uniphier_xdmac_device. [1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci Cc: Vinod Koul Cc: Kunihiko Hayashi Cc: Masami Hiramatsu Cc: dmaengine@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org Signed-off-by: Kees Cook Reviewed-by: "Gustavo A. R. Silva" Link: https://lore.kernel.org/r/20230817235859.49846-20-keescook@chromium.org Signed-off-by: Vinod Koul --- drivers/dma/uniphier-xdmac.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/dma/uniphier-xdmac.c b/drivers/dma/uniphier-xdmac.c index dd51522879a7..3a8ee2b173b5 100644 --- a/drivers/dma/uniphier-xdmac.c +++ b/drivers/dma/uniphier-xdmac.c @@ -97,7 +97,7 @@ struct uniphier_xdmac_device { struct dma_device ddev; void __iomem *reg_base; int nr_chans; - struct uniphier_xdmac_chan channels[]; + struct uniphier_xdmac_chan channels[] __counted_by(nr_chans); }; static struct uniphier_xdmac_chan * -- cgit v1.2.3 From a04bbeaa37d8789de5592506fa776256e784b69c Mon Sep 17 00:00:00 2001 From: Kees Cook Date: Thu, 17 Aug 2023 16:58:58 -0700 Subject: dmaengine: usb-dmac: Annotate struct usb_dmac_desc with __counted_by Prepare for the coming implementation by GCC and Clang of the __counted_by attribute. Flexible array members annotated with __counted_by can have their accesses bounds-checked at run-time checking via CONFIG_UBSAN_BOUNDS (for array indexing) and CONFIG_FORTIFY_SOURCE (for strcpy/memcpy-family functions). As found with Coccinelle[1], add __counted_by for struct usb_dmac_desc. [1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci Cc: Vinod Koul Cc: Yu Kuai Cc: Greg Kroah-Hartman Cc: Jordy Zomer Cc: Jernej Skrabec Cc: Tudor Ambarus Cc: dmaengine@vger.kernel.org Signed-off-by: Kees Cook Reviewed-by: "Gustavo A. R. Silva" Link: https://lore.kernel.org/r/20230817235859.49846-21-keescook@chromium.org Signed-off-by: Vinod Koul --- drivers/dma/sh/usb-dmac.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/dma/sh/usb-dmac.c b/drivers/dma/sh/usb-dmac.c index d8c93faa424d..a9b4302f6050 100644 --- a/drivers/dma/sh/usb-dmac.c +++ b/drivers/dma/sh/usb-dmac.c @@ -57,7 +57,7 @@ struct usb_dmac_desc { u32 residue; struct list_head node; dma_cookie_t done_cookie; - struct usb_dmac_sg sg[]; + struct usb_dmac_sg sg[] __counted_by(sg_allocated_len); }; #define to_usb_dmac_desc(vd) container_of(vd, struct usb_dmac_desc, vd) -- cgit v1.2.3 From 9c6e02eab10a8a7628cac2cd9b8db6806acc63ca Mon Sep 17 00:00:00 2001 From: Kaiwei Liu Date: Tue, 19 Sep 2023 15:38:01 +0800 Subject: dmaengine: sprd: add dma mask interface in probe In the probe of DMA, the default addressing range is 32 bits, while the actual DMA hardware addressing range used is 36 bits. So add dma_set_mask_and_coherent function to match DMA addressing range. Signed-off-by: Kaiwei Liu Reviewed-by: Baolin Wang Link: https://lore.kernel.org/r/20230919073801.25054-1-kaiwei.liu@unisoc.com Signed-off-by: Vinod Koul --- drivers/dma/sprd-dma.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/dma/sprd-dma.c b/drivers/dma/sprd-dma.c index 0064a5f4f0cb..fe3d69c1ce1f 100644 --- a/drivers/dma/sprd-dma.c +++ b/drivers/dma/sprd-dma.c @@ -1117,6 +1117,15 @@ static int sprd_dma_probe(struct platform_device *pdev) u32 chn_count; int ret, i; + ret = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(36)); + if (ret) { + ret = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32)); + if (ret) { + dev_err(&pdev->dev, "unable to set coherent mask to 32\n"); + return ret; + } + } + /* Parse new and deprecated dma-channels properties */ ret = device_property_read_u32(&pdev->dev, "dma-channels", &chn_count); if (ret) -- cgit v1.2.3 From 14f6d317913f634920a640e9047aa2e66f5bdcb7 Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Fri, 15 Sep 2023 15:59:59 +0300 Subject: dmaengine: ti: edma: handle irq_of_parse_and_map() errors Zero is not a valid IRQ for in-kernel code and the irq_of_parse_and_map() function returns zero on error. So this check for valid IRQs should only accept values > 0. Fixes: 2b6b3b742019 ("ARM/dmaengine: edma: Merge the two drivers under drivers/dma/") Signed-off-by: Dan Carpenter Acked-by: Peter Ujfalusi Link: https://lore.kernel.org/r/f15cb6a7-8449-4f79-98b6-34072f04edbc@moroto.mountain Signed-off-by: Vinod Koul --- drivers/dma/ti/edma.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/dma/ti/edma.c b/drivers/dma/ti/edma.c index fe06288e034b..f1f920861fa9 100644 --- a/drivers/dma/ti/edma.c +++ b/drivers/dma/ti/edma.c @@ -2401,7 +2401,7 @@ static int edma_probe(struct platform_device *pdev) if (irq < 0 && node) irq = irq_of_parse_and_map(node, 0); - if (irq >= 0) { + if (irq > 0) { irq_name = devm_kasprintf(dev, GFP_KERNEL, "%s_ccint", dev_name(dev)); ret = devm_request_irq(dev, irq, dma_irq_handler, 0, irq_name, @@ -2417,7 +2417,7 @@ static int edma_probe(struct platform_device *pdev) if (irq < 0 && node) irq = irq_of_parse_and_map(node, 2); - if (irq >= 0) { + if (irq > 0) { irq_name = devm_kasprintf(dev, GFP_KERNEL, "%s_ccerrint", dev_name(dev)); ret = devm_request_irq(dev, irq, dma_ccerr_handler, 0, irq_name, -- cgit v1.2.3 From f1009d3214ede734e01da4cc64fc2854bf94a2f2 Mon Sep 17 00:00:00 2001 From: Kaiwei Liu Date: Tue, 19 Sep 2023 09:49:29 +0800 Subject: dmaengine: sprd: delete redundant parameter for dma driver function The parameter *sdesc in function sprd_dma_check_trans_done is not used, so here delete redundant parameter. Signed-off-by: Kaiwei Liu Reviewed-by: Baolin Wang Link: https://lore.kernel.org/r/20230919014929.17037-1-kaiwei.liu@unisoc.com Signed-off-by: Vinod Koul --- drivers/dma/sprd-dma.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/dma/sprd-dma.c b/drivers/dma/sprd-dma.c index fe3d69c1ce1f..3f54ff37c5e0 100644 --- a/drivers/dma/sprd-dma.c +++ b/drivers/dma/sprd-dma.c @@ -572,8 +572,7 @@ static void sprd_dma_stop(struct sprd_dma_chn *schan) schan->cur_desc = NULL; } -static bool sprd_dma_check_trans_done(struct sprd_dma_desc *sdesc, - enum sprd_dma_int_type int_type, +static bool sprd_dma_check_trans_done(enum sprd_dma_int_type int_type, enum sprd_dma_req_mode req_mode) { if (int_type == SPRD_DMA_NO_INT) @@ -619,8 +618,7 @@ static irqreturn_t dma_irq_handle(int irq, void *dev_id) vchan_cyclic_callback(&sdesc->vd); } else { /* Check if the dma request descriptor is done. */ - trans_done = sprd_dma_check_trans_done(sdesc, int_type, - req_type); + trans_done = sprd_dma_check_trans_done(int_type, req_type); if (trans_done == true) { vchan_cookie_complete(&sdesc->vd); schan->cur_desc = NULL; -- cgit v1.2.3 From eb15bd5c2a690a84eb998140f99b2b660b4c8e7d Mon Sep 17 00:00:00 2001 From: Konrad Dybcio Date: Wed, 30 Aug 2023 14:48:40 +0200 Subject: dt-bindings: dmaengine: qcom: gpi: Allow dma-coherent On SM8550, the GPI DMA controller is coherent with the CPU. Allow specifying that. Signed-off-by: Konrad Dybcio Acked-by: Rob Herring Link: https://lore.kernel.org/r/20230830-topic-8550_dmac2-v1-1-49bb25239fb1@linaro.org Signed-off-by: Vinod Koul --- Documentation/devicetree/bindings/dma/qcom,gpi.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Documentation/devicetree/bindings/dma/qcom,gpi.yaml b/Documentation/devicetree/bindings/dma/qcom,gpi.yaml index f61145c91b6d..88d0de3d1b46 100644 --- a/Documentation/devicetree/bindings/dma/qcom,gpi.yaml +++ b/Documentation/devicetree/bindings/dma/qcom,gpi.yaml @@ -69,6 +69,8 @@ properties: dma-channel-mask: maxItems: 1 + dma-coherent: true + required: - compatible - reg -- cgit v1.2.3 From c223bafdcbd51506df00509088efc62e08ef6c3f Mon Sep 17 00:00:00 2001 From: Kees Cook Date: Tue, 3 Oct 2023 16:27:56 -0700 Subject: dmaengine: fsl-edma: Annotate struct struct fsl_edma_engine with __counted_by Prepare for the coming implementation by GCC and Clang of the __counted_by attribute. Flexible array members annotated with __counted_by can have their accesses bounds-checked at run-time via CONFIG_UBSAN_BOUNDS (for array indexing) and CONFIG_FORTIFY_SOURCE (for strcpy/memcpy-family functions). As found with Coccinelle[1], add __counted_by for struct struct fsl_edma_engine. Cc: Vinod Koul Cc: dmaengine@vger.kernel.org Link: https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci [1] Signed-off-by: Kees Cook Reviewed-by: "Gustavo A. R. Silva" Link: https://lore.kernel.org/r/20231003232704.work.596-kees@kernel.org Signed-off-by: Vinod Koul --- drivers/dma/fsl-edma-common.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/dma/fsl-edma-common.h b/drivers/dma/fsl-edma-common.h index 3cc0cc8fc2d0..2b55c2e399f9 100644 --- a/drivers/dma/fsl-edma-common.h +++ b/drivers/dma/fsl-edma-common.h @@ -213,7 +213,7 @@ struct fsl_edma_engine { bool big_endian; struct edma_regs regs; u64 chan_masked; - struct fsl_edma_chan chans[]; + struct fsl_edma_chan chans[] __counted_by(n_chans); }; #define edma_read_tcdreg(chan, __name) \ -- cgit v1.2.3 From 7af1e0aceeb321cbc90fcf6fa0bec8870290377f Mon Sep 17 00:00:00 2001 From: Dave Jiang Date: Fri, 8 Sep 2023 13:10:45 -0700 Subject: dmaengine: idxd: add wq driver name support for accel-config user tool With the possibility of multiple wq drivers that can be bound to the wq, the user config tool accel-config needs a way to know which wq driver to bind to the wq. Introduce per wq driver_name sysfs attribute where the user can indicate the driver to be bound to the wq. This allows accel-config to just bind to the driver using wq->driver_name. Signed-off-by: Dave Jiang Signed-off-by: Tom Zanussi Reviewed-by: Fenghua Yu Acked-by: Vinod Koul Link: https://lore.kernel.org/r/20230908201045.4115614-1-fenghua.yu@intel.com Signed-off-by: Vinod Koul --- Documentation/ABI/stable/sysfs-driver-dma-idxd | 6 +++++ drivers/dma/idxd/cdev.c | 7 ++++++ drivers/dma/idxd/dma.c | 6 +++++ drivers/dma/idxd/idxd.h | 9 +++++++ drivers/dma/idxd/sysfs.c | 34 ++++++++++++++++++++++++++ include/uapi/linux/idxd.h | 1 + 6 files changed, 63 insertions(+) diff --git a/Documentation/ABI/stable/sysfs-driver-dma-idxd b/Documentation/ABI/stable/sysfs-driver-dma-idxd index 825e619250bf..f2ec42949a54 100644 --- a/Documentation/ABI/stable/sysfs-driver-dma-idxd +++ b/Documentation/ABI/stable/sysfs-driver-dma-idxd @@ -270,6 +270,12 @@ Description: Shows the operation capability bits displayed in bitmap format correlates to the operations allowed. It's visible only on platforms that support the capability. +What: /sys/bus/dsa/devices/wq./driver_name +Date: Sept 8, 2023 +KernelVersion: 6.7.0 +Contact: dmaengine@vger.kernel.org +Description: Name of driver to be bounded to the wq. + What: /sys/bus/dsa/devices/engine./group_id Date: Oct 25, 2019 KernelVersion: 5.6.0 diff --git a/drivers/dma/idxd/cdev.c b/drivers/dma/idxd/cdev.c index d32deb9b4e3d..0423655f5a88 100644 --- a/drivers/dma/idxd/cdev.c +++ b/drivers/dma/idxd/cdev.c @@ -509,6 +509,7 @@ void idxd_wq_del_cdev(struct idxd_wq *wq) static int idxd_user_drv_probe(struct idxd_dev *idxd_dev) { + struct device *dev = &idxd_dev->conf_dev; struct idxd_wq *wq = idxd_dev_to_wq(idxd_dev); struct idxd_device *idxd = wq->idxd; int rc; @@ -536,6 +537,12 @@ static int idxd_user_drv_probe(struct idxd_dev *idxd_dev) mutex_lock(&wq->wq_lock); + if (!idxd_wq_driver_name_match(wq, dev)) { + idxd->cmd_status = IDXD_SCMD_WQ_NO_DRV_NAME; + rc = -ENODEV; + goto wq_err; + } + wq->wq = create_workqueue(dev_name(wq_confdev(wq))); if (!wq->wq) { rc = -ENOMEM; diff --git a/drivers/dma/idxd/dma.c b/drivers/dma/idxd/dma.c index 07623fb0f52f..47a01893cfdb 100644 --- a/drivers/dma/idxd/dma.c +++ b/drivers/dma/idxd/dma.c @@ -306,6 +306,12 @@ static int idxd_dmaengine_drv_probe(struct idxd_dev *idxd_dev) return -ENXIO; mutex_lock(&wq->wq_lock); + if (!idxd_wq_driver_name_match(wq, dev)) { + idxd->cmd_status = IDXD_SCMD_WQ_NO_DRV_NAME; + rc = -ENODEV; + goto err; + } + wq->type = IDXD_WQT_KERNEL; rc = drv_enable_wq(wq); diff --git a/drivers/dma/idxd/idxd.h b/drivers/dma/idxd/idxd.h index e269ca1f4862..1e89c80a07fc 100644 --- a/drivers/dma/idxd/idxd.h +++ b/drivers/dma/idxd/idxd.h @@ -159,6 +159,8 @@ struct idxd_cdev { int minor; }; +#define DRIVER_NAME_SIZE 128 + #define IDXD_ALLOCATED_BATCH_SIZE 128U #define WQ_NAME_SIZE 1024 #define WQ_TYPE_SIZE 10 @@ -227,6 +229,8 @@ struct idxd_wq { /* Lock to protect upasid_xa access. */ struct mutex uc_lock; struct xarray upasid_xa; + + char driver_name[DRIVER_NAME_SIZE + 1]; }; struct idxd_engine { @@ -646,6 +650,11 @@ static inline void idxd_wqcfg_set_max_batch_shift(int idxd_type, union wqcfg *wq wqcfg->max_batch_shift = max_batch_shift; } +static inline int idxd_wq_driver_name_match(struct idxd_wq *wq, struct device *dev) +{ + return (strncmp(wq->driver_name, dev->driver->name, strlen(dev->driver->name)) == 0); +} + int __must_check __idxd_driver_register(struct idxd_device_driver *idxd_drv, struct module *module, const char *mod_name); #define idxd_driver_register(driver) \ diff --git a/drivers/dma/idxd/sysfs.c b/drivers/dma/idxd/sysfs.c index 7caba90d85b3..523ae0dff7d4 100644 --- a/drivers/dma/idxd/sysfs.c +++ b/drivers/dma/idxd/sysfs.c @@ -1259,6 +1259,39 @@ err: static struct device_attribute dev_attr_wq_op_config = __ATTR(op_config, 0644, wq_op_config_show, wq_op_config_store); +static ssize_t wq_driver_name_show(struct device *dev, struct device_attribute *attr, char *buf) +{ + struct idxd_wq *wq = confdev_to_wq(dev); + + return sysfs_emit(buf, "%s\n", wq->driver_name); +} + +static ssize_t wq_driver_name_store(struct device *dev, struct device_attribute *attr, + const char *buf, size_t count) +{ + struct idxd_wq *wq = confdev_to_wq(dev); + char *input, *pos; + + if (wq->state != IDXD_WQ_DISABLED) + return -EPERM; + + if (strlen(buf) > DRIVER_NAME_SIZE || strlen(buf) == 0) + return -EINVAL; + + input = kstrndup(buf, count, GFP_KERNEL); + if (!input) + return -ENOMEM; + + pos = strim(input); + memset(wq->driver_name, 0, DRIVER_NAME_SIZE + 1); + sprintf(wq->driver_name, "%s", pos); + kfree(input); + return count; +} + +static struct device_attribute dev_attr_wq_driver_name = + __ATTR(driver_name, 0644, wq_driver_name_show, wq_driver_name_store); + static struct attribute *idxd_wq_attributes[] = { &dev_attr_wq_clients.attr, &dev_attr_wq_state.attr, @@ -1278,6 +1311,7 @@ static struct attribute *idxd_wq_attributes[] = { &dev_attr_wq_occupancy.attr, &dev_attr_wq_enqcmds_retries.attr, &dev_attr_wq_op_config.attr, + &dev_attr_wq_driver_name.attr, NULL, }; diff --git a/include/uapi/linux/idxd.h b/include/uapi/linux/idxd.h index 606b52e88ce3..3d1987e1bb2d 100644 --- a/include/uapi/linux/idxd.h +++ b/include/uapi/linux/idxd.h @@ -31,6 +31,7 @@ enum idxd_scmd_stat { IDXD_SCMD_WQ_IRQ_ERR = 0x80100000, IDXD_SCMD_WQ_USER_NO_IOMMU = 0x80110000, IDXD_SCMD_DEV_EVL_ERR = 0x80120000, + IDXD_SCMD_WQ_NO_DRV_NAME = 0x80200000, }; #define IDXD_SCMD_SOFTERR_MASK 0x80000000 -- cgit v1.2.3 From 74d885711c2f619e92f41ef308691948cc63f224 Mon Sep 17 00:00:00 2001 From: Kees Cook Date: Thu, 28 Sep 2023 16:43:42 -0700 Subject: dmaengine: ep93xx_dma: Annotate struct ep93xx_dma_engine with __counted_by Prepare for the coming implementation by GCC and Clang of the __counted_by attribute. Flexible array members annotated with __counted_by can have their accesses bounds-checked at run-time via CONFIG_UBSAN_BOUNDS (for array indexing) and CONFIG_FORTIFY_SOURCE (for strcpy/memcpy-family functions). As found with Coccinelle[1], add __counted_by for struct ep93xx_dma_engine. [1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci Cc: Vinod Koul Cc: Nathan Chancellor Cc: Nick Desaulniers Cc: Tom Rix Cc: dmaengine@vger.kernel.org Cc: llvm@lists.linux.dev Signed-off-by: Kees Cook Reviewed-by: "Gustavo A. R. Silva" Link: https://lore.kernel.org/r/20230928234334.work.391-kees@kernel.org Signed-off-by: Vinod Koul --- drivers/dma/ep93xx_dma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/dma/ep93xx_dma.c b/drivers/dma/ep93xx_dma.c index 5c4a448a1254..d6c60635e90d 100644 --- a/drivers/dma/ep93xx_dma.c +++ b/drivers/dma/ep93xx_dma.c @@ -213,7 +213,7 @@ struct ep93xx_dma_engine { #define INTERRUPT_NEXT_BUFFER 2 size_t num_channels; - struct ep93xx_dma_chan channels[]; + struct ep93xx_dma_chan channels[] __counted_by(num_channels); }; static inline struct device *chan2dev(struct ep93xx_dma_chan *edmac) -- cgit v1.2.3 From 88ba97688a03843755803bfc28b975ae27d533d1 Mon Sep 17 00:00:00 2001 From: Jinjie Ruan Date: Fri, 1 Sep 2023 15:11:14 +0800 Subject: dmaengine: fsl-edma: Remove redundant dev_err() for platform_get_irq() Since commit 7723f4c5ecdb ("driver core: platform: Add an error message to platform_get_irq*()") and commit 2043727c2882 ("driver core: platform: Make use of the helper function dev_err_probe()"), there is no need to call the dev_err() function directly to print a custom message when handling an error from platform_get_irq() function as it is going to display an appropriate error message in case of a failure. Fixes: 72f5801a4e2b ("dmaengine: fsl-edma: integrate v3 support") Signed-off-by: Jinjie Ruan Link: https://lore.kernel.org/r/20230901071115.1322000-1-ruanjinjie@huawei.com Signed-off-by: Vinod Koul --- drivers/dma/fsl-edma-main.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/dma/fsl-edma-main.c b/drivers/dma/fsl-edma-main.c index 11da143955b3..78ceaa71675f 100644 --- a/drivers/dma/fsl-edma-main.c +++ b/drivers/dma/fsl-edma-main.c @@ -230,10 +230,8 @@ static int fsl_edma3_irq_init(struct platform_device *pdev, struct fsl_edma_engi /* request channel irq */ fsl_chan->txirq = platform_get_irq(pdev, i); - if (fsl_chan->txirq < 0) { - dev_err(&pdev->dev, "Can't get chan %d's irq.\n", i); + if (fsl_chan->txirq < 0) return -EINVAL; - } ret = devm_request_irq(&pdev->dev, fsl_chan->txirq, fsl_edma3_tx_handler, IRQF_SHARED, -- cgit v1.2.3 From 9a2136b60cc1a5ba9c5878f08a41f41271c4cd17 Mon Sep 17 00:00:00 2001 From: Krzysztof Kozlowski Date: Thu, 10 Aug 2023 11:59:59 +0200 Subject: dmaengine: qcom: fix Wvoid-pointer-to-enum-cast warning 'cap' is an enum, thus cast of pointer on 64-bit compile test with W=1 causes: hidma.c:748:8: error: cast to smaller integer type 'enum hidma_cap' from 'const void *' [-Werror,-Wvoid-pointer-to-enum-cast] Signed-off-by: Krzysztof Kozlowski Link: https://lore.kernel.org/r/20230810100000.123515-1-krzysztof.kozlowski@linaro.org Signed-off-by: Vinod Koul --- drivers/dma/qcom/hidma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/dma/qcom/hidma.c b/drivers/dma/qcom/hidma.c index f4659553945b..d63b93dc7047 100644 --- a/drivers/dma/qcom/hidma.c +++ b/drivers/dma/qcom/hidma.c @@ -745,7 +745,7 @@ static bool hidma_test_capability(struct device *dev, enum hidma_cap test_cap) { enum hidma_cap cap; - cap = (enum hidma_cap) device_get_match_data(dev); + cap = (uintptr_t) device_get_match_data(dev); return cap ? ((cap & test_cap) > 0) : 0; } -- cgit v1.2.3 From 094f9ee5fb547c31486801a017a07d7f1c1e7881 Mon Sep 17 00:00:00 2001 From: Krzysztof Kozlowski Date: Thu, 10 Aug 2023 12:00:00 +0200 Subject: dmaengine: mmp: fix Wvoid-pointer-to-enum-cast warning 'type' is an enum, thus cast of pointer on 64-bit compile test with W=1 causes: mmp_tdma.c:649:10: error: cast to smaller integer type 'enum mmp_tdma_type' from 'const void *' [-Werror,-Wvoid-pointer-to-enum-cast] Signed-off-by: Krzysztof Kozlowski Link: https://lore.kernel.org/r/20230810100000.123515-2-krzysztof.kozlowski@linaro.org Signed-off-by: Vinod Koul --- drivers/dma/mmp_tdma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/dma/mmp_tdma.c b/drivers/dma/mmp_tdma.c index f039e07181f7..fbde35688121 100644 --- a/drivers/dma/mmp_tdma.c +++ b/drivers/dma/mmp_tdma.c @@ -644,7 +644,7 @@ static int mmp_tdma_probe(struct platform_device *pdev) of_id = of_match_device(mmp_tdma_dt_ids, &pdev->dev); if (of_id) - type = (enum mmp_tdma_type) of_id->data; + type = (uintptr_t) of_id->data; else type = platform_get_device_id(pdev)->driver_data; -- cgit v1.2.3 From 09361abc346102c505657db4f3ae19ed70e1b703 Mon Sep 17 00:00:00 2001 From: Yue Haibing Date: Wed, 9 Aug 2023 16:00:12 +0800 Subject: dmaengine: Remove unused declaration dma_chan_cleanup() Commit f27c580c3628 ("dmaengine: remove 'bigref' infrastructure") removed the implementation but left declaration in place. Remove it. Signed-off-by: Yue Haibing Reviewed-by: Andy Shevchenko Link: https://lore.kernel.org/r/20230809080012.22000-1-yuehaibing@huawei.com Signed-off-by: Vinod Koul --- include/linux/dmaengine.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h index c3656e590213..3df70d6131c8 100644 --- a/include/linux/dmaengine.h +++ b/include/linux/dmaengine.h @@ -517,8 +517,6 @@ static inline const char *dma_chan_name(struct dma_chan *chan) return dev_name(&chan->dev->device); } -void dma_chan_cleanup(struct kref *kref); - /** * typedef dma_filter_fn - callback filter for dma_request_channel * @chan: channel to be reviewed -- cgit v1.2.3 From a1cb2ffe5fe59b0f5612e5e9148c5311c32f311c Mon Sep 17 00:00:00 2001 From: Li Zetao Date: Fri, 4 Aug 2023 18:02:45 +0800 Subject: dmaengine: fsl-dpaa2-qdma: Remove redundant initialization owner in dpaa2_qdma_driver The fsl_mc_driver_register() will set "THIS_MODULE" to driver.owner when register a fsl_mc_driver driver, so it is redundant initialization to set driver.owner in dpaa2_qdma_driver statement. Remove it for clean code. Signed-off-by: Li Zetao Link: https://lore.kernel.org/r/20230804100245.100068-1-lizetao1@huawei.com Signed-off-by: Vinod Koul --- drivers/dma/fsl-dpaa2-qdma/dpaa2-qdma.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/dma/fsl-dpaa2-qdma/dpaa2-qdma.c b/drivers/dma/fsl-dpaa2-qdma/dpaa2-qdma.c index a42a37634881..7958ac33e36c 100644 --- a/drivers/dma/fsl-dpaa2-qdma/dpaa2-qdma.c +++ b/drivers/dma/fsl-dpaa2-qdma/dpaa2-qdma.c @@ -814,7 +814,6 @@ static const struct fsl_mc_device_id dpaa2_qdma_id_table[] = { static struct fsl_mc_driver dpaa2_qdma_driver = { .driver = { .name = "dpaa2-qdma", - .owner = THIS_MODULE, }, .probe = dpaa2_qdma_probe, .remove = dpaa2_qdma_remove, -- cgit v1.2.3 From 90a6c030f506585f484a9804aafe29cb42b93697 Mon Sep 17 00:00:00 2001 From: Li Zetao Date: Thu, 3 Aug 2023 11:32:35 +0800 Subject: dmaengine: xilinx: xdma: Use resource_size() in xdma_probe() There is a warning reported by coccinelle: ./drivers/dma/xilinx/xdma.c:888:22-25: ERROR: Missing resource_size with res Use resource_size() on resource object instead of explicit computation. Signed-off-by: Li Zetao Link: https://lore.kernel.org/r/20230803033235.3049137-1-lizetao1@huawei.com Signed-off-by: Vinod Koul --- drivers/dma/xilinx/xdma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/dma/xilinx/xdma.c b/drivers/dma/xilinx/xdma.c index 459e7b9838ed..78a8eef5dcf7 100644 --- a/drivers/dma/xilinx/xdma.c +++ b/drivers/dma/xilinx/xdma.c @@ -883,7 +883,7 @@ static int xdma_probe(struct platform_device *pdev) goto failed; } xdev->irq_start = res->start; - xdev->irq_num = res->end - res->start + 1; + xdev->irq_num = resource_size(res); res = platform_get_resource(pdev, IORESOURCE_MEM, 0); if (!res) { -- cgit v1.2.3 From 83c761f568733277ce1f7eb9dc9e890649c29a8c Mon Sep 17 00:00:00 2001 From: Christophe JAILLET Date: Sat, 7 Oct 2023 13:13:09 +0200 Subject: dmaengine: pxa_dma: Remove an erroneous BUG_ON() in pxad_free_desc() If pxad_alloc_desc() fails on the first dma_pool_alloc() call, then sw_desc->nb_desc is zero. In such a case pxad_free_desc() is called and it will BUG_ON(). Remove this erroneous BUG_ON(). It is also useless, because if "sw_desc->nb_desc == 0", then, on the first iteration of the for loop, i is -1 and the loop will not be executed. (both i and sw_desc->nb_desc are 'int') Fixes: a57e16cf0333 ("dmaengine: pxa: add pxa dmaengine driver") Signed-off-by: Christophe JAILLET Link: https://lore.kernel.org/r/c8fc5563c9593c914fde41f0f7d1489a21b45a9a.1696676782.git.christophe.jaillet@wanadoo.fr Signed-off-by: Vinod Koul --- drivers/dma/pxa_dma.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/dma/pxa_dma.c b/drivers/dma/pxa_dma.c index 3c574dc0613b..94cef2905940 100644 --- a/drivers/dma/pxa_dma.c +++ b/drivers/dma/pxa_dma.c @@ -722,7 +722,6 @@ static void pxad_free_desc(struct virt_dma_desc *vd) dma_addr_t dma; struct pxad_desc_sw *sw_desc = to_pxad_sw_desc(vd); - BUG_ON(sw_desc->nb_desc == 0); for (i = sw_desc->nb_desc - 1; i >= 0; i--) { if (i > 0) dma = sw_desc->hw_desc[i - 1]->ddadr; -- cgit v1.2.3 From 0481291f0ccbc5147635cf0eb108f9fe5a05ee7d Mon Sep 17 00:00:00 2001 From: Christophe JAILLET Date: Sat, 7 Oct 2023 13:13:10 +0200 Subject: dmaengine: pxa_dma: Annotate struct pxad_desc_sw with __counted_by Prepare for the coming implementation by GCC and Clang of the __counted_by attribute. Flexible array members annotated with __counted_by can have their accesses bounds-checked at run-time checking via CONFIG_UBSAN_BOUNDS (for array indexing) and CONFIG_FORTIFY_SOURCE (for strcpy/memcpy-family functions). To do so, the code needs a little shuffling related to how hw_desc is used and nb_desc incremented. The one by one increment is needed for the error handling path, calling pxad_free_desc(), to work correctly. So, add a new intermediate variable, desc, to store the result of the dma_pool_alloc() call. Signed-off-by: Christophe JAILLET Reviewed-by: Kees Cook Link: https://lore.kernel.org/r/1c9ef22826f449a3756bb13a83494e9fe3e0be8b.1696676782.git.christophe.jaillet@wanadoo.fr Signed-off-by: Vinod Koul --- drivers/dma/pxa_dma.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/drivers/dma/pxa_dma.c b/drivers/dma/pxa_dma.c index 94cef2905940..c6e2862896e3 100644 --- a/drivers/dma/pxa_dma.c +++ b/drivers/dma/pxa_dma.c @@ -91,7 +91,8 @@ struct pxad_desc_sw { bool cyclic; struct dma_pool *desc_pool; /* Channel's used allocator */ - struct pxad_desc_hw *hw_desc[]; /* DMA coherent descriptors */ + struct pxad_desc_hw *hw_desc[] __counted_by(nb_desc); + /* DMA coherent descriptors */ }; struct pxad_phy { @@ -739,6 +740,7 @@ pxad_alloc_desc(struct pxad_chan *chan, unsigned int nb_hw_desc) { struct pxad_desc_sw *sw_desc; dma_addr_t dma; + void *desc; int i; sw_desc = kzalloc(struct_size(sw_desc, hw_desc, nb_hw_desc), @@ -748,20 +750,21 @@ pxad_alloc_desc(struct pxad_chan *chan, unsigned int nb_hw_desc) sw_desc->desc_pool = chan->desc_pool; for (i = 0; i < nb_hw_desc; i++) { - sw_desc->hw_desc[i] = dma_pool_alloc(sw_desc->desc_pool, - GFP_NOWAIT, &dma); - if (!sw_desc->hw_desc[i]) { + desc = dma_pool_alloc(sw_desc->desc_pool, GFP_NOWAIT, &dma); + if (!desc) { dev_err(&chan->vc.chan.dev->device, "%s(): Couldn't allocate the %dth hw_desc from dma_pool %p\n", __func__, i, sw_desc->desc_pool); goto err; } + sw_desc->nb_desc++; + sw_desc->hw_desc[i] = desc; + if (i == 0) sw_desc->first = dma; else sw_desc->hw_desc[i - 1]->ddadr = dma; - sw_desc->nb_desc++; } return sw_desc; -- cgit v1.2.3 From a67ba97dfb30486deb4661f770b954387acc898d Mon Sep 17 00:00:00 2001 From: Rob Herring Date: Fri, 6 Oct 2023 16:38:43 -0500 Subject: dmaengine: Use device_get_match_data() Use preferred device_get_match_data() instead of of_match_device() to get the driver match data. With this, adjust the includes to explicitly include the correct headers. Signed-off-by: Rob Herring Link: https://lore.kernel.org/r/20231006213844.333027-1-robh@kernel.org Signed-off-by: Vinod Koul --- drivers/dma/fsl-edma-main.c | 9 ++------- drivers/dma/mmp_tdma.c | 28 +++++++--------------------- drivers/dma/mv_xor.c | 11 +++-------- drivers/dma/st_fdma.c | 12 +++--------- 4 files changed, 15 insertions(+), 45 deletions(-) diff --git a/drivers/dma/fsl-edma-main.c b/drivers/dma/fsl-edma-main.c index 78ceaa71675f..2638290e4199 100644 --- a/drivers/dma/fsl-edma-main.c +++ b/drivers/dma/fsl-edma-main.c @@ -13,13 +13,11 @@ #include #include #include -#include -#include -#include #include #include #include #include +#include #include "fsl-edma-common.h" @@ -414,8 +412,6 @@ static int fsl_edma3_attach_pd(struct platform_device *pdev, struct fsl_edma_eng static int fsl_edma_probe(struct platform_device *pdev) { - const struct of_device_id *of_id = - of_match_device(fsl_edma_dt_ids, &pdev->dev); struct device_node *np = pdev->dev.of_node; struct fsl_edma_engine *fsl_edma; const struct fsl_edma_drvdata *drvdata = NULL; @@ -424,8 +420,7 @@ static int fsl_edma_probe(struct platform_device *pdev) int chans; int ret, i; - if (of_id) - drvdata = of_id->data; + drvdata = device_get_match_data(&pdev->dev); if (!drvdata) { dev_err(&pdev->dev, "unable to find driver data\n"); return -EINVAL; diff --git a/drivers/dma/mmp_tdma.c b/drivers/dma/mmp_tdma.c index fbde35688121..9fff54b12db7 100644 --- a/drivers/dma/mmp_tdma.c +++ b/drivers/dma/mmp_tdma.c @@ -14,9 +14,9 @@ #include #include #include +#include #include #include -#include #include #include "dmaengine.h" @@ -642,11 +642,7 @@ static int mmp_tdma_probe(struct platform_device *pdev) int chan_num = TDMA_CHANNEL_NUM; struct gen_pool *pool = NULL; - of_id = of_match_device(mmp_tdma_dt_ids, &pdev->dev); - if (of_id) - type = (uintptr_t) of_id->data; - else - type = platform_get_device_id(pdev)->driver_data; + type = (enum mmp_tdma_type)device_get_match_data(&pdev->dev); /* always have couple channels */ tdev = devm_kzalloc(&pdev->dev, sizeof(*tdev), GFP_KERNEL); @@ -724,32 +720,22 @@ static int mmp_tdma_probe(struct platform_device *pdev) return ret; } - if (pdev->dev.of_node) { - ret = of_dma_controller_register(pdev->dev.of_node, - mmp_tdma_xlate, tdev); - if (ret) { - dev_err(tdev->device.dev, - "failed to register controller\n"); - return ret; - } + ret = of_dma_controller_register(pdev->dev.of_node, + mmp_tdma_xlate, tdev); + if (ret) { + dev_err(tdev->device.dev, "failed to register controller\n"); + return ret; } dev_info(tdev->device.dev, "initialized\n"); return 0; } -static const struct platform_device_id mmp_tdma_id_table[] = { - { "mmp-adma", MMP_AUD_TDMA }, - { "pxa910-squ", PXA910_SQU }, - { }, -}; - static struct platform_driver mmp_tdma_driver = { .driver = { .name = "mmp-tdma", .of_match_table = mmp_tdma_dt_ids, }, - .id_table = mmp_tdma_id_table, .probe = mmp_tdma_probe, .remove_new = mmp_tdma_remove, }; diff --git a/drivers/dma/mv_xor.c b/drivers/dma/mv_xor.c index 23b232b57518..bcd3b623ac6c 100644 --- a/drivers/dma/mv_xor.c +++ b/drivers/dma/mv_xor.c @@ -10,8 +10,8 @@ #include #include #include -#include #include +#include #include #include #include @@ -1328,13 +1328,8 @@ static int mv_xor_probe(struct platform_device *pdev) * setting up. In non-dt case it can only be the legacy one. */ xordev->xor_type = XOR_ORION; - if (pdev->dev.of_node) { - const struct of_device_id *of_id = - of_match_device(mv_xor_dt_ids, - &pdev->dev); - - xordev->xor_type = (uintptr_t)of_id->data; - } + if (pdev->dev.of_node) + xordev->xor_type = (uintptr_t)device_get_match_data(&pdev->dev); /* * (Re-)program MBUS remapping windows if we are asked to. diff --git a/drivers/dma/st_fdma.c b/drivers/dma/st_fdma.c index 145bd0f2496e..8880b5e336f8 100644 --- a/drivers/dma/st_fdma.c +++ b/drivers/dma/st_fdma.c @@ -10,9 +10,10 @@ #include #include -#include +#include #include #include +#include #include #include #include @@ -739,18 +740,11 @@ static void st_fdma_free(struct st_fdma_dev *fdev) static int st_fdma_probe(struct platform_device *pdev) { struct st_fdma_dev *fdev; - const struct of_device_id *match; struct device_node *np = pdev->dev.of_node; const struct st_fdma_driverdata *drvdata; int ret, i; - match = of_match_device((st_fdma_match), &pdev->dev); - if (!match || !match->data) { - dev_err(&pdev->dev, "No device match found\n"); - return -ENODEV; - } - - drvdata = match->data; + drvdata = device_get_match_data(&pdev->dev); fdev = devm_kzalloc(&pdev->dev, sizeof(*fdev), GFP_KERNEL); if (!fdev) -- cgit v1.2.3 From c48de45d4cefc5a2f0d0e4101c39884326ac704c Mon Sep 17 00:00:00 2001 From: Rob Herring Date: Fri, 6 Oct 2023 16:38:35 -0500 Subject: dmaengine: Drop unnecessary of_match_device() calls If probe is reached, we've already matched the device and in the case of DT matching, the struct device_node pointer will be set. Therefore, there is no need to call of_match_device() in probe. Signed-off-by: Rob Herring Link: https://lore.kernel.org/r/20231006213835.332848-1-robh@kernel.org Signed-off-by: Vinod Koul --- drivers/dma/k3dma.c | 25 ++++++++++--------------- drivers/dma/mmp_pdma.c | 5 +---- drivers/dma/pxa_dma.c | 7 ++----- drivers/dma/stm32-dma.c | 8 -------- 4 files changed, 13 insertions(+), 32 deletions(-) diff --git a/drivers/dma/k3dma.c b/drivers/dma/k3dma.c index 22b37b525a48..5de8c21d41e7 100644 --- a/drivers/dma/k3dma.c +++ b/drivers/dma/k3dma.c @@ -15,7 +15,6 @@ #include #include #include -#include #include #include #include @@ -839,7 +838,6 @@ static int k3_dma_probe(struct platform_device *op) { const struct k3dma_soc_data *soc_data; struct k3_dma_dev *d; - const struct of_device_id *of_id; int i, ret, irq = 0; d = devm_kzalloc(&op->dev, sizeof(*d), GFP_KERNEL); @@ -854,19 +852,16 @@ static int k3_dma_probe(struct platform_device *op) if (IS_ERR(d->base)) return PTR_ERR(d->base); - of_id = of_match_device(k3_pdma_dt_ids, &op->dev); - if (of_id) { - of_property_read_u32((&op->dev)->of_node, - "dma-channels", &d->dma_channels); - of_property_read_u32((&op->dev)->of_node, - "dma-requests", &d->dma_requests); - ret = of_property_read_u32((&op->dev)->of_node, - "dma-channel-mask", &d->dma_channel_mask); - if (ret) { - dev_warn(&op->dev, - "dma-channel-mask doesn't exist, considering all as available.\n"); - d->dma_channel_mask = (u32)~0UL; - } + of_property_read_u32((&op->dev)->of_node, + "dma-channels", &d->dma_channels); + of_property_read_u32((&op->dev)->of_node, + "dma-requests", &d->dma_requests); + ret = of_property_read_u32((&op->dev)->of_node, + "dma-channel-mask", &d->dma_channel_mask); + if (ret) { + dev_warn(&op->dev, + "dma-channel-mask doesn't exist, considering all as available.\n"); + d->dma_channel_mask = (u32)~0UL; } if (!(soc_data->flags & K3_FLAG_NOCLK)) { diff --git a/drivers/dma/mmp_pdma.c b/drivers/dma/mmp_pdma.c index 492ec491a59b..136fcaeff8dd 100644 --- a/drivers/dma/mmp_pdma.c +++ b/drivers/dma/mmp_pdma.c @@ -15,7 +15,6 @@ #include #include #include -#include #include #include @@ -1019,7 +1018,6 @@ static struct dma_chan *mmp_pdma_dma_xlate(struct of_phandle_args *dma_spec, static int mmp_pdma_probe(struct platform_device *op) { struct mmp_pdma_device *pdev; - const struct of_device_id *of_id; struct mmp_dma_platdata *pdata = dev_get_platdata(&op->dev); int i, ret, irq = 0; int dma_channels = 0, irq_num = 0; @@ -1039,8 +1037,7 @@ static int mmp_pdma_probe(struct platform_device *op) if (IS_ERR(pdev->base)) return PTR_ERR(pdev->base); - of_id = of_match_device(mmp_pdma_dt_ids, pdev->dev); - if (of_id) { + if (pdev->dev->of_node) { /* Parse new and deprecated dma-channels properties */ if (of_property_read_u32(pdev->dev->of_node, "dma-channels", &dma_channels)) diff --git a/drivers/dma/pxa_dma.c b/drivers/dma/pxa_dma.c index c6e2862896e3..31f8da810c05 100644 --- a/drivers/dma/pxa_dma.c +++ b/drivers/dma/pxa_dma.c @@ -15,9 +15,8 @@ #include #include #include -#include -#include #include +#include #include #include @@ -1344,7 +1343,6 @@ static int pxad_init_dmadev(struct platform_device *op, static int pxad_probe(struct platform_device *op) { struct pxad_device *pdev; - const struct of_device_id *of_id; const struct dma_slave_map *slave_map = NULL; struct mmp_dma_platdata *pdata = dev_get_platdata(&op->dev); int ret, dma_channels = 0, nb_requestors = 0, slave_map_cnt = 0; @@ -1362,8 +1360,7 @@ static int pxad_probe(struct platform_device *op) if (IS_ERR(pdev->base)) return PTR_ERR(pdev->base); - of_id = of_match_device(pxad_dt_ids, &op->dev); - if (of_id) { + if (op->dev.of_node) { /* Parse new and deprecated dma-channels properties */ if (of_property_read_u32(op->dev.of_node, "dma-channels", &dma_channels)) diff --git a/drivers/dma/stm32-dma.c b/drivers/dma/stm32-dma.c index a732b3807b11..c8089e77c950 100644 --- a/drivers/dma/stm32-dma.c +++ b/drivers/dma/stm32-dma.c @@ -21,7 +21,6 @@ #include #include #include -#include #include #include #include @@ -1561,17 +1560,10 @@ static int stm32_dma_probe(struct platform_device *pdev) struct stm32_dma_chan *chan; struct stm32_dma_device *dmadev; struct dma_device *dd; - const struct of_device_id *match; struct resource *res; struct reset_control *rst; int i, ret; - match = of_match_device(stm32_dma_of_match, &pdev->dev); - if (!match) { - dev_err(&pdev->dev, "Error: No device match found\n"); - return -ENODEV; - } - dmadev = devm_kzalloc(&pdev->dev, sizeof(*dmadev), GFP_KERNEL); if (!dmadev) return -ENOMEM; -- cgit v1.2.3 From 0db2b6717c5ed1471a639f3af2f650eb9010c732 Mon Sep 17 00:00:00 2001 From: Miquel Raynal Date: Thu, 5 Oct 2023 18:02:36 +0200 Subject: dmaengine: xilinx: xdma: Prepare the introduction of cyclic transfers In order to reduce and clarify the diff when introducing cyclic transfers support, let's first prepare the driver a bit. There is no functional change. Signed-off-by: Miquel Raynal Link: https://lore.kernel.org/r/20231005160237.2804238-3-miquel.raynal@bootlin.com Signed-off-by: Vinod Koul --- drivers/dma/xilinx/xdma.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/drivers/dma/xilinx/xdma.c b/drivers/dma/xilinx/xdma.c index 78a8eef5dcf7..95076d24b202 100644 --- a/drivers/dma/xilinx/xdma.c +++ b/drivers/dma/xilinx/xdma.c @@ -137,10 +137,10 @@ static inline void *xdma_blk_last_desc(struct xdma_desc_block *block) } /** - * xdma_link_desc_blocks - Link descriptor blocks for DMA transfer + * xdma_link_sg_desc_blocks - Link SG descriptor blocks for DMA transfer * @sw_desc: Tx descriptor pointer */ -static void xdma_link_desc_blocks(struct xdma_desc *sw_desc) +static void xdma_link_sg_desc_blocks(struct xdma_desc *sw_desc) { struct xdma_desc_block *block; u32 last_blk_desc, desc_control; @@ -239,6 +239,7 @@ xdma_alloc_desc(struct xdma_chan *chan, u32 desc_num) struct xdma_hw_desc *desc; dma_addr_t dma_addr; u32 dblk_num; + u32 control; void *addr; int i, j; @@ -254,6 +255,8 @@ xdma_alloc_desc(struct xdma_chan *chan, u32 desc_num) if (!sw_desc->desc_blocks) goto failed; + control = XDMA_DESC_CONTROL(1, 0); + sw_desc->dblk_num = dblk_num; for (i = 0; i < sw_desc->dblk_num; i++) { addr = dma_pool_alloc(chan->desc_pool, GFP_NOWAIT, &dma_addr); @@ -263,10 +266,10 @@ xdma_alloc_desc(struct xdma_chan *chan, u32 desc_num) sw_desc->desc_blocks[i].virt_addr = addr; sw_desc->desc_blocks[i].dma_addr = dma_addr; for (j = 0, desc = addr; j < XDMA_DESC_ADJACENT; j++) - desc[j].control = cpu_to_le32(XDMA_DESC_CONTROL(1, 0)); + desc[j].control = cpu_to_le32(control); } - xdma_link_desc_blocks(sw_desc); + xdma_link_sg_desc_blocks(sw_desc); return sw_desc; @@ -577,6 +580,12 @@ static int xdma_alloc_chan_resources(struct dma_chan *chan) return 0; } +static enum dma_status xdma_tx_status(struct dma_chan *chan, dma_cookie_t cookie, + struct dma_tx_state *state) +{ + return dma_cookie_status(chan, cookie, state); +} + /** * xdma_channel_isr - XDMA channel interrupt handler * @irq: IRQ number @@ -923,7 +932,7 @@ static int xdma_probe(struct platform_device *pdev) xdev->dma_dev.dev = &pdev->dev; xdev->dma_dev.device_free_chan_resources = xdma_free_chan_resources; xdev->dma_dev.device_alloc_chan_resources = xdma_alloc_chan_resources; - xdev->dma_dev.device_tx_status = dma_cookie_status; + xdev->dma_dev.device_tx_status = xdma_tx_status; xdev->dma_dev.device_prep_slave_sg = xdma_prep_device_sg; xdev->dma_dev.device_config = xdma_device_config; xdev->dma_dev.device_issue_pending = xdma_issue_pending; -- cgit v1.2.3 From cd8c732ce1a561d62e22a9d8cf5e4737d66b7d5e Mon Sep 17 00:00:00 2001 From: Miquel Raynal Date: Thu, 5 Oct 2023 18:02:37 +0200 Subject: dmaengine: xilinx: xdma: Support cyclic transfers In order to use this dmaengine with sound devices, let's add cyclic transfers support. Most of the code is reused from the existing scatter-gather implementation, only the final linking between descriptors, the control fields (to trigger interrupts more often) and the interrupt handling are really different. This controller supports up to 32 adjacent descriptors, we assume this is way more than enough for the purpose of cyclic transfers and limit to 32 the number of cycled descriptors. This way, we simplify a lot the overall handling of the descriptors. Signed-off-by: Miquel Raynal Link: https://lore.kernel.org/r/20231005160237.2804238-4-miquel.raynal@bootlin.com Signed-off-by: Vinod Koul --- drivers/dma/xilinx/xdma-regs.h | 2 + drivers/dma/xilinx/xdma.c | 166 +++++++++++++++++++++++++++++++++++++++-- 2 files changed, 162 insertions(+), 6 deletions(-) diff --git a/drivers/dma/xilinx/xdma-regs.h b/drivers/dma/xilinx/xdma-regs.h index dd98b4526b90..e641a5083e14 100644 --- a/drivers/dma/xilinx/xdma-regs.h +++ b/drivers/dma/xilinx/xdma-regs.h @@ -44,6 +44,8 @@ FIELD_PREP(XDMA_DESC_FLAGS_BITS, (flag))) #define XDMA_DESC_CONTROL_LAST \ XDMA_DESC_CONTROL(1, XDMA_DESC_STOPPED | XDMA_DESC_COMPLETED) +#define XDMA_DESC_CONTROL_CYCLIC \ + XDMA_DESC_CONTROL(1, XDMA_DESC_COMPLETED) /* * Descriptor for a single contiguous memory block transfer. diff --git a/drivers/dma/xilinx/xdma.c b/drivers/dma/xilinx/xdma.c index 95076d24b202..84a88029226f 100644 --- a/drivers/dma/xilinx/xdma.c +++ b/drivers/dma/xilinx/xdma.c @@ -83,6 +83,9 @@ struct xdma_chan { * @dblk_num: Number of hardware descriptor blocks * @desc_num: Number of hardware descriptors * @completed_desc_num: Completed hardware descriptors + * @cyclic: Cyclic transfer vs. scatter-gather + * @periods: Number of periods in the cyclic transfer + * @period_size: Size of a period in bytes in cyclic transfers */ struct xdma_desc { struct virt_dma_desc vdesc; @@ -93,6 +96,9 @@ struct xdma_desc { u32 dblk_num; u32 desc_num; u32 completed_desc_num; + bool cyclic; + u32 periods; + u32 period_size; }; #define XDMA_DEV_STATUS_REG_DMA BIT(0) @@ -174,6 +180,25 @@ static void xdma_link_sg_desc_blocks(struct xdma_desc *sw_desc) desc->control = cpu_to_le32(XDMA_DESC_CONTROL_LAST); } +/** + * xdma_link_cyclic_desc_blocks - Link cyclic descriptor blocks for DMA transfer + * @sw_desc: Tx descriptor pointer + */ +static void xdma_link_cyclic_desc_blocks(struct xdma_desc *sw_desc) +{ + struct xdma_desc_block *block; + struct xdma_hw_desc *desc; + int i; + + block = sw_desc->desc_blocks; + for (i = 0; i < sw_desc->desc_num - 1; i++) { + desc = block->virt_addr + i * XDMA_DESC_SIZE; + desc->next_desc = cpu_to_le64(block->dma_addr + ((i + 1) * XDMA_DESC_SIZE)); + } + desc = block->virt_addr + i * XDMA_DESC_SIZE; + desc->next_desc = cpu_to_le64(block->dma_addr); +} + static inline struct xdma_chan *to_xdma_chan(struct dma_chan *chan) { return container_of(chan, struct xdma_chan, vchan.chan); @@ -231,9 +256,10 @@ static void xdma_free_desc(struct virt_dma_desc *vdesc) * xdma_alloc_desc - Allocate descriptor * @chan: DMA channel pointer * @desc_num: Number of hardware descriptors + * @cyclic: Whether this is a cyclic transfer */ static struct xdma_desc * -xdma_alloc_desc(struct xdma_chan *chan, u32 desc_num) +xdma_alloc_desc(struct xdma_chan *chan, u32 desc_num, bool cyclic) { struct xdma_desc *sw_desc; struct xdma_hw_desc *desc; @@ -249,13 +275,17 @@ xdma_alloc_desc(struct xdma_chan *chan, u32 desc_num) sw_desc->chan = chan; sw_desc->desc_num = desc_num; + sw_desc->cyclic = cyclic; dblk_num = DIV_ROUND_UP(desc_num, XDMA_DESC_ADJACENT); sw_desc->desc_blocks = kcalloc(dblk_num, sizeof(*sw_desc->desc_blocks), GFP_NOWAIT); if (!sw_desc->desc_blocks) goto failed; - control = XDMA_DESC_CONTROL(1, 0); + if (cyclic) + control = XDMA_DESC_CONTROL_CYCLIC; + else + control = XDMA_DESC_CONTROL(1, 0); sw_desc->dblk_num = dblk_num; for (i = 0; i < sw_desc->dblk_num; i++) { @@ -269,7 +299,10 @@ xdma_alloc_desc(struct xdma_chan *chan, u32 desc_num) desc[j].control = cpu_to_le32(control); } - xdma_link_sg_desc_blocks(sw_desc); + if (cyclic) + xdma_link_cyclic_desc_blocks(sw_desc); + else + xdma_link_sg_desc_blocks(sw_desc); return sw_desc; @@ -469,7 +502,7 @@ xdma_prep_device_sg(struct dma_chan *chan, struct scatterlist *sgl, for_each_sg(sgl, sg, sg_len, i) desc_num += DIV_ROUND_UP(sg_dma_len(sg), XDMA_DESC_BLEN_MAX); - sw_desc = xdma_alloc_desc(xdma_chan, desc_num); + sw_desc = xdma_alloc_desc(xdma_chan, desc_num, false); if (!sw_desc) return NULL; sw_desc->dir = dir; @@ -524,6 +557,81 @@ failed: return NULL; } +/** + * xdma_prep_dma_cyclic - prepare for cyclic DMA transactions + * @chan: DMA channel pointer + * @address: Device DMA address to access + * @size: Total length to transfer + * @period_size: Period size to use for each transfer + * @dir: Transfer direction + * @flags: Transfer ack flags + */ +static struct dma_async_tx_descriptor * +xdma_prep_dma_cyclic(struct dma_chan *chan, dma_addr_t address, + size_t size, size_t period_size, + enum dma_transfer_direction dir, + unsigned long flags) +{ + struct xdma_chan *xdma_chan = to_xdma_chan(chan); + struct xdma_device *xdev = xdma_chan->xdev_hdl; + unsigned int periods = size / period_size; + struct dma_async_tx_descriptor *tx_desc; + struct xdma_desc_block *dblk; + struct xdma_hw_desc *desc; + struct xdma_desc *sw_desc; + unsigned int i; + + /* + * Simplify the whole logic by preventing an abnormally high number of + * periods and periods size. + */ + if (period_size > XDMA_DESC_BLEN_MAX) { + xdma_err(xdev, "period size limited to %lu bytes\n", XDMA_DESC_BLEN_MAX); + return NULL; + } + + if (periods > XDMA_DESC_ADJACENT) { + xdma_err(xdev, "number of periods limited to %u\n", XDMA_DESC_ADJACENT); + return NULL; + } + + sw_desc = xdma_alloc_desc(xdma_chan, periods, true); + if (!sw_desc) + return NULL; + + sw_desc->periods = periods; + sw_desc->period_size = period_size; + sw_desc->dir = dir; + + dblk = sw_desc->desc_blocks; + desc = dblk->virt_addr; + + /* fill hardware descriptor */ + for (i = 0; i < periods; i++) { + desc->bytes = cpu_to_le32(period_size); + if (dir == DMA_MEM_TO_DEV) { + desc->src_addr = cpu_to_le64(address + i * period_size); + desc->dst_addr = cpu_to_le64(xdma_chan->cfg.dst_addr); + } else { + desc->src_addr = cpu_to_le64(xdma_chan->cfg.src_addr); + desc->dst_addr = cpu_to_le64(address + i * period_size); + } + + desc++; + } + + tx_desc = vchan_tx_prep(&xdma_chan->vchan, &sw_desc->vdesc, flags); + if (!tx_desc) + goto failed; + + return tx_desc; + +failed: + xdma_free_desc(&sw_desc->vdesc); + + return NULL; +} + /** * xdma_device_config - Configure the DMA channel * @chan: DMA channel @@ -583,7 +691,36 @@ static int xdma_alloc_chan_resources(struct dma_chan *chan) static enum dma_status xdma_tx_status(struct dma_chan *chan, dma_cookie_t cookie, struct dma_tx_state *state) { - return dma_cookie_status(chan, cookie, state); + struct xdma_chan *xdma_chan = to_xdma_chan(chan); + struct xdma_desc *desc = NULL; + struct virt_dma_desc *vd; + enum dma_status ret; + unsigned long flags; + unsigned int period_idx; + u32 residue = 0; + + ret = dma_cookie_status(chan, cookie, state); + if (ret == DMA_COMPLETE) + return ret; + + spin_lock_irqsave(&xdma_chan->vchan.lock, flags); + + vd = vchan_find_desc(&xdma_chan->vchan, cookie); + if (vd) + desc = to_xdma_desc(vd); + if (!desc || !desc->cyclic) { + spin_unlock_irqrestore(&xdma_chan->vchan.lock, flags); + return ret; + } + + period_idx = desc->completed_desc_num % desc->periods; + residue = (desc->periods - period_idx) * desc->period_size; + + spin_unlock_irqrestore(&xdma_chan->vchan.lock, flags); + + dma_set_residue(state, residue); + + return ret; } /** @@ -599,6 +736,7 @@ static irqreturn_t xdma_channel_isr(int irq, void *dev_id) struct virt_dma_desc *vd; struct xdma_desc *desc; int ret; + u32 st; spin_lock(&xchan->vchan.lock); @@ -617,6 +755,19 @@ static irqreturn_t xdma_channel_isr(int irq, void *dev_id) goto out; desc->completed_desc_num += complete_desc_num; + + if (desc->cyclic) { + ret = regmap_read(xdev->rmap, xchan->base + XDMA_CHAN_STATUS, + &st); + if (ret) + goto out; + + regmap_write(xdev->rmap, xchan->base + XDMA_CHAN_STATUS, st); + + vchan_cyclic_callback(vd); + goto out; + } + /* * if all data blocks are transferred, remove and complete the request */ @@ -630,7 +781,7 @@ static irqreturn_t xdma_channel_isr(int irq, void *dev_id) complete_desc_num != XDMA_DESC_BLOCK_NUM * XDMA_DESC_ADJACENT) goto out; - /* transfer the rest of data */ + /* transfer the rest of data (SG only) */ xdma_xfer_start(xchan); out: @@ -928,8 +1079,10 @@ static int xdma_probe(struct platform_device *pdev) dma_cap_set(DMA_SLAVE, xdev->dma_dev.cap_mask); dma_cap_set(DMA_PRIVATE, xdev->dma_dev.cap_mask); + dma_cap_set(DMA_CYCLIC, xdev->dma_dev.cap_mask); xdev->dma_dev.dev = &pdev->dev; + xdev->dma_dev.residue_granularity = DMA_RESIDUE_GRANULARITY_SEGMENT; xdev->dma_dev.device_free_chan_resources = xdma_free_chan_resources; xdev->dma_dev.device_alloc_chan_resources = xdma_alloc_chan_resources; xdev->dma_dev.device_tx_status = xdma_tx_status; @@ -939,6 +1092,7 @@ static int xdma_probe(struct platform_device *pdev) xdev->dma_dev.filter.map = pdata->device_map; xdev->dma_dev.filter.mapcnt = pdata->device_map_cnt; xdev->dma_dev.filter.fn = xdma_filter_fn; + xdev->dma_dev.device_prep_dma_cyclic = xdma_prep_dma_cyclic; ret = dma_async_device_register(&xdev->dma_dev); if (ret) { -- cgit v1.2.3 From 9f895354cc3cf4fbff21c922a5721691ed40589d Mon Sep 17 00:00:00 2001 From: Frank Li Date: Wed, 4 Oct 2023 10:32:28 -0400 Subject: MAINTAINERS: Add entries for NXP(Freescale) eDMA drivers Add the MAINTAINERS entries for NXP(Freescale) eDMA drivers Acked-by: Randy Dunlap Signed-off-by: Frank Li Link: https://lore.kernel.org/r/20231004143228.839288-1-Frank.Li@nxp.com Signed-off-by: Vinod Koul --- MAINTAINERS | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index 90f13281d297..84c2964ad0b6 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -8238,6 +8238,14 @@ F: Documentation/devicetree/bindings/spi/spi-fsl-dspi.txt F: drivers/spi/spi-fsl-dspi.c F: include/linux/spi/spi-fsl-dspi.h +FREESCALE eDMA DRIVER +M: Frank Li +L: imx@lists.linux.dev +L: dmaengine@vger.kernel.org +S: Maintained +F: Documentation/devicetree/bindings/dma/fsl,edma.yaml +F: drivers/dma/fsl-edma*.* + FREESCALE ENETC ETHERNET DRIVERS M: Claudiu Manoil M: Vladimir Oltean -- cgit v1.2.3 From 8bf914570650ec5858e18554d70d2838cef01de1 Mon Sep 17 00:00:00 2001 From: Vinod Koul Date: Tue, 10 Oct 2023 12:27:29 +0530 Subject: dmaengine: mmp_tdma: drop unused variable 'of_id' Recent change a67ba97dfb30 ("dmaengine: Use device_get_match_data()") cleaned up device tree data calls but left an unused variable, so drop that Reported-by: Stephen Rothwell Fixes: a67ba97dfb30 ("dmaengine: Use device_get_match_data()") Signed-off-by: Vinod Koul Link: https://lore.kernel.org/r/20231010065729.29385-1-vkoul@kernel.org Signed-off-by: Vinod Koul --- drivers/dma/mmp_tdma.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/dma/mmp_tdma.c b/drivers/dma/mmp_tdma.c index 9fff54b12db7..b76fe99e1151 100644 --- a/drivers/dma/mmp_tdma.c +++ b/drivers/dma/mmp_tdma.c @@ -635,7 +635,6 @@ MODULE_DEVICE_TABLE(of, mmp_tdma_dt_ids); static int mmp_tdma_probe(struct platform_device *pdev) { enum mmp_tdma_type type; - const struct of_device_id *of_id; struct mmp_tdma_device *tdev; int i, ret; int irq = 0, irq_num = 0; -- cgit v1.2.3 From c1939c2f76d7971b0a02cad0d1d1e9d44ac37cfc Mon Sep 17 00:00:00 2001 From: Uwe Kleine-König Date: Sat, 14 Oct 2023 23:16:57 +0200 Subject: dmaengine: xilinx: xilinx_dma: Fix kernel doc about xilinx_dma_remove() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Since commit cc99582d46b4 ("dmaengine: xilinx: xilinx_dma: Convert to platform remove callback returning void") xilinx_dma_remove() doesn't return zero any more. As the function has no return value any more, just drop the statement about the return value. Reported-by: Radhey Shyam Pandey Signed-off-by: Uwe Kleine-König Link: https://lore.kernel.org/r/20231014211656.1512016-2-u.kleine-koenig@pengutronix.de Signed-off-by: Vinod Koul --- drivers/dma/xilinx/xilinx_dma.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/dma/xilinx/xilinx_dma.c b/drivers/dma/xilinx/xilinx_dma.c index 0c363a1ed853..e40696f6f864 100644 --- a/drivers/dma/xilinx/xilinx_dma.c +++ b/drivers/dma/xilinx/xilinx_dma.c @@ -3242,8 +3242,6 @@ disable_clks: /** * xilinx_dma_remove - Driver remove function * @pdev: Pointer to the platform_device structure - * - * Return: Always '0' */ static void xilinx_dma_remove(struct platform_device *pdev) { -- cgit v1.2.3 From 495e18b16e3dd8218eaec6a8a55334fb55245d59 Mon Sep 17 00:00:00 2001 From: Sergey Khimich Date: Tue, 10 Oct 2023 13:14:50 +0300 Subject: dmaengine: dw-axi-dmac: Add support DMAX_NUM_CHANNELS > 16 Added support for DMA controller with more than 16 channels. Signed-off-by: Sergey Khimich Link: https://lore.kernel.org/r/20231010101450.2949126-2-serghox@gmail.com Signed-off-by: Vinod Koul --- drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c | 156 ++++++++++++++++++------- drivers/dma/dw-axi-dmac/dw-axi-dmac.h | 6 +- 2 files changed, 120 insertions(+), 42 deletions(-) diff --git a/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c b/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c index 974da2fda2e4..a86a81ff0caa 100644 --- a/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c +++ b/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c @@ -62,6 +62,17 @@ static inline u32 axi_dma_ioread32(struct axi_dma_chip *chip, u32 reg) return ioread32(chip->regs + reg); } +static inline void +axi_dma_iowrite64(struct axi_dma_chip *chip, u32 reg, u64 val) +{ + iowrite64(val, chip->regs + reg); +} + +static inline u64 axi_dma_ioread64(struct axi_dma_chip *chip, u32 reg) +{ + return ioread64(chip->regs + reg); +} + static inline void axi_chan_iowrite32(struct axi_dma_chan *chan, u32 reg, u32 val) { @@ -182,38 +193,73 @@ static inline u32 axi_chan_irq_read(struct axi_dma_chan *chan) static inline void axi_chan_disable(struct axi_dma_chan *chan) { - u32 val; - - val = axi_dma_ioread32(chan->chip, DMAC_CHEN); - val &= ~(BIT(chan->id) << DMAC_CHAN_EN_SHIFT); - if (chan->chip->dw->hdata->reg_map_8_channels) - val |= BIT(chan->id) << DMAC_CHAN_EN_WE_SHIFT; - else - val |= BIT(chan->id) << DMAC_CHAN_EN2_WE_SHIFT; - axi_dma_iowrite32(chan->chip, DMAC_CHEN, val); + u64 val; + + if (chan->chip->dw->hdata->nr_channels >= DMAC_CHAN_16) { + val = axi_dma_ioread64(chan->chip, DMAC_CHEN); + if (chan->id >= DMAC_CHAN_16) { + val &= ~((u64)(BIT(chan->id) >> DMAC_CHAN_16) + << (DMAC_CHAN_EN_SHIFT + DMAC_CHAN_BLOCK_SHIFT)); + val |= (u64)(BIT(chan->id) >> DMAC_CHAN_16) + << (DMAC_CHAN_EN2_WE_SHIFT + DMAC_CHAN_BLOCK_SHIFT); + } else { + val &= ~(BIT(chan->id) << DMAC_CHAN_EN_SHIFT); + val |= BIT(chan->id) << DMAC_CHAN_EN2_WE_SHIFT; + } + axi_dma_iowrite64(chan->chip, DMAC_CHEN, val); + } else { + val = axi_dma_ioread32(chan->chip, DMAC_CHEN); + val &= ~(BIT(chan->id) << DMAC_CHAN_EN_SHIFT); + if (chan->chip->dw->hdata->reg_map_8_channels) + val |= BIT(chan->id) << DMAC_CHAN_EN_WE_SHIFT; + else + val |= BIT(chan->id) << DMAC_CHAN_EN2_WE_SHIFT; + axi_dma_iowrite32(chan->chip, DMAC_CHEN, (u32)val); + } } static inline void axi_chan_enable(struct axi_dma_chan *chan) { - u32 val; - - val = axi_dma_ioread32(chan->chip, DMAC_CHEN); - if (chan->chip->dw->hdata->reg_map_8_channels) - val |= BIT(chan->id) << DMAC_CHAN_EN_SHIFT | - BIT(chan->id) << DMAC_CHAN_EN_WE_SHIFT; - else - val |= BIT(chan->id) << DMAC_CHAN_EN_SHIFT | + u64 val; + + if (chan->chip->dw->hdata->nr_channels >= DMAC_CHAN_16) { + val = axi_dma_ioread64(chan->chip, DMAC_CHEN); + if (chan->id >= DMAC_CHAN_16) { + val |= (u64)(BIT(chan->id) >> DMAC_CHAN_16) + << (DMAC_CHAN_EN_SHIFT + DMAC_CHAN_BLOCK_SHIFT) | + (u64)(BIT(chan->id) >> DMAC_CHAN_16) + << (DMAC_CHAN_EN2_WE_SHIFT + DMAC_CHAN_BLOCK_SHIFT); + } else { + val |= BIT(chan->id) << DMAC_CHAN_EN_SHIFT | BIT(chan->id) << DMAC_CHAN_EN2_WE_SHIFT; - axi_dma_iowrite32(chan->chip, DMAC_CHEN, val); + } + axi_dma_iowrite64(chan->chip, DMAC_CHEN, val); + } else { + val = axi_dma_ioread32(chan->chip, DMAC_CHEN); + if (chan->chip->dw->hdata->reg_map_8_channels) { + val |= BIT(chan->id) << DMAC_CHAN_EN_SHIFT | + BIT(chan->id) << DMAC_CHAN_EN_WE_SHIFT; + } else { + val |= BIT(chan->id) << DMAC_CHAN_EN_SHIFT | + BIT(chan->id) << DMAC_CHAN_EN2_WE_SHIFT; + } + axi_dma_iowrite32(chan->chip, DMAC_CHEN, (u32)val); + } } static inline bool axi_chan_is_hw_enable(struct axi_dma_chan *chan) { - u32 val; + u64 val; - val = axi_dma_ioread32(chan->chip, DMAC_CHEN); + if (chan->chip->dw->hdata->nr_channels >= DMAC_CHAN_16) + val = axi_dma_ioread64(chan->chip, DMAC_CHEN); + else + val = axi_dma_ioread32(chan->chip, DMAC_CHEN); - return !!(val & (BIT(chan->id) << DMAC_CHAN_EN_SHIFT)); + if (chan->id >= DMAC_CHAN_16) + return !!(val & ((u64)(BIT(chan->id) >> DMAC_CHAN_16) << DMAC_CHAN_BLOCK_SHIFT)); + else + return !!(val & (BIT(chan->id) << DMAC_CHAN_EN_SHIFT)); } static void axi_dma_hw_init(struct axi_dma_chip *chip) @@ -1175,20 +1221,34 @@ static int dma_chan_pause(struct dma_chan *dchan) struct axi_dma_chan *chan = dchan_to_axi_dma_chan(dchan); unsigned long flags; unsigned int timeout = 20; /* timeout iterations */ - u32 val; + u64 val; spin_lock_irqsave(&chan->vc.lock, flags); - if (chan->chip->dw->hdata->reg_map_8_channels) { - val = axi_dma_ioread32(chan->chip, DMAC_CHEN); - val |= BIT(chan->id) << DMAC_CHAN_SUSP_SHIFT | - BIT(chan->id) << DMAC_CHAN_SUSP_WE_SHIFT; - axi_dma_iowrite32(chan->chip, DMAC_CHEN, val); + if (chan->chip->dw->hdata->nr_channels >= DMAC_CHAN_16) { + val = axi_dma_ioread64(chan->chip, DMAC_CHSUSPREG); + if (chan->id >= DMAC_CHAN_16) { + val |= (u64)(BIT(chan->id) >> DMAC_CHAN_16) + << (DMAC_CHAN_SUSP2_SHIFT + DMAC_CHAN_BLOCK_SHIFT) | + (u64)(BIT(chan->id) >> DMAC_CHAN_16) + << (DMAC_CHAN_SUSP2_WE_SHIFT + DMAC_CHAN_BLOCK_SHIFT); + } else { + val |= BIT(chan->id) << DMAC_CHAN_SUSP2_SHIFT | + BIT(chan->id) << DMAC_CHAN_SUSP2_WE_SHIFT; + } + axi_dma_iowrite64(chan->chip, DMAC_CHSUSPREG, val); } else { - val = axi_dma_ioread32(chan->chip, DMAC_CHSUSPREG); - val |= BIT(chan->id) << DMAC_CHAN_SUSP2_SHIFT | + if (chan->chip->dw->hdata->reg_map_8_channels) { + val = axi_dma_ioread32(chan->chip, DMAC_CHEN); + val |= BIT(chan->id) << DMAC_CHAN_SUSP_SHIFT | + BIT(chan->id) << DMAC_CHAN_SUSP_WE_SHIFT; + axi_dma_iowrite32(chan->chip, DMAC_CHEN, (u32)val); + } else { + val = axi_dma_ioread32(chan->chip, DMAC_CHSUSPREG); + val |= BIT(chan->id) << DMAC_CHAN_SUSP2_SHIFT | BIT(chan->id) << DMAC_CHAN_SUSP2_WE_SHIFT; - axi_dma_iowrite32(chan->chip, DMAC_CHSUSPREG, val); + axi_dma_iowrite32(chan->chip, DMAC_CHSUSPREG, (u32)val); + } } do { @@ -1210,18 +1270,32 @@ static int dma_chan_pause(struct dma_chan *dchan) /* Called in chan locked context */ static inline void axi_chan_resume(struct axi_dma_chan *chan) { - u32 val; - - if (chan->chip->dw->hdata->reg_map_8_channels) { - val = axi_dma_ioread32(chan->chip, DMAC_CHEN); - val &= ~(BIT(chan->id) << DMAC_CHAN_SUSP_SHIFT); - val |= (BIT(chan->id) << DMAC_CHAN_SUSP_WE_SHIFT); - axi_dma_iowrite32(chan->chip, DMAC_CHEN, val); + u64 val; + + if (chan->chip->dw->hdata->nr_channels >= DMAC_CHAN_16) { + val = axi_dma_ioread64(chan->chip, DMAC_CHSUSPREG); + if (chan->id >= DMAC_CHAN_16) { + val &= ~((u64)(BIT(chan->id) >> DMAC_CHAN_16) + << (DMAC_CHAN_SUSP2_SHIFT + DMAC_CHAN_BLOCK_SHIFT)); + val |= ((u64)(BIT(chan->id) >> DMAC_CHAN_16) + << (DMAC_CHAN_SUSP2_WE_SHIFT + DMAC_CHAN_BLOCK_SHIFT)); + } else { + val &= ~(BIT(chan->id) << DMAC_CHAN_SUSP2_SHIFT); + val |= (BIT(chan->id) << DMAC_CHAN_SUSP2_WE_SHIFT); + } + axi_dma_iowrite64(chan->chip, DMAC_CHSUSPREG, val); } else { - val = axi_dma_ioread32(chan->chip, DMAC_CHSUSPREG); - val &= ~(BIT(chan->id) << DMAC_CHAN_SUSP2_SHIFT); - val |= (BIT(chan->id) << DMAC_CHAN_SUSP2_WE_SHIFT); - axi_dma_iowrite32(chan->chip, DMAC_CHSUSPREG, val); + if (chan->chip->dw->hdata->reg_map_8_channels) { + val = axi_dma_ioread32(chan->chip, DMAC_CHEN); + val &= ~(BIT(chan->id) << DMAC_CHAN_SUSP_SHIFT); + val |= (BIT(chan->id) << DMAC_CHAN_SUSP_WE_SHIFT); + axi_dma_iowrite32(chan->chip, DMAC_CHEN, (u32)val); + } else { + val = axi_dma_ioread32(chan->chip, DMAC_CHSUSPREG); + val &= ~(BIT(chan->id) << DMAC_CHAN_SUSP2_SHIFT); + val |= (BIT(chan->id) << DMAC_CHAN_SUSP2_WE_SHIFT); + axi_dma_iowrite32(chan->chip, DMAC_CHSUSPREG, (u32)val); + } } chan->is_paused = false; diff --git a/drivers/dma/dw-axi-dmac/dw-axi-dmac.h b/drivers/dma/dw-axi-dmac/dw-axi-dmac.h index eb267cb24f67..454904d99654 100644 --- a/drivers/dma/dw-axi-dmac/dw-axi-dmac.h +++ b/drivers/dma/dw-axi-dmac/dw-axi-dmac.h @@ -18,7 +18,7 @@ #include "../virt-dma.h" -#define DMAC_MAX_CHANNELS 16 +#define DMAC_MAX_CHANNELS 32 #define DMAC_MAX_MASTERS 2 #define DMAC_MAX_BLK_SIZE 0x200000 @@ -222,6 +222,10 @@ static inline struct axi_dma_chan *dchan_to_axi_dma_chan(struct dma_chan *dchan) /* DMAC_CHEN2 */ #define DMAC_CHAN_EN2_WE_SHIFT 16 +/* DMAC CHAN BLOCKS */ +#define DMAC_CHAN_BLOCK_SHIFT 32 +#define DMAC_CHAN_16 16 + /* DMAC_CHSUSP */ #define DMAC_CHAN_SUSP2_SHIFT 0 #define DMAC_CHAN_SUSP2_WE_SHIFT 16 -- cgit v1.2.3 From 03f25d53b145bc2f7ccc82fc04e4482ed734f524 Mon Sep 17 00:00:00 2001 From: Alain Volmat Date: Mon, 9 Oct 2023 10:24:50 +0200 Subject: dmaengine: stm32-mdma: correct desc prep when channel running In case of the prep descriptor while the channel is already running, the CCR register value stored into the channel could already have its EN bit set. This would lead to a bad transfer since, at start transfer time, enabling the channel while other registers aren't yet properly set. To avoid this, ensure to mask the CCR_EN bit when storing the ccr value into the mdma channel structure. Fixes: a4ffb13c8946 ("dmaengine: Add STM32 MDMA driver") Signed-off-by: Alain Volmat Signed-off-by: Amelie Delaunay Cc: stable@vger.kernel.org Tested-by: Alain Volmat Link: https://lore.kernel.org/r/20231009082450.452877-1-amelie.delaunay@foss.st.com Signed-off-by: Vinod Koul --- drivers/dma/stm32-mdma.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/dma/stm32-mdma.c b/drivers/dma/stm32-mdma.c index 0c7d2295856e..264abfb54a8e 100644 --- a/drivers/dma/stm32-mdma.c +++ b/drivers/dma/stm32-mdma.c @@ -488,7 +488,7 @@ static int stm32_mdma_set_xfer_param(struct stm32_mdma_chan *chan, src_maxburst = chan->dma_config.src_maxburst; dst_maxburst = chan->dma_config.dst_maxburst; - ccr = stm32_mdma_read(dmadev, STM32_MDMA_CCR(chan->id)); + ccr = stm32_mdma_read(dmadev, STM32_MDMA_CCR(chan->id)) & ~STM32_MDMA_CCR_EN; ctcr = stm32_mdma_read(dmadev, STM32_MDMA_CTCR(chan->id)); ctbr = stm32_mdma_read(dmadev, STM32_MDMA_CTBR(chan->id)); @@ -966,7 +966,7 @@ stm32_mdma_prep_dma_memcpy(struct dma_chan *c, dma_addr_t dest, dma_addr_t src, if (!desc) return NULL; - ccr = stm32_mdma_read(dmadev, STM32_MDMA_CCR(chan->id)); + ccr = stm32_mdma_read(dmadev, STM32_MDMA_CCR(chan->id)) & ~STM32_MDMA_CCR_EN; ctcr = stm32_mdma_read(dmadev, STM32_MDMA_CTCR(chan->id)); ctbr = stm32_mdma_read(dmadev, STM32_MDMA_CTBR(chan->id)); cbndtr = stm32_mdma_read(dmadev, STM32_MDMA_CBNDTR(chan->id)); -- cgit v1.2.3