linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH] scatterlist: Initialize the dma_address field with invalid dma address
@ 2010-12-09 13:15 Nicolas Ferre
  2010-12-09 20:00 ` David Miller
  0 siblings, 1 reply; 3+ messages in thread
From: Nicolas Ferre @ 2010-12-09 13:15 UTC (permalink / raw)
  To: linux-arm-kernel

Initialize the the dma_address field so that it will be possible to test
its value while using scatterlists. This field will be compatible with
testing by dma_mapping_error().

Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
---
Hi,

I wonder why this field is not initialized in the scatterlist: is it
intentional and is there a different way to check if dma_address is a
valid field?

 lib/scatterlist.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/lib/scatterlist.c b/lib/scatterlist.c
index 4ceb05d..ca69409 100644
--- a/lib/scatterlist.c
+++ b/lib/scatterlist.c
@@ -85,6 +85,7 @@ EXPORT_SYMBOL(sg_last);
 void sg_init_table(struct scatterlist *sgl, unsigned int nents)
 {
 	memset(sgl, 0, sizeof(*sgl) * nents);
+	sgl->dma_address = (~(dma_addr_t)0);
 #ifdef CONFIG_DEBUG_SG
 	{
 		unsigned int i;
-- 
1.7.3

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

* [RFC PATCH] scatterlist: Initialize the dma_address field with invalid dma address
  2010-12-09 13:15 [RFC PATCH] scatterlist: Initialize the dma_address field with invalid dma address Nicolas Ferre
@ 2010-12-09 20:00 ` David Miller
  2010-12-10 10:37   ` Nicolas Ferre
  0 siblings, 1 reply; 3+ messages in thread
From: David Miller @ 2010-12-09 20:00 UTC (permalink / raw)
  To: linux-arm-kernel

From: Nicolas Ferre <nicolas.ferre@atmel.com>
Date: Thu,  9 Dec 2010 14:15:14 +0100

> Initialize the the dma_address field so that it will be possible to test
> its value while using scatterlists. This field will be compatible with
> testing by dma_mapping_error().
> 
> Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>

Please don't do this, it's unjustified and it's going to kill performance.
Even if it were a good change, you should have used the invalid DMA
address definition defined by various architectures instead of a constant.

You should be aware of whether entries in a scatterlist have been setup
by your code path.

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

* [RFC PATCH] scatterlist: Initialize the dma_address field with invalid dma address
  2010-12-09 20:00 ` David Miller
@ 2010-12-10 10:37   ` Nicolas Ferre
  0 siblings, 0 replies; 3+ messages in thread
From: Nicolas Ferre @ 2010-12-10 10:37 UTC (permalink / raw)
  To: linux-arm-kernel

Le 09/12/2010 21:00, David Miller :
> From: Nicolas Ferre <nicolas.ferre@atmel.com>
> Date: Thu,  9 Dec 2010 14:15:14 +0100
> 
>> Initialize the the dma_address field so that it will be possible to test
>> its value while using scatterlists. This field will be compatible with
>> testing by dma_mapping_error().
>>
>> Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
> 
> Please don't do this, it's unjustified and it's going to kill performance.

Yes, that is what I suspected...

> Even if it were a good change, you should have used the invalid DMA
> address definition defined by various architectures instead of a constant.

Well this definition seems to be spread among drivers (mostly usb ones):
DMA_ADDR_INVALID...
And also sometimes with different names:
DMA_INVALID_HANDLE, INVALID_DMA_ADDRESS

> You should be aware of whether entries in a scatterlist have been setup
> by your code path.

Yes, in fact my need is related to the fact that my scatterlist is
filled in a driver and then handled by the dmaengine driver.
But I will reconsider the path taken by my sg to be able to avoid
checking the dma_address field.

Best regards,
-- 
Nicolas Ferre

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

end of thread, other threads:[~2010-12-10 10:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-12-09 13:15 [RFC PATCH] scatterlist: Initialize the dma_address field with invalid dma address Nicolas Ferre
2010-12-09 20:00 ` David Miller
2010-12-10 10:37   ` Nicolas Ferre

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).