lkml.org 
[lkml]   [2014]   [Dec]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 04/15] media: blackfin: bfin_capture: improve buf_prepare() callback
Date
this patch improves the buf_prepare() callback.

Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
---
drivers/media/platform/blackfin/bfin_capture.c | 12 ++++--------
1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/drivers/media/platform/blackfin/bfin_capture.c b/drivers/media/platform/blackfin/bfin_capture.c
index a997eac..8bd94a1 100644
--- a/drivers/media/platform/blackfin/bfin_capture.c
+++ b/drivers/media/platform/blackfin/bfin_capture.c
@@ -305,16 +305,12 @@ static int bcap_queue_setup(struct vb2_queue *vq,
static int bcap_buffer_prepare(struct vb2_buffer *vb)
{
struct bcap_device *bcap_dev = vb2_get_drv_priv(vb->vb2_queue);
- struct bcap_buffer *buf = to_bcap_vb(vb);
- unsigned long size;

- size = bcap_dev->fmt.sizeimage;
- if (vb2_plane_size(vb, 0) < size) {
- v4l2_err(&bcap_dev->v4l2_dev, "buffer too small (%lu < %lu)\n",
- vb2_plane_size(vb, 0), size);
+ vb2_set_plane_payload(vb, 0, bcap_dev->fmt.sizeimage);
+ if (vb2_get_plane_payload(vb, 0) > vb2_plane_size(vb, 0))
return -EINVAL;
- }
- vb2_set_plane_payload(&buf->vb, 0, size);
+
+ vb->v4l2_buf.field = bcap_dev->fmt.field;

return 0;
}
--
1.9.1


\
 
 \ /
  Last update: 2014-12-20 12:21    [W:0.133 / U:0.072 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site