public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
From: Sakari Ailus <sakari.ailus@maxwell.research.nokia.com>
To: Arnout Vandecappelle <arnout@mind.be>
Cc: linux-media@vger.kernel.org, mchehab@infradead.org
Subject: Re: [PATCH 1/2] V4L/DVB: buf-dma-sg.c: don't assume nr_pages == sglen
Date: Wed, 24 Mar 2010 07:43:22 +0200	[thread overview]
Message-ID: <4BA9A67A.3070004@maxwell.research.nokia.com> (raw)
In-Reply-To: <1268866385-15692-2-git-send-email-arnout@mind.be>

Hi Arnout,

Thanks for the patch.

Arnout Vandecappelle wrote:
> videobuf_pages_to_sg() and videobuf_vmalloc_to_sg() happen to create
> a scatterlist element for every page.  However, this is not true for
> bus addresses, so other functions shouldn't rely on the length of the
> scatter list being equal to nr_pages.
> ---
>  drivers/media/video/videobuf-dma-sg.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/media/video/videobuf-dma-sg.c b/drivers/media/video/videobuf-dma-sg.c
> index da1790e..18aaf54 100644
> --- a/drivers/media/video/videobuf-dma-sg.c
> +++ b/drivers/media/video/videobuf-dma-sg.c
> @@ -262,7 +262,7 @@ int videobuf_dma_sync(struct videobuf_queue *q, struct videobuf_dmabuf *dma)
>  	MAGIC_CHECK(dma->magic, MAGIC_DMABUF);
>  	BUG_ON(!dma->sglen);
>  
> -	dma_sync_sg_for_cpu(q->dev, dma->sglist, dma->nr_pages, dma->direction);
> +	dma_sync_sg_for_cpu(q->dev, dma->sglist, dma->sglen, dma->direction);
>  	return 0;
>  }

I think the same problem still exists --- dma->sglen is not initialised
anywhere, is it?

> @@ -272,7 +272,7 @@ int videobuf_dma_unmap(struct videobuf_queue* q,struct videobuf_dmabuf *dma)
>  	if (!dma->sglen)
>  		return 0;
>  
> -	dma_unmap_sg(q->dev, dma->sglist, dma->nr_pages, dma->direction);
> +	dma_unmap_sg(q->dev, dma->sglist, dma->sglen, dma->direction);
>  
>  	kfree(dma->sglist);
>  	dma->sglist = NULL;


-- 
Sakari Ailus
sakari.ailus@maxwell.research.nokia.com

  reply	other threads:[~2010-03-24  5:44 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-17 22:53 [PATCH v3] Support for zerocopy to DMA buffers Arnout Vandecappelle
2010-03-17 22:53 ` [PATCH 1/2] V4L/DVB: buf-dma-sg.c: don't assume nr_pages == sglen Arnout Vandecappelle
2010-03-24  5:43   ` Sakari Ailus [this message]
2010-03-30 10:27     ` Arnout Vandecappelle
2010-03-17 22:53 ` [PATCH 2/2] V4L/DVB: buf-dma-sg.c: support non-pageable user-allocated memory Arnout Vandecappelle
2010-03-18 11:58   ` Aguirre, Sergio
2010-05-06  4:06   ` Mauro Carvalho Chehab
2010-05-20 19:22     ` Arnout Vandecappelle
  -- strict thread matches above, loose matches on Subject: below --
2010-03-03 14:12 Support for zerocopy to DSP on OMAP3 Arnout Vandecappelle
2010-03-04 16:00 ` [PATCH 1/2] V4L/DVB: buf-dma-sg.c: don't assume nr_pages == sglen Arnout Vandecappelle
2010-03-17 20:57   ` Sakari Ailus
2010-03-17 22:50     ` Arnout Vandecappelle

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4BA9A67A.3070004@maxwell.research.nokia.com \
    --to=sakari.ailus@maxwell.research.nokia.com \
    --cc=arnout@mind.be \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox