* [PATCH v3 0/7] dmaengine: Manage OF DMA routers and disable STM32 unbind
@ 2026-12-04 12:16 Tian Xuechen
2026-12-04 12:16 ` [PATCH v3 1/7] dmaengine: of: Add managed DMA router registration Tian Xuechen
` (6 more replies)
0 siblings, 7 replies; 13+ messages in thread
From: Tian Xuechen @ 2026-12-04 12:16 UTC (permalink / raw)
To: vkoul; +Cc: Frank.Li, dmaengine, amelie.delaunay, vz, vireshk, vigneshr
Add devm_of_dma_router_register() and convert the LPC18xx, LPC32xx,
RZ/N1, STM32 DMAMUX and TI DMA crossbar drivers. On device detach the
helper withdraws the router entry before devres frees its backing
data. The TI conversion covers both probe paths.
Following Amelie's feedback on the STM32 series, disable manual sysfs
bind and unbind on the built-in STM32 DMAMUX, DMA and MDMA drivers in
a separate patch. The flag also opts these drivers out of the driver
core's debug probe/remove test. The DMAMUX conversion keeps the existing
probe error unwind for runtime PM and clocks.
Cross-compiled the OF DMA core and seven driver objects with ARM
allmodconfig, Clang 21.1.8 and W=1. No runtime tests were performed.
Changes in v3:
- Combine the RZ/N1, STM32 DMAMUX and TI router changes with the
LPC series at Frank's request.
- Add the separate STM32 sysfs bind/unbind patch suggested by Amelie.
- Install the release action before publishing the router and
remove the action if registration fails.
- Mark driver fixes that depend on the new API as stable+noautosel.
- Retain the review tags for the unchanged LPC driver diffs.
v2: https://lore.kernel.org/r/20261127110400.379397-1-202300460064@mail.sdu.edu.cn
RZ/N1 review: https://lore.kernel.org/r/axGZwK_S5bdGRwpO@SMW015318
STM32 router review: https://lore.kernel.org/r/awmem4rf9yPfggMa@SMW015318
STM32 sysfs discussion: https://lore.kernel.org/r/f2a156ee-55d4-4a00-ac75-bb51f1785a9d@foss.st.com
TI router patch: https://lore.kernel.org/r/20261128110224.875369-3-202300460064@mail.sdu.edu.cn
A coding assistant helped prepare the router conversions, helper
failure path, STM32 sysfs change and cover letter.
Tian Xuechen (7):
dmaengine: of: Add managed DMA router registration
dmaengine: lpc18xx-dmamux: Use managed DMA router registration
dmaengine: lpc32xx-dmamux: Use managed DMA router registration
dmaengine: dw: dmamux: Use managed DMA router registration
dmaengine: stm32: Disable manual bind and unbind
dmaengine: stm32-dmamux: Use managed DMA router registration
dmaengine: ti-dma-crossbar: Use managed DMA router registration
drivers/dma/dw/rzn1-dmamux.c | 5 +++--
drivers/dma/lpc18xx-dmamux.c | 5 +++--
drivers/dma/lpc32xx-dmamux.c | 5 +++--
drivers/dma/stm32/stm32-dma.c | 1 +
drivers/dma/stm32/stm32-dmamux.c | 6 ++++--
drivers/dma/stm32/stm32-mdma.c | 1 +
drivers/dma/ti/dma-crossbar.c | 10 ++++++----
include/linux/of_dma.h | 28 ++++++++++++++++++++++++++++
8 files changed, 49 insertions(+), 12 deletions(-)
base-commit: 2e02fb103be058cf8b2fb24112a74a2715e090f0
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH v3 1/7] dmaengine: of: Add managed DMA router registration
2026-12-04 12:16 [PATCH v3 0/7] dmaengine: Manage OF DMA routers and disable STM32 unbind Tian Xuechen
@ 2026-12-04 12:16 ` Tian Xuechen
2026-12-04 17:54 ` Frank Li
2026-12-04 12:16 ` [PATCH v3 2/7] dmaengine: lpc18xx-dmamux: Use " Tian Xuechen
` (5 subsequent siblings)
6 siblings, 1 reply; 13+ messages in thread
From: Tian Xuechen @ 2026-12-04 12:16 UTC (permalink / raw)
To: vkoul; +Cc: Frank.Li, dmaengine, robh, saravanak, devicetree
Add devm_of_dma_router_register() to unregister an OF DMA router
when its device is detached. Reuse the controller release action
because controllers and routers share the same registry.
Install the release action before publishing the router so allocating
the action cannot fail after publication. If router registration
fails, remove the unused action.
Signed-off-by: Tian Xuechen <202300460064@mail.sdu.edu.cn>
---
include/linux/of_dma.h | 28 ++++++++++++++++++++++++++++
1 file changed, 28 insertions(+)
diff --git a/include/linux/of_dma.h b/include/linux/of_dma.h
index 16b08234d..df200c0cb 100644
--- a/include/linux/of_dma.h
+++ b/include/linux/of_dma.h
@@ -64,6 +64,25 @@ extern int of_dma_router_register(struct device_node *np,
struct dma_router *dma_router);
#define of_dma_router_free of_dma_controller_free
+static inline int
+devm_of_dma_router_register(struct device *dev, struct device_node *np,
+ void *(*of_dma_route_allocate)
+ (struct of_phandle_args *, struct of_dma *),
+ struct dma_router *dma_router)
+{
+ int ret;
+
+ ret = devm_add_action(dev, __of_dma_controller_free, np);
+ if (ret)
+ return ret;
+
+ ret = of_dma_router_register(np, of_dma_route_allocate, dma_router);
+ if (ret)
+ devm_remove_action(dev, __of_dma_controller_free, np);
+
+ return ret;
+}
+
extern struct dma_chan *of_dma_request_slave_channel(struct device_node *np,
const char *name);
extern struct dma_chan *of_dma_simple_xlate(struct of_phandle_args *dma_spec,
@@ -103,6 +122,15 @@ static inline int of_dma_router_register(struct device_node *np,
#define of_dma_router_free of_dma_controller_free
+static inline int
+devm_of_dma_router_register(struct device *dev, struct device_node *np,
+ void *(*of_dma_route_allocate)
+ (struct of_phandle_args *, struct of_dma *),
+ struct dma_router *dma_router)
+{
+ return -ENODEV;
+}
+
static inline struct dma_chan *of_dma_request_slave_channel(struct device_node *np,
const char *name)
{
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH v3 2/7] dmaengine: lpc18xx-dmamux: Use managed DMA router registration
2026-12-04 12:16 [PATCH v3 0/7] dmaengine: Manage OF DMA routers and disable STM32 unbind Tian Xuechen
2026-12-04 12:16 ` [PATCH v3 1/7] dmaengine: of: Add managed DMA router registration Tian Xuechen
@ 2026-12-04 12:16 ` Tian Xuechen
2026-12-04 12:16 ` [PATCH v3 3/7] dmaengine: lpc32xx-dmamux: " Tian Xuechen
` (4 subsequent siblings)
6 siblings, 0 replies; 13+ messages in thread
From: Tian Xuechen @ 2026-12-04 12:16 UTC (permalink / raw)
To: vkoul; +Cc: Frank.Li, dmaengine, vz, manabian, linux-arm-kernel
The DMA router remains in the OF registry after its device-managed
data is released. Use managed registration to remove the routing
entry before the router data is freed.
This issue was found by our static analysis tool under development.
Fixes: e5f4ae84be74 ("dmaengine: add driver for lpc18xx dmamux")
Cc: stable+noautosel@kernel.org # relies on new API
Reviewed-by: Frank Li <Frank.Li@nxp.com>
Reviewed-by: Vladimir Zapolskiy <vz@mleia.com>
Signed-off-by: Tian Xuechen <202300460064@mail.sdu.edu.cn>
---
drivers/dma/lpc18xx-dmamux.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/dma/lpc18xx-dmamux.c b/drivers/dma/lpc18xx-dmamux.c
index d3ff52195..0c6758c53 100644
--- a/drivers/dma/lpc18xx-dmamux.c
+++ b/drivers/dma/lpc18xx-dmamux.c
@@ -166,8 +166,9 @@ static int lpc18xx_dmamux_probe(struct platform_device *pdev)
dmamux->dmarouter.dev = &pdev->dev;
dmamux->dmarouter.route_free = lpc18xx_dmamux_free;
- return of_dma_router_register(np, lpc18xx_dmamux_reserve,
- &dmamux->dmarouter);
+ return devm_of_dma_router_register(&pdev->dev, np,
+ lpc18xx_dmamux_reserve,
+ &dmamux->dmarouter);
}
static const struct of_device_id lpc18xx_dmamux_match[] = {
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH v3 3/7] dmaengine: lpc32xx-dmamux: Use managed DMA router registration
2026-12-04 12:16 [PATCH v3 0/7] dmaengine: Manage OF DMA routers and disable STM32 unbind Tian Xuechen
2026-12-04 12:16 ` [PATCH v3 1/7] dmaengine: of: Add managed DMA router registration Tian Xuechen
2026-12-04 12:16 ` [PATCH v3 2/7] dmaengine: lpc18xx-dmamux: Use " Tian Xuechen
@ 2026-12-04 12:16 ` Tian Xuechen
2026-12-04 12:16 ` [PATCH v3 4/7] dmaengine: dw: dmamux: " Tian Xuechen
` (3 subsequent siblings)
6 siblings, 0 replies; 13+ messages in thread
From: Tian Xuechen @ 2026-12-04 12:16 UTC (permalink / raw)
To: vkoul; +Cc: Frank.Li, dmaengine, vz, piotr.wojtaszczyk, linux-arm-kernel
The DMA router remains in the OF registry after its device-managed
data is released. Use managed registration to remove the routing
entry before the router data is freed.
This issue was found by our static analysis tool under development.
Fixes: 5d318b595982 ("dmaengine: Add dma router for pl08x in LPC32XX SoC")
Cc: stable+noautosel@kernel.org # relies on new API
Reviewed-by: Frank Li <Frank.Li@nxp.com>
Reviewed-by: Vladimir Zapolskiy <vz@mleia.com>
Signed-off-by: Tian Xuechen <202300460064@mail.sdu.edu.cn>
---
drivers/dma/lpc32xx-dmamux.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/dma/lpc32xx-dmamux.c b/drivers/dma/lpc32xx-dmamux.c
index 33be71474..3218be8e8 100644
--- a/drivers/dma/lpc32xx-dmamux.c
+++ b/drivers/dma/lpc32xx-dmamux.c
@@ -180,8 +180,9 @@ static int lpc32xx_dmamux_probe(struct platform_device *pdev)
dmamux->dmarouter.dev = &pdev->dev;
dmamux->dmarouter.route_free = lpc32xx_dmamux_release;
- return of_dma_router_register(np, lpc32xx_dmamux_reserve,
- &dmamux->dmarouter);
+ return devm_of_dma_router_register(&pdev->dev, np,
+ lpc32xx_dmamux_reserve,
+ &dmamux->dmarouter);
}
static const struct of_device_id lpc32xx_dmamux_match[] = {
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH v3 4/7] dmaengine: dw: dmamux: Use managed DMA router registration
2026-12-04 12:16 [PATCH v3 0/7] dmaengine: Manage OF DMA routers and disable STM32 unbind Tian Xuechen
` (2 preceding siblings ...)
2026-12-04 12:16 ` [PATCH v3 3/7] dmaengine: lpc32xx-dmamux: " Tian Xuechen
@ 2026-12-04 12:16 ` Tian Xuechen
2026-12-04 17:55 ` Frank Li
2026-12-04 12:16 ` [PATCH v3 5/7] dmaengine: stm32: Disable manual bind and unbind Tian Xuechen
` (2 subsequent siblings)
6 siblings, 1 reply; 13+ messages in thread
From: Tian Xuechen @ 2026-12-04 12:16 UTC (permalink / raw)
To: vkoul
Cc: Frank.Li, dmaengine, vireshk, andriy.shevchenko, ilpo.jarvinen,
miquel.raynal
The RZ/N1 DMAMUX leaves its router in the OF DMA registry when the
device is detached. The router data is then released by devres.
Register the router with devm_of_dma_router_register() so that its
registry entry is removed before the managed router data is released.
Fixes: 134d9c52fca2 ("dmaengine: dw: dmamux: Introduce RZN1 DMA router support")
Cc: stable+noautosel@kernel.org # relies on new API
Signed-off-by: Tian Xuechen <202300460064@mail.sdu.edu.cn>
---
drivers/dma/dw/rzn1-dmamux.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/dma/dw/rzn1-dmamux.c b/drivers/dma/dw/rzn1-dmamux.c
index fb495ee6e..4fed7f40b 100644
--- a/drivers/dma/dw/rzn1-dmamux.c
+++ b/drivers/dma/dw/rzn1-dmamux.c
@@ -145,8 +145,9 @@ static int rzn1_dmamux_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, dmamux);
- return of_dma_router_register(mux_node, rzn1_dmamux_route_allocate,
- &dmamux->dmarouter);
+ return devm_of_dma_router_register(&pdev->dev, mux_node,
+ rzn1_dmamux_route_allocate,
+ &dmamux->dmarouter);
}
static const struct of_device_id rzn1_dmamux_match[] = {
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH v3 5/7] dmaengine: stm32: Disable manual bind and unbind
2026-12-04 12:16 [PATCH v3 0/7] dmaengine: Manage OF DMA routers and disable STM32 unbind Tian Xuechen
` (3 preceding siblings ...)
2026-12-04 12:16 ` [PATCH v3 4/7] dmaengine: dw: dmamux: " Tian Xuechen
@ 2026-12-04 12:16 ` Tian Xuechen
2026-12-04 17:56 ` Frank Li
2026-12-04 12:16 ` [PATCH v3 6/7] dmaengine: stm32-dmamux: Use managed DMA router registration Tian Xuechen
2026-12-04 12:16 ` [PATCH v3 7/7] dmaengine: ti-dma-crossbar: " Tian Xuechen
6 siblings, 1 reply; 13+ messages in thread
From: Tian Xuechen @ 2026-12-04 12:16 UTC (permalink / raw)
To: vkoul
Cc: Frank.Li, dmaengine, amelie.delaunay, mcoquelin.stm32,
alexandre.torgue, cedric.madianga, pierre-yves.mordret,
linux-stm32, linux-arm-kernel
STM32 DMAMUX routes peripheral requests to the STM32 DMA controller,
and STM32 DMA and MDMA channels can be chained. The three built-in
drivers are not designed to be unbound while those paths are in use.
Set suppress_bind_attrs on all three platform drivers to disable
manual bind and unbind through sysfs.
Suggested-by: Amelie Delaunay <amelie.delaunay@foss.st.com>
Link: https://lore.kernel.org/r/f2a156ee-55d4-4a00-ac75-bb51f1785a9d@foss.st.com
Signed-off-by: Tian Xuechen <202300460064@mail.sdu.edu.cn>
---
drivers/dma/stm32/stm32-dma.c | 1 +
drivers/dma/stm32/stm32-dmamux.c | 1 +
drivers/dma/stm32/stm32-mdma.c | 1 +
3 files changed, 3 insertions(+)
diff --git a/drivers/dma/stm32/stm32-dma.c b/drivers/dma/stm32/stm32-dma.c
index 4688cebaf..f34e5e36f 100644
--- a/drivers/dma/stm32/stm32-dma.c
+++ b/drivers/dma/stm32/stm32-dma.c
@@ -1764,6 +1764,7 @@ static const struct dev_pm_ops stm32_dma_pm_ops = {
static struct platform_driver stm32_dma_driver = {
.driver = {
.name = "stm32-dma",
+ .suppress_bind_attrs = true,
.of_match_table = stm32_dma_of_match,
.pm = &stm32_dma_pm_ops,
},
diff --git a/drivers/dma/stm32/stm32-dmamux.c b/drivers/dma/stm32/stm32-dmamux.c
index 57318715d..b3cacd57b 100644
--- a/drivers/dma/stm32/stm32-dmamux.c
+++ b/drivers/dma/stm32/stm32-dmamux.c
@@ -393,6 +393,7 @@ static struct platform_driver stm32_dmamux_driver = {
.probe = stm32_dmamux_probe,
.driver = {
.name = "stm32-dmamux",
+ .suppress_bind_attrs = true,
.of_match_table = stm32_dmamux_match,
.pm = &stm32_dmamux_pm_ops,
},
diff --git a/drivers/dma/stm32/stm32-mdma.c b/drivers/dma/stm32/stm32-mdma.c
index 04639e4b5..e2e638a1f 100644
--- a/drivers/dma/stm32/stm32-mdma.c
+++ b/drivers/dma/stm32/stm32-mdma.c
@@ -1806,6 +1806,7 @@ static struct platform_driver stm32_mdma_driver = {
.probe = stm32_mdma_probe,
.driver = {
.name = "stm32-mdma",
+ .suppress_bind_attrs = true,
.of_match_table = stm32_mdma_of_match,
.pm = &stm32_mdma_pm_ops,
},
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH v3 6/7] dmaengine: stm32-dmamux: Use managed DMA router registration
2026-12-04 12:16 [PATCH v3 0/7] dmaengine: Manage OF DMA routers and disable STM32 unbind Tian Xuechen
` (4 preceding siblings ...)
2026-12-04 12:16 ` [PATCH v3 5/7] dmaengine: stm32: Disable manual bind and unbind Tian Xuechen
@ 2026-12-04 12:16 ` Tian Xuechen
2026-12-04 17:57 ` Frank Li
2026-12-04 12:16 ` [PATCH v3 7/7] dmaengine: ti-dma-crossbar: " Tian Xuechen
6 siblings, 1 reply; 13+ messages in thread
From: Tian Xuechen @ 2026-12-04 12:16 UTC (permalink / raw)
To: vkoul
Cc: Frank.Li, dmaengine, amelie.delaunay, mcoquelin.stm32,
alexandre.torgue, cedric.madianga, pierre-yves.mordret,
linux-stm32, linux-arm-kernel
The STM32 DMAMUX registers an OF DMA router backed by managed driver
data. The router entry can outlive that data when the device is
detached.
Use devm_of_dma_router_register() to remove the entry before devres
releases the router data. Keep the probe error unwind for runtime PM
and clocks when registration fails.
Fixes: df7e762db5f6 ("dmaengine: Add STM32 DMAMUX driver")
Cc: stable+noautosel@kernel.org # relies on new API
Signed-off-by: Tian Xuechen <202300460064@mail.sdu.edu.cn>
---
drivers/dma/stm32/stm32-dmamux.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/dma/stm32/stm32-dmamux.c b/drivers/dma/stm32/stm32-dmamux.c
index b3cacd57b..3cb9d4051 100644
--- a/drivers/dma/stm32/stm32-dmamux.c
+++ b/drivers/dma/stm32/stm32-dmamux.c
@@ -290,8 +290,9 @@ static int stm32_dmamux_probe(struct platform_device *pdev)
pm_runtime_put(&pdev->dev);
- ret = of_dma_router_register(node, stm32_dmamux_route_allocate,
- &stm32_dmamux->dmarouter);
+ ret = devm_of_dma_router_register(&pdev->dev, node,
+ stm32_dmamux_route_allocate,
+ &stm32_dmamux->dmarouter);
if (ret)
goto pm_disable;
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH v3 7/7] dmaengine: ti-dma-crossbar: Use managed DMA router registration
2026-12-04 12:16 [PATCH v3 0/7] dmaengine: Manage OF DMA routers and disable STM32 unbind Tian Xuechen
` (5 preceding siblings ...)
2026-12-04 12:16 ` [PATCH v3 6/7] dmaengine: stm32-dmamux: Use managed DMA router registration Tian Xuechen
@ 2026-12-04 12:16 ` Tian Xuechen
2026-12-04 17:57 ` Frank Li
6 siblings, 1 reply; 13+ messages in thread
From: Tian Xuechen @ 2026-12-04 12:16 UTC (permalink / raw)
To: vkoul; +Cc: Frank.Li, dmaengine, vigneshr, peter.ujfalusi, grygorii.strashko
The AM335x/AM43xx and DRA7x probe paths register OF DMA routers backed
by managed driver data. Their registry entries can outlive that data
when the device is detached.
Use devm_of_dma_router_register() for both probe paths so devres
withdraws the entries before releasing their backing data. Preserve
the DRA7x register reset on registration failure.
Fixes: a074ae38f859 ("dmaengine: Add driver for TI DMA crossbar on DRA7x")
Fixes: 42dbdcc6bf96 ("dmaengine: ti-dma-crossbar: Add support for crossbar on AM33xx/AM43xx")
Cc: stable+noautosel@kernel.org # relies on new API
Signed-off-by: Tian Xuechen <202300460064@mail.sdu.edu.cn>
---
drivers/dma/ti/dma-crossbar.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/drivers/dma/ti/dma-crossbar.c b/drivers/dma/ti/dma-crossbar.c
index f6d75ee94..87a728c48 100644
--- a/drivers/dma/ti/dma-crossbar.c
+++ b/drivers/dma/ti/dma-crossbar.c
@@ -192,8 +192,9 @@ static int ti_am335x_xbar_probe(struct platform_device *pdev)
for (i = 0; i < xbar->dma_requests; i++)
ti_am335x_xbar_write(xbar->iomem, i, 0);
- ret = of_dma_router_register(node, ti_am335x_xbar_route_allocate,
- &xbar->dmarouter);
+ ret = devm_of_dma_router_register(&pdev->dev, node,
+ ti_am335x_xbar_route_allocate,
+ &xbar->dmarouter);
return ret;
}
@@ -430,8 +431,9 @@ static int ti_dra7_xbar_probe(struct platform_device *pdev)
ti_dra7_xbar_write(xbar->iomem, i, xbar->safe_val);
}
- ret = of_dma_router_register(node, ti_dra7_xbar_route_allocate,
- &xbar->dmarouter);
+ ret = devm_of_dma_router_register(&pdev->dev, node,
+ ti_dra7_xbar_route_allocate,
+ &xbar->dmarouter);
if (ret) {
/* Restore the defaults for the crossbar */
for (i = 0; i < xbar->dma_requests; i++) {
^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PATCH v3 1/7] dmaengine: of: Add managed DMA router registration
2026-12-04 12:16 ` [PATCH v3 1/7] dmaengine: of: Add managed DMA router registration Tian Xuechen
@ 2026-12-04 17:54 ` Frank Li
0 siblings, 0 replies; 13+ messages in thread
From: Frank Li @ 2026-12-04 17:54 UTC (permalink / raw)
To: Tian Xuechen; +Cc: vkoul, Frank.Li, dmaengine, robh, saravanak, devicetree
On Fri, Dec 04, 2026 at 08:16:24PM +0800, Tian Xuechen wrote:
> Add devm_of_dma_router_register() to unregister an OF DMA router
> when its device is detached. Reuse the controller release action
> because controllers and routers share the same registry.
>
> Install the release action before publishing the router so allocating
> the action cannot fail after publication. If router registration
> fails, remove the unused action.
>
> Signed-off-by: Tian Xuechen <202300460064@mail.sdu.edu.cn>
> ---
I remember I reviewed this patch. Did you missed my review tags.
And also missed Vladimir Zapolskiy's review tags.
Reviewed-by: Frank Li <Frank.Li@nxp.com>
> include/linux/of_dma.h | 28 ++++++++++++++++++++++++++++
> 1 file changed, 28 insertions(+)
>
> diff --git a/include/linux/of_dma.h b/include/linux/of_dma.h
> index 16b08234d..df200c0cb 100644
> --- a/include/linux/of_dma.h
> +++ b/include/linux/of_dma.h
> @@ -64,6 +64,25 @@ extern int of_dma_router_register(struct device_node *np,
> struct dma_router *dma_router);
> #define of_dma_router_free of_dma_controller_free
>
> +static inline int
> +devm_of_dma_router_register(struct device *dev, struct device_node *np,
> + void *(*of_dma_route_allocate)
> + (struct of_phandle_args *, struct of_dma *),
> + struct dma_router *dma_router)
> +{
> + int ret;
> +
> + ret = devm_add_action(dev, __of_dma_controller_free, np);
> + if (ret)
> + return ret;
> +
> + ret = of_dma_router_register(np, of_dma_route_allocate, dma_router);
> + if (ret)
> + devm_remove_action(dev, __of_dma_controller_free, np);
> +
> + return ret;
> +}
> +
> extern struct dma_chan *of_dma_request_slave_channel(struct device_node *np,
> const char *name);
> extern struct dma_chan *of_dma_simple_xlate(struct of_phandle_args *dma_spec,
> @@ -103,6 +122,15 @@ static inline int of_dma_router_register(struct device_node *np,
>
> #define of_dma_router_free of_dma_controller_free
>
> +static inline int
> +devm_of_dma_router_register(struct device *dev, struct device_node *np,
> + void *(*of_dma_route_allocate)
> + (struct of_phandle_args *, struct of_dma *),
> + struct dma_router *dma_router)
> +{
> + return -ENODEV;
> +}
> +
> static inline struct dma_chan *of_dma_request_slave_channel(struct device_node *np,
> const char *name)
> {
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH v3 4/7] dmaengine: dw: dmamux: Use managed DMA router registration
2026-12-04 12:16 ` [PATCH v3 4/7] dmaengine: dw: dmamux: " Tian Xuechen
@ 2026-12-04 17:55 ` Frank Li
0 siblings, 0 replies; 13+ messages in thread
From: Frank Li @ 2026-12-04 17:55 UTC (permalink / raw)
To: Tian Xuechen
Cc: vkoul, Frank.Li, dmaengine, vireshk, andriy.shevchenko,
ilpo.jarvinen, miquel.raynal
On Fri, Dec 04, 2026 at 08:16:27PM +0800, Tian Xuechen wrote:
> The RZ/N1 DMAMUX leaves its router in the OF DMA registry when the
> device is detached. The router data is then released by devres.
>
> Register the router with devm_of_dma_router_register() so that its
> registry entry is removed before the managed router data is released.
>
> Fixes: 134d9c52fca2 ("dmaengine: dw: dmamux: Introduce RZN1 DMA router support")
> Cc: stable+noautosel@kernel.org # relies on new API
> Signed-off-by: Tian Xuechen <202300460064@mail.sdu.edu.cn>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
> ---
> drivers/dma/dw/rzn1-dmamux.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/dma/dw/rzn1-dmamux.c b/drivers/dma/dw/rzn1-dmamux.c
> index fb495ee6e..4fed7f40b 100644
> --- a/drivers/dma/dw/rzn1-dmamux.c
> +++ b/drivers/dma/dw/rzn1-dmamux.c
> @@ -145,8 +145,9 @@ static int rzn1_dmamux_probe(struct platform_device *pdev)
>
> platform_set_drvdata(pdev, dmamux);
>
> - return of_dma_router_register(mux_node, rzn1_dmamux_route_allocate,
> - &dmamux->dmarouter);
> + return devm_of_dma_router_register(&pdev->dev, mux_node,
> + rzn1_dmamux_route_allocate,
> + &dmamux->dmarouter);
> }
>
> static const struct of_device_id rzn1_dmamux_match[] = {
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH v3 5/7] dmaengine: stm32: Disable manual bind and unbind
2026-12-04 12:16 ` [PATCH v3 5/7] dmaengine: stm32: Disable manual bind and unbind Tian Xuechen
@ 2026-12-04 17:56 ` Frank Li
0 siblings, 0 replies; 13+ messages in thread
From: Frank Li @ 2026-12-04 17:56 UTC (permalink / raw)
To: Tian Xuechen
Cc: vkoul, Frank.Li, dmaengine, amelie.delaunay, mcoquelin.stm32,
alexandre.torgue, cedric.madianga, pierre-yves.mordret,
linux-stm32, linux-arm-kernel
On Fri, Dec 04, 2026 at 08:16:28PM +0800, Tian Xuechen wrote:
> STM32 DMAMUX routes peripheral requests to the STM32 DMA controller,
> and STM32 DMA and MDMA channels can be chained. The three built-in
> drivers are not designed to be unbound while those paths are in use.
>
> Set suppress_bind_attrs on all three platform drivers to disable
> manual bind and unbind through sysfs.
>
> Suggested-by: Amelie Delaunay <amelie.delaunay@foss.st.com>
> Link: https://lore.kernel.org/r/f2a156ee-55d4-4a00-ac75-bb51f1785a9d@foss.st.com
> Signed-off-by: Tian Xuechen <202300460064@mail.sdu.edu.cn>
> ---
This difference purpose patch. You'd better send seperately.
Reviewed-by: Frank Li <Frank.Li@nxp.com>
> drivers/dma/stm32/stm32-dma.c | 1 +
> drivers/dma/stm32/stm32-dmamux.c | 1 +
> drivers/dma/stm32/stm32-mdma.c | 1 +
> 3 files changed, 3 insertions(+)
>
> diff --git a/drivers/dma/stm32/stm32-dma.c b/drivers/dma/stm32/stm32-dma.c
> index 4688cebaf..f34e5e36f 100644
> --- a/drivers/dma/stm32/stm32-dma.c
> +++ b/drivers/dma/stm32/stm32-dma.c
> @@ -1764,6 +1764,7 @@ static const struct dev_pm_ops stm32_dma_pm_ops = {
> static struct platform_driver stm32_dma_driver = {
> .driver = {
> .name = "stm32-dma",
> + .suppress_bind_attrs = true,
> .of_match_table = stm32_dma_of_match,
> .pm = &stm32_dma_pm_ops,
> },
> diff --git a/drivers/dma/stm32/stm32-dmamux.c b/drivers/dma/stm32/stm32-dmamux.c
> index 57318715d..b3cacd57b 100644
> --- a/drivers/dma/stm32/stm32-dmamux.c
> +++ b/drivers/dma/stm32/stm32-dmamux.c
> @@ -393,6 +393,7 @@ static struct platform_driver stm32_dmamux_driver = {
> .probe = stm32_dmamux_probe,
> .driver = {
> .name = "stm32-dmamux",
> + .suppress_bind_attrs = true,
> .of_match_table = stm32_dmamux_match,
> .pm = &stm32_dmamux_pm_ops,
> },
> diff --git a/drivers/dma/stm32/stm32-mdma.c b/drivers/dma/stm32/stm32-mdma.c
> index 04639e4b5..e2e638a1f 100644
> --- a/drivers/dma/stm32/stm32-mdma.c
> +++ b/drivers/dma/stm32/stm32-mdma.c
> @@ -1806,6 +1806,7 @@ static struct platform_driver stm32_mdma_driver = {
> .probe = stm32_mdma_probe,
> .driver = {
> .name = "stm32-mdma",
> + .suppress_bind_attrs = true,
> .of_match_table = stm32_mdma_of_match,
> .pm = &stm32_mdma_pm_ops,
> },
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH v3 6/7] dmaengine: stm32-dmamux: Use managed DMA router registration
2026-12-04 12:16 ` [PATCH v3 6/7] dmaengine: stm32-dmamux: Use managed DMA router registration Tian Xuechen
@ 2026-12-04 17:57 ` Frank Li
0 siblings, 0 replies; 13+ messages in thread
From: Frank Li @ 2026-12-04 17:57 UTC (permalink / raw)
To: Tian Xuechen
Cc: vkoul, Frank.Li, dmaengine, amelie.delaunay, mcoquelin.stm32,
alexandre.torgue, cedric.madianga, pierre-yves.mordret,
linux-stm32, linux-arm-kernel
On Fri, Dec 04, 2026 at 08:16:29PM +0800, Tian Xuechen wrote:
> The STM32 DMAMUX registers an OF DMA router backed by managed driver
> data. The router entry can outlive that data when the device is
> detached.
>
> Use devm_of_dma_router_register() to remove the entry before devres
> releases the router data. Keep the probe error unwind for runtime PM
> and clocks when registration fails.
>
> Fixes: df7e762db5f6 ("dmaengine: Add STM32 DMAMUX driver")
> Cc: stable+noautosel@kernel.org # relies on new API
> Signed-off-by: Tian Xuechen <202300460064@mail.sdu.edu.cn>
> ---
Reviewed-by: Frank Li <Frank.Li@nxp.com>
> drivers/dma/stm32/stm32-dmamux.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/dma/stm32/stm32-dmamux.c b/drivers/dma/stm32/stm32-dmamux.c
> index b3cacd57b..3cb9d4051 100644
> --- a/drivers/dma/stm32/stm32-dmamux.c
> +++ b/drivers/dma/stm32/stm32-dmamux.c
> @@ -290,8 +290,9 @@ static int stm32_dmamux_probe(struct platform_device *pdev)
>
> pm_runtime_put(&pdev->dev);
>
> - ret = of_dma_router_register(node, stm32_dmamux_route_allocate,
> - &stm32_dmamux->dmarouter);
> + ret = devm_of_dma_router_register(&pdev->dev, node,
> + stm32_dmamux_route_allocate,
> + &stm32_dmamux->dmarouter);
> if (ret)
> goto pm_disable;
>
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH v3 7/7] dmaengine: ti-dma-crossbar: Use managed DMA router registration
2026-12-04 12:16 ` [PATCH v3 7/7] dmaengine: ti-dma-crossbar: " Tian Xuechen
@ 2026-12-04 17:57 ` Frank Li
0 siblings, 0 replies; 13+ messages in thread
From: Frank Li @ 2026-12-04 17:57 UTC (permalink / raw)
To: Tian Xuechen
Cc: vkoul, Frank.Li, dmaengine, vigneshr, peter.ujfalusi,
grygorii.strashko
On Fri, Dec 04, 2026 at 08:16:30PM +0800, Tian Xuechen wrote:
> The AM335x/AM43xx and DRA7x probe paths register OF DMA routers backed
> by managed driver data. Their registry entries can outlive that data
> when the device is detached.
>
> Use devm_of_dma_router_register() for both probe paths so devres
> withdraws the entries before releasing their backing data. Preserve
> the DRA7x register reset on registration failure.
>
> Fixes: a074ae38f859 ("dmaengine: Add driver for TI DMA crossbar on DRA7x")
> Fixes: 42dbdcc6bf96 ("dmaengine: ti-dma-crossbar: Add support for crossbar on AM33xx/AM43xx")
> Cc: stable+noautosel@kernel.org # relies on new API
> Signed-off-by: Tian Xuechen <202300460064@mail.sdu.edu.cn>
> ---
> drivers/dma/ti/dma-crossbar.c | 10 ++++++----
Reviewed-by: Frank Li <Frank.Li@nxp.com>
> 1 file changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/dma/ti/dma-crossbar.c b/drivers/dma/ti/dma-crossbar.c
> index f6d75ee94..87a728c48 100644
> --- a/drivers/dma/ti/dma-crossbar.c
> +++ b/drivers/dma/ti/dma-crossbar.c
> @@ -192,8 +192,9 @@ static int ti_am335x_xbar_probe(struct platform_device *pdev)
> for (i = 0; i < xbar->dma_requests; i++)
> ti_am335x_xbar_write(xbar->iomem, i, 0);
>
> - ret = of_dma_router_register(node, ti_am335x_xbar_route_allocate,
> - &xbar->dmarouter);
> + ret = devm_of_dma_router_register(&pdev->dev, node,
> + ti_am335x_xbar_route_allocate,
> + &xbar->dmarouter);
>
> return ret;
> }
> @@ -430,8 +431,9 @@ static int ti_dra7_xbar_probe(struct platform_device *pdev)
> ti_dra7_xbar_write(xbar->iomem, i, xbar->safe_val);
> }
>
> - ret = of_dma_router_register(node, ti_dra7_xbar_route_allocate,
> - &xbar->dmarouter);
> + ret = devm_of_dma_router_register(&pdev->dev, node,
> + ti_dra7_xbar_route_allocate,
> + &xbar->dmarouter);
> if (ret) {
> /* Restore the defaults for the crossbar */
> for (i = 0; i < xbar->dma_requests; i++) {
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2026-12-04 17:57 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-04 12:16 [PATCH v3 0/7] dmaengine: Manage OF DMA routers and disable STM32 unbind Tian Xuechen
2026-12-04 12:16 ` [PATCH v3 1/7] dmaengine: of: Add managed DMA router registration Tian Xuechen
2026-12-04 17:54 ` Frank Li
2026-12-04 12:16 ` [PATCH v3 2/7] dmaengine: lpc18xx-dmamux: Use " Tian Xuechen
2026-12-04 12:16 ` [PATCH v3 3/7] dmaengine: lpc32xx-dmamux: " Tian Xuechen
2026-12-04 12:16 ` [PATCH v3 4/7] dmaengine: dw: dmamux: " Tian Xuechen
2026-12-04 17:55 ` Frank Li
2026-12-04 12:16 ` [PATCH v3 5/7] dmaengine: stm32: Disable manual bind and unbind Tian Xuechen
2026-12-04 17:56 ` Frank Li
2026-12-04 12:16 ` [PATCH v3 6/7] dmaengine: stm32-dmamux: Use managed DMA router registration Tian Xuechen
2026-12-04 17:57 ` Frank Li
2026-12-04 12:16 ` [PATCH v3 7/7] dmaengine: ti-dma-crossbar: " Tian Xuechen
2026-12-04 17:57 ` Frank Li
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox