[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <1423659195-23265-2-git-send-email-ricardo.ribalda@gmail.com>
Date: Wed, 11 Feb 2015 13:53:15 +0100
From: Ricardo Ribalda Delgado <ricardo.ribalda@...il.com>
To: Arnd Bergmann <arnd@...db.de>,
Marek Szyprowski <m.szyprowski@...sung.com>,
James Bottomley <jbottomley@...allels.com>,
Will Deacon <will.deacon@....com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Bjorn Helgaas <bhelgaas@...gle.com>,
Thierry Reding <treding@...dia.com>,
Santosh Shilimkar <santosh.shilimkar@...com>,
linux-arch@...r.kernel.org, linux-kernel@...r.kernel.org
Cc: Ricardo Ribalda Delgado <ricardo.ribalda@...il.com>
Subject: [PATCH 2/2] include/dma-mapping: Clarify output of dma_map_sg
Although dma_map_sg returns 0 on error and it cannot return a
value < 0, the function returns a signed integer.
Most of the time, this function is used with a scatterlist structure.
This structure uses an unsigned integer for the number of memory.
A dma developer that has not read in detail DMA-API.txt, can wrongly
return a value < 0 on error.
Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@...il.com>
---
include/linux/dma-mapping.h | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h
index c3007cb..ac07ff0 100644
--- a/include/linux/dma-mapping.h
+++ b/include/linux/dma-mapping.h
@@ -34,6 +34,10 @@ struct dma_map_ops {
void (*unmap_page)(struct device *dev, dma_addr_t dma_handle,
size_t size, enum dma_data_direction dir,
struct dma_attrs *attrs);
+ /*
+ * map_sg returns 0 on error and a value > 0 on success.
+ * It should never return a value < 0.
+ */
int (*map_sg)(struct device *dev, struct scatterlist *sg,
int nents, enum dma_data_direction dir,
struct dma_attrs *attrs);
--
2.1.4
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists