DMA Engine development
 help / color / mirror / Atom feed
From: Frank Li <Frank.li@oss.nxp.com>
To: Tian Xuechen <202300460064@mail.sdu.edu.cn>
Cc: vkoul@kernel.org, Frank.Li@kernel.org, dmaengine@vger.kernel.org,
	linux-kernel@vger.kernel.org, vz@mleia.com,
	piotr.wojtaszczyk@timesys.com, manabian@gmail.com,
	robh@kernel.org, saravanak@kernel.org,
	devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v2 1/3] dmaengine: of: Add managed DMA router registration
Date: Fri, 27 Nov 2026 09:21:35 -0600	[thread overview]
Message-ID: <awmf_2AvjLr8WH8S@SMW015318> (raw)
In-Reply-To: <20261127110400.379397-2-202300460064@mail.sdu.edu.cn>

On Fri, Nov 27, 2026 at 07:03:58PM +0800, Tian Xuechen wrote:
> Add devm_of_dma_router_register() to unregister a router when its
> device is detached. Reuse the controller cleanup action, since routers
> share the same OF registry. If registering the cleanup action fails,
> remove the newly registered router immediately.
>
> Signed-off-by: Tian Xuechen <202300460064@mail.sdu.edu.cn>
> ---

Reviewed-by: Frank Li <Frank.Li@nxp.com>

> Changes in v2:
>   - Add the reusable managed router helper.
>
>  include/linux/of_dma.h | 24 ++++++++++++++++++++++++
>  1 file changed, 24 insertions(+)
>
> diff --git a/include/linux/of_dma.h b/include/linux/of_dma.h
> index 16b08234d03b..7f9198ea9627 100644
> --- a/include/linux/of_dma.h
> +++ b/include/linux/of_dma.h
> @@ -64,6 +64,21 @@ 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 = of_dma_router_register(np, of_dma_route_allocate, dma_router);
> +	if (ret)
> +		return ret;
> +
> +	return devm_add_action_or_reset(dev, __of_dma_controller_free, np);
> +}
> +
>  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 +118,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)
>  {
> --
> 2.43.0
>

  reply	other threads:[~2026-11-27 15:21 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-27 11:03 [PATCH v2 0/3] dmaengine: lpc: Manage DMA router registration Tian Xuechen
2026-11-27 11:03 ` [PATCH v2 1/3] dmaengine: of: Add managed " Tian Xuechen
2026-11-27 15:21   ` Frank Li [this message]
2026-11-27 11:03 ` [PATCH v2 2/3] dmaengine: lpc18xx-dmamux: Use " Tian Xuechen
2026-11-27 15:22   ` Frank Li
2026-11-27 11:04 ` [PATCH v2 3/3] dmaengine: lpc32xx-dmamux: " Tian Xuechen
2026-11-27 15:22   ` Frank Li

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=awmf_2AvjLr8WH8S@SMW015318 \
    --to=frank.li@oss.nxp.com \
    --cc=202300460064@mail.sdu.edu.cn \
    --cc=Frank.Li@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dmaengine@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=manabian@gmail.com \
    --cc=piotr.wojtaszczyk@timesys.com \
    --cc=robh@kernel.org \
    --cc=saravanak@kernel.org \
    --cc=vkoul@kernel.org \
    --cc=vz@mleia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox