Skip to content

Commit 80c2b40

Browse files
Benjamin GaignardHans Verkuil
authored andcommitted
media: videobuf2: core: Rename min_buffers_needed field in vb2_queue
Rename min_buffers_needed into min_queued_buffers and update the documentation about it. Signed-off-by: Benjamin Gaignard <[email protected]> Signed-off-by: Hans Verkuil <[email protected]> [hverkuil: Drop the change where min_queued_buffers + 1 buffers would be] [hverkuil: allocated. Now this patch only renames this field instead of making] [hverkuil: a functional change as well.] [hverkuil: Renamed 3 remaining min_buffers_needed occurrences.]
1 parent a3e28ea commit 80c2b40

File tree

68 files changed

+103
-100
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+103
-100
lines changed

drivers/input/touchscreen/atmel_mxt_ts.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2546,7 +2546,7 @@ static const struct vb2_queue mxt_queue = {
25462546
.ops = &mxt_queue_ops,
25472547
.mem_ops = &vb2_vmalloc_memops,
25482548
.timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC,
2549-
.min_buffers_needed = 1,
2549+
.min_queued_buffers = 1,
25502550
};
25512551

25522552
static int mxt_vidioc_querycap(struct file *file, void *priv,

drivers/input/touchscreen/sur40.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1124,7 +1124,7 @@ static const struct vb2_queue sur40_queue = {
11241124
.ops = &sur40_queue_ops,
11251125
.mem_ops = &vb2_dma_sg_memops,
11261126
.timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC,
1127-
.min_buffers_needed = 3,
1127+
.min_queued_buffers = 3,
11281128
};
11291129

11301130
static const struct v4l2_file_operations sur40_video_fops = {

drivers/media/common/saa7146/saa7146_fops.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,7 @@ int saa7146_register_device(struct video_device *vfd, struct saa7146_dev *dev,
387387
q->gfp_flags = __GFP_DMA32;
388388
q->buf_struct_size = sizeof(struct saa7146_buf);
389389
q->lock = &dev->v4l2_lock;
390-
q->min_buffers_needed = 2;
390+
q->min_queued_buffers = 2;
391391
q->dev = &dev->pci->dev;
392392
err = vb2_queue_init(q);
393393
if (err)

drivers/media/common/videobuf2/videobuf2-core.c

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -865,7 +865,7 @@ int vb2_core_reqbufs(struct vb2_queue *q, enum vb2_memory memory,
865865
/*
866866
* Make sure the requested values and current defaults are sane.
867867
*/
868-
num_buffers = max_t(unsigned int, *count, q->min_buffers_needed);
868+
num_buffers = max_t(unsigned int, *count, q->min_queued_buffers);
869869
num_buffers = min_t(unsigned int, num_buffers, q->max_num_buffers);
870870
memset(q->alloc_devs, 0, sizeof(q->alloc_devs));
871871
/*
@@ -917,7 +917,7 @@ int vb2_core_reqbufs(struct vb2_queue *q, enum vb2_memory memory,
917917
* There is no point in continuing if we can't allocate the minimum
918918
* number of buffers needed by this vb2_queue.
919919
*/
920-
if (allocated_buffers < q->min_buffers_needed)
920+
if (allocated_buffers < q->min_queued_buffers)
921921
ret = -ENOMEM;
922922

923923
/*
@@ -1653,7 +1653,7 @@ EXPORT_SYMBOL_GPL(vb2_core_prepare_buf);
16531653
* @q: videobuf2 queue
16541654
*
16551655
* Attempt to start streaming. When this function is called there must be
1656-
* at least q->min_buffers_needed buffers queued up (i.e. the minimum
1656+
* at least q->min_queued_buffers queued up (i.e. the minimum
16571657
* number of buffers required for the DMA engine to function). If the
16581658
* @start_streaming op fails it is supposed to return all the driver-owned
16591659
* buffers back to vb2 in state QUEUED. Check if that happened and if
@@ -1846,7 +1846,7 @@ int vb2_core_qbuf(struct vb2_queue *q, struct vb2_buffer *vb, void *pb,
18461846
* then we can finally call start_streaming().
18471847
*/
18481848
if (q->streaming && !q->start_streaming_called &&
1849-
q->queued_count >= q->min_buffers_needed) {
1849+
q->queued_count >= q->min_queued_buffers) {
18501850
ret = vb2_start_streaming(q);
18511851
if (ret) {
18521852
/*
@@ -2210,9 +2210,9 @@ int vb2_core_streamon(struct vb2_queue *q, unsigned int type)
22102210
return -EINVAL;
22112211
}
22122212

2213-
if (q_num_bufs < q->min_buffers_needed) {
2214-
dprintk(q, 1, "need at least %u allocated buffers\n",
2215-
q->min_buffers_needed);
2213+
if (q_num_bufs < q->min_queued_buffers) {
2214+
dprintk(q, 1, "need at least %u queued buffers\n",
2215+
q->min_queued_buffers);
22162216
return -EINVAL;
22172217
}
22182218

@@ -2224,7 +2224,7 @@ int vb2_core_streamon(struct vb2_queue *q, unsigned int type)
22242224
* Tell driver to start streaming provided sufficient buffers
22252225
* are available.
22262226
*/
2227-
if (q->queued_count >= q->min_buffers_needed) {
2227+
if (q->queued_count >= q->min_queued_buffers) {
22282228
ret = vb2_start_streaming(q);
22292229
if (ret)
22302230
goto unprepare;
@@ -2504,21 +2504,21 @@ int vb2_core_queue_init(struct vb2_queue *q)
25042504
return -EINVAL;
25052505

25062506
if (WARN_ON(q->max_num_buffers > MAX_BUFFER_INDEX) ||
2507-
WARN_ON(q->min_buffers_needed > q->max_num_buffers))
2507+
WARN_ON(q->min_queued_buffers > q->max_num_buffers))
25082508
return -EINVAL;
25092509

25102510
if (WARN_ON(q->requires_requests && !q->supports_requests))
25112511
return -EINVAL;
25122512

25132513
/*
25142514
* This combination is not allowed since a non-zero value of
2515-
* q->min_buffers_needed can cause vb2_core_qbuf() to fail if
2515+
* q->min_queued_buffers can cause vb2_core_qbuf() to fail if
25162516
* it has to call start_streaming(), and the Request API expects
25172517
* that queueing a request (and thus queueing a buffer contained
25182518
* in that request) will always succeed. There is no method of
25192519
* propagating an error back to userspace.
25202520
*/
2521-
if (WARN_ON(q->supports_requests && q->min_buffers_needed))
2521+
if (WARN_ON(q->supports_requests && q->min_queued_buffers))
25222522
return -EINVAL;
25232523

25242524
INIT_LIST_HEAD(&q->queued_list);
@@ -2735,14 +2735,14 @@ static int __vb2_init_fileio(struct vb2_queue *q, int read)
27352735
return -EBUSY;
27362736

27372737
/*
2738-
* Start with q->min_buffers_needed + 1, driver can increase it in
2738+
* Start with q->min_queued_buffers + 1, driver can increase it in
27392739
* queue_setup()
27402740
*
2741-
* 'min_buffers_needed' buffers need to be queued up before you
2741+
* 'min_queued_buffers' buffers need to be queued up before you
27422742
* can start streaming, plus 1 for userspace (or in this case,
27432743
* kernelspace) processing.
27442744
*/
2745-
count = max(2, q->min_buffers_needed + 1);
2745+
count = max(2, q->min_queued_buffers + 1);
27462746

27472747
dprintk(q, 3, "setting up file io: mode %s, count %d, read_once %d, write_immediately %d\n",
27482748
(read) ? "read" : "write", count, q->fileio_read_once,

drivers/media/dvb-core/dvb_vb2.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ int dvb_vb2_init(struct dvb_vb2_ctx *ctx, const char *name, int nonblocking)
171171
q->io_modes = VB2_MMAP;
172172
q->drv_priv = ctx;
173173
q->buf_struct_size = sizeof(struct dvb_buffer);
174-
q->min_buffers_needed = 1;
174+
q->min_queued_buffers = 1;
175175
q->ops = &dvb_vb2_qops;
176176
q->mem_ops = &vb2_vmalloc_memops;
177177
q->buf_ops = &dvb_vb2_buf_ops;

drivers/media/i2c/video-i2c.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -795,7 +795,7 @@ static int video_i2c_probe(struct i2c_client *client)
795795
queue->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC;
796796
queue->drv_priv = data;
797797
queue->buf_struct_size = sizeof(struct video_i2c_buffer);
798-
queue->min_buffers_needed = 1;
798+
queue->min_queued_buffers = 1;
799799
queue->ops = &video_i2c_video_qops;
800800
queue->mem_ops = &vb2_vmalloc_memops;
801801

drivers/media/pci/bt8xx/bttv-driver.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3113,7 +3113,7 @@ static int vdev_init(struct bttv *btv, struct video_device *vfd,
31133113
q->gfp_flags = __GFP_DMA32;
31143114
q->buf_struct_size = sizeof(struct bttv_buffer);
31153115
q->lock = &btv->lock;
3116-
q->min_buffers_needed = 2;
3116+
q->min_queued_buffers = 2;
31173117
q->dev = &btv->c.pci->dev;
31183118
err = vb2_queue_init(q);
31193119
if (err)

drivers/media/pci/cobalt/cobalt-v4l2.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1260,7 +1260,7 @@ static int cobalt_node_register(struct cobalt *cobalt, int node)
12601260
q->ops = &cobalt_qops;
12611261
q->mem_ops = &vb2_dma_sg_memops;
12621262
q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC;
1263-
q->min_buffers_needed = 2;
1263+
q->min_queued_buffers = 2;
12641264
q->lock = &s->lock;
12651265
q->dev = &cobalt->pci_dev->dev;
12661266
vdev->queue = q;

drivers/media/pci/cx18/cx18-streams.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ static int cx18_stream_init(struct cx18 *cx, int type)
287287
s->vidq.ops = &cx18_vb2_qops;
288288
s->vidq.mem_ops = &vb2_vmalloc_memops;
289289
s->vidq.timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC;
290-
s->vidq.min_buffers_needed = 2;
290+
s->vidq.min_queued_buffers = 2;
291291
s->vidq.gfp_flags = GFP_DMA32;
292292
s->vidq.dev = &cx->pci_dev->dev;
293293
s->vidq.lock = &cx->serialize_lock;

drivers/media/pci/cx23885/cx23885-417.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1525,7 +1525,7 @@ int cx23885_417_register(struct cx23885_dev *dev)
15251525
q->type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
15261526
q->io_modes = VB2_MMAP | VB2_USERPTR | VB2_DMABUF | VB2_READ;
15271527
q->gfp_flags = GFP_DMA32;
1528-
q->min_buffers_needed = 2;
1528+
q->min_queued_buffers = 2;
15291529
q->drv_priv = dev;
15301530
q->buf_struct_size = sizeof(struct cx23885_buffer);
15311531
q->ops = &cx23885_qops;

0 commit comments

Comments
 (0)