From fa13c3ef3f45bca5a1474755dac57bfaf28ef61b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= 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(-) (limited to 'drivers/dma/fsl-edma-main.c') 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 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(-) (limited to 'drivers/dma/fsl-edma-main.c') 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 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 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'drivers/dma/fsl-edma-main.c') 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; -- cgit v1.2.3