Small update on dma_debug_entry's struct commentary and also standardize
the usage of 'dma_addr' variable name from debug_dma_map_page() on
debug_dma_unmap_page(), and similarly on debug_dma_free_coherent()
Signed-off-by: Desnes Nunes <desnesn@redhat.com>
---
kernel/dma/debug.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/kernel/dma/debug.c b/kernel/dma/debug.c
index 18c93c2276ca..e0ad8db1ec25 100644
--- a/kernel/dma/debug.c
+++ b/kernel/dma/debug.c
@@ -52,7 +52,8 @@ enum map_err_types {
/**
* struct dma_debug_entry - track a dma_map* or dma_alloc_coherent mapping
* @list: node on pre-allocated free_entries list
- * @dev: 'dev' argument to dma_map_{page|single|sg} or dma_alloc_coherent
+ * @dev: pointer to the device driver
+ * @dev_addr: 'dev' argument to dma_map_{page|single|sg} or dma_alloc_coherent
* @size: length of the mapping
* @type: single, page, sg, coherent
* @direction: enum dma_data_direction
@@ -1262,13 +1263,13 @@ void debug_dma_mapping_error(struct device *dev, dma_addr_t dma_addr)
}
EXPORT_SYMBOL(debug_dma_mapping_error);
-void debug_dma_unmap_page(struct device *dev, dma_addr_t addr,
+void debug_dma_unmap_page(struct device *dev, dma_addr_t dma_addr,
size_t size, int direction)
{
struct dma_debug_entry ref = {
.type = dma_debug_single,
.dev = dev,
- .dev_addr = addr,
+ .dev_addr = dma_addr,
.size = size,
.direction = direction,
};
@@ -1403,13 +1404,13 @@ void debug_dma_alloc_coherent(struct device *dev, size_t size,
}
void debug_dma_free_coherent(struct device *dev, size_t size,
- void *virt, dma_addr_t addr)
+ void *virt, dma_addr_t dma_addr)
{
struct dma_debug_entry ref = {
.type = dma_debug_coherent,
.dev = dev,
.offset = offset_in_page(virt),
- .dev_addr = addr,
+ .dev_addr = dma_addr,
.size = size,
.direction = DMA_BIDIRECTIONAL,
};
--
2.39.1
On 2023-03-15 19:21, Desnes Nunes wrote:
> Small update on dma_debug_entry's struct commentary and also standardize
> the usage of 'dma_addr' variable name from debug_dma_map_page() on
> debug_dma_unmap_page(), and similarly on debug_dma_free_coherent()
>
> Signed-off-by: Desnes Nunes <desnesn@redhat.com>
> ---
> kernel/dma/debug.c | 11 ++++++-----
> 1 file changed, 6 insertions(+), 5 deletions(-)
>
> diff --git a/kernel/dma/debug.c b/kernel/dma/debug.c
> index 18c93c2276ca..e0ad8db1ec25 100644
> --- a/kernel/dma/debug.c
> +++ b/kernel/dma/debug.c
> @@ -52,7 +52,8 @@ enum map_err_types {
> /**
> * struct dma_debug_entry - track a dma_map* or dma_alloc_coherent mapping
> * @list: node on pre-allocated free_entries list
> - * @dev: 'dev' argument to dma_map_{page|single|sg} or dma_alloc_coherent
> + * @dev: pointer to the device driver
The original comment was correct...
> + * @dev_addr: 'dev' argument to dma_map_{page|single|sg} or dma_alloc_coherent
...and the address is clearly not the argument representing the device,
since it is an address :/
Thanks,
Robin.
> * @size: length of the mapping
> * @type: single, page, sg, coherent
> * @direction: enum dma_data_direction
> @@ -1262,13 +1263,13 @@ void debug_dma_mapping_error(struct device *dev, dma_addr_t dma_addr)
> }
> EXPORT_SYMBOL(debug_dma_mapping_error);
>
> -void debug_dma_unmap_page(struct device *dev, dma_addr_t addr,
> +void debug_dma_unmap_page(struct device *dev, dma_addr_t dma_addr,
> size_t size, int direction)
> {
> struct dma_debug_entry ref = {
> .type = dma_debug_single,
> .dev = dev,
> - .dev_addr = addr,
> + .dev_addr = dma_addr,
> .size = size,
> .direction = direction,
> };
> @@ -1403,13 +1404,13 @@ void debug_dma_alloc_coherent(struct device *dev, size_t size,
> }
>
> void debug_dma_free_coherent(struct device *dev, size_t size,
> - void *virt, dma_addr_t addr)
> + void *virt, dma_addr_t dma_addr)
> {
> struct dma_debug_entry ref = {
> .type = dma_debug_coherent,
> .dev = dev,
> .offset = offset_in_page(virt),
> - .dev_addr = addr,
> + .dev_addr = dma_addr,
> .size = size,
> .direction = DMA_BIDIRECTIONAL,
> };
Good day Robin,
Thank you very much for the review and clarification - will send a v2
with the proper comment update.
Best Regards,
On Thu, Mar 16, 2023 at 7:24 AM Robin Murphy <robin.murphy@arm.com> wrote:
>
> On 2023-03-15 19:21, Desnes Nunes wrote:
> > Small update on dma_debug_entry's struct commentary and also standardize
> > the usage of 'dma_addr' variable name from debug_dma_map_page() on
> > debug_dma_unmap_page(), and similarly on debug_dma_free_coherent()
> >
> > Signed-off-by: Desnes Nunes <desnesn@redhat.com>
> > ---
> > kernel/dma/debug.c | 11 ++++++-----
> > 1 file changed, 6 insertions(+), 5 deletions(-)
> >
> > diff --git a/kernel/dma/debug.c b/kernel/dma/debug.c
> > index 18c93c2276ca..e0ad8db1ec25 100644
> > --- a/kernel/dma/debug.c
> > +++ b/kernel/dma/debug.c
> > @@ -52,7 +52,8 @@ enum map_err_types {
> > /**
> > * struct dma_debug_entry - track a dma_map* or dma_alloc_coherent mapping
> > * @list: node on pre-allocated free_entries list
> > - * @dev: 'dev' argument to dma_map_{page|single|sg} or dma_alloc_coherent
> > + * @dev: pointer to the device driver
>
> The original comment was correct...
>
> > + * @dev_addr: 'dev' argument to dma_map_{page|single|sg} or dma_alloc_coherent
>
> ...and the address is clearly not the argument representing the device,
> since it is an address :/
>
> Thanks,
> Robin.
>
> > * @size: length of the mapping
> > * @type: single, page, sg, coherent
> > * @direction: enum dma_data_direction
> > @@ -1262,13 +1263,13 @@ void debug_dma_mapping_error(struct device *dev, dma_addr_t dma_addr)
> > }
> > EXPORT_SYMBOL(debug_dma_mapping_error);
> >
> > -void debug_dma_unmap_page(struct device *dev, dma_addr_t addr,
> > +void debug_dma_unmap_page(struct device *dev, dma_addr_t dma_addr,
> > size_t size, int direction)
> > {
> > struct dma_debug_entry ref = {
> > .type = dma_debug_single,
> > .dev = dev,
> > - .dev_addr = addr,
> > + .dev_addr = dma_addr,
> > .size = size,
> > .direction = direction,
> > };
> > @@ -1403,13 +1404,13 @@ void debug_dma_alloc_coherent(struct device *dev, size_t size,
> > }
> >
> > void debug_dma_free_coherent(struct device *dev, size_t size,
> > - void *virt, dma_addr_t addr)
> > + void *virt, dma_addr_t dma_addr)
> > {
> > struct dma_debug_entry ref = {
> > .type = dma_debug_coherent,
> > .dev = dev,
> > .offset = offset_in_page(virt),
> > - .dev_addr = addr,
> > + .dev_addr = dma_addr,
> > .size = size,
> > .direction = DMA_BIDIRECTIONAL,
> > };
>
--
Desnes Nunes
Principal Software Engineer
Red Hat Brasil
© 2016 - 2026 Red Hat, Inc.