History log of /drivers/media/video/videobuf-dma-sg.c
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
45f239ab82b2a808103a0fae02594961b09c5c8b 19-Apr-2011 Newson Edouard <newsondev@gmail.com> [media] videobuf_pages_to_sg: sglist[0] length problem

On function videobuf_pages_to_sg the statement sg_set_page(&sglist[0],
pages[0], PAGE_SIZE - offset, offset) will fail if size is less than
PAGE_SIZE.

Signed-off-by: Newson Edouard <newsondev@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
/drivers/media/video/videobuf-dma-sg.c
41d9931c5ae014fbab8bf612c70b8e7ff16f4641 25-Dec-2010 Hans Verkuil <hverkuil@xs4all.nl> [media] videobuf-dma-sg: remove obsolete comments

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
/drivers/media/video/videobuf-dma-sg.c
08af245de0cf6ab5f4ed008ee2bb99273774fce0 24-Dec-2010 Hans Verkuil <hverkuil@xs4all.nl> [media] V4L: remove V4L1 compatibility mode

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
/drivers/media/video/videobuf-dma-sg.c
101b25b55ec48354bc40b9102b4f7922c9ad9eae 05-Nov-2010 Joe Perches <joe@perches.com> [media] drivers/media: Use vzalloc

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
/drivers/media/video/videobuf-dma-sg.c
1bede7521dbc12b386f72f26d41933789ccc9d7d 07-Oct-2010 Mauro Carvalho Chehab <mchehab@redhat.com> [media] videobuf-dma-sg: Use min_t(size_t, PAGE_SIZE ..)

As pointed by Laurent:

I think min_t(size_t, PAGE_SIZE, size) is the preferred way.

Thanks-to: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
/drivers/media/video/videobuf-dma-sg.c
d026d8284378110c8629a259caaccae4628f1ce0 07-Oct-2010 Mauro Carvalho Chehab <mchehab@redhat.com> V4L/DVB: videobuf-dma-sg: Fix a warning due to the usage of min(PAGE_SIZE, arg)

drivers/media/video/videobuf-dma-sg.c: In function ‘videobuf_pages_to_sg’:
drivers/media/video/videobuf-dma-sg.c:119: warning: comparison of distinct pointer types lacks a cast
drivers/media/video/videobuf-dma-sg.c:120: warning: comparison of distinct pointer types lacks a cast

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
/drivers/media/video/videobuf-dma-sg.c
08bff03ed697a583612b62a6ac566bd5bce98012 20-Sep-2010 Hans Verkuil <hverkuil@xs4all.nl> V4L/DVB: videobuf: add ext_lock argument to the queue init functions

Add an ext_lock argument to the videobuf init functions. This allows
drivers to pass the vdev->lock pointer (or any other externally held lock)
to videobuf. For now all drivers just pass NULL.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
/drivers/media/video/videobuf-dma-sg.c
97397687886aa8ecd4ec603fab9e70e970c11597 20-Sep-2010 Hans Verkuil <hverkuil@xs4all.nl> V4L/DVB: videobuf: prepare to make locking optional in videobuf

Currently videobuf uses the vb_lock mutex to lock its data structures.
But this locking will (optionally) move into the v4l2 core, which means
that in that case vb_lock shouldn't be used since the external lock is already
held.

Prepare for this by adding a pointer to such an external mutex and
don't lock if that pointer is set.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
/drivers/media/video/videobuf-dma-sg.c
2fc11536cf5c0b8eb4eb7e01a2a672a189e9280f 07-Sep-2010 Hans Verkuil <hans.verkuil@tandberg.com> V4L/DVB: videobuf-dma-sg: set correct size in last sg element

This fixes a nasty memory corruption bug when using userptr I/O.
The function videobuf_pages_to_sg() sets up the scatter-gather list for the
DMA transfer to the userspace pages. The first transfer is setup correctly
(the size is set to PAGE_SIZE - offset), but all other transfers have size
PAGE_SIZE. This is wrong for the last transfer which may be less than PAGE_SIZE.

Most, if not all, drivers will program the boards DMA engine correctly, i.e.
even though the size in the last sg element is wrong, they will do their
own size calculations and make sure the right amount is DMA-ed, and so seemingly
prevent memory corruption.

However, behind the scenes the dynamic DMA mapping support (in lib/swiotlb.c)
may create bounce buffers if the memory pages are not in DMA-able memory.
This happens for example on a 64-bit linux with a board that only supports
32-bit DMA.

