linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] Improve DMA API sg_sync function documentation
@ 2015-09-23 11:41 Sakari Ailus
  2015-09-23 11:41 ` [PATCH 1/2] Documentation: DMA API: Be more explicit that nents is always the same Sakari Ailus
  2015-09-23 11:41 ` [PATCH 2/2] arm: mm: Fix comments in sg_sync functions Sakari Ailus
  0 siblings, 2 replies; 5+ messages in thread
From: Sakari Ailus @ 2015-09-23 11:41 UTC (permalink / raw)
  To: linux-doc; +Cc: bhelgaas, corbet, linux-kernel, djkurtz

Hi,

This set of two patches improves DMA API function documentation for cache
sync functions operating on scatterlists and fixes related comments in the
ARM implementation.

-- 
Kind regards,
Sakari


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/2] Documentation: DMA API: Be more explicit that nents is always the same
  2015-09-23 11:41 [PATCH 0/2] Improve DMA API sg_sync function documentation Sakari Ailus
@ 2015-09-23 11:41 ` Sakari Ailus
  2015-09-24 21:51   ` Jonathan Corbet
  2015-09-23 11:41 ` [PATCH 2/2] arm: mm: Fix comments in sg_sync functions Sakari Ailus
  1 sibling, 1 reply; 5+ messages in thread
From: Sakari Ailus @ 2015-09-23 11:41 UTC (permalink / raw)
  To: linux-doc; +Cc: bhelgaas, corbet, linux-kernel, djkurtz, Sakari Ailus

From: Sakari Ailus <sakari.ailus@iki.fi>

The nents argument to the DMA API functions operating on scatterlists is
always the same. The documentation used different argument names and the
matter was not mentioned in Documentation/DMA-API-HOWTO.txt at all. Fix
these.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
---
 Documentation/DMA-API-HOWTO.txt | 5 +++++
 Documentation/DMA-API.txt       | 6 +++---
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/Documentation/DMA-API-HOWTO.txt b/Documentation/DMA-API-HOWTO.txt
index 55b70b9..d69b3fc 100644
--- a/Documentation/DMA-API-HOWTO.txt
+++ b/Documentation/DMA-API-HOWTO.txt
@@ -681,6 +681,11 @@ or:
 
 as appropriate.
 
+PLEASE NOTE:  The 'nents' argument to dma_sync_sg_for_cpu() and
+	      dma_sync_sg_for_device() must be the same passed to
+	      dma_map_sg(). It is _NOT_ the count returned by
+	      dma_map_sg().
+
 After the last DMA transfer call one of the DMA unmap routines
 dma_unmap_{single,sg}(). If you don't touch the data from the first
 dma_map_*() call till dma_unmap_*(), then you don't have to call the
diff --git a/Documentation/DMA-API.txt b/Documentation/DMA-API.txt
index edccacd..8d065d6 100644
--- a/Documentation/DMA-API.txt
+++ b/Documentation/DMA-API.txt
@@ -340,7 +340,7 @@ accessed sg->address and sg->length as shown above.
 
 	void
 	dma_unmap_sg(struct device *dev, struct scatterlist *sg,
-		int nhwentries, enum dma_data_direction direction)
+		int nents, enum dma_data_direction direction)
 
 Unmap the previously mapped scatter/gather list.  All the parameters
 must be the same as those and passed in to the scatter/gather mapping
@@ -356,10 +356,10 @@ void
 dma_sync_single_for_device(struct device *dev, dma_addr_t dma_handle, size_t size,
 			   enum dma_data_direction direction)
 void
-dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg, int nelems,
+dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg, int nents,
 		    enum dma_data_direction direction)
 void
-dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg, int nelems,
+dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg, int nents,
 		       enum dma_data_direction direction)
 
 Synchronise a single contiguous or scatter/gather mapping for the CPU
-- 
2.1.0.231.g7484e3b


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/2] arm: mm: Fix comments in sg_sync functions
  2015-09-23 11:41 [PATCH 0/2] Improve DMA API sg_sync function documentation Sakari Ailus
  2015-09-23 11:41 ` [PATCH 1/2] Documentation: DMA API: Be more explicit that nents is always the same Sakari Ailus
