[media] soc_camera: Use soc_camera_device::sizeimage to compute buffer sizes
[firefly-linux-kernel-4.4.55.git] / drivers / media / video / pxa_camera.c
index 5a413f4427e09e60f0b640e5c716f3bdc68e315d..6130abe31c439c7c239f0970dd6ae54be1267f48 100644 (file)
@@ -241,15 +241,10 @@ static int pxa_videobuf_setup(struct videobuf_queue *vq, unsigned int *count,
                              unsigned int *size)
 {
        struct soc_camera_device *icd = vq->priv_data;
-       int bytes_per_line = soc_mbus_bytes_per_line(icd->user_width,
-                                               icd->current_fmt->host_fmt);
-
-       if (bytes_per_line < 0)
-               return bytes_per_line;
 
        dev_dbg(icd->parent, "count=%d, size=%d\n", *count, *size);
 
-       *size = bytes_per_line * icd->user_height;
+       *size = icd->sizeimage;
 
        if (0 == *count)
                *count = 32;
@@ -435,11 +430,6 @@ static int pxa_videobuf_prepare(struct videobuf_queue *vq,
        struct pxa_buffer *buf = container_of(vb, struct pxa_buffer, vb);
        int ret;
        int size_y, size_u = 0, size_v = 0;
-       int bytes_per_line = soc_mbus_bytes_per_line(icd->user_width,
-                                               icd->current_fmt->host_fmt);
-
-       if (bytes_per_line < 0)
-               return bytes_per_line;
 
        dev_dbg(dev, "%s (vb=0x%p) 0x%08lx %d\n", __func__,
                vb, vb->baddr, vb->bsize);
@@ -474,7 +464,7 @@ static int pxa_videobuf_prepare(struct videobuf_queue *vq,
                vb->state       = VIDEOBUF_NEEDS_INIT;
        }
 
-       vb->size = bytes_per_line * vb->height;
+       vb->size = icd->sizeimage;
        if (0 != vb->baddr && vb->bsize < vb->size) {
                ret = -EINVAL;
                goto out;