These bounce buffers DO use the information in the sg list to determine the
size. So while the DMA engine transfers the correct amount of data, when the
data is 'bounced' back too much is copied, causing buffer overwrites.

The fix is simple: calculate and set the correct size for the last sg list
element.

Signed-off-by: Hans Verkuil <hans.verkuil@tandberg.com>
Cc: stable@kernel.org
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
/drivers/media/video/videobuf-dma-sg.c
bb6dbe74806a17bcec8396c57ca7fd9a889e3b27 11-May-2010 Laurent Pinchart <laurent.pinchart@ideasonboard.com> V4L/DVB: videobuf: Rename vmalloc fields to vaddr

The videobuf_dmabuf and videobuf_vmalloc_memory fields have a vmalloc
field to store the kernel virtual address of vmalloc'ed buffers. Rename
the field to vaddr.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
/drivers/media/video/videobuf-dma-sg.c
959794ddc05ab6fbcd458bc093e7f0b92633d052 11-May-2010 Laurent Pinchart <laurent.pinchart@ideasonboard.com> V4L/DVB: videobuf: Remove videobuf_mapping start and end fields

The fields are assigned but never used, remove them.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
/drivers/media/video/videobuf-dma-sg.c
7181772d8915e6025ee4f2f6c5b16064689646f0 11-May-2010 Laurent Pinchart <laurent.pinchart@ideasonboard.com> V4L/DVB: videobuf: Don't export videobuf_(vmalloc|pages)_to_sg

Those functions are only called inside videobuf-dma-sg.c, make them
static.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
/drivers/media/video/videobuf-dma-sg.c
952684035a91334dbe33b15063514cab5e7c6907 11-May-2010 Laurent Pinchart <laurent.pinchart@ideasonboard.com> V4L/DVB: videobuf: Remove the videobuf_sg_dma_map/unmap functions

Instead of creating dirty wrappers around videobuf_dma_map/unmap that
create a dummy videobuf_queue structure, modify videobuf_dma_map/unmap
to take a device pointer argument and use it directly. The
videobuf_sg_dma_map/unmap then become unused and can be removed.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
/drivers/media/video/videobuf-dma-sg.c
33c38283f03d8ea0358229fc03c1beebe67aed0e 11-May-2010 Pawel Osciak <p.osciak@samsung.com> V4L/DVB: videobuf: rename videobuf_alloc to videobuf_alloc_vb

These functions allocate videobuf_buffer structures only. Renaming in order
to prevent confusion with functions allocating actual video buffer memory.

Rename the functions in videobuf-core.h videobuf-dma-sg.c as well.

Signed-off-by: Pawel Osciak <p.osciak@samsung.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
/drivers/media/video/videobuf-dma-sg.c
fc7f8fd42c2b934ac348995e0c530c917fc277d5 17-Mar-2010 Arnout Vandecappelle <arnout@mind.be> V4L/DVB: buf-dma-sg.c: don't assume nr_pages == sglen

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.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
/drivers/media/video/videobuf-dma-sg.c
97f8105dcd62a5c122f31ca5ae53c924c3e7d42b 05-May-2010 Mauro Carvalho Chehab <mchehab@redhat.com> V4L/DVB: videobuf-dma-sg: remove external function videobuf_dma_sync()

While analyzing one of the videobuf patches, I noticed that
videobuf_dma_sync is only used internally inside videobuf-dma-sg.
So, let's remove this function, merging the code at __videobuf_dma_sync()

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
/drivers/media/video/videobuf-dma-sg.c
474675ad8006834be996c046b47436d8ca7a5105 25-Apr-2010 Mauro Carvalho Chehab <mchehab@redhat.com> V4L/DVB: videobuf-dma-sg: Avoid using a wrong size

drivers/media/video/videobuf-dma-sg.c: In function ‘__videobuf_mmap_mapper’:
drivers/media/video/videobuf-dma-sg.c:557: warning: ‘size’ may be used uninitialized in this function

The condition where size is floating should never happen, due to the paranoia check,
but a future change at the logic might break it. So, let's just set size to zero and
use it for the paranoia check.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
/drivers/media/video/videobuf-dma-sg.c
0b62b73778554cd47480ea465f0b255cc63b4336 28-Mar-2010 Hans Verkuil <hverkuil@xs4all.nl> V4L/DVB: v4l videobuf: add videobuf_buffer *buf as argument to mmap_mapper

mmap_mapper should operate on a buffer, not on a complete queue. So let
the videobuf-core find the correct buffer instead of duplicating that
code in each mmap_mapper implementation.

The dma-sg implementation has backwards compatibility code for handling
the V4L1_COMPAT layer. This code is now under the v4L1_COMPAT config option.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
/drivers/media/video/videobuf-dma-sg.c
37111039c9521c751ce0597c129fe6d45ba72818 28-Mar-2010 Hans Verkuil <hverkuil@xs4all.nl> V4L/DVB: v4l videobuf: move video_copy_to_user and copy_stream to core

The video_copy_to_user and copy_stream ops are almost identical for all
videobuf memtype variants. All that is needed is to use the new vaddr
op and these functions can be moved into the core, ensuring we have just
one single implementation instead of three.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
/drivers/media/video/videobuf-dma-sg.c
037c75eb14cd6adb837f81f0c2b2a52c31c91e69 28-Mar-2010 Hans Verkuil <hverkuil@xs4all.nl> V4L/DVB: v4l videobuf: rename .vmalloc to .vaddr

Rename the .vmalloc op in struct videobuf_qtype_ops to .vaddr. This op returns
the virtual kernel address of a buffer. vaddr is a lot less confusing than
vmalloc since this callback does do any allocations.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
/drivers/media/video/videobuf-dma-sg.c
a4cf4cac2979a828e7cd0a3cd02d7a5308a44a7f 28-Mar-2010 Hans Verkuil <hverkuil@xs4all.nl> V4L/DVB: v4l videobuf: use struct videobuf_buffer * instead of void * for videobuf_alloc

videobuf_alloc() returned a void *. Change to struct videobuf_buffer *
to get better type checking.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
/drivers/media/video/videobuf-dma-sg.c
53aaf07637baae8f53c33b803bbc96047d8da1c4 28-Mar-2010 Hans Verkuil <hverkuil@xs4all.nl> V4L/DVB: v4l videobuf: remove mmap_free callback

Remove the mmap_free callback from struct videobuf_qtype_ops.

All implementations of this callback do the same trivial check: return
-EBUSY if any buffer is mmapped. That can also be tested in the
videobuf core.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
/drivers/media/video/videobuf-dma-sg.c
7a02264ca9ec5409e22b9d41f32b431d08eadbce 17-Mar-2010 Pawel Osciak <p.osciak@samsung.com> V4L/DVB: v4l: videobuf: code cleanup

Make videobuf pass checkpatch; minor code cleanups.

Signed-off-by: Pawel Osciak <p.osciak@samsung.com>
Reviewed-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
/drivers/media/video/videobuf-dma-sg.c
bee527f97963ece5e3f6e6587402197af889865b 22-Feb-2010 Pawel Osciak <p.osciak@samsung.com> V4L/DVB: videobuf: add missing checks for kzalloc returning NULL

Signed-off-by: Pawel Osciak <p.osciak@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
/drivers/media/video/videobuf-dma-sg.c
38a54f35a0a90c0b62b111dd4de24248b22616b9 17-Nov-2009 Jonathan Corbet <corbet@lwn.net> V4L/DVB (13377): make struct videobuf_queue_ops constant

The videobuf_queue_ops function vector is not declared constant, but
there's no need for the videobuf layer to ever change it. Make it const
so that videobuf users can make their operations const without warnings.

Signed-off-by: Jonathan Corbet <corbet@lwn.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
/drivers/media/video/videobuf-dma-sg.c
7cbefad085c9112d0b1814db18423e5da072f5c8 23-Jul-2009 Tuukka Toivonen <tuukka.o.toivonen@nokia.com> V4L/DVB (13165): videobuf do not force buffer size to be multiple of PAGE_SIZE

When the image size (bytesperline*height) is not multiple
of PAGE_SIZE, v4l2 rounded the required buffer size to
be multiple of PAGE_SIZE. This prevented user space
to store images directly into userptr buffers which were
not multiple of PAGE_SIZE. This constraint is removed.

The start address is still assumed to be required
page-aligned, ie., when v4l2 allocates mmap buffers,
the offset between different buffers is page-aligned.

Signed-off-by: Tuukka Toivonen <tuukka.o.toivonen@nokia.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
/drivers/media/video/videobuf-dma-sg.c
d43c36dc6b357fa1806800f18aa30123c747a6d1 07-Oct-2009 Alexey Dobriyan <adobriyan@gmail.com> headers: remove sched.h from interrupt.h

After m68k's task_thread_info() doesn't refer to current,
it's possible to remove sched.h from interrupt.h and not break m68k!
Many thanks to Heiko Carstens for allowing this.

Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
/drivers/media/video/videobuf-dma-sg.c
f0f37e2f77731b3473fa6bd5ee53255d9a9cdb40 27-Sep-2009 Alexey Dobriyan <adobriyan@gmail.com> const: mark struct vm_struct_operations

* mark struct vm_area_struct::vm_ops as const
* mark vm_ops in AGP code

But leave TTM code alone, something is fishy there with global vm_ops
being used.

Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
/drivers/media/video/videobuf-dma-sg.c
92051b285b12855255f0213d9a25153d917e262c 11-Jun-2009 Figo.zhang <figo1802@gmail.com> V4L/DVB (11953): videobuf-dma-sg: return -ENOMEM if vmalloc fails

it is better return -ENOMEM than -EIO

Signed-off-by: Figo.zhang <figo1802@gmail.com>
Signed-off-by: Douglas Schilling Landgraf <dougsland@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
/drivers/media/video/videobuf-dma-sg.c
1010ed132727bbf486ac28fd149ccfb0ef5cd2ab 11-May-2009 Cohen David.A <david.cohen@nokia.com> V4L/DVB (11840): change kmalloc to vmalloc for sglist allocation in videobuf_dma_map/unmap

Change kmalloc()/kfree() to vmalloc()/vfree() for sglist allocation
during videobuf_dma_map() and videobuf_dma_unmap()

High resolution sensors might require too many contiguous pages
to be allocated for sglist by kmalloc() during videobuf_dma_map()
(i.e. 256Kib for 8MP sensor).
In such situations, kmalloc() could face some problem to find the
required free memory. vmalloc() is a safer solution instead, as the
allocated memory does not need to be contiguous.

Signed-off-by: David Cohen <david.cohen@nokia.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
/drivers/media/video/videobuf-dma-sg.c
c0cd5010e54e52931c321ee66d81d10a8e2a9ff6 03-Jan-2009 Guennadi Liakhovetski <g.liakhovetski@gmx.de> V4L/DVB (10176a): Switch remaining clear_user_page users over to clear_user_highpage

Not all architectures provide clear_user_page(), but clear_user_highpage()
is available everywhere at least via the compatibility inline function.

Is this the "trivial patch" that's required for these two drivers?

Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
/drivers/media/video/videobuf-dma-sg.c
5d6aaf50e2986d3289d16fc2859c490c66a1be63 17-Jul-2008 Magnus Damm <magnus.damm@gmail.com> V4L/DVB (8340): videobuf: Fix gather spelling

Use "scatter gather" instead of "scatter gatter".

Signed-off-by: Magnus Damm <damm@igel.co.jp>
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@pengutronix.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
/drivers/media/video/videobuf-dma-sg.c
a47cacbd869b67ce16981ad5a0b06e4eac2efaff 04-Jul-2008 Christophe Jaillet <jaillet.christophe@wanadoo.fr> V4L/DVB (8252): buf-dma-sg.c: avoid clearing memory twice

1) Remove a useless initialisation of 'i'

2) Avoid clearing the memory allocated twice (once in 'kcalloc', once
in 'sg_init_table')

3) Remove a test that can never trigger. The function returns NULL in
such a case, so we know that at this point 'pages[0]' != NULL

Signed-off-by: Christophe Jaillet <jaillet.christophe@wanadoo.fr>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
/drivers/media/video/videobuf-dma-sg.c
59d3448995a4c0ca98cbe82f6dac9460323377c1 13-Apr-2008 Mauro Carvalho Chehab <mchehab@infradead.org> V4L/DVB (7566): videobuf-dvb: allow its usage with videobuf-vmalloc

videobuf-dvb were still using a function that were videobuf-dma-sg
dependent. This patch creates a generic handler for this function. This
way, videobuf-dvb can now work with all videobuf implementations.

Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
/drivers/media/video/videobuf-dma-sg.c
a9dbbeb7d615761a82fcd4f00ec290a07be7d8a2 13-Apr-2008 Mauro Carvalho Chehab <mchehab@infradead.org> V4L/DVB (7554): videobuf-dma-sg: Remove unused flag

Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
/drivers/media/video/videobuf-dma-sg.c
7e28adb2497f6b873516163e2d29210c11777613 09-Apr-2008 Harvey Harrison <harvey.harrison@gmail.com> V4L/DVB (7518): media/video/ replace remaining __FUNCTION__ occurrences

__FUNCTION__ is gcc-specific, use __func__

Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
Signed-off-by: Michael Krufky <mkrufky@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
/drivers/media/video/videobuf-dma-sg.c
ce54093cefd64c1a2cb6b8c5ed1d68d2bd7a34ab 02-Apr-2008 Brandon Philips <brandon@ifup.org> V4L/DVB (7494): videobuf-dma-sg.c: Avoid NULL dereference and add comment about backwards compatibility

Signed-off-by: Brandon Philips <bphilips@suse.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
/drivers/media/video/videobuf-dma-sg.c
1c3bf598cf794558694c8beb0c8c7056a81dbe04 22-Apr-2008 Douglas Schilling Landgraf <dougsland@gmail.com> V4L/DVB (7283): videobuf-dma-sg: Remove unused variable

Removed warning message:

- videobuf-dma-sg.c: In function 'videobuf_dma_unmap':
- videobuf-dma-sg.c:281: warning: unused variable 'dev'

Signed-off-by: Douglas Schilling Landgraf <dougsland@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
/drivers/media/video/videobuf-dma-sg.c
0705135e59f8503e4dade4b3580fed77b1743b7c 22-Apr-2008 Guennadi Liakhovetski <g.liakhovetski@pengutronix.de> V4L/DVB (7237): Convert videobuf-dma-sg to generic DMA API

videobuf-dma-sg does not need to depend on PCI. Switch it to using generic
DMA API, convert all affected drivers, relax Kconfig restriction, improve
compile-time type checking, fix some Coding Style violations while at it.

Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@pengutronix.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
/drivers/media/video/videobuf-dma-sg.c
ff699e6bd02eb1c6d02c7c2b576c2ee6caab201c 22-Apr-2008 Douglas Schilling Landgraf <dougsland@gmail.com> V4L/DVB (7094): static memory

- Static memory is always initialized with 0.
- Replaced in some cases C99 comments for /* */

Signed-off-by: Douglas Schilling Landgraf <dougsland@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
/drivers/media/video/videobuf-dma-sg.c
64f9477f95bf5d4ba49dc3988d47a15bc06bb5da 31-Jan-2008 Mauro Carvalho Chehab <mchehab@infradead.org> V4L/DVB (7121): Renames videobuf lock to vb_lock

This helps to identify where vb_lock is being used, and find missusages of the
locks.

Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
/drivers/media/video/videobuf-dma-sg.c
d172b8bdab3812a6ad710e4cc78ceea3e8a40cd5 08-Dec-2007 Andrew Morton <akpm@linux-foundation.org> V4L/DVB (6749): v4l-nopage-fix

dont just copy-and-paste stuff.
(compile-tested this time)

Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Cc: Nick Piggin <nickpiggin@yahoo.com.au>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
/drivers/media/video/videobuf-dma-sg.c
105354a0f0410d4715f38e67d5790dead5dafdad 07-Dec-2007 Nick Piggin <npiggin@suse.de> V4L/DVB (6748): Subject: v4l: nopage

Convert v4l from nopage to fault.
Remove redundant vma range checks.

Signed-off-by: Nick Piggin <npiggin@suse.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
/drivers/media/video/videobuf-dma-sg.c
642f149031d70415d9318b919d50b71e4724adbd 24-Oct-2007 Jens Axboe <jens.axboe@oracle.com> SG: Change sg_set_page() to take length and offset argument

Most drivers need to set length and offset as well, so may as well fold
those three lines into one.

Add sg_assign_page() for those two locations that only needed to set
the page, where the offset/length is set outside of the function context.

Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
/drivers/media/video/videobuf-dma-sg.c
117636092a87a28a013a4acb5de5492645ed620f 23-Oct-2007 Ralf Baechle <ralf@linux-mips.org> [PATCH] Fix breakage after SG cleanups

Commits

58b053e4ce9d2fc3023645c1b96e537c72aa8d9a ("Update arch/ to use sg helpers")
45711f1af6eff1a6d010703b4862e0d2b9afd056 ("[SG] Update drivers to use sg helpers")
fa05f1286be25a8ce915c5dd492aea61126b3f33 ("Update net/ to use sg helpers")

converted many files to use the scatter gather helpers without ensuring
that the necessary headerfile <linux/scatterlist> is included. This
happened to work for ia64, powerpc, sparc64 and x86 because they
happened to drag in that file via their <asm/dma-mapping.h>.

On most of the others this probably broke.

Instead of increasing the header file spider web I choose to include
<linux/scatterlist.h> directly into the affectes files.

Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
/drivers/media/video/videobuf-dma-sg.c
45711f1af6eff1a6d010703b4862e0d2b9afd056 22-Oct-2007 Jens Axboe <jens.axboe@oracle.com> [SG] Update drivers to use sg helpers

Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
/drivers/media/video/videobuf-dma-sg.c
13bcd5d0e21e3ca726965371ada8ff6c64af288f 13-Oct-2007 Al Viro <viro@ftp.linux.org.uk> v4l: copy_to_user() is not a good method name

Breaks on any target that has copy_to_user() defined as a non-trivial
macro.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
/drivers/media/video/videobuf-dma-sg.c
d4cae5a50021271b9ef4e5e39e71e177d12fa8cb 08-Oct-2007 Mauro Carvalho Chehab <mchehab@infradead.org> V4L/DVB (6292): videobuf_core init always require callback implementation

In the past, videobuf_queue_init were used to initialize PCI DMA videobuffers.
This patch renames it, to avoid confusion with the previous kernel API, doing:
s/videobuf_queue_init/void videobuf_queue_core_init/

Also, the operations is now part of the function parameter. The function will
also add a test if this is defined, otherwise producing BUG.

Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
/drivers/media/video/videobuf-dma-sg.c
5ddff43435394c1c2540fcdeed00cb54862c31bf 08-Oct-2007 Mauro Carvalho Chehab <mchehab@infradead.org> V4L/DVB (6290): remove videobuf_set_pci_ops

Before the videobuf redesign, a procedure for re-using videobuf without PCI
scatter/gather where provided by changing the pci-dependent operations by
other operations.

With the newer approach, those methods are obsolete and can safelly be removed.

Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
/drivers/media/video/videobuf-dma-sg.c
9900132f3437e9373aa030cdb5bd2d5db15566e3 28-Sep-2007 Maxim Levitsky <maximlevitsky@gmail.com> V4L/DVB (6268): V4L: Fix a lock inversion in generic videobuf code

videobuf_qbuf takes q->lock, and then calls
q->ops->buf_prepare which by design in all drivers calls
videobuf_iolock which calls videobuf_dma_init_user and this
takes current->mm->mmap_sem

on the other hand if user calls mumap from other thread, sys_munmap
takes current->mm->mmap_sem and videobuf_vm_close takes q->lock

Since this can occur only for V4L2_MEMORY_MMAP buffers, take
current->mm->mmap_sem in qbuf, before q->lock, and don't take
current->mm->mmap_sem videobuf_dma_init_user for those buffers

Signed-off-by: Maxim Levitsky <maximlevitsky@gmail.com>
http://thread.gmane.org/gmane.comp.video.video4linux/34978/focus=34981
Reviewed-by: Ricardo Cerqueira <v4l@cerqueira.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
/drivers/media/video/videobuf-dma-sg.c
851c0c96b2212f48fe51afc1589541b5eae3a544 27-Sep-2007 Mauro Carvalho Chehab <mchehab@infradead.org> V4L/DVB (6266): videobuf cleanup: mmap check is common to all videobuf. Make it at core

Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
http://thread.gmane.org/gmane.comp.video.video4linux/34978/focus=34981
Reviewed-by: Ricardo Cerqueira <v4l@cerqueira.org>
/drivers/media/video/videobuf-dma-sg.c
7a7d9a89d0307b1743d782197e2c5fc5ddf183f3 23-Aug-2007 Mauro Carvalho Chehab <mchehab@infradead.org> V4L/DVB (6251): Replace video-buf to a more generic approach

video-buf currently does two different tasks:

- Manages video buffers with a common code that allows
implementing all the V4L2 different modes of buffering;

- Controls memory allocations

While the first task is generic, the second were written to support PCI DMA
Scatter/Gather needs. The original approach can't even work for those
video capture hardware that don't support scatter/gather.

I did one approach to make it more generic. While the approach worked
fine for vivi driver, it were not generic enough to handle USB needs.

This patch creates two different modules, one containing the generic
video buffer handling (videobuf-core) and another with PCI DMA S/G.
After this patch, it would be simpler to write an USB video-buf and a
non-SG DMA module.

Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
http://thread.gmane.org/gmane.comp.video.video4linux/34978/focus=34981
Reviewed-by: Ricardo Cerqueira <v4l@cerqueira.org>
/drivers/media/video/videobuf-dma-sg.c