* [PATCH v3 1/4] dmaengine: Replace dma_request_slave_channel() by dma_request_chan()
2025-02-05 14:57 [PATCH v3 0/4] dmaengine: dma_request_chan*() amendments Andy Shevchenko
@ 2025-02-05 14:57 ` Andy Shevchenko
2025-02-05 14:57 ` [PATCH v3 2/4] dmaengine: Use dma_request_channel() instead of __dma_request_channel() Andy Shevchenko
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Andy Shevchenko @ 2025-02-05 14:57 UTC (permalink / raw)
To: Vinod Koul, Amelie Delaunay, Frank Li, Paul Cercueil,
Randy Dunlap, dmaengine, linux-kernel, imx, linux-arm-kernel
Cc: Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
Andy Shevchenko
Replace dma_request_slave_channel() by dma_request_chan() as suggested
since the former is deprecated.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/dma/imx-sdma.c | 5 ++---
include/linux/dmaengine.h | 4 ++--
2 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/drivers/dma/imx-sdma.c b/drivers/dma/imx-sdma.c
index 3449006cd14b..02a85d6f1bea 100644
--- a/drivers/dma/imx-sdma.c
+++ b/drivers/dma/imx-sdma.c
@@ -1459,9 +1459,8 @@ static int sdma_alloc_chan_resources(struct dma_chan *chan)
* dmatest, thus create 'struct imx_dma_data mem_data' for this case.
* Please note in any other slave case, you have to setup chan->private
* with 'struct imx_dma_data' in your own filter function if you want to
- * request dma channel by dma_request_channel() rather than
- * dma_request_slave_channel(). Othwise, 'MEMCPY in case?' will appear
- * to warn you to correct your filter function.
+ * request DMA channel by dma_request_channel(), otherwise, 'MEMCPY in
+ * case?' will appear to warn you to correct your filter function.
*/
if (!data) {
dev_dbg(sdmac->sdma->dev, "MEMCPY in case?\n");
diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h
index 346251bf1026..83cbf7197a76 100644
--- a/include/linux/dmaengine.h
+++ b/include/linux/dmaengine.h
@@ -1639,8 +1639,8 @@ static inline struct dma_chan
{
struct dma_chan *chan;
- chan = dma_request_slave_channel(dev, name);
- if (chan)
+ chan = dma_request_chan(dev, name);
+ if (!IS_ERR(chan))
return chan;
if (!fn || !fn_param)
--
2.43.0.rc1.1336.g36b5255a03ac
^ permalink raw reply related [flat|nested] 6+ messages in thread* [PATCH v3 2/4] dmaengine: Use dma_request_channel() instead of __dma_request_channel()
2025-02-05 14:57 [PATCH v3 0/4] dmaengine: dma_request_chan*() amendments Andy Shevchenko
2025-02-05 14:57 ` [PATCH v3 1/4] dmaengine: Replace dma_request_slave_channel() by dma_request_chan() Andy Shevchenko
@ 2025-02-05 14:57 ` Andy Shevchenko
2025-02-05 14:57 ` [PATCH v3 3/4] dmaengine: Add a comment on why it's okay when kasprintf() fails Andy Shevchenko
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Andy Shevchenko @ 2025-02-05 14:57 UTC (permalink / raw)
To: Vinod Koul, Amelie Delaunay, Frank Li, Paul Cercueil,
Randy Dunlap, dmaengine, linux-kernel, imx, linux-arm-kernel
Cc: Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
Andy Shevchenko
Reduce use of internal __dma_request_channel() function in public
dmaengine.h.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
include/linux/dmaengine.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h
index 83cbf7197a76..a360e0330436 100644
--- a/include/linux/dmaengine.h
+++ b/include/linux/dmaengine.h
@@ -1646,7 +1646,7 @@ static inline struct dma_chan
if (!fn || !fn_param)
return NULL;
- return __dma_request_channel(&mask, fn, fn_param, NULL);
+ return dma_request_channel(mask, fn, fn_param);
}
static inline char *
--
2.43.0.rc1.1336.g36b5255a03ac
^ permalink raw reply related [flat|nested] 6+ messages in thread* [PATCH v3 3/4] dmaengine: Add a comment on why it's okay when kasprintf() fails
2025-02-05 14:57 [PATCH v3 0/4] dmaengine: dma_request_chan*() amendments Andy Shevchenko
2025-02-05 14:57 ` [PATCH v3 1/4] dmaengine: Replace dma_request_slave_channel() by dma_request_chan() Andy Shevchenko
2025-02-05 14:57 ` [PATCH v3 2/4] dmaengine: Use dma_request_channel() instead of __dma_request_channel() Andy Shevchenko
@ 2025-02-05 14:57 ` Andy Shevchenko
2025-02-05 14:57 ` [PATCH v3 4/4] dmaengine: Unify checks in dma_request_chan() Andy Shevchenko
2025-02-10 14:35 ` [PATCH v3 0/4] dmaengine: dma_request_chan*() amendments Vinod Koul
4 siblings, 0 replies; 6+ messages in thread
From: Andy Shevchenko @ 2025-02-05 14:57 UTC (permalink / raw)
To: Vinod Koul, Amelie Delaunay, Frank Li, Paul Cercueil,
Randy Dunlap, dmaengine, linux-kernel, imx, linux-arm-kernel
Cc: Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
Andy Shevchenko
Add a comment in dma_request_chan() to clarify kasprintf() missing return
value check and it is correct functionality.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/dma/dmaengine.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/dma/dmaengine.c b/drivers/dma/dmaengine.c
index c1357d7f3dc6..dd4224d90f07 100644
--- a/drivers/dma/dmaengine.c
+++ b/drivers/dma/dmaengine.c
@@ -854,8 +854,8 @@ struct dma_chan *dma_request_chan(struct device *dev, const char *name)
found:
#ifdef CONFIG_DEBUG_FS
- chan->dbg_client_name = kasprintf(GFP_KERNEL, "%s:%s", dev_name(dev),
- name);
+ chan->dbg_client_name = kasprintf(GFP_KERNEL, "%s:%s", dev_name(dev), name);
+ /* No functional issue if it fails, users are supposed to test before use */
#endif
chan->name = kasprintf(GFP_KERNEL, "dma:%s", name);
--
2.43.0.rc1.1336.g36b5255a03ac
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH v3 4/4] dmaengine: Unify checks in dma_request_chan()
2025-02-05 14:57 [PATCH v3 0/4] dmaengine: dma_request_chan*() amendments Andy Shevchenko
` (2 preceding siblings ...)
2025-02-05 14:57 ` [PATCH v3 3/4] dmaengine: Add a comment on why it's okay when kasprintf() fails Andy Shevchenko
@ 2025-02-05 14:57 ` Andy Shevchenko
2025-02-10 14:35 ` [PATCH v3 0/4] dmaengine: dma_request_chan*() amendments Vinod Koul
4 siblings, 0 replies; 6+ messages in thread
From: Andy Shevchenko @ 2025-02-05 14:57 UTC (permalink / raw)
To: Vinod Koul, Amelie Delaunay, Frank Li, Paul Cercueil,
Randy Dunlap, dmaengine, linux-kernel, imx, linux-arm-kernel
Cc: Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
Andy Shevchenko
Use dev_fwnode() to simplify the check logic for Device Tree and ACPI
in dma_request_chan().
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/dma/dmaengine.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/dma/dmaengine.c b/drivers/dma/dmaengine.c
index dd4224d90f07..758fcd0546d8 100644
--- a/drivers/dma/dmaengine.c
+++ b/drivers/dma/dmaengine.c
@@ -40,6 +40,8 @@
#include <linux/dmaengine.h>
#include <linux/hardirq.h>
#include <linux/spinlock.h>
+#include <linux/of.h>
+#include <linux/property.h>
#include <linux/percpu.h>
#include <linux/rcupdate.h>
#include <linux/mutex.h>
@@ -812,15 +814,13 @@ static const struct dma_slave_map *dma_filter_match(struct dma_device *device,
*/
struct dma_chan *dma_request_chan(struct device *dev, const char *name)
{
+ struct fwnode_handle *fwnode = dev_fwnode(dev);
struct dma_device *d, *_d;
struct dma_chan *chan = NULL;
- /* If device-tree is present get slave info from here */
- if (dev->of_node)
- chan = of_dma_request_slave_channel(dev->of_node, name);
-
- /* If device was enumerated by ACPI get slave info from here */
- if (has_acpi_companion(dev) && !chan)
+ if (is_of_node(fwnode))
+ chan = of_dma_request_slave_channel(to_of_node(fwnode), name);
+ else if (is_acpi_device_node(fwnode))
chan = acpi_dma_request_slave_chan_by_name(dev, name);
if (PTR_ERR(chan) == -EPROBE_DEFER)
--
2.43.0.rc1.1336.g36b5255a03ac
^ permalink raw reply related [flat|nested] 6+ messages in thread* Re: [PATCH v3 0/4] dmaengine: dma_request_chan*() amendments
2025-02-05 14:57 [PATCH v3 0/4] dmaengine: dma_request_chan*() amendments Andy Shevchenko
` (3 preceding siblings ...)
2025-02-05 14:57 ` [PATCH v3 4/4] dmaengine: Unify checks in dma_request_chan() Andy Shevchenko
@ 2025-02-10 14:35 ` Vinod Koul
4 siblings, 0 replies; 6+ messages in thread
From: Vinod Koul @ 2025-02-10 14:35 UTC (permalink / raw)
To: Amelie Delaunay, Frank Li, Paul Cercueil, Randy Dunlap, dmaengine,
linux-kernel, imx, linux-arm-kernel, Andy Shevchenko
Cc: Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam
On Wed, 05 Feb 2025 16:57:08 +0200, Andy Shevchenko wrote:
> Reduce the scope of the use of some rarely used DMA request channel APIs
> in order to make the step of their removal or making static in the
> future. No functional changes intended.
>
> In v3:
> - rebased on top of v6.14-rc1
>
> [...]
Applied, thanks!
[1/4] dmaengine: Replace dma_request_slave_channel() by dma_request_chan()
commit: 31d43141d13aa63587f140884b1f667800ce4e1d
[2/4] dmaengine: Use dma_request_channel() instead of __dma_request_channel()
commit: 1c83d3dfa0905590408595560629627cba4f9261
[3/4] dmaengine: Add a comment on why it's okay when kasprintf() fails
commit: 1722fb4a1307748f983c1345c4c24178d8e0be47
[4/4] dmaengine: Unify checks in dma_request_chan()
commit: 91d8560c15918c7d44e4f665fac829ba8057a2f3
Best regards,
--
~Vinod
^ permalink raw reply [flat|nested] 6+ messages in thread