[media] media: videobuf2: Move timestamp to vb2_buffer
[linux-2.6-block.git] / drivers / input / touchscreen / sur40.c
index d214f22ed305aab0773fe783c2e692c62fc342eb..b6c4d03de3408cc951d6c6ed03cd775f14f3f198 100644 (file)
@@ -444,7 +444,7 @@ static void sur40_process_video(struct sur40_state *sur40)
                goto err_poll;
 
        /* mark as finished */
-       v4l2_get_timestamp(&new_buf->vb.timestamp);
+       new_buf->vb.vb2_buf.timestamp = ktime_get_ns();
        new_buf->vb.sequence = sur40->sequence++;
        new_buf->vb.field = V4L2_FIELD_NONE;
        vb2_buffer_done(&new_buf->vb.vb2_buf, VB2_BUF_STATE_DONE);
@@ -644,22 +644,21 @@ static void sur40_disconnect(struct usb_interface *interface)
  * minimum number: many DMA engines need a minimum of 2 buffers in the
  * queue and you need to have another available for userspace processing.
  */
-static int sur40_queue_setup(struct vb2_queue *q, const void *parg,
+static int sur40_queue_setup(struct vb2_queue *q,
                       unsigned int *nbuffers, unsigned int *nplanes,
                       unsigned int sizes[], void *alloc_ctxs[])
 {
-       const struct v4l2_format *fmt = parg;
        struct sur40_state *sur40 = vb2_get_drv_priv(q);
 
        if (q->num_buffers + *nbuffers < 3)
                *nbuffers = 3 - q->num_buffers;
+       alloc_ctxs[0] = sur40->alloc_ctx;
 
-       if (fmt && fmt->fmt.pix.sizeimage < sur40_video_format.sizeimage)
-               return -EINVAL;
+       if (*nplanes)
+               return sizes[0] < sur40_video_format.sizeimage ? -EINVAL : 0;
 
        *nplanes = 1;
-       sizes[0] = fmt ? fmt->fmt.pix.sizeimage : sur40_video_format.sizeimage;
-       alloc_ctxs[0] = sur40->alloc_ctx;
+       sizes[0] = sur40_video_format.sizeimage;
 
        return 0;
 }