LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices


Reply
  Search this Thread
Old 01-19-2018, 05:13 AM   #1
bonezuk
LQ Newbie
 
Registered: Jan 2018
Posts: 1

Rep: Reputation: Disabled
'nents' argument of dma_unmap_sg?


Hi

I'm maintaining a driver for the 4.4 branch which makes use of a mapped scatterlist using

count = dma_map_sg(device, sglist, nents, direction);

In the DMA-API-HOWTO.txt documentation (at line 647) is the statement: "The 'nents' argument to the dma_unmap_sg call must be the _same_ one you passed into the dma_map_sg call, it should _NOT_ be the 'count' value _returned_ from the dma_map_sg call."

Thus I would expect to unmap the scatterlist by calling

dma_unmap_sg(device, sglist, nents, direction);

However, in looking at drivers/media/v4l2-core/videobuf-dma-sg.c as a reference example the call to dma_unmap_sg in the videobuf_dma_unmap function uses the number of entries returned by the dma_map_sg call. i.e. It is going against the statement in the DMA-API-HOWTO.txt. That is:

dma_unmap_sg(device, sglist, count, direction);

So my question is which one is the correct use or this a mistake in the documentation? In my implementation I use 'count' as when I used 'nents' I got context page faults on the call to unmapping the memory.

Cheers for any help,

Stuart MacLean
 
Old 01-19-2018, 10:51 PM   #2
AwesomeMachine
LQ Guru
 
Registered: Jan 2005
Location: USA and Italy
Distribution: Debian testing/sid; OpenSuSE; Fedora; Mint
Posts: 5,524

Rep: Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015
Hi bonezuk,

Welcome to LQ!

I would say the second one is correct.
 
Old 04-25-2018, 08:24 AM   #3
thellstrom
LQ Newbie
 
Registered: Apr 2018
Posts: 1

Rep: Reputation: Disabled
Bonezuk,

I vaguely remember hitting the same problem. What architecture are you on and are you using an IOMMU?
Thanks,

Thomas
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] iptables bad argument Bad argument `5060' treschen Linux - Newbie 3 11-10-2012 09:29 AM
[SOLVED] shell scripting: value of argument dissapears depending on argument order akelder Programming 5 03-21-2011 11:27 PM
message sending failed : Error[22 ] invalid argument .....but each and every argument rakeshranjanjha Linux - Software 2 01-07-2008 11:22 PM
Help Me!! [ too many argument ] firetankiee1 Programming 5 04-16-2006 10:46 AM
I need help in an argument! cleorobrepixbox General 11 09-23-2004 08:29 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel

All times are GMT -5. The time now is 10:37 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration