aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/videobuf-dma-sg.c (follow)
AgeCommit message (Collapse)AuthorFilesLines
2010-05-19V4L/DVB: buf-dma-sg.c: don't assume nr_pages == sglenArnout Vandecappelle1-2/+2
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>
2010-05-19V4L/DVB: videobuf-dma-sg: remove external function videobuf_dma_sync()Mauro Carvalho Chehab1-13/+7
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>
2010-05-19V4L/DVB: videobuf-dma-sg: Avoid using a wrong sizeMauro Carvalho Chehab1-2/+2
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>
2010-05-19V4L/DVB: v4l videobuf: add videobuf_buffer *buf as argument to mmap_mapperHans Verkuil1-36/+33
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>
2010-05-19V4L/DVB: v4l videobuf: move video_copy_to_user and copy_stream to coreHans Verkuil1-49/+0
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>
2010-05-19V4L/DVB: v4l videobuf: rename .vmalloc to .vaddrHans Verkuil1-2/+2
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>
2010-05-19V4L/DVB: v4l videobuf: use struct videobuf_buffer * instead of void * for videobuf_allocHans Verkuil1-1/+1
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>
2010-05-19V4L/DVB: v4l videobuf: remove mmap_free callbackHans Verkuil1-15/+0
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>
2010-05-18V4L/DVB: v4l: videobuf: code cleanupPawel Osciak1-136/+140
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>
2010-02-26V4L/DVB: videobuf: add missing checks for kzalloc returning NULLPawel Osciak1-0/+2
Signed-off-by: Pawel Osciak <p.osciak@samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-12-05V4L/DVB (13377): make struct videobuf_queue_ops constantJonathan Corbet1-1/+1
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>
2009-12-05V4L/DVB (13165): videobuf do not force buffer size to be multiple of PAGE_SIZETuukka Toivonen1-2/+2
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>
2009-10-11headers: remove sched.h from interrupt.hAlexey Dobriyan1-0/+1
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>
2009-09-27const: mark struct vm_struct_operationsAlexey Dobriyan1-1/+1
* 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>
2009-06-16V4L/DVB (11953): videobuf-dma-sg: return -ENOMEM if vmalloc failsFigo.zhang1-1/+1
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>
2009-06-16V4L/DVB (11840): change kmalloc to vmalloc for sglist allocation in videobuf_dma_map/unmapCohen David.A1-8/+9
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>
2009-01-07V4L/DVB (10176a): Switch remaining clear_user_page users over to clear_user_highpageGuennadi Liakhovetski1-2/+1
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>
2008-07-20V4L/DVB (8340): videobuf: Fix gather spellingMagnus Damm1-1/+1
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>
2008-07-20V4L/DVB (8252): buf-dma-sg.c: avoid clearing memory twiceChristophe Jaillet1-4/+2
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>
2008-04-24V4L/DVB (7566): videobuf-dvb: allow its usage with videobuf-vmallocMauro Carvalho Chehab1-0/+11
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>
2008-04-24V4L/DVB (7554): videobuf-dma-sg: Remove unused flagMauro Carvalho Chehab1-4/+0
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2008-04-24V4L/DVB (7518): media/video/ replace remaining __FUNCTION__ occurrencesHarvey Harrison1-2/+2
__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>
2008-04-24V4L/DVB (7494): videobuf-dma-sg.c: Avoid NULL dereference and add comment about backwards compatibilityBrandon Philips1-1/+15
Signed-off-by: Brandon Philips <bphilips@suse.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2008-04-24V4L/DVB (7283): videobuf-dma-sg: Remove unused variableDouglas Schilling Landgraf1-2/+0
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>
2008-04-24V4L/DVB (7237): Convert videobuf-dma-sg to generic DMA APIGuennadi Liakhovetski1-58/+59
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>
2008-04-24V4L/DVB (7094): static memoryDouglas Schilling Landgraf1-1/+1
- 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>
2008-02-18V4L/DVB (7121): Renames videobuf lock to vb_lockMauro Carvalho Chehab1-2/+2
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>
2008-01-25V4L/DVB (6749): v4l-nopage-fixAndrew Morton1-1/+2
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>
2008-01-25V4L/DVB (6748): Subject: v4l: nopageNick Piggin1-12/+8
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>
2007-10-24SG: Change sg_set_page() to take length and offset argumentJens Axboe1-7/+3
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>
2007-10-23[PATCH] Fix breakage after SG cleanupsRalf Baechle1-0/+1
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>
2007-10-22[SG] Update drivers to use sg helpersJens Axboe1-3/+5
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
2007-10-13v4l: copy_to_user() is not a good method nameAl Viro1-1/+1
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>
2007-10-10V4L/DVB (6292): videobuf_core init always require callback implementationMauro Carvalho Chehab1-2/+2
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>
2007-10-10V4L/DVB (6290): remove videobuf_set_pci_opsMauro Carvalho Chehab1-58/+4
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>
2007-10-10V4L/DVB (6268): V4L: Fix a lock inversion in generic videobuf codeMaxim Levitsky1-5/+27
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>
2007-10-10V4L/DVB (6266): videobuf cleanup: mmap check is common to all videobuf. Make it at coreMauro Carvalho Chehab1-19/+5
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>
2007-10-09V4L/DVB (6251): Replace video-buf to a more generic approachMauro Carvalho Chehab1-0/+772
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>