Add cleanup FREE defines for dma_async_tx_descriptor to support automatic
cleanup and simplify error handling.
Signed-off-by: Frank Li <Frank.Li@nxp.com>
---
Check patch report exceed 100 chars, but it's still better put into one
line to keep consistent with other DEFINE_FREE and better readablity
change in v2
- remove surpoiouse remove empty line
---
include/linux/dmaengine.h | 3 +++
1 file changed, 3 insertions(+)
diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h
index 99efe2b9b4ea9844ca6161208362ef18ef111d96..27fa1646a807c49c781e1bce9e3e7d9a3c66f41d 100644
--- a/include/linux/dmaengine.h
+++ b/include/linux/dmaengine.h
@@ -5,6 +5,7 @@
#ifndef LINUX_DMAENGINE_H
#define LINUX_DMAENGINE_H
+#include <linux/cleanup.h>
#include <linux/device.h>
#include <linux/err.h>
#include <linux/uio.h>
@@ -1612,6 +1613,8 @@ static inline int dmaengine_desc_free(struct dma_async_tx_descriptor *desc)
return desc->desc_free(desc);
}
+DEFINE_FREE(dma_async_tx_descriptor, struct dma_async_tx_descriptor *, if (_T) dmaengine_desc_free(_T))
+
/* --- DMA device --- */
int dma_async_device_register(struct dma_device *device);
--
2.34.1
On 10/3/25 9:26 AM, Frank Li wrote: > Add cleanup FREE defines for dma_async_tx_descriptor to support automatic > cleanup and simplify error handling. > > Signed-off-by: Frank Li <Frank.Li@nxp.com> > --- > Check patch report exceed 100 chars, but it's still better put into one > line to keep consistent with other DEFINE_FREE and better readablity > > change in v2 > - remove surpoiouse remove empty line > --- > include/linux/dmaengine.h | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h > index 99efe2b9b4ea9844ca6161208362ef18ef111d96..27fa1646a807c49c781e1bce9e3e7d9a3c66f41d 100644 > --- a/include/linux/dmaengine.h > +++ b/include/linux/dmaengine.h > @@ -5,6 +5,7 @@ > #ifndef LINUX_DMAENGINE_H > #define LINUX_DMAENGINE_H > > +#include <linux/cleanup.h> > #include <linux/device.h> > #include <linux/err.h> > #include <linux/uio.h> > @@ -1612,6 +1613,8 @@ static inline int dmaengine_desc_free(struct dma_async_tx_descriptor *desc) > return desc->desc_free(desc); > } > > +DEFINE_FREE(dma_async_tx_descriptor, struct dma_async_tx_descriptor *, if (_T) dmaengine_desc_free(_T)) maybe free_dma_async_tx may be clearer as the name vs dma_async_tx_descriptor. DJ > + > /* --- DMA device --- */ > > int dma_async_device_register(struct dma_device *device); >
On Wed, Dec 03, 2025 at 03:48:41PM -0700, Dave Jiang wrote: > > > On 10/3/25 9:26 AM, Frank Li wrote: > > Add cleanup FREE defines for dma_async_tx_descriptor to support automatic > > cleanup and simplify error handling. > > > > Signed-off-by: Frank Li <Frank.Li@nxp.com> > > --- > > Check patch report exceed 100 chars, but it's still better put into one > > line to keep consistent with other DEFINE_FREE and better readablity > > > > change in v2 > > - remove surpoiouse remove empty line > > --- > > include/linux/dmaengine.h | 3 +++ > > 1 file changed, 3 insertions(+) > > > > diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h > > index 99efe2b9b4ea9844ca6161208362ef18ef111d96..27fa1646a807c49c781e1bce9e3e7d9a3c66f41d 100644 > > --- a/include/linux/dmaengine.h > > +++ b/include/linux/dmaengine.h > > @@ -5,6 +5,7 @@ > > #ifndef LINUX_DMAENGINE_H > > #define LINUX_DMAENGINE_H > > > > +#include <linux/cleanup.h> > > #include <linux/device.h> > > #include <linux/err.h> > > #include <linux/uio.h> > > @@ -1612,6 +1613,8 @@ static inline int dmaengine_desc_free(struct dma_async_tx_descriptor *desc) > > return desc->desc_free(desc); > > } > > > > +DEFINE_FREE(dma_async_tx_descriptor, struct dma_async_tx_descriptor *, if (_T) dmaengine_desc_free(_T)) > > maybe free_dma_async_tx may be clearer as the name vs dma_async_tx_descriptor. If that, 'dmaengine_desc_free' is better because avoid create new name for it. Frank > > DJ > > > + > > /* --- DMA device --- */ > > > > int dma_async_device_register(struct dma_device *device); > > >
On 12/3/25 6:30 PM, Frank Li wrote: > On Wed, Dec 03, 2025 at 03:48:41PM -0700, Dave Jiang wrote: >> >> >> On 10/3/25 9:26 AM, Frank Li wrote: >>> Add cleanup FREE defines for dma_async_tx_descriptor to support automatic >>> cleanup and simplify error handling. >>> >>> Signed-off-by: Frank Li <Frank.Li@nxp.com> >>> --- >>> Check patch report exceed 100 chars, but it's still better put into one >>> line to keep consistent with other DEFINE_FREE and better readablity >>> >>> change in v2 >>> - remove surpoiouse remove empty line >>> --- >>> include/linux/dmaengine.h | 3 +++ >>> 1 file changed, 3 insertions(+) >>> >>> diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h >>> index 99efe2b9b4ea9844ca6161208362ef18ef111d96..27fa1646a807c49c781e1bce9e3e7d9a3c66f41d 100644 >>> --- a/include/linux/dmaengine.h >>> +++ b/include/linux/dmaengine.h >>> @@ -5,6 +5,7 @@ >>> #ifndef LINUX_DMAENGINE_H >>> #define LINUX_DMAENGINE_H >>> >>> +#include <linux/cleanup.h> >>> #include <linux/device.h> >>> #include <linux/err.h> >>> #include <linux/uio.h> >>> @@ -1612,6 +1613,8 @@ static inline int dmaengine_desc_free(struct dma_async_tx_descriptor *desc) >>> return desc->desc_free(desc); >>> } >>> >>> +DEFINE_FREE(dma_async_tx_descriptor, struct dma_async_tx_descriptor *, if (_T) dmaengine_desc_free(_T)) >> >> maybe free_dma_async_tx may be clearer as the name vs dma_async_tx_descriptor. > > If that, 'dmaengine_desc_free' is better because avoid create new name for > it. That works too. > > Frank >> >> DJ >> >>> + >>> /* --- DMA device --- */ >>> >>> int dma_async_device_register(struct dma_device *device); >>> >> >
On 04-12-25, 08:07, Dave Jiang wrote: > > > On 12/3/25 6:30 PM, Frank Li wrote: > > On Wed, Dec 03, 2025 at 03:48:41PM -0700, Dave Jiang wrote: > >> > >> > >> On 10/3/25 9:26 AM, Frank Li wrote: > >>> Add cleanup FREE defines for dma_async_tx_descriptor to support automatic > >>> cleanup and simplify error handling. > >>> > >>> Signed-off-by: Frank Li <Frank.Li@nxp.com> > >>> --- > >>> Check patch report exceed 100 chars, but it's still better put into one > >>> line to keep consistent with other DEFINE_FREE and better readablity > >>> > >>> change in v2 > >>> - remove surpoiouse remove empty line > >>> --- > >>> include/linux/dmaengine.h | 3 +++ > >>> 1 file changed, 3 insertions(+) > >>> > >>> diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h > >>> index 99efe2b9b4ea9844ca6161208362ef18ef111d96..27fa1646a807c49c781e1bce9e3e7d9a3c66f41d 100644 > >>> --- a/include/linux/dmaengine.h > >>> +++ b/include/linux/dmaengine.h > >>> @@ -5,6 +5,7 @@ > >>> #ifndef LINUX_DMAENGINE_H > >>> #define LINUX_DMAENGINE_H > >>> > >>> +#include <linux/cleanup.h> > >>> #include <linux/device.h> > >>> #include <linux/err.h> > >>> #include <linux/uio.h> > >>> @@ -1612,6 +1613,8 @@ static inline int dmaengine_desc_free(struct dma_async_tx_descriptor *desc) > >>> return desc->desc_free(desc); > >>> } > >>> > >>> +DEFINE_FREE(dma_async_tx_descriptor, struct dma_async_tx_descriptor *, if (_T) dmaengine_desc_free(_T)) > >> > >> maybe free_dma_async_tx may be clearer as the name vs dma_async_tx_descriptor. > > > > If that, 'dmaengine_desc_free' is better because avoid create new name for > > it. > > That works too. Agree, it is better name -- ~Vinod
On Fri, Oct 03, 2025 at 12:26:49PM -0400, Frank Li wrote: > Add cleanup FREE defines for dma_async_tx_descriptor to support automatic > cleanup and simplify error handling. > > Signed-off-by: Frank Li <Frank.Li@nxp.com> > --- Vinod Koul: Do you have chance to check this one, 3 month passed. Is it missed at your review queue? Frank > Check patch report exceed 100 chars, but it's still better put into one > line to keep consistent with other DEFINE_FREE and better readablity > > change in v2 > - remove surpoiouse remove empty line > --- > include/linux/dmaengine.h | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h > index 99efe2b9b4ea9844ca6161208362ef18ef111d96..27fa1646a807c49c781e1bce9e3e7d9a3c66f41d 100644 > --- a/include/linux/dmaengine.h > +++ b/include/linux/dmaengine.h > @@ -5,6 +5,7 @@ > #ifndef LINUX_DMAENGINE_H > #define LINUX_DMAENGINE_H > > +#include <linux/cleanup.h> > #include <linux/device.h> > #include <linux/err.h> > #include <linux/uio.h> > @@ -1612,6 +1613,8 @@ static inline int dmaengine_desc_free(struct dma_async_tx_descriptor *desc) > return desc->desc_free(desc); > } > > +DEFINE_FREE(dma_async_tx_descriptor, struct dma_async_tx_descriptor *, if (_T) dmaengine_desc_free(_T)) > + > /* --- DMA device --- */ > > int dma_async_device_register(struct dma_device *device); > > -- > 2.34.1 >
© 2016 - 2025 Red Hat, Inc.