* [PATCH v2 0/7] dmaengine:Use devm_clk_get_enabled() helpers
@ 2024-08-30 9:41 Liao Yuanhong
2024-08-30 9:41 ` [PATCH v2 1/7] dmaengine:Add COMPILE_TEST for easy testing Liao Yuanhong
` (7 more replies)
0 siblings, 8 replies; 16+ messages in thread
From: Liao Yuanhong @ 2024-08-30 9:41 UTC (permalink / raw)
To: vkoul; +Cc: dmaengine, linux-arm-kernel, linux-kernel, imx, Liao Yuanhong
The devm_clk_get_enabled() helpers:
- call devm_clk_get()
- call clk_prepare_enable() and register what is needed in order to
call clk_disable_unprepare() when needed, as a managed resource.
This simplifies the code and avoids the calls to clk_disable_unprepare().
---
v2:remove inappropriate modifications, configure COMPILE_TEST for easy
testing, add devm_clk_getprepaed() for imx sdma device.
---
Liao Yuanhong (7):
dmaengine:Add COMPILE_TEST for easy testing
dmaengine:at_hdmac:Use devm_clk_get_enabled() helpers
dmaengine:dma-jz4780:Use devm_clk_get_enabled() helpers
dmaengine:imx-dma:Use devm_clk_get_enabled() helpers
dmaengine:imx-sdma:Use devm_clk_get_prepared() helpers
dmaengine:milbeaut-hdmac:Use devm_clk_get_enabled() helpers
dmaengine:uniphier-mdmac:Use devm_clk_get_enabled() helpers
drivers/dma/Kconfig | 6 ++--
drivers/dma/at_hdmac.c | 16 ++--------
drivers/dma/dma-jz4780.c | 18 ++++-------
drivers/dma/imx-dma.c | 59 ++++++++++++------------------------
drivers/dma/imx-sdma.c | 22 +++-----------
drivers/dma/milbeaut-hdmac.c | 20 ++++--------
drivers/dma/uniphier-mdmac.c | 20 ++++--------
7 files changed, 47 insertions(+), 114 deletions(-)
--
2.25.1
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH v2 1/7] dmaengine:Add COMPILE_TEST for easy testing
2024-08-30 9:41 [PATCH v2 0/7] dmaengine:Use devm_clk_get_enabled() helpers Liao Yuanhong
@ 2024-08-30 9:41 ` Liao Yuanhong
2024-08-30 17:44 ` Krzysztof Kozlowski
` (2 more replies)
2024-08-30 9:41 ` [PATCH v2 2/7] dmaengine:at_hdmac:Use devm_clk_get_enabled() helpers Liao Yuanhong
` (6 subsequent siblings)
7 siblings, 3 replies; 16+ messages in thread
From: Liao Yuanhong @ 2024-08-30 9:41 UTC (permalink / raw)
To: vkoul; +Cc: dmaengine, linux-arm-kernel, linux-kernel, imx, Liao Yuanhong
Add COMPILE_TEST configuration for at-hdmac, imx-dma, imx-sdma
devices for easy debugging.
Signed-off-by: Liao Yuanhong <liaoyuanhong@vivo.com>
---
drivers/dma/Kconfig | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/dma/Kconfig b/drivers/dma/Kconfig
index cc0a62c34861..ca1ae677e0fa 100644
--- a/drivers/dma/Kconfig
+++ b/drivers/dma/Kconfig
@@ -95,7 +95,7 @@ config APPLE_ADMAC
config AT_HDMAC
tristate "Atmel AHB DMA support"
- depends on ARCH_AT91
+ depends on ARCH_AT91 || COMPILE_TEST
select DMA_ENGINE
select DMA_VIRTUAL_CHANNELS
help
@@ -264,7 +264,7 @@ config IMG_MDC_DMA
config IMX_DMA
tristate "i.MX DMA support"
- depends on ARCH_MXC
+ depends on ARCH_MXC || COMPILE_TEST
select DMA_ENGINE
help
Support the i.MX DMA engine. This engine is integrated into
@@ -272,7 +272,7 @@ config IMX_DMA
config IMX_SDMA
tristate "i.MX SDMA support"
- depends on ARCH_MXC
+ depends on ARCH_MXC || COMPILE_TEST
select DMA_ENGINE
select DMA_VIRTUAL_CHANNELS
help
--
2.25.1
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH v2 2/7] dmaengine:at_hdmac:Use devm_clk_get_enabled() helpers
2024-08-30 9:41 [PATCH v2 0/7] dmaengine:Use devm_clk_get_enabled() helpers Liao Yuanhong
2024-08-30 9:41 ` [PATCH v2 1/7] dmaengine:Add COMPILE_TEST for easy testing Liao Yuanhong
@ 2024-08-30 9:41 ` Liao Yuanhong
2024-08-30 12:24 ` Nicolas Ferre
2024-08-30 9:41 ` [PATCH v2 3/7] dmaengine:dma-jz4780:Use " Liao Yuanhong
` (5 subsequent siblings)
7 siblings, 1 reply; 16+ messages in thread
From: Liao Yuanhong @ 2024-08-30 9:41 UTC (permalink / raw)
To: vkoul; +Cc: dmaengine, linux-arm-kernel, linux-kernel, imx, Liao Yuanhong
Use devm_clk_get_enabled() instead of clk functions in at_hdmac.
Signed-off-by: Liao Yuanhong <liaoyuanhong@vivo.com>
---
v2:remove modifications related to the resume operation.
---
drivers/dma/at_hdmac.c | 16 ++--------------
1 file changed, 2 insertions(+), 14 deletions(-)
diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c
index 40052d1bd0b5..2274aeb58271 100644
--- a/drivers/dma/at_hdmac.c
+++ b/drivers/dma/at_hdmac.c
@@ -1975,20 +1975,16 @@ static int __init at_dma_probe(struct platform_device *pdev)
atdma->dma_device.cap_mask = plat_dat->cap_mask;
atdma->all_chan_mask = (1 << plat_dat->nr_channels) - 1;
- atdma->clk = devm_clk_get(&pdev->dev, "dma_clk");
+ atdma->clk = devm_clk_get_enabled(&pdev->dev, "dma_clk");
if (IS_ERR(atdma->clk))
return PTR_ERR(atdma->clk);
- err = clk_prepare_enable(atdma->clk);
- if (err)
- return err;
-
/* force dma off, just in case */
at_dma_off(atdma);
err = request_irq(irq, at_dma_interrupt, 0, "at_hdmac", atdma);
if (err)
- goto err_irq;
+ return err;
platform_set_drvdata(pdev, atdma);
@@ -2105,8 +2101,6 @@ static int __init at_dma_probe(struct platform_device *pdev)
dma_pool_destroy(atdma->lli_pool);
err_desc_pool_create:
free_irq(platform_get_irq(pdev, 0), atdma);
-err_irq:
- clk_disable_unprepare(atdma->clk);
return err;
}
@@ -2130,16 +2124,11 @@ static void at_dma_remove(struct platform_device *pdev)
atc_disable_chan_irq(atdma, chan->chan_id);
list_del(&chan->device_node);
}
-
- clk_disable_unprepare(atdma->clk);
}
static void at_dma_shutdown(struct platform_device *pdev)
{
- struct at_dma *atdma = platform_get_drvdata(pdev);
-
at_dma_off(platform_get_drvdata(pdev));
- clk_disable_unprepare(atdma->clk);
}
static int at_dma_prepare(struct device *dev)
@@ -2194,7 +2183,6 @@ static int at_dma_suspend_noirq(struct device *dev)
/* disable DMA controller */
at_dma_off(atdma);
- clk_disable_unprepare(atdma->clk);
return 0;
}
--
2.25.1
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH v2 3/7] dmaengine:dma-jz4780:Use devm_clk_get_enabled() helpers
2024-08-30 9:41 [PATCH v2 0/7] dmaengine:Use devm_clk_get_enabled() helpers Liao Yuanhong
2024-08-30 9:41 ` [PATCH v2 1/7] dmaengine:Add COMPILE_TEST for easy testing Liao Yuanhong
2024-08-30 9:41 ` [PATCH v2 2/7] dmaengine:at_hdmac:Use devm_clk_get_enabled() helpers Liao Yuanhong
@ 2024-08-30 9:41 ` Liao Yuanhong
2024-08-30 9:41 ` [PATCH v2 4/7] dmaengine:imx-dma:Use " Liao Yuanhong
` (4 subsequent siblings)
7 siblings, 0 replies; 16+ messages in thread
From: Liao Yuanhong @ 2024-08-30 9:41 UTC (permalink / raw)
To: vkoul; +Cc: dmaengine, linux-arm-kernel, linux-kernel, imx, Liao Yuanhong
Use devm_clk_get_enabled() instead of clk functions in dma-jz4780.
Signed-off-by: Liao Yuanhong <liaoyuanhong@vivo.com>
---
drivers/dma/dma-jz4780.c | 18 ++++++------------
1 file changed, 6 insertions(+), 12 deletions(-)
diff --git a/drivers/dma/dma-jz4780.c b/drivers/dma/dma-jz4780.c
index c9cfa341db51..151a85516419 100644
--- a/drivers/dma/dma-jz4780.c
+++ b/drivers/dma/dma-jz4780.c
@@ -149,7 +149,6 @@ struct jz4780_dma_dev {
struct dma_device dma_device;
void __iomem *chn_base;
void __iomem *ctrl_base;
- struct clk *clk;
unsigned int irq;
const struct jz4780_dma_soc_data *soc_data;
@@ -857,6 +856,7 @@ static int jz4780_dma_probe(struct platform_device *pdev)
struct dma_device *dd;
struct resource *res;
int i, ret;
+ struct clk *clk;
if (!dev->of_node) {
dev_err(dev, "This driver must be probed from devicetree\n");
@@ -896,15 +896,13 @@ static int jz4780_dma_probe(struct platform_device *pdev)
return -EINVAL;
}
- jzdma->clk = devm_clk_get(dev, NULL);
- if (IS_ERR(jzdma->clk)) {
+ clk = devm_clk_get_enabled(dev, NULL);
+ if (IS_ERR(clk)) {
dev_err(dev, "failed to get clock\n");
- ret = PTR_ERR(jzdma->clk);
+ ret = PTR_ERR(clk);
return ret;
}
- clk_prepare_enable(jzdma->clk);
-
/* Property is optional, if it doesn't exist the value will remain 0. */
of_property_read_u32_index(dev->of_node, "ingenic,reserved-channels",
0, &jzdma->chan_reserved);
@@ -972,7 +970,7 @@ static int jz4780_dma_probe(struct platform_device *pdev)
ret = platform_get_irq(pdev, 0);
if (ret < 0)
- goto err_disable_clk;
+ return ret;
jzdma->irq = ret;
@@ -980,7 +978,7 @@ static int jz4780_dma_probe(struct platform_device *pdev)
jzdma);
if (ret) {
dev_err(dev, "failed to request IRQ %u!\n", jzdma->irq);
- goto err_disable_clk;
+ return ret;
}
ret = dmaenginem_async_device_register(dd);
@@ -1002,9 +1000,6 @@ static int jz4780_dma_probe(struct platform_device *pdev)
err_free_irq:
free_irq(jzdma->irq, jzdma);
-
-err_disable_clk:
- clk_disable_unprepare(jzdma->clk);
return ret;
}
@@ -1015,7 +1010,6 @@ static void jz4780_dma_remove(struct platform_device *pdev)
of_dma_controller_free(pdev->dev.of_node);
- clk_disable_unprepare(jzdma->clk);
free_irq(jzdma->irq, jzdma);
for (i = 0; i < jzdma->soc_data->nb_channels; i++)
--
2.25.1
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH v2 4/7] dmaengine:imx-dma:Use devm_clk_get_enabled() helpers
2024-08-30 9:41 [PATCH v2 0/7] dmaengine:Use devm_clk_get_enabled() helpers Liao Yuanhong
` (2 preceding siblings ...)
2024-08-30 9:41 ` [PATCH v2 3/7] dmaengine:dma-jz4780:Use " Liao Yuanhong
@ 2024-08-30 9:41 ` Liao Yuanhong
2024-08-30 15:12 ` Frank Li
2024-08-30 9:41 ` [PATCH v2 5/7] dmaengine:imx-sdma:Use devm_clk_get_prepared() helpers Liao Yuanhong
` (3 subsequent siblings)
7 siblings, 1 reply; 16+ messages in thread
From: Liao Yuanhong @ 2024-08-30 9:41 UTC (permalink / raw)
To: vkoul; +Cc: dmaengine, linux-arm-kernel, linux-kernel, imx, Liao Yuanhong
Use devm_clk_get_enabled() instead of clk functions in imx-dma.
Signed-off-by: Liao Yuanhong <liaoyuanhong@vivo.com>
---
v2:use dev_err_probe() instead of warn msg and return value.
---
drivers/dma/imx-dma.c | 59 +++++++++++++++----------------------------
1 file changed, 20 insertions(+), 39 deletions(-)
diff --git a/drivers/dma/imx-dma.c b/drivers/dma/imx-dma.c
index ebf7c115d553..7178e9643102 100644
--- a/drivers/dma/imx-dma.c
+++ b/drivers/dma/imx-dma.c
@@ -1039,6 +1039,7 @@ static int __init imxdma_probe(struct platform_device *pdev)
struct imxdma_engine *imxdma;
int ret, i;
int irq, irq_err;
+ struct clk *dma_ahb, *dma_ipg;
imxdma = devm_kzalloc(&pdev->dev, sizeof(*imxdma), GFP_KERNEL);
if (!imxdma)
@@ -1055,20 +1056,13 @@ static int __init imxdma_probe(struct platform_device *pdev)
if (irq < 0)
return irq;
- imxdma->dma_ipg = devm_clk_get(&pdev->dev, "ipg");
- if (IS_ERR(imxdma->dma_ipg))
- return PTR_ERR(imxdma->dma_ipg);
+ dma_ipg = devm_clk_get_enabled(&pdev->dev, "ipg");
+ if (IS_ERR(dma_ipg))
+ return PTR_ERR(dma_ipg);
- imxdma->dma_ahb = devm_clk_get(&pdev->dev, "ahb");
- if (IS_ERR(imxdma->dma_ahb))
- return PTR_ERR(imxdma->dma_ahb);
-
- ret = clk_prepare_enable(imxdma->dma_ipg);
- if (ret)
- return ret;
- ret = clk_prepare_enable(imxdma->dma_ahb);
- if (ret)
- goto disable_dma_ipg_clk;
+ dma_ahb = devm_clk_get_enabled(&pdev->dev, "ahb");
+ if (IS_ERR(dma_ahb))
+ return PTR_ERR(dma_ahb);
/* reset DMA module */
imx_dmav1_writel(imxdma, DCR_DRST, DMA_DCR);
@@ -1076,24 +1070,22 @@ static int __init imxdma_probe(struct platform_device *pdev)
if (is_imx1_dma(imxdma)) {
ret = devm_request_irq(&pdev->dev, irq,
dma_irq_handler, 0, "DMA", imxdma);
- if (ret) {
- dev_warn(imxdma->dev, "Can't register IRQ for DMA\n");
- goto disable_dma_ahb_clk;
- }
+ if (ret)
+ return dev_err_probe(imxdma->dev, ret, "Can't register IRQ for DMA\n");
+
imxdma->irq = irq;
irq_err = platform_get_irq(pdev, 1);
if (irq_err < 0) {
ret = irq_err;
- goto disable_dma_ahb_clk;
+ return ret;
}
ret = devm_request_irq(&pdev->dev, irq_err,
imxdma_err_handler, 0, "DMA", imxdma);
- if (ret) {
- dev_warn(imxdma->dev, "Can't register ERRIRQ for DMA\n");
- goto disable_dma_ahb_clk;
- }
+ if (ret)
+ return dev_err_probe(imxdma->dev, ret, "Can't register ERRIRQ for DMA\n");
+
imxdma->irq_err = irq_err;
}
@@ -1126,12 +1118,10 @@ static int __init imxdma_probe(struct platform_device *pdev)
if (!is_imx1_dma(imxdma)) {
ret = devm_request_irq(&pdev->dev, irq + i,
dma_irq_handler, 0, "DMA", imxdma);
- if (ret) {
- dev_warn(imxdma->dev, "Can't register IRQ %d "
- "for DMA channel %d\n",
- irq + i, i);
- goto disable_dma_ahb_clk;
- }
+ if (ret)
+ return dev_err_probe(imxdma->dev, ret,
+ "Can't register IRQ %d for DMA channel %d\n",
+ irq + i, i);
imxdmac->irq = irq + i;
timer_setup(&imxdmac->watchdog, imxdma_watchdog, 0);
@@ -1172,10 +1162,8 @@ static int __init imxdma_probe(struct platform_device *pdev)
dma_set_max_seg_size(imxdma->dma_device.dev, 0xffffff);
ret = dma_async_device_register(&imxdma->dma_device);
- if (ret) {
- dev_err(&pdev->dev, "unable to register\n");
- goto disable_dma_ahb_clk;
- }
+ if (ret)
+ return dev_err_probe(&pdev->dev, ret, "unable to register\n");
if (pdev->dev.of_node) {
ret = of_dma_controller_register(pdev->dev.of_node,
@@ -1190,10 +1178,6 @@ static int __init imxdma_probe(struct platform_device *pdev)
err_of_dma_controller:
dma_async_device_unregister(&imxdma->dma_device);
-disable_dma_ahb_clk:
- clk_disable_unprepare(imxdma->dma_ahb);
-disable_dma_ipg_clk:
- clk_disable_unprepare(imxdma->dma_ipg);
return ret;
}
@@ -1226,9 +1210,6 @@ static void imxdma_remove(struct platform_device *pdev)
if (pdev->dev.of_node)
of_dma_controller_free(pdev->dev.of_node);
-
- clk_disable_unprepare(imxdma->dma_ipg);
- clk_disable_unprepare(imxdma->dma_ahb);
}
static struct platform_driver imxdma_driver = {
--
2.25.1
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH v2 5/7] dmaengine:imx-sdma:Use devm_clk_get_prepared() helpers
2024-08-30 9:41 [PATCH v2 0/7] dmaengine:Use devm_clk_get_enabled() helpers Liao Yuanhong
` (3 preceding siblings ...)
2024-08-30 9:41 ` [PATCH v2 4/7] dmaengine:imx-dma:Use " Liao Yuanhong
@ 2024-08-30 9:41 ` Liao Yuanhong
2024-08-30 15:11 ` Frank Li
2024-08-30 9:41 ` [PATCH v2 6/7] dmaengine:milbeaut-hdmac:Use devm_clk_get_enabled() helpers Liao Yuanhong
` (2 subsequent siblings)
7 siblings, 1 reply; 16+ messages in thread
From: Liao Yuanhong @ 2024-08-30 9:41 UTC (permalink / raw)
To: vkoul; +Cc: dmaengine, linux-arm-kernel, linux-kernel, imx, Liao Yuanhong
Use devm_clk_get_prepared() instead of clk functions in imx-sdma.
Signed-off-by: Liao Yuanhong <liaoyuanhong@vivo.com>
---
v2:remove all enable related modifications, replace clk_prepare() with
devm_clk_get_prepared()
---
drivers/dma/imx-sdma.c | 22 ++++------------------
1 file changed, 4 insertions(+), 18 deletions(-)
diff --git a/drivers/dma/imx-sdma.c b/drivers/dma/imx-sdma.c
index 72299a08af44..07a017c40a82 100644
--- a/drivers/dma/imx-sdma.c
+++ b/drivers/dma/imx-sdma.c
@@ -2266,33 +2266,25 @@ static int sdma_probe(struct platform_device *pdev)
if (IS_ERR(sdma->regs))
return PTR_ERR(sdma->regs);
- sdma->clk_ipg = devm_clk_get(&pdev->dev, "ipg");
+ sdma->clk_ipg = devm_clk_get_prepared(&pdev->dev, "ipg");
if (IS_ERR(sdma->clk_ipg))
return PTR_ERR(sdma->clk_ipg);
- sdma->clk_ahb = devm_clk_get(&pdev->dev, "ahb");
+ sdma->clk_ahb = devm_clk_get_prepared(&pdev->dev, "ahb");
if (IS_ERR(sdma->clk_ahb))
return PTR_ERR(sdma->clk_ahb);
- ret = clk_prepare(sdma->clk_ipg);
- if (ret)
- return ret;
-
- ret = clk_prepare(sdma->clk_ahb);
- if (ret)
- goto err_clk;
-
ret = devm_request_irq(&pdev->dev, irq, sdma_int_handler, 0,
dev_name(&pdev->dev), sdma);
if (ret)
- goto err_irq;
+ return ret;
sdma->irq = irq;
sdma->script_addrs = kzalloc(sizeof(*sdma->script_addrs), GFP_KERNEL);
if (!sdma->script_addrs) {
ret = -ENOMEM;
- goto err_irq;
+ return ret;
}
/* initially no scripts available */
@@ -2407,10 +2399,6 @@ static int sdma_probe(struct platform_device *pdev)
dma_async_device_unregister(&sdma->dma_device);
err_init:
kfree(sdma->script_addrs);
-err_irq:
- clk_unprepare(sdma->clk_ahb);
-err_clk:
- clk_unprepare(sdma->clk_ipg);
return ret;
}
@@ -2422,8 +2410,6 @@ static void sdma_remove(struct platform_device *pdev)
devm_free_irq(&pdev->dev, sdma->irq, sdma);
dma_async_device_unregister(&sdma->dma_device);
kfree(sdma->script_addrs);
- clk_unprepare(sdma->clk_ahb);
- clk_unprepare(sdma->clk_ipg);
/* Kill the tasklet */
for (i = 0; i < MAX_DMA_CHANNELS; i++) {
struct sdma_channel *sdmac = &sdma->channel[i];
--
2.25.1
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH v2 6/7] dmaengine:milbeaut-hdmac:Use devm_clk_get_enabled() helpers
2024-08-30 9:41 [PATCH v2 0/7] dmaengine:Use devm_clk_get_enabled() helpers Liao Yuanhong
` (4 preceding siblings ...)
2024-08-30 9:41 ` [PATCH v2 5/7] dmaengine:imx-sdma:Use devm_clk_get_prepared() helpers Liao Yuanhong
@ 2024-08-30 9:41 ` Liao Yuanhong
2024-08-30 9:41 ` [PATCH v2 7/7] dmaengine:uniphier-mdmac:Use " Liao Yuanhong
2024-08-30 18:11 ` [PATCH v2 0/7] dmaengine:Use " Krzysztof Kozlowski
7 siblings, 0 replies; 16+ messages in thread
From: Liao Yuanhong @ 2024-08-30 9:41 UTC (permalink / raw)
To: vkoul; +Cc: dmaengine, linux-arm-kernel, linux-kernel, imx, Liao Yuanhong
Use devm_clk_get_enabled() instead of clk functions in milbeaut-hdmac.
Signed-off-by: Liao Yuanhong <liaoyuanhong@vivo.com>
---
drivers/dma/milbeaut-hdmac.c | 20 ++++++--------------
1 file changed, 6 insertions(+), 14 deletions(-)
diff --git a/drivers/dma/milbeaut-hdmac.c b/drivers/dma/milbeaut-hdmac.c
index 7b41c670970a..b188bfa9613a 100644
--- a/drivers/dma/milbeaut-hdmac.c
+++ b/drivers/dma/milbeaut-hdmac.c
@@ -75,7 +75,6 @@ struct milbeaut_hdmac_chan {
struct milbeaut_hdmac_device {
struct dma_device ddev;
- struct clk *clk;
void __iomem *reg_base;
struct milbeaut_hdmac_chan channels[];
};
@@ -458,6 +457,7 @@ static int milbeaut_hdmac_probe(struct platform_device *pdev)
struct milbeaut_hdmac_device *mdev;
struct dma_device *ddev;
int nr_chans, ret, i;
+ struct clk *clk;
nr_chans = platform_irq_count(pdev);
if (nr_chans < 0)
@@ -476,16 +476,12 @@ static int milbeaut_hdmac_probe(struct platform_device *pdev)
if (IS_ERR(mdev->reg_base))
return PTR_ERR(mdev->reg_base);
- mdev->clk = devm_clk_get(dev, NULL);
- if (IS_ERR(mdev->clk)) {
+ clk = devm_clk_get_enabled(dev, NULL);
+ if (IS_ERR(clk)) {
dev_err(dev, "failed to get clock\n");
- return PTR_ERR(mdev->clk);
+ return PTR_ERR(clk);
}
- ret = clk_prepare_enable(mdev->clk);
- if (ret)
- return ret;
-
ddev = &mdev->ddev;
ddev->dev = dev;
dma_cap_set(DMA_SLAVE, ddev->cap_mask);
@@ -507,12 +503,12 @@ static int milbeaut_hdmac_probe(struct platform_device *pdev)
for (i = 0; i < nr_chans; i++) {
ret = milbeaut_hdmac_chan_init(pdev, mdev, i);
if (ret)
- goto disable_clk;
+ return ret;
}
ret = dma_async_device_register(ddev);
if (ret)
- goto disable_clk;
+ return ret;
ret = of_dma_controller_register(dev->of_node,
milbeaut_hdmac_xlate, mdev);
@@ -525,9 +521,6 @@ static int milbeaut_hdmac_probe(struct platform_device *pdev)
unregister_dmac:
dma_async_device_unregister(ddev);
-disable_clk:
- clk_disable_unprepare(mdev->clk);
-
return ret;
}
@@ -560,7 +553,6 @@ static void milbeaut_hdmac_remove(struct platform_device *pdev)
of_dma_controller_free(pdev->dev.of_node);
dma_async_device_unregister(&mdev->ddev);
- clk_disable_unprepare(mdev->clk);
}
static const struct of_device_id milbeaut_hdmac_match[] = {
--
2.25.1
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH v2 7/7] dmaengine:uniphier-mdmac:Use devm_clk_get_enabled() helpers
2024-08-30 9:41 [PATCH v2 0/7] dmaengine:Use devm_clk_get_enabled() helpers Liao Yuanhong
` (5 preceding siblings ...)
2024-08-30 9:41 ` [PATCH v2 6/7] dmaengine:milbeaut-hdmac:Use devm_clk_get_enabled() helpers Liao Yuanhong
@ 2024-08-30 9:41 ` Liao Yuanhong
2024-08-30 18:11 ` [PATCH v2 0/7] dmaengine:Use " Krzysztof Kozlowski
7 siblings, 0 replies; 16+ messages in thread
From: Liao Yuanhong @ 2024-08-30 9:41 UTC (permalink / raw)
To: vkoul; +Cc: dmaengine, linux-arm-kernel, linux-kernel, imx, Liao Yuanhong
Use devm_clk_get_enabled() instead of clk functions in uniphier-mdmac.
Signed-off-by: Liao Yuanhong <liaoyuanhong@vivo.com>
---
drivers/dma/uniphier-mdmac.c | 20 ++++++--------------
1 file changed, 6 insertions(+), 14 deletions(-)
diff --git a/drivers/dma/uniphier-mdmac.c b/drivers/dma/uniphier-mdmac.c
index ad7125f6e2ca..6b3570440b70 100644
--- a/drivers/dma/uniphier-mdmac.c
+++ b/drivers/dma/uniphier-mdmac.c
@@ -66,7 +66,6 @@ struct uniphier_mdmac_chan {
struct uniphier_mdmac_device {
struct dma_device ddev;
- struct clk *clk;
void __iomem *reg_base;
struct uniphier_mdmac_chan channels[];
};
@@ -383,6 +382,7 @@ static int uniphier_mdmac_probe(struct platform_device *pdev)
struct uniphier_mdmac_device *mdev;
struct dma_device *ddev;
int nr_chans, ret, i;
+ struct clk *clk;
nr_chans = platform_irq_count(pdev);
if (nr_chans < 0)
@@ -401,16 +401,12 @@ static int uniphier_mdmac_probe(struct platform_device *pdev)
if (IS_ERR(mdev->reg_base))
return PTR_ERR(mdev->reg_base);
- mdev->clk = devm_clk_get(dev, NULL);
- if (IS_ERR(mdev->clk)) {
+ clk = devm_clk_get_enabled(dev, NULL);
+ if (IS_ERR(clk)) {
dev_err(dev, "failed to get clock\n");
- return PTR_ERR(mdev->clk);
+ return PTR_ERR(clk);
}
- ret = clk_prepare_enable(mdev->clk);
- if (ret)
- return ret;
-
ddev = &mdev->ddev;
ddev->dev = dev;
dma_cap_set(DMA_PRIVATE, ddev->cap_mask);
@@ -429,12 +425,12 @@ static int uniphier_mdmac_probe(struct platform_device *pdev)
for (i = 0; i < nr_chans; i++) {
ret = uniphier_mdmac_chan_init(pdev, mdev, i);
if (ret)
- goto disable_clk;
+ return ret;
}
ret = dma_async_device_register(ddev);
if (ret)
- goto disable_clk;
+ return ret;
ret = of_dma_controller_register(dev->of_node, of_dma_xlate_by_chan_id,
ddev);
@@ -447,9 +443,6 @@ static int uniphier_mdmac_probe(struct platform_device *pdev)
unregister_dmac:
dma_async_device_unregister(ddev);
-disable_clk:
- clk_disable_unprepare(mdev->clk);
-
return ret;
}
@@ -482,7 +475,6 @@ static void uniphier_mdmac_remove(struct platform_device *pdev)
of_dma_controller_free(pdev->dev.of_node);
dma_async_device_unregister(&mdev->ddev);
- clk_disable_unprepare(mdev->clk);
}
static const struct of_device_id uniphier_mdmac_match[] = {
--
2.25.1
^ permalink raw reply related [flat|nested] 16+ messages in thread
* Re: [PATCH v2 2/7] dmaengine:at_hdmac:Use devm_clk_get_enabled() helpers
2024-08-30 9:41 ` [PATCH v2 2/7] dmaengine:at_hdmac:Use devm_clk_get_enabled() helpers Liao Yuanhong
@ 2024-08-30 12:24 ` Nicolas Ferre
0 siblings, 0 replies; 16+ messages in thread
From: Nicolas Ferre @ 2024-08-30 12:24 UTC (permalink / raw)
To: Liao Yuanhong, vkoul; +Cc: dmaengine, linux-arm-kernel, linux-kernel, imx
On 30/08/2024 at 11:41, Liao Yuanhong wrote:
> Use devm_clk_get_enabled() instead of clk functions in at_hdmac.
I don't see how it could work: so please disregard at_hdmac when playing
with "simplification". No subsequent version of this thing please.
NACK (again).
Best regards,
Nicolas
> Signed-off-by: Liao Yuanhong <liaoyuanhong@vivo.com>
> ---
> v2:remove modifications related to the resume operation.
> ---
> drivers/dma/at_hdmac.c | 16 ++--------------
> 1 file changed, 2 insertions(+), 14 deletions(-)
>
> diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c
> index 40052d1bd0b5..2274aeb58271 100644
> --- a/drivers/dma/at_hdmac.c
> +++ b/drivers/dma/at_hdmac.c
> @@ -1975,20 +1975,16 @@ static int __init at_dma_probe(struct platform_device *pdev)
> atdma->dma_device.cap_mask = plat_dat->cap_mask;
> atdma->all_chan_mask = (1 << plat_dat->nr_channels) - 1;
>
> - atdma->clk = devm_clk_get(&pdev->dev, "dma_clk");
> + atdma->clk = devm_clk_get_enabled(&pdev->dev, "dma_clk");
> if (IS_ERR(atdma->clk))
> return PTR_ERR(atdma->clk);
>
> - err = clk_prepare_enable(atdma->clk);
> - if (err)
> - return err;
> -
> /* force dma off, just in case */
> at_dma_off(atdma);
>
> err = request_irq(irq, at_dma_interrupt, 0, "at_hdmac", atdma);
> if (err)
> - goto err_irq;
> + return err;
>
> platform_set_drvdata(pdev, atdma);
>
> @@ -2105,8 +2101,6 @@ static int __init at_dma_probe(struct platform_device *pdev)
> dma_pool_destroy(atdma->lli_pool);
> err_desc_pool_create:
> free_irq(platform_get_irq(pdev, 0), atdma);
> -err_irq:
> - clk_disable_unprepare(atdma->clk);
> return err;
> }
>
> @@ -2130,16 +2124,11 @@ static void at_dma_remove(struct platform_device *pdev)
> atc_disable_chan_irq(atdma, chan->chan_id);
> list_del(&chan->device_node);
> }
> -
> - clk_disable_unprepare(atdma->clk);
> }
>
> static void at_dma_shutdown(struct platform_device *pdev)
> {
> - struct at_dma *atdma = platform_get_drvdata(pdev);
> -
> at_dma_off(platform_get_drvdata(pdev));
> - clk_disable_unprepare(atdma->clk);
> }
>
> static int at_dma_prepare(struct device *dev)
> @@ -2194,7 +2183,6 @@ static int at_dma_suspend_noirq(struct device *dev)
>
> /* disable DMA controller */
> at_dma_off(atdma);
> - clk_disable_unprepare(atdma->clk);
> return 0;
> }
>
> --
> 2.25.1
>
>
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH v2 5/7] dmaengine:imx-sdma:Use devm_clk_get_prepared() helpers
2024-08-30 9:41 ` [PATCH v2 5/7] dmaengine:imx-sdma:Use devm_clk_get_prepared() helpers Liao Yuanhong
@ 2024-08-30 15:11 ` Frank Li
0 siblings, 0 replies; 16+ messages in thread
From: Frank Li @ 2024-08-30 15:11 UTC (permalink / raw)
To: Liao Yuanhong; +Cc: vkoul, dmaengine, linux-arm-kernel, linux-kernel, imx
On Fri, Aug 30, 2024 at 05:41:16PM +0800, Liao Yuanhong wrote:
> Use devm_clk_get_prepared() instead of clk functions in imx-sdma.
>
> Signed-off-by: Liao Yuanhong <liaoyuanhong@vivo.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
> ---
> v2:remove all enable related modifications, replace clk_prepare() with
> devm_clk_get_prepared()
> ---
> drivers/dma/imx-sdma.c | 22 ++++------------------
> 1 file changed, 4 insertions(+), 18 deletions(-)
>
> diff --git a/drivers/dma/imx-sdma.c b/drivers/dma/imx-sdma.c
> index 72299a08af44..07a017c40a82 100644
> --- a/drivers/dma/imx-sdma.c
> +++ b/drivers/dma/imx-sdma.c
> @@ -2266,33 +2266,25 @@ static int sdma_probe(struct platform_device *pdev)
> if (IS_ERR(sdma->regs))
> return PTR_ERR(sdma->regs);
>
> - sdma->clk_ipg = devm_clk_get(&pdev->dev, "ipg");
> + sdma->clk_ipg = devm_clk_get_prepared(&pdev->dev, "ipg");
> if (IS_ERR(sdma->clk_ipg))
> return PTR_ERR(sdma->clk_ipg);
>
> - sdma->clk_ahb = devm_clk_get(&pdev->dev, "ahb");
> + sdma->clk_ahb = devm_clk_get_prepared(&pdev->dev, "ahb");
> if (IS_ERR(sdma->clk_ahb))
> return PTR_ERR(sdma->clk_ahb);
>
> - ret = clk_prepare(sdma->clk_ipg);
> - if (ret)
> - return ret;
> -
> - ret = clk_prepare(sdma->clk_ahb);
> - if (ret)
> - goto err_clk;
> -
> ret = devm_request_irq(&pdev->dev, irq, sdma_int_handler, 0,
> dev_name(&pdev->dev), sdma);
> if (ret)
> - goto err_irq;
> + return ret;
>
> sdma->irq = irq;
>
> sdma->script_addrs = kzalloc(sizeof(*sdma->script_addrs), GFP_KERNEL);
> if (!sdma->script_addrs) {
> ret = -ENOMEM;
> - goto err_irq;
> + return ret;
> }
>
> /* initially no scripts available */
> @@ -2407,10 +2399,6 @@ static int sdma_probe(struct platform_device *pdev)
> dma_async_device_unregister(&sdma->dma_device);
> err_init:
> kfree(sdma->script_addrs);
> -err_irq:
> - clk_unprepare(sdma->clk_ahb);
> -err_clk:
> - clk_unprepare(sdma->clk_ipg);
> return ret;
> }
>
> @@ -2422,8 +2410,6 @@ static void sdma_remove(struct platform_device *pdev)
> devm_free_irq(&pdev->dev, sdma->irq, sdma);
> dma_async_device_unregister(&sdma->dma_device);
> kfree(sdma->script_addrs);
> - clk_unprepare(sdma->clk_ahb);
> - clk_unprepare(sdma->clk_ipg);
> /* Kill the tasklet */
> for (i = 0; i < MAX_DMA_CHANNELS; i++) {
> struct sdma_channel *sdmac = &sdma->channel[i];
> --
> 2.25.1
>
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH v2 4/7] dmaengine:imx-dma:Use devm_clk_get_enabled() helpers
2024-08-30 9:41 ` [PATCH v2 4/7] dmaengine:imx-dma:Use " Liao Yuanhong
@ 2024-08-30 15:12 ` Frank Li
0 siblings, 0 replies; 16+ messages in thread
From: Frank Li @ 2024-08-30 15:12 UTC (permalink / raw)
To: Liao Yuanhong; +Cc: vkoul, dmaengine, linux-arm-kernel, linux-kernel, imx
On Fri, Aug 30, 2024 at 05:41:15PM +0800, Liao Yuanhong wrote:
> Use devm_clk_get_enabled() instead of clk functions in imx-dma.
>
> Signed-off-by: Liao Yuanhong <liaoyuanhong@vivo.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
> ---
> v2:use dev_err_probe() instead of warn msg and return value.
> ---
> drivers/dma/imx-dma.c | 59 +++++++++++++++----------------------------
> 1 file changed, 20 insertions(+), 39 deletions(-)
>
> diff --git a/drivers/dma/imx-dma.c b/drivers/dma/imx-dma.c
> index ebf7c115d553..7178e9643102 100644
> --- a/drivers/dma/imx-dma.c
> +++ b/drivers/dma/imx-dma.c
> @@ -1039,6 +1039,7 @@ static int __init imxdma_probe(struct platform_device *pdev)
> struct imxdma_engine *imxdma;
> int ret, i;
> int irq, irq_err;
> + struct clk *dma_ahb, *dma_ipg;
>
> imxdma = devm_kzalloc(&pdev->dev, sizeof(*imxdma), GFP_KERNEL);
> if (!imxdma)
> @@ -1055,20 +1056,13 @@ static int __init imxdma_probe(struct platform_device *pdev)
> if (irq < 0)
> return irq;
>
> - imxdma->dma_ipg = devm_clk_get(&pdev->dev, "ipg");
> - if (IS_ERR(imxdma->dma_ipg))
> - return PTR_ERR(imxdma->dma_ipg);
> + dma_ipg = devm_clk_get_enabled(&pdev->dev, "ipg");
> + if (IS_ERR(dma_ipg))
> + return PTR_ERR(dma_ipg);
>
> - imxdma->dma_ahb = devm_clk_get(&pdev->dev, "ahb");
> - if (IS_ERR(imxdma->dma_ahb))
> - return PTR_ERR(imxdma->dma_ahb);
> -
> - ret = clk_prepare_enable(imxdma->dma_ipg);
> - if (ret)
> - return ret;
> - ret = clk_prepare_enable(imxdma->dma_ahb);
> - if (ret)
> - goto disable_dma_ipg_clk;
> + dma_ahb = devm_clk_get_enabled(&pdev->dev, "ahb");
> + if (IS_ERR(dma_ahb))
> + return PTR_ERR(dma_ahb);
>
> /* reset DMA module */
> imx_dmav1_writel(imxdma, DCR_DRST, DMA_DCR);
> @@ -1076,24 +1070,22 @@ static int __init imxdma_probe(struct platform_device *pdev)
> if (is_imx1_dma(imxdma)) {
> ret = devm_request_irq(&pdev->dev, irq,
> dma_irq_handler, 0, "DMA", imxdma);
> - if (ret) {
> - dev_warn(imxdma->dev, "Can't register IRQ for DMA\n");
> - goto disable_dma_ahb_clk;
> - }
> + if (ret)
> + return dev_err_probe(imxdma->dev, ret, "Can't register IRQ for DMA\n");
> +
> imxdma->irq = irq;
>
> irq_err = platform_get_irq(pdev, 1);
> if (irq_err < 0) {
> ret = irq_err;
> - goto disable_dma_ahb_clk;
> + return ret;
> }
>
> ret = devm_request_irq(&pdev->dev, irq_err,
> imxdma_err_handler, 0, "DMA", imxdma);
> - if (ret) {
> - dev_warn(imxdma->dev, "Can't register ERRIRQ for DMA\n");
> - goto disable_dma_ahb_clk;
> - }
> + if (ret)
> + return dev_err_probe(imxdma->dev, ret, "Can't register ERRIRQ for DMA\n");
> +
> imxdma->irq_err = irq_err;
> }
>
> @@ -1126,12 +1118,10 @@ static int __init imxdma_probe(struct platform_device *pdev)
> if (!is_imx1_dma(imxdma)) {
> ret = devm_request_irq(&pdev->dev, irq + i,
> dma_irq_handler, 0, "DMA", imxdma);
> - if (ret) {
> - dev_warn(imxdma->dev, "Can't register IRQ %d "
> - "for DMA channel %d\n",
> - irq + i, i);
> - goto disable_dma_ahb_clk;
> - }
> + if (ret)
> + return dev_err_probe(imxdma->dev, ret,
> + "Can't register IRQ %d for DMA channel %d\n",
> + irq + i, i);
>
> imxdmac->irq = irq + i;
> timer_setup(&imxdmac->watchdog, imxdma_watchdog, 0);
> @@ -1172,10 +1162,8 @@ static int __init imxdma_probe(struct platform_device *pdev)
> dma_set_max_seg_size(imxdma->dma_device.dev, 0xffffff);
>
> ret = dma_async_device_register(&imxdma->dma_device);
> - if (ret) {
> - dev_err(&pdev->dev, "unable to register\n");
> - goto disable_dma_ahb_clk;
> - }
> + if (ret)
> + return dev_err_probe(&pdev->dev, ret, "unable to register\n");
>
> if (pdev->dev.of_node) {
> ret = of_dma_controller_register(pdev->dev.of_node,
> @@ -1190,10 +1178,6 @@ static int __init imxdma_probe(struct platform_device *pdev)
>
> err_of_dma_controller:
> dma_async_device_unregister(&imxdma->dma_device);
> -disable_dma_ahb_clk:
> - clk_disable_unprepare(imxdma->dma_ahb);
> -disable_dma_ipg_clk:
> - clk_disable_unprepare(imxdma->dma_ipg);
> return ret;
> }
>
> @@ -1226,9 +1210,6 @@ static void imxdma_remove(struct platform_device *pdev)
>
> if (pdev->dev.of_node)
> of_dma_controller_free(pdev->dev.of_node);
> -
> - clk_disable_unprepare(imxdma->dma_ipg);
> - clk_disable_unprepare(imxdma->dma_ahb);
> }
>
> static struct platform_driver imxdma_driver = {
> --
> 2.25.1
>
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH v2 1/7] dmaengine:Add COMPILE_TEST for easy testing
2024-08-30 9:41 ` [PATCH v2 1/7] dmaengine:Add COMPILE_TEST for easy testing Liao Yuanhong
@ 2024-08-30 17:44 ` Krzysztof Kozlowski
2024-08-31 13:15 ` kernel test robot
2024-08-31 21:31 ` kernel test robot
2 siblings, 0 replies; 16+ messages in thread
From: Krzysztof Kozlowski @ 2024-08-30 17:44 UTC (permalink / raw)
To: Liao Yuanhong, vkoul; +Cc: dmaengine, linux-arm-kernel, linux-kernel, imx
On 30/08/2024 11:41, Liao Yuanhong wrote:
> Add COMPILE_TEST configuration for at-hdmac, imx-dma, imx-sdma
> devices for easy debugging.
>
> Signed-off-by: Liao Yuanhong <liaoyuanhong@vivo.com>
> ---
> drivers/dma/Kconfig | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
I don't think this was really tested. It should fail on some platforms.
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH v2 0/7] dmaengine:Use devm_clk_get_enabled() helpers
2024-08-30 9:41 [PATCH v2 0/7] dmaengine:Use devm_clk_get_enabled() helpers Liao Yuanhong
` (6 preceding siblings ...)
2024-08-30 9:41 ` [PATCH v2 7/7] dmaengine:uniphier-mdmac:Use " Liao Yuanhong
@ 2024-08-30 18:11 ` Krzysztof Kozlowski
2024-09-03 5:18 ` Vinod Koul
7 siblings, 1 reply; 16+ messages in thread
From: Krzysztof Kozlowski @ 2024-08-30 18:11 UTC (permalink / raw)
To: vkoul; +Cc: Liao Yuanhong, dmaengine, linux-arm-kernel, linux-kernel, imx
On 30/08/2024 11:41, Liao Yuanhong wrote:
> The devm_clk_get_enabled() helpers:
> - call devm_clk_get()
> - call clk_prepare_enable() and register what is needed in order to
> call clk_disable_unprepare() when needed, as a managed resource.
>
> This simplifies the code and avoids the calls to clk_disable_unprepare().
> ---
> v2:remove inappropriate modifications, configure COMPILE_TEST for easy
> testing, add devm_clk_getprepaed() for imx sdma device.
> ---
>
Vinod,
Since ~2 weeks there is tremendous amount of trivial patches coming from
vivo.com. I identified at least 6 buggy, where the contributor did not
understand the code. Not sure about intention, but I advise extra
carefulness
when dealing with these "trivial" improvements.
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH v2 1/7] dmaengine:Add COMPILE_TEST for easy testing
2024-08-30 9:41 ` [PATCH v2 1/7] dmaengine:Add COMPILE_TEST for easy testing Liao Yuanhong
2024-08-30 17:44 ` Krzysztof Kozlowski
@ 2024-08-31 13:15 ` kernel test robot
2024-08-31 21:31 ` kernel test robot
2 siblings, 0 replies; 16+ messages in thread
From: kernel test robot @ 2024-08-31 13:15 UTC (permalink / raw)
To: Liao Yuanhong, vkoul
Cc: llvm, oe-kbuild-all, dmaengine, linux-arm-kernel, linux-kernel,
imx, Liao Yuanhong
Hi Liao,
kernel test robot noticed the following build warnings:
[auto build test WARNING on vkoul-dmaengine/next]
[also build test WARNING on shawnguo/for-next soc/for-next linus/master v6.11-rc5 next-20240830]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Liao-Yuanhong/dmaengine-Add-COMPILE_TEST-for-easy-testing/20240830-174451
base: https://git.kernel.org/pub/scm/linux/kernel/git/vkoul/dmaengine.git next
patch link: https://lore.kernel.org/r/20240830094118.15458-2-liaoyuanhong%40vivo.com
patch subject: [PATCH v2 1/7] dmaengine:Add COMPILE_TEST for easy testing
config: x86_64-allyesconfig (https://download.01.org/0day-ci/archive/20240831/202408312025.Tjnlxn0W-lkp@intel.com/config)
compiler: clang version 18.1.5 (https://github.com/llvm/llvm-project 617a15a9eac96088ae5e9134248d8236e34b91b1)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240831/202408312025.Tjnlxn0W-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202408312025.Tjnlxn0W-lkp@intel.com/
All warnings (new ones prefixed by >>):
>> drivers/dma/at_hdmac.c:891:45: warning: format specifies type 'int' but the argument has type 'size_t' (aka 'unsigned long') [-Wformat]
890 | "%s: src=%pad, dest=%pad, numf=%d, frame_size=%d, flags=0x%lx\n",
| ~~
| %zu
891 | __func__, &xt->src_start, &xt->dst_start, xt->numf,
| ^~~~~~~~
include/linux/dev_printk.h:160:67: note: expanded from macro 'dev_info'
160 | dev_printk_index_wrap(_dev_info, KERN_INFO, dev, dev_fmt(fmt), ##__VA_ARGS__)
| ~~~ ^~~~~~~~~~~
include/linux/dev_printk.h:110:23: note: expanded from macro 'dev_printk_index_wrap'
110 | _p_func(dev, fmt, ##__VA_ARGS__); \
| ~~~ ^~~~~~~~~~~
drivers/dma/at_hdmac.c:892:3: warning: format specifies type 'int' but the argument has type 'size_t' (aka 'unsigned long') [-Wformat]
890 | "%s: src=%pad, dest=%pad, numf=%d, frame_size=%d, flags=0x%lx\n",
| ~~
| %zu
891 | __func__, &xt->src_start, &xt->dst_start, xt->numf,
892 | xt->frame_size, flags);
| ^~~~~~~~~~~~~~
include/linux/dev_printk.h:160:67: note: expanded from macro 'dev_info'
160 | dev_printk_index_wrap(_dev_info, KERN_INFO, dev, dev_fmt(fmt), ##__VA_ARGS__)
| ~~~ ^~~~~~~~~~~
include/linux/dev_printk.h:110:23: note: expanded from macro 'dev_printk_index_wrap'
110 | _p_func(dev, fmt, ##__VA_ARGS__); \
| ~~~ ^~~~~~~~~~~
>> drivers/dma/at_hdmac.c:1178:11: warning: format specifies type 'size_t' (aka 'unsigned long') but the argument has type 'unsigned int' [-Wformat]
1177 | dev_vdbg(chan2dev(chan), "%s: v0x%x l0x%zx f0x%lx\n", __func__,
| ~~~
| %x
1178 | value, sg_len, flags);
| ^~~~~~
include/linux/dev_printk.h:261:18: note: expanded from macro 'dev_vdbg'
261 | #define dev_vdbg dev_dbg
| ^
include/linux/dev_printk.h:165:39: note: expanded from macro 'dev_dbg'
165 | dynamic_dev_dbg(dev, dev_fmt(fmt), ##__VA_ARGS__)
| ~~~ ^~~~~~~~~~~
include/linux/dynamic_debug.h:274:19: note: expanded from macro 'dynamic_dev_dbg'
274 | dev, fmt, ##__VA_ARGS__)
| ~~~ ^~~~~~~~~~~
include/linux/dynamic_debug.h:250:59: note: expanded from macro '_dynamic_func_call'
250 | _dynamic_func_call_cls(_DPRINTK_CLASS_DFLT, fmt, func, ##__VA_ARGS__)
| ^~~~~~~~~~~
include/linux/dynamic_debug.h:248:65: note: expanded from macro '_dynamic_func_call_cls'
248 | __dynamic_func_call_cls(__UNIQUE_ID(ddebug), cls, fmt, func, ##__VA_ARGS__)
| ^~~~~~~~~~~
include/linux/dynamic_debug.h:224:15: note: expanded from macro '__dynamic_func_call_cls'
224 | func(&id, ##__VA_ARGS__); \
| ^~~~~~~~~~~
drivers/dma/at_hdmac.c:1509:13: warning: format specifies type 'int' but the argument has type 'size_t' (aka 'unsigned long') [-Wformat]
1506 | dev_vdbg(chan2dev(chan), "prep_dma_cyclic: %s buf@%pad - %d (%d/%d)\n",
| ~~
| %zu
1507 | direction == DMA_MEM_TO_DEV ? "TO DEVICE" : "FROM DEVICE",
1508 | &buf_addr,
1509 | periods, buf_len, period_len);
| ^~~~~~~
include/linux/dev_printk.h:261:18: note: expanded from macro 'dev_vdbg'
261 | #define dev_vdbg dev_dbg
| ^
include/linux/dev_printk.h:165:39: note: expanded from macro 'dev_dbg'
165 | dynamic_dev_dbg(dev, dev_fmt(fmt), ##__VA_ARGS__)
| ~~~ ^~~~~~~~~~~
include/linux/dynamic_debug.h:274:19: note: expanded from macro 'dynamic_dev_dbg'
274 | dev, fmt, ##__VA_ARGS__)
| ~~~ ^~~~~~~~~~~
include/linux/dynamic_debug.h:250:59: note: expanded from macro '_dynamic_func_call'
250 | _dynamic_func_call_cls(_DPRINTK_CLASS_DFLT, fmt, func, ##__VA_ARGS__)
| ^~~~~~~~~~~
include/linux/dynamic_debug.h:248:65: note: expanded from macro '_dynamic_func_call_cls'
248 | __dynamic_func_call_cls(__UNIQUE_ID(ddebug), cls, fmt, func, ##__VA_ARGS__)
| ^~~~~~~~~~~
include/linux/dynamic_debug.h:224:15: note: expanded from macro '__dynamic_func_call_cls'
224 | func(&id, ##__VA_ARGS__); \
| ^~~~~~~~~~~
drivers/dma/at_hdmac.c:1509:22: warning: format specifies type 'int' but the argument has type 'size_t' (aka 'unsigned long') [-Wformat]
1506 | dev_vdbg(chan2dev(chan), "prep_dma_cyclic: %s buf@%pad - %d (%d/%d)\n",
| ~~
| %zu
1507 | direction == DMA_MEM_TO_DEV ? "TO DEVICE" : "FROM DEVICE",
1508 | &buf_addr,
1509 | periods, buf_len, period_len);
| ^~~~~~~~~~
include/linux/dev_printk.h:261:18: note: expanded from macro 'dev_vdbg'
261 | #define dev_vdbg dev_dbg
| ^
include/linux/dev_printk.h:165:39: note: expanded from macro 'dev_dbg'
165 | dynamic_dev_dbg(dev, dev_fmt(fmt), ##__VA_ARGS__)
| ~~~ ^~~~~~~~~~~
include/linux/dynamic_debug.h:274:19: note: expanded from macro 'dynamic_dev_dbg'
274 | dev, fmt, ##__VA_ARGS__)
| ~~~ ^~~~~~~~~~~
include/linux/dynamic_debug.h:250:59: note: expanded from macro '_dynamic_func_call'
250 | _dynamic_func_call_cls(_DPRINTK_CLASS_DFLT, fmt, func, ##__VA_ARGS__)
| ^~~~~~~~~~~
include/linux/dynamic_debug.h:248:65: note: expanded from macro '_dynamic_func_call_cls'
248 | __dynamic_func_call_cls(__UNIQUE_ID(ddebug), cls, fmt, func, ##__VA_ARGS__)
| ^~~~~~~~~~~
include/linux/dynamic_debug.h:224:15: note: expanded from macro '__dynamic_func_call_cls'
224 | func(&id, ##__VA_ARGS__); \
| ^~~~~~~~~~~
5 warnings generated.
vim +891 drivers/dma/at_hdmac.c
dc78baa2b90b28 Nicolas Ferre 2009-07-03 858
dc78baa2b90b28 Nicolas Ferre 2009-07-03 859 /*-- DMA Engine API --------------------------------------------------*/
5abecfa5e96972 Maxime Ripard 2015-05-27 860 /**
5abecfa5e96972 Maxime Ripard 2015-05-27 861 * atc_prep_dma_interleaved - prepare memory to memory interleaved operation
5abecfa5e96972 Maxime Ripard 2015-05-27 862 * @chan: the channel to prepare operation on
5abecfa5e96972 Maxime Ripard 2015-05-27 863 * @xt: Interleaved transfer template
5abecfa5e96972 Maxime Ripard 2015-05-27 864 * @flags: tx descriptor status flags
5abecfa5e96972 Maxime Ripard 2015-05-27 865 */
5abecfa5e96972 Maxime Ripard 2015-05-27 866 static struct dma_async_tx_descriptor *
5abecfa5e96972 Maxime Ripard 2015-05-27 867 atc_prep_dma_interleaved(struct dma_chan *chan,
5abecfa5e96972 Maxime Ripard 2015-05-27 868 struct dma_interleaved_template *xt,
5abecfa5e96972 Maxime Ripard 2015-05-27 869 unsigned long flags)
5abecfa5e96972 Maxime Ripard 2015-05-27 870 {
ac803b56860f65 Tudor Ambarus 2022-10-25 871 struct at_dma *atdma = to_at_dma(chan->device);
5abecfa5e96972 Maxime Ripard 2015-05-27 872 struct at_dma_chan *atchan = to_at_dma_chan(chan);
62a277d43d47e7 Gustavo A. R. Silva 2017-11-20 873 struct data_chunk *first;
ac803b56860f65 Tudor Ambarus 2022-10-25 874 struct atdma_sg *atdma_sg;
ac803b56860f65 Tudor Ambarus 2022-10-25 875 struct at_desc *desc;
ac803b56860f65 Tudor Ambarus 2022-10-25 876 struct at_lli *lli;
5abecfa5e96972 Maxime Ripard 2015-05-27 877 size_t xfer_count;
5abecfa5e96972 Maxime Ripard 2015-05-27 878 unsigned int dwidth;
5abecfa5e96972 Maxime Ripard 2015-05-27 879 u32 ctrla;
5abecfa5e96972 Maxime Ripard 2015-05-27 880 u32 ctrlb;
5abecfa5e96972 Maxime Ripard 2015-05-27 881 size_t len = 0;
5abecfa5e96972 Maxime Ripard 2015-05-27 882 int i;
5abecfa5e96972 Maxime Ripard 2015-05-27 883
4483320e241c5f Maninder Singh 2015-06-26 884 if (unlikely(!xt || xt->numf != 1 || !xt->frame_size))
4483320e241c5f Maninder Singh 2015-06-26 885 return NULL;
4483320e241c5f Maninder Singh 2015-06-26 886
62a277d43d47e7 Gustavo A. R. Silva 2017-11-20 887 first = xt->sgl;
62a277d43d47e7 Gustavo A. R. Silva 2017-11-20 888
5abecfa5e96972 Maxime Ripard 2015-05-27 889 dev_info(chan2dev(chan),
2c5d7407e01272 Arnd Bergmann 2015-11-12 890 "%s: src=%pad, dest=%pad, numf=%d, frame_size=%d, flags=0x%lx\n",
2c5d7407e01272 Arnd Bergmann 2015-11-12 @891 __func__, &xt->src_start, &xt->dst_start, xt->numf,
5abecfa5e96972 Maxime Ripard 2015-05-27 892 xt->frame_size, flags);
5abecfa5e96972 Maxime Ripard 2015-05-27 893
5abecfa5e96972 Maxime Ripard 2015-05-27 894 /*
5abecfa5e96972 Maxime Ripard 2015-05-27 895 * The controller can only "skip" X bytes every Y bytes, so we
5abecfa5e96972 Maxime Ripard 2015-05-27 896 * need to make sure we are given a template that fit that
5abecfa5e96972 Maxime Ripard 2015-05-27 897 * description, ie a template with chunks that always have the
5abecfa5e96972 Maxime Ripard 2015-05-27 898 * same size, with the same ICGs.
5abecfa5e96972 Maxime Ripard 2015-05-27 899 */
5abecfa5e96972 Maxime Ripard 2015-05-27 900 for (i = 0; i < xt->frame_size; i++) {
5abecfa5e96972 Maxime Ripard 2015-05-27 901 struct data_chunk *chunk = xt->sgl + i;
5abecfa5e96972 Maxime Ripard 2015-05-27 902
5abecfa5e96972 Maxime Ripard 2015-05-27 903 if ((chunk->size != xt->sgl->size) ||
5abecfa5e96972 Maxime Ripard 2015-05-27 904 (dmaengine_get_dst_icg(xt, chunk) != dmaengine_get_dst_icg(xt, first)) ||
5abecfa5e96972 Maxime Ripard 2015-05-27 905 (dmaengine_get_src_icg(xt, chunk) != dmaengine_get_src_icg(xt, first))) {
5abecfa5e96972 Maxime Ripard 2015-05-27 906 dev_err(chan2dev(chan),
5abecfa5e96972 Maxime Ripard 2015-05-27 907 "%s: the controller can transfer only identical chunks\n",
5abecfa5e96972 Maxime Ripard 2015-05-27 908 __func__);
5abecfa5e96972 Maxime Ripard 2015-05-27 909 return NULL;
5abecfa5e96972 Maxime Ripard 2015-05-27 910 }
5abecfa5e96972 Maxime Ripard 2015-05-27 911
5abecfa5e96972 Maxime Ripard 2015-05-27 912 len += chunk->size;
5abecfa5e96972 Maxime Ripard 2015-05-27 913 }
5abecfa5e96972 Maxime Ripard 2015-05-27 914
ac803b56860f65 Tudor Ambarus 2022-10-25 915 dwidth = atc_get_xfer_width(xt->src_start, xt->dst_start, len);
5abecfa5e96972 Maxime Ripard 2015-05-27 916
5abecfa5e96972 Maxime Ripard 2015-05-27 917 xfer_count = len >> dwidth;
5abecfa5e96972 Maxime Ripard 2015-05-27 918 if (xfer_count > ATC_BTSIZE_MAX) {
5abecfa5e96972 Maxime Ripard 2015-05-27 919 dev_err(chan2dev(chan), "%s: buffer is too big\n", __func__);
5abecfa5e96972 Maxime Ripard 2015-05-27 920 return NULL;
5abecfa5e96972 Maxime Ripard 2015-05-27 921 }
5abecfa5e96972 Maxime Ripard 2015-05-27 922
d8840a7edcf0aa Tudor Ambarus 2022-10-25 923 ctrla = FIELD_PREP(ATC_SRC_WIDTH, dwidth) |
d8840a7edcf0aa Tudor Ambarus 2022-10-25 924 FIELD_PREP(ATC_DST_WIDTH, dwidth);
5abecfa5e96972 Maxime Ripard 2015-05-27 925
d8840a7edcf0aa Tudor Ambarus 2022-10-25 926 ctrlb = ATC_DEFAULT_CTRLB | ATC_IEN |
d8840a7edcf0aa Tudor Ambarus 2022-10-25 927 FIELD_PREP(ATC_SRC_ADDR_MODE, ATC_SRC_ADDR_MODE_INCR) |
d8840a7edcf0aa Tudor Ambarus 2022-10-25 928 FIELD_PREP(ATC_DST_ADDR_MODE, ATC_DST_ADDR_MODE_INCR) |
d8840a7edcf0aa Tudor Ambarus 2022-10-25 929 ATC_SRC_PIP | ATC_DST_PIP |
d8840a7edcf0aa Tudor Ambarus 2022-10-25 930 FIELD_PREP(ATC_FC, ATC_FC_MEM2MEM);
5abecfa5e96972 Maxime Ripard 2015-05-27 931
ac803b56860f65 Tudor Ambarus 2022-10-25 932 desc = kzalloc(struct_size(desc, sg, 1), GFP_ATOMIC);
ac803b56860f65 Tudor Ambarus 2022-10-25 933 if (!desc)
ac803b56860f65 Tudor Ambarus 2022-10-25 934 return NULL;
ac803b56860f65 Tudor Ambarus 2022-10-25 935 desc->sglen = 1;
ac803b56860f65 Tudor Ambarus 2022-10-25 936
ac803b56860f65 Tudor Ambarus 2022-10-25 937 atdma_sg = desc->sg;
ac803b56860f65 Tudor Ambarus 2022-10-25 938 atdma_sg->lli = dma_pool_alloc(atdma->lli_pool, GFP_NOWAIT,
ac803b56860f65 Tudor Ambarus 2022-10-25 939 &atdma_sg->lli_phys);
ac803b56860f65 Tudor Ambarus 2022-10-25 940 if (!atdma_sg->lli) {
ac803b56860f65 Tudor Ambarus 2022-10-25 941 kfree(desc);
5abecfa5e96972 Maxime Ripard 2015-05-27 942 return NULL;
5abecfa5e96972 Maxime Ripard 2015-05-27 943 }
ac803b56860f65 Tudor Ambarus 2022-10-25 944 lli = atdma_sg->lli;
5abecfa5e96972 Maxime Ripard 2015-05-27 945
ac803b56860f65 Tudor Ambarus 2022-10-25 946 lli->saddr = xt->src_start;
ac803b56860f65 Tudor Ambarus 2022-10-25 947 lli->daddr = xt->dst_start;
ac803b56860f65 Tudor Ambarus 2022-10-25 948 lli->ctrla = ctrla | xfer_count;
ac803b56860f65 Tudor Ambarus 2022-10-25 949 lli->ctrlb = ctrlb;
5abecfa5e96972 Maxime Ripard 2015-05-27 950
5abecfa5e96972 Maxime Ripard 2015-05-27 951 desc->boundary = first->size >> dwidth;
5abecfa5e96972 Maxime Ripard 2015-05-27 952 desc->dst_hole = (dmaengine_get_dst_icg(xt, first) >> dwidth) + 1;
5abecfa5e96972 Maxime Ripard 2015-05-27 953 desc->src_hole = (dmaengine_get_src_icg(xt, first) >> dwidth) + 1;
5abecfa5e96972 Maxime Ripard 2015-05-27 954
ac803b56860f65 Tudor Ambarus 2022-10-25 955 atdma_sg->len = len;
ac803b56860f65 Tudor Ambarus 2022-10-25 956 desc->total_len = len;
5abecfa5e96972 Maxime Ripard 2015-05-27 957
ac803b56860f65 Tudor Ambarus 2022-10-25 958 set_lli_eol(desc, 0);
ac803b56860f65 Tudor Ambarus 2022-10-25 959 return vchan_tx_prep(&atchan->vc, &desc->vd, flags);
5abecfa5e96972 Maxime Ripard 2015-05-27 960 }
5abecfa5e96972 Maxime Ripard 2015-05-27 961
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH v2 1/7] dmaengine:Add COMPILE_TEST for easy testing
2024-08-30 9:41 ` [PATCH v2 1/7] dmaengine:Add COMPILE_TEST for easy testing Liao Yuanhong
2024-08-30 17:44 ` Krzysztof Kozlowski
2024-08-31 13:15 ` kernel test robot
@ 2024-08-31 21:31 ` kernel test robot
2 siblings, 0 replies; 16+ messages in thread
From: kernel test robot @ 2024-08-31 21:31 UTC (permalink / raw)
To: Liao Yuanhong, vkoul
Cc: oe-kbuild-all, dmaengine, linux-arm-kernel, linux-kernel, imx,
Liao Yuanhong
Hi Liao,
kernel test robot noticed the following build warnings:
[auto build test WARNING on vkoul-dmaengine/next]
[also build test WARNING on shawnguo/for-next soc/for-next linus/master v6.11-rc5 next-20240830]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Liao-Yuanhong/dmaengine-Add-COMPILE_TEST-for-easy-testing/20240830-174451
base: https://git.kernel.org/pub/scm/linux/kernel/git/vkoul/dmaengine.git next
patch link: https://lore.kernel.org/r/20240830094118.15458-2-liaoyuanhong%40vivo.com
patch subject: [PATCH v2 1/7] dmaengine:Add COMPILE_TEST for easy testing
config: loongarch-allmodconfig (https://download.01.org/0day-ci/archive/20240901/202409010519.GDhNqskE-lkp@intel.com/config)
compiler: loongarch64-linux-gcc (GCC) 14.1.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240901/202409010519.GDhNqskE-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202409010519.GDhNqskE-lkp@intel.com/
All warnings (new ones prefixed by >>):
In file included from include/linux/device.h:15,
from include/linux/dmaengine.h:8,
from drivers/dma/at_hdmac.c:16:
drivers/dma/at_hdmac.c: In function 'atc_prep_dma_interleaved':
>> drivers/dma/at_hdmac.c:890:18: warning: format '%d' expects argument of type 'int', but argument 6 has type 'size_t' {aka 'long unsigned int'} [-Wformat=]
890 | "%s: src=%pad, dest=%pad, numf=%d, frame_size=%d, flags=0x%lx\n",
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/dev_printk.h:110:30: note: in definition of macro 'dev_printk_index_wrap'
110 | _p_func(dev, fmt, ##__VA_ARGS__); \
| ^~~
include/linux/dev_printk.h:160:58: note: in expansion of macro 'dev_fmt'
160 | dev_printk_index_wrap(_dev_info, KERN_INFO, dev, dev_fmt(fmt), ##__VA_ARGS__)
| ^~~~~~~
drivers/dma/at_hdmac.c:889:9: note: in expansion of macro 'dev_info'
889 | dev_info(chan2dev(chan),
| ^~~~~~~~
drivers/dma/at_hdmac.c:890:50: note: format string is defined here
890 | "%s: src=%pad, dest=%pad, numf=%d, frame_size=%d, flags=0x%lx\n",
| ~^
| |
| int
| %ld
drivers/dma/at_hdmac.c:890:18: warning: format '%d' expects argument of type 'int', but argument 7 has type 'size_t' {aka 'long unsigned int'} [-Wformat=]
890 | "%s: src=%pad, dest=%pad, numf=%d, frame_size=%d, flags=0x%lx\n",
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/dev_printk.h:110:30: note: in definition of macro 'dev_printk_index_wrap'
110 | _p_func(dev, fmt, ##__VA_ARGS__); \
| ^~~
include/linux/dev_printk.h:160:58: note: in expansion of macro 'dev_fmt'
160 | dev_printk_index_wrap(_dev_info, KERN_INFO, dev, dev_fmt(fmt), ##__VA_ARGS__)
| ^~~~~~~
drivers/dma/at_hdmac.c:889:9: note: in expansion of macro 'dev_info'
889 | dev_info(chan2dev(chan),
| ^~~~~~~~
drivers/dma/at_hdmac.c:890:65: note: format string is defined here
890 | "%s: src=%pad, dest=%pad, numf=%d, frame_size=%d, flags=0x%lx\n",
| ~^
| |
| int
| %ld
In file included from include/linux/printk.h:574,
from include/linux/kernel.h:31,
from include/linux/clk.h:13,
from drivers/dma/at_hdmac.c:15:
drivers/dma/at_hdmac.c: In function 'atc_prep_dma_memset_sg':
>> drivers/dma/at_hdmac.c:1177:34: warning: format '%zx' expects argument of type 'size_t', but argument 6 has type 'unsigned int' [-Wformat=]
1177 | dev_vdbg(chan2dev(chan), "%s: v0x%x l0x%zx f0x%lx\n", __func__,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/dynamic_debug.h:224:29: note: in definition of macro '__dynamic_func_call_cls'
224 | func(&id, ##__VA_ARGS__); \
| ^~~~~~~~~~~
include/linux/dynamic_debug.h:250:9: note: in expansion of macro '_dynamic_func_call_cls'
250 | _dynamic_func_call_cls(_DPRINTK_CLASS_DFLT, fmt, func, ##__VA_ARGS__)
| ^~~~~~~~~~~~~~~~~~~~~~
include/linux/dynamic_debug.h:273:9: note: in expansion of macro '_dynamic_func_call'
273 | _dynamic_func_call(fmt, __dynamic_dev_dbg, \
| ^~~~~~~~~~~~~~~~~~
include/linux/dev_printk.h:165:9: note: in expansion of macro 'dynamic_dev_dbg'
165 | dynamic_dev_dbg(dev, dev_fmt(fmt), ##__VA_ARGS__)
| ^~~~~~~~~~~~~~~
include/linux/dev_printk.h:165:30: note: in expansion of macro 'dev_fmt'
165 | dynamic_dev_dbg(dev, dev_fmt(fmt), ##__VA_ARGS__)
| ^~~~~~~
include/linux/dev_printk.h:261:25: note: in expansion of macro 'dev_dbg'
261 | #define dev_vdbg dev_dbg
| ^~~~~~~
drivers/dma/at_hdmac.c:1177:9: note: in expansion of macro 'dev_vdbg'
1177 | dev_vdbg(chan2dev(chan), "%s: v0x%x l0x%zx f0x%lx\n", __func__,
| ^~~~~~~~
drivers/dma/at_hdmac.c:1177:50: note: format string is defined here
1177 | dev_vdbg(chan2dev(chan), "%s: v0x%x l0x%zx f0x%lx\n", __func__,
| ~~^
| |
| long unsigned int
| %x
drivers/dma/at_hdmac.c: In function 'atc_prep_dma_cyclic':
drivers/dma/at_hdmac.c:1506:34: warning: format '%d' expects argument of type 'int', but argument 7 has type 'size_t' {aka 'long unsigned int'} [-Wformat=]
1506 | dev_vdbg(chan2dev(chan), "prep_dma_cyclic: %s buf@%pad - %d (%d/%d)\n",
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/dynamic_debug.h:224:29: note: in definition of macro '__dynamic_func_call_cls'
224 | func(&id, ##__VA_ARGS__); \
| ^~~~~~~~~~~
include/linux/dynamic_debug.h:250:9: note: in expansion of macro '_dynamic_func_call_cls'
250 | _dynamic_func_call_cls(_DPRINTK_CLASS_DFLT, fmt, func, ##__VA_ARGS__)
| ^~~~~~~~~~~~~~~~~~~~~~
include/linux/dynamic_debug.h:273:9: note: in expansion of macro '_dynamic_func_call'
273 | _dynamic_func_call(fmt, __dynamic_dev_dbg, \
| ^~~~~~~~~~~~~~~~~~
include/linux/dev_printk.h:165:9: note: in expansion of macro 'dynamic_dev_dbg'
165 | dynamic_dev_dbg(dev, dev_fmt(fmt), ##__VA_ARGS__)
| ^~~~~~~~~~~~~~~
include/linux/dev_printk.h:165:30: note: in expansion of macro 'dev_fmt'
165 | dynamic_dev_dbg(dev, dev_fmt(fmt), ##__VA_ARGS__)
| ^~~~~~~
include/linux/dev_printk.h:261:25: note: in expansion of macro 'dev_dbg'
261 | #define dev_vdbg dev_dbg
| ^~~~~~~
drivers/dma/at_hdmac.c:1506:9: note: in expansion of macro 'dev_vdbg'
1506 | dev_vdbg(chan2dev(chan), "prep_dma_cyclic: %s buf@%pad - %d (%d/%d)\n",
| ^~~~~~~~
drivers/dma/at_hdmac.c:1506:71: note: format string is defined here
1506 | dev_vdbg(chan2dev(chan), "prep_dma_cyclic: %s buf@%pad - %d (%d/%d)\n",
| ~^
| |
| int
| %ld
drivers/dma/at_hdmac.c:1506:34: warning: format '%d' expects argument of type 'int', but argument 8 has type 'size_t' {aka 'long unsigned int'} [-Wformat=]
1506 | dev_vdbg(chan2dev(chan), "prep_dma_cyclic: %s buf@%pad - %d (%d/%d)\n",
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/dynamic_debug.h:224:29: note: in definition of macro '__dynamic_func_call_cls'
224 | func(&id, ##__VA_ARGS__); \
| ^~~~~~~~~~~
include/linux/dynamic_debug.h:250:9: note: in expansion of macro '_dynamic_func_call_cls'
250 | _dynamic_func_call_cls(_DPRINTK_CLASS_DFLT, fmt, func, ##__VA_ARGS__)
| ^~~~~~~~~~~~~~~~~~~~~~
include/linux/dynamic_debug.h:273:9: note: in expansion of macro '_dynamic_func_call'
273 | _dynamic_func_call(fmt, __dynamic_dev_dbg, \
| ^~~~~~~~~~~~~~~~~~
include/linux/dev_printk.h:165:9: note: in expansion of macro 'dynamic_dev_dbg'
165 | dynamic_dev_dbg(dev, dev_fmt(fmt), ##__VA_ARGS__)
| ^~~~~~~~~~~~~~~
include/linux/dev_printk.h:165:30: note: in expansion of macro 'dev_fmt'
165 | dynamic_dev_dbg(dev, dev_fmt(fmt), ##__VA_ARGS__)
| ^~~~~~~
include/linux/dev_printk.h:261:25: note: in expansion of macro 'dev_dbg'
261 | #define dev_vdbg dev_dbg
| ^~~~~~~
drivers/dma/at_hdmac.c:1506:9: note: in expansion of macro 'dev_vdbg'
1506 | dev_vdbg(chan2dev(chan), "prep_dma_cyclic: %s buf@%pad - %d (%d/%d)\n",
| ^~~~~~~~
drivers/dma/at_hdmac.c:1506:74: note: format string is defined here
1506 | dev_vdbg(chan2dev(chan), "prep_dma_cyclic: %s buf@%pad - %d (%d/%d)\n",
| ~^
| |
| int
| %ld
vim +890 drivers/dma/at_hdmac.c
dc78baa2b90b28 Nicolas Ferre 2009-07-03 858
dc78baa2b90b28 Nicolas Ferre 2009-07-03 859 /*-- DMA Engine API --------------------------------------------------*/
5abecfa5e96972 Maxime Ripard 2015-05-27 860 /**
5abecfa5e96972 Maxime Ripard 2015-05-27 861 * atc_prep_dma_interleaved - prepare memory to memory interleaved operation
5abecfa5e96972 Maxime Ripard 2015-05-27 862 * @chan: the channel to prepare operation on
5abecfa5e96972 Maxime Ripard 2015-05-27 863 * @xt: Interleaved transfer template
5abecfa5e96972 Maxime Ripard 2015-05-27 864 * @flags: tx descriptor status flags
5abecfa5e96972 Maxime Ripard 2015-05-27 865 */
5abecfa5e96972 Maxime Ripard 2015-05-27 866 static struct dma_async_tx_descriptor *
5abecfa5e96972 Maxime Ripard 2015-05-27 867 atc_prep_dma_interleaved(struct dma_chan *chan,
5abecfa5e96972 Maxime Ripard 2015-05-27 868 struct dma_interleaved_template *xt,
5abecfa5e96972 Maxime Ripard 2015-05-27 869 unsigned long flags)
5abecfa5e96972 Maxime Ripard 2015-05-27 870 {
ac803b56860f65 Tudor Ambarus 2022-10-25 871 struct at_dma *atdma = to_at_dma(chan->device);
5abecfa5e96972 Maxime Ripard 2015-05-27 872 struct at_dma_chan *atchan = to_at_dma_chan(chan);
62a277d43d47e7 Gustavo A. R. Silva 2017-11-20 873 struct data_chunk *first;
ac803b56860f65 Tudor Ambarus 2022-10-25 874 struct atdma_sg *atdma_sg;
ac803b56860f65 Tudor Ambarus 2022-10-25 875 struct at_desc *desc;
ac803b56860f65 Tudor Ambarus 2022-10-25 876 struct at_lli *lli;
5abecfa5e96972 Maxime Ripard 2015-05-27 877 size_t xfer_count;
5abecfa5e96972 Maxime Ripard 2015-05-27 878 unsigned int dwidth;
5abecfa5e96972 Maxime Ripard 2015-05-27 879 u32 ctrla;
5abecfa5e96972 Maxime Ripard 2015-05-27 880 u32 ctrlb;
5abecfa5e96972 Maxime Ripard 2015-05-27 881 size_t len = 0;
5abecfa5e96972 Maxime Ripard 2015-05-27 882 int i;
5abecfa5e96972 Maxime Ripard 2015-05-27 883
4483320e241c5f Maninder Singh 2015-06-26 884 if (unlikely(!xt || xt->numf != 1 || !xt->frame_size))
4483320e241c5f Maninder Singh 2015-06-26 885 return NULL;
4483320e241c5f Maninder Singh 2015-06-26 886
62a277d43d47e7 Gustavo A. R. Silva 2017-11-20 887 first = xt->sgl;
62a277d43d47e7 Gustavo A. R. Silva 2017-11-20 888
5abecfa5e96972 Maxime Ripard 2015-05-27 889 dev_info(chan2dev(chan),
2c5d7407e01272 Arnd Bergmann 2015-11-12 @890 "%s: src=%pad, dest=%pad, numf=%d, frame_size=%d, flags=0x%lx\n",
2c5d7407e01272 Arnd Bergmann 2015-11-12 891 __func__, &xt->src_start, &xt->dst_start, xt->numf,
5abecfa5e96972 Maxime Ripard 2015-05-27 892 xt->frame_size, flags);
5abecfa5e96972 Maxime Ripard 2015-05-27 893
5abecfa5e96972 Maxime Ripard 2015-05-27 894 /*
5abecfa5e96972 Maxime Ripard 2015-05-27 895 * The controller can only "skip" X bytes every Y bytes, so we
5abecfa5e96972 Maxime Ripard 2015-05-27 896 * need to make sure we are given a template that fit that
5abecfa5e96972 Maxime Ripard 2015-05-27 897 * description, ie a template with chunks that always have the
5abecfa5e96972 Maxime Ripard 2015-05-27 898 * same size, with the same ICGs.
5abecfa5e96972 Maxime Ripard 2015-05-27 899 */
5abecfa5e96972 Maxime Ripard 2015-05-27 900 for (i = 0; i < xt->frame_size; i++) {
5abecfa5e96972 Maxime Ripard 2015-05-27 901 struct data_chunk *chunk = xt->sgl + i;
5abecfa5e96972 Maxime Ripard 2015-05-27 902
5abecfa5e96972 Maxime Ripard 2015-05-27 903 if ((chunk->size != xt->sgl->size) ||
5abecfa5e96972 Maxime Ripard 2015-05-27 904 (dmaengine_get_dst_icg(xt, chunk) != dmaengine_get_dst_icg(xt, first)) ||
5abecfa5e96972 Maxime Ripard 2015-05-27 905 (dmaengine_get_src_icg(xt, chunk) != dmaengine_get_src_icg(xt, first))) {
5abecfa5e96972 Maxime Ripard 2015-05-27 906 dev_err(chan2dev(chan),
5abecfa5e96972 Maxime Ripard 2015-05-27 907 "%s: the controller can transfer only identical chunks\n",
5abecfa5e96972 Maxime Ripard 2015-05-27 908 __func__);
5abecfa5e96972 Maxime Ripard 2015-05-27 909 return NULL;
5abecfa5e96972 Maxime Ripard 2015-05-27 910 }
5abecfa5e96972 Maxime Ripard 2015-05-27 911
5abecfa5e96972 Maxime Ripard 2015-05-27 912 len += chunk->size;
5abecfa5e96972 Maxime Ripard 2015-05-27 913 }
5abecfa5e96972 Maxime Ripard 2015-05-27 914
ac803b56860f65 Tudor Ambarus 2022-10-25 915 dwidth = atc_get_xfer_width(xt->src_start, xt->dst_start, len);
5abecfa5e96972 Maxime Ripard 2015-05-27 916
5abecfa5e96972 Maxime Ripard 2015-05-27 917 xfer_count = len >> dwidth;
5abecfa5e96972 Maxime Ripard 2015-05-27 918 if (xfer_count > ATC_BTSIZE_MAX) {
5abecfa5e96972 Maxime Ripard 2015-05-27 919 dev_err(chan2dev(chan), "%s: buffer is too big\n", __func__);
5abecfa5e96972 Maxime Ripard 2015-05-27 920 return NULL;
5abecfa5e96972 Maxime Ripard 2015-05-27 921 }
5abecfa5e96972 Maxime Ripard 2015-05-27 922
d8840a7edcf0aa Tudor Ambarus 2022-10-25 923 ctrla = FIELD_PREP(ATC_SRC_WIDTH, dwidth) |
d8840a7edcf0aa Tudor Ambarus 2022-10-25 924 FIELD_PREP(ATC_DST_WIDTH, dwidth);
5abecfa5e96972 Maxime Ripard 2015-05-27 925
d8840a7edcf0aa Tudor Ambarus 2022-10-25 926 ctrlb = ATC_DEFAULT_CTRLB | ATC_IEN |
d8840a7edcf0aa Tudor Ambarus 2022-10-25 927 FIELD_PREP(ATC_SRC_ADDR_MODE, ATC_SRC_ADDR_MODE_INCR) |
d8840a7edcf0aa Tudor Ambarus 2022-10-25 928 FIELD_PREP(ATC_DST_ADDR_MODE, ATC_DST_ADDR_MODE_INCR) |
d8840a7edcf0aa Tudor Ambarus 2022-10-25 929 ATC_SRC_PIP | ATC_DST_PIP |
d8840a7edcf0aa Tudor Ambarus 2022-10-25 930 FIELD_PREP(ATC_FC, ATC_FC_MEM2MEM);
5abecfa5e96972 Maxime Ripard 2015-05-27 931
ac803b56860f65 Tudor Ambarus 2022-10-25 932 desc = kzalloc(struct_size(desc, sg, 1), GFP_ATOMIC);
ac803b56860f65 Tudor Ambarus 2022-10-25 933 if (!desc)
ac803b56860f65 Tudor Ambarus 2022-10-25 934 return NULL;
ac803b56860f65 Tudor Ambarus 2022-10-25 935 desc->sglen = 1;
ac803b56860f65 Tudor Ambarus 2022-10-25 936
ac803b56860f65 Tudor Ambarus 2022-10-25 937 atdma_sg = desc->sg;
ac803b56860f65 Tudor Ambarus 2022-10-25 938 atdma_sg->lli = dma_pool_alloc(atdma->lli_pool, GFP_NOWAIT,
ac803b56860f65 Tudor Ambarus 2022-10-25 939 &atdma_sg->lli_phys);
ac803b56860f65 Tudor Ambarus 2022-10-25 940 if (!atdma_sg->lli) {
ac803b56860f65 Tudor Ambarus 2022-10-25 941 kfree(desc);
5abecfa5e96972 Maxime Ripard 2015-05-27 942 return NULL;
5abecfa5e96972 Maxime Ripard 2015-05-27 943 }
ac803b56860f65 Tudor Ambarus 2022-10-25 944 lli = atdma_sg->lli;
5abecfa5e96972 Maxime Ripard 2015-05-27 945
ac803b56860f65 Tudor Ambarus 2022-10-25 946 lli->saddr = xt->src_start;
ac803b56860f65 Tudor Ambarus 2022-10-25 947 lli->daddr = xt->dst_start;
ac803b56860f65 Tudor Ambarus 2022-10-25 948 lli->ctrla = ctrla | xfer_count;
ac803b56860f65 Tudor Ambarus 2022-10-25 949 lli->ctrlb = ctrlb;
5abecfa5e96972 Maxime Ripard 2015-05-27 950
5abecfa5e96972 Maxime Ripard 2015-05-27 951 desc->boundary = first->size >> dwidth;
5abecfa5e96972 Maxime Ripard 2015-05-27 952 desc->dst_hole = (dmaengine_get_dst_icg(xt, first) >> dwidth) + 1;
5abecfa5e96972 Maxime Ripard 2015-05-27 953 desc->src_hole = (dmaengine_get_src_icg(xt, first) >> dwidth) + 1;
5abecfa5e96972 Maxime Ripard 2015-05-27 954
ac803b56860f65 Tudor Ambarus 2022-10-25 955 atdma_sg->len = len;
ac803b56860f65 Tudor Ambarus 2022-10-25 956 desc->total_len = len;
5abecfa5e96972 Maxime Ripard 2015-05-27 957
ac803b56860f65 Tudor Ambarus 2022-10-25 958 set_lli_eol(desc, 0);
ac803b56860f65 Tudor Ambarus 2022-10-25 959 return vchan_tx_prep(&atchan->vc, &desc->vd, flags);
5abecfa5e96972 Maxime Ripard 2015-05-27 960 }
5abecfa5e96972 Maxime Ripard 2015-05-27 961
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH v2 0/7] dmaengine:Use devm_clk_get_enabled() helpers
2024-08-30 18:11 ` [PATCH v2 0/7] dmaengine:Use " Krzysztof Kozlowski
@ 2024-09-03 5:18 ` Vinod Koul
0 siblings, 0 replies; 16+ messages in thread
From: Vinod Koul @ 2024-09-03 5:18 UTC (permalink / raw)
To: Krzysztof Kozlowski
Cc: Liao Yuanhong, dmaengine, linux-arm-kernel, linux-kernel, imx
On 30-08-24, 20:11, Krzysztof Kozlowski wrote:
> On 30/08/2024 11:41, Liao Yuanhong wrote:
> > The devm_clk_get_enabled() helpers:
> > - call devm_clk_get()
> > - call clk_prepare_enable() and register what is needed in order to
> > call clk_disable_unprepare() when needed, as a managed resource.
> >
> > This simplifies the code and avoids the calls to clk_disable_unprepare().
> > ---
> > v2:remove inappropriate modifications, configure COMPILE_TEST for easy
> > testing, add devm_clk_getprepaed() for imx sdma device.
> > ---
> >
>
> Vinod,
>
> Since ~2 weeks there is tremendous amount of trivial patches coming from
> vivo.com. I identified at least 6 buggy, where the contributor did not
> understand the code. Not sure about intention, but I advise extra
> carefulness
> when dealing with these "trivial" improvements.
Agree, these are introducing bugs as well..
Vivo folks, please channel your energies into fixing some real problems,
contributing support for your vivo phones including DT, drivers and
running mainline on them...
That would be better use of your and our time :-)
BR
--
~Vinod
^ permalink raw reply [flat|nested] 16+ messages in thread
end of thread, other threads:[~2024-09-03 5:19 UTC | newest]
Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-30 9:41 [PATCH v2 0/7] dmaengine:Use devm_clk_get_enabled() helpers Liao Yuanhong
2024-08-30 9:41 ` [PATCH v2 1/7] dmaengine:Add COMPILE_TEST for easy testing Liao Yuanhong
2024-08-30 17:44 ` Krzysztof Kozlowski
2024-08-31 13:15 ` kernel test robot
2024-08-31 21:31 ` kernel test robot
2024-08-30 9:41 ` [PATCH v2 2/7] dmaengine:at_hdmac:Use devm_clk_get_enabled() helpers Liao Yuanhong
2024-08-30 12:24 ` Nicolas Ferre
2024-08-30 9:41 ` [PATCH v2 3/7] dmaengine:dma-jz4780:Use " Liao Yuanhong
2024-08-30 9:41 ` [PATCH v2 4/7] dmaengine:imx-dma:Use " Liao Yuanhong
2024-08-30 15:12 ` Frank Li
2024-08-30 9:41 ` [PATCH v2 5/7] dmaengine:imx-sdma:Use devm_clk_get_prepared() helpers Liao Yuanhong
2024-08-30 15:11 ` Frank Li
2024-08-30 9:41 ` [PATCH v2 6/7] dmaengine:milbeaut-hdmac:Use devm_clk_get_enabled() helpers Liao Yuanhong
2024-08-30 9:41 ` [PATCH v2 7/7] dmaengine:uniphier-mdmac:Use " Liao Yuanhong
2024-08-30 18:11 ` [PATCH v2 0/7] dmaengine:Use " Krzysztof Kozlowski
2024-09-03 5:18 ` Vinod Koul
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).