diff options
Diffstat (limited to 'Documentation/video4linux/v4l2-pci-skeleton.c')
-rw-r--r-- | Documentation/video4linux/v4l2-pci-skeleton.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/Documentation/video4linux/v4l2-pci-skeleton.c b/Documentation/video4linux/v4l2-pci-skeleton.c index 1c8b102a6529..79af0c041056 100644 --- a/Documentation/video4linux/v4l2-pci-skeleton.c +++ b/Documentation/video4linux/v4l2-pci-skeleton.c | |||
@@ -163,11 +163,10 @@ static irqreturn_t skeleton_irq(int irq, void *dev_id) | |||
163 | * minimum number: many DMA engines need a minimum of 2 buffers in the | 163 | * minimum number: many DMA engines need a minimum of 2 buffers in the |
164 | * queue and you need to have another available for userspace processing. | 164 | * queue and you need to have another available for userspace processing. |
165 | */ | 165 | */ |
166 | static int queue_setup(struct vb2_queue *vq, const void *parg, | 166 | static int queue_setup(struct vb2_queue *vq, |
167 | unsigned int *nbuffers, unsigned int *nplanes, | 167 | unsigned int *nbuffers, unsigned int *nplanes, |
168 | unsigned int sizes[], void *alloc_ctxs[]) | 168 | unsigned int sizes[], void *alloc_ctxs[]) |
169 | { | 169 | { |
170 | const struct v4l2_format *fmt = parg; | ||
171 | struct skeleton *skel = vb2_get_drv_priv(vq); | 170 | struct skeleton *skel = vb2_get_drv_priv(vq); |
172 | 171 | ||
173 | skel->field = skel->format.field; | 172 | skel->field = skel->format.field; |
@@ -183,12 +182,12 @@ static int queue_setup(struct vb2_queue *vq, const void *parg, | |||
183 | 182 | ||
184 | if (vq->num_buffers + *nbuffers < 3) | 183 | if (vq->num_buffers + *nbuffers < 3) |
185 | *nbuffers = 3 - vq->num_buffers; | 184 | *nbuffers = 3 - vq->num_buffers; |
185 | alloc_ctxs[0] = skel->alloc_ctx; | ||
186 | 186 | ||
187 | if (fmt && fmt->fmt.pix.sizeimage < skel->format.sizeimage) | 187 | if (*nplanes) |
188 | return -EINVAL; | 188 | return sizes[0] < skel->format.sizeimage ? -EINVAL : 0; |
189 | *nplanes = 1; | 189 | *nplanes = 1; |
190 | sizes[0] = fmt ? fmt->fmt.pix.sizeimage : skel->format.sizeimage; | 190 | sizes[0] = skel->format.sizeimage; |
191 | alloc_ctxs[0] = skel->alloc_ctx; | ||
192 | return 0; | 191 | return 0; |
193 | } | 192 | } |
194 | 193 | ||