@ 2015-09-23 11:41 ` Sakari Ailus
  1 sibling, 0 replies; 5+ messages in thread
From: Sakari Ailus @ 2015-09-23 11:41 UTC (permalink / raw)
  To: linux-doc; +Cc: bhelgaas, corbet, linux-kernel, djkurtz

The comment on the usage of arm_dma_sync_sg_for_cpu(),
arm_dma_sync_sg_for_device(), arm_iommu_sync_sg_for_cpu() and
arm_iommu_sync_sg_for_device() functions wrongly noted that the "nelems"
parameter is the number of sglist entries returned by dma_map_sg(), while
this must be the number of entiries passed to dma_map_sg() instead.

Suggested-by: Daniel Kurtz <djkurtz@chromium.org>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
---
 arch/arm/mm/dma-mapping.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c
index e626043..1c0154a 100644
--- a/arch/arm/mm/dma-mapping.c
+++ b/arch/arm/mm/dma-mapping.c
@@ -958,7 +958,7 @@ void arm_dma_unmap_sg(struct device *dev, struct scatterlist *sg, int nents,
  * arm_dma_sync_sg_for_cpu
  * @dev: valid struct device pointer, or NULL for ISA and EISA-like devices
  * @sg: list of buffers
- * @nents: number of buffers to map (returned from dma_map_sg)
+ * @nents: number of buffers to sync (same as was passed to dma_map_sg)
  * @dir: DMA transfer direction (same as was passed to dma_map_sg)
  */
 void arm_dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg,
@@ -977,7 +977,7 @@ void arm_dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg,
  * arm_dma_sync_sg_for_device
  * @dev: valid struct device pointer, or NULL for ISA and EISA-like devices
  * @sg: list of buffers
- * @nents: number of buffers to map (returned from dma_map_sg)
+ * @nents: number of buffers to sync (same as was passed to dma_map_sg)
  * @dir: DMA transfer direction (same as was passed to dma_map_sg)
  */
 void arm_dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg,
@@ -1672,7 +1672,7 @@ void arm_iommu_unmap_sg(struct device *dev, struct scatterlist *sg, int nents,
  * arm_iommu_sync_sg_for_cpu
  * @dev: valid struct device pointer
  * @sg: list of buffers
- * @nents: number of buffers to map (returned from dma_map_sg)
+ * @nents: number of buffers to sync (same as was passed to dma_map_sg)
  * @dir: DMA transfer direction (same as was passed to dma_map_sg)
  */
 void arm_iommu_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg,
@@ -1690,7 +1690,7 @@ void arm_iommu_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg,
  * arm_iommu_sync_sg_for_device
  * @dev: valid struct device pointer
  * @sg: list of buffers
- * @nents: number of buffers to map (returned from dma_map_sg)
+ * @nents: number of buffers to sync (same as was passed to dma_map_sg)
  * @dir: DMA transfer direction (same as was passed to dma_map_sg)
  */
 void arm_iommu_sync_sg_for_device(struct device *dev, struct scatterlist *sg,
-- 
2.1.0.231.g7484e3b


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2] Documentation: DMA API: Be more explicit that nents is always the same
  2015-09-23 11:41 ` [PATCH 1/2] Documentation: DMA API: Be more explicit that nents is always the same Sakari Ailus
@ 2015-09-24 21:51   ` Jonathan Corbet
  2015-09-28 12:08     ` Sakari Ailus
  0 siblings, 1 reply; 5+ messages in thread
From: Jonathan Corbet @ 2015-09-24 21:51 UTC (permalink / raw)
  To: Sakari Ailus; +Cc: linux-doc, bhelgaas, linux-kernel, djkurtz, Sakari Ailus

On Wed, 23 Sep 2015 14:41:09 +0300
Sakari Ailus <sakari.ailus@linux.intel.com> wrote:

> The nents argument to the DMA API functions operating on scatterlists is
> always the same. The documentation used different argument names and the
> matter was not mentioned in Documentation/DMA-API-HOWTO.txt at all. Fix
> these.

OK, I've taken this one into the docs tree.  Part 2 needs to go in via an
ARM maintainer, and should probably make an appearance on the ARM list.

Thanks,

jon

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2] Documentation: DMA API: Be more explicit that nents is always the same
  2015-09-24 21:51   ` Jonathan Corbet
@ 2015-09-28 12:08     ` Sakari Ailus
  0 siblings, 0 replies; 5+ messages in thread
From: Sakari Ailus @ 2015-09-28 12:08 UTC (permalink / raw)
  To: Jonathan Corbet; +Cc: Sakari Ailus, linux-doc, bhelgaas, linux-kernel, djkurtz

On Thu, Sep 24, 2015 at 03:51:27PM -0600, Jonathan Corbet wrote:
> On Wed, 23 Sep 2015 14:41:09 +0300
> Sakari Ailus <sakari.ailus@linux.intel.com> wrote:
> 
> > The nents argument to the DMA API functions operating on scatterlists is
> > always the same. The documentation used different argument names and the
> > matter was not mentioned in Documentation/DMA-API-HOWTO.txt at all. Fix
> > these.
> 
> OK, I've taken this one into the docs tree.  Part 2 needs to go in via an
> ARM maintainer, and should probably make an appearance on the ARM list.

Good point. I'll submit it there.

Thanks!

-- 
Sakari Ailus
e-mail: sakari.ailus@iki.fi	XMPP: sailus@retiisi.org.uk

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-09-28 12:08 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-23 11:41 [PATCH 0/2] Improve DMA API sg_sync function documentation Sakari Ailus
2015-09-23 11:41 ` [PATCH 1/2] Documentation: DMA API: Be more explicit that nents is always the same Sakari Ailus
2015-09-24 21:51   ` Jonathan Corbet
2015-09-28 12:08     ` Sakari Ailus
2015-09-23 11:41 ` [PATCH 2/2] arm: mm: Fix comments in sg_sync functions Sakari Ailus

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).