[media] vb2-dma-sg: move dma_(un)map_sg here
authorHans Verkuil <hans.verkuil@cisco.com>
Mon, 24 Nov 2014 11:50:31 +0000 (08:50 -0300)
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>
Tue, 25 Nov 2014 11:01:16 +0000 (09:01 -0200)
commitd790b7eda953df474f470169ebdf111c02fa7a2d
tree31ad9dce666141bf0d83989717188fe8700ac310
parent0c3a14c177aa85afb991e7c2be3921aa9a52a893
[media] vb2-dma-sg: move dma_(un)map_sg here

This moves dma_(un)map_sg to the get_userptr/put_userptr and alloc/put
memops of videobuf2-dma-sg.c and adds dma_sync_sg_for_device/cpu to the
prepare/finish memops.

Now that vb2-dma-sg will sync the buffers for you in the prepare/finish
memops we can drop that from the drivers that use dma-sg.

For the solo6x10 driver that was a bit more involved because it needs to
copy JPEG or MPEG headers to the buffer before returning it to userspace,
and that cannot be done in the old place since the buffer there is still
setup for DMA access, not for CPU access. However, the buf_finish
op is the ideal place to do this. By the time buf_finish is called
the buffer is available for CPU access, so copying to the buffer is fine.

[mchehab@osg.samsung.com: Fix a compilation breakage:
 drivers/media/v4l2-core/videobuf2-dma-sg.c:150:19: error: 'struct vb2_dma_sg_buf' has no member named 'dma_sgt']

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Pawel Osciak <pawel@osciak.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
14 files changed:
drivers/media/pci/cx23885/cx23885-417.c
drivers/media/pci/cx23885/cx23885-core.c
drivers/media/pci/cx23885/cx23885-dvb.c
drivers/media/pci/cx23885/cx23885-vbi.c
drivers/media/pci/cx23885/cx23885-video.c
drivers/media/pci/saa7134/saa7134-empress.c
drivers/media/pci/saa7134/saa7134-ts.c
drivers/media/pci/saa7134/saa7134-vbi.c
drivers/media/pci/saa7134/saa7134-video.c
drivers/media/pci/saa7134/saa7134.h
drivers/media/pci/solo6x10/solo6x10-v4l2-enc.c
drivers/media/pci/tw68/tw68-video.c
drivers/media/platform/marvell-ccic/mcam-core.c
drivers/media/v4l2-core/videobuf2-dma-sg.c