videobuf2/videobuf2-dma-sg.c: convert to use vm_map_pages()

Convert to use vm_map_pages() to map range of kernel memory to user vma.

vm_pgoff is treated in V4L2 API as a 'cookie' to select a buffer, not as a
in-buffer offset by design and it always want to mmap a whole buffer from
its beginning.

Signed-off-by: Souptick Joarder <>
Suggested-by: Marek Szyprowski <>
Reviewed-by: Marek Szyprowski <>
Cc: Boris Ostrovsky <>
Cc: David Airlie <>
Cc: Heiko Stuebner <>
Cc: Joerg Roedel <>
Cc: Joonsoo Kim <>
Cc: Juergen Gross <>
Cc: Kees Cook <>
Cc: "Kirill A. Shutemov" <>
Cc: Kyungmin Park <>
Cc: Matthew Wilcox <>
Cc: Mauro Carvalho Chehab <>
Cc: Michal Hocko <>
Cc: Mike Rapoport <>
Cc: Oleksandr Andrushchenko <>
Cc: Pawel Osciak <>
Cc: Peter Zijlstra <>
Cc: Rik van Riel <>
Cc: Robin Murphy <>
Cc: Russell King <>
Cc: Sandy Huang <>
Cc: Stefan Richter <>
Cc: Stephen Rothwell <>
Cc: Thierry Reding <>
Cc: Vlastimil Babka <>
Signed-off-by: Andrew Morton <>
Signed-off-by: Linus Torvalds <>
3 files changed