From: Arash Golgol <arash.golgol@gmail.com>
To: linux-media@vger.kernel.org
Cc: matt@ranostay.sg, mchehab@kernel.org,
Arash Golgol <arash.golgol@gmail.com>
Subject: [PATCH v2] media: video-i2c: fix buffer queue ordering
Date: Sun, 10 May 2026 07:04:23 +0330 [thread overview]
Message-ID: <20260510033423.15741-1-arash.golgol@gmail.com> (raw)
Queued buffers are added to the tail of vid_cap_active in
buffer_queue(), but the capture kthread also retrieves buffers from
the tail of the list.
This makes the queue behave as LIFO instead of FIFO when multiple
buffers are queued.
Fix this by retrieving buffers from the head of the list.
Signed-off-by: Arash Golgol <arash.golgol@gmail.com>
---
Changes in v2:
- Fix Media CI robot warning about open parenthesis
- Link to report: https://linux-media.pages.freedesktop.org/-/users/patchwork/-/jobs/99429813/artifacts/report.htm
- Link to v1: https://patchwork.kernel.org/project/linux-media/patch/20260509160948.14578-1-arash.golgol@gmail.com/
drivers/media/i2c/video-i2c.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/media/i2c/video-i2c.c b/drivers/media/i2c/video-i2c.c
index fef3993f4e2d..38c35a8c80f8 100644
--- a/drivers/media/i2c/video-i2c.c
+++ b/drivers/media/i2c/video-i2c.c
@@ -454,8 +454,9 @@ static int video_i2c_thread_vid_cap(void *priv)
spin_lock(&data->slock);
if (!list_empty(&data->vid_cap_active)) {
- vid_cap_buf = list_last_entry(&data->vid_cap_active,
- struct video_i2c_buffer, list);
+ vid_cap_buf = list_first_entry(&data->vid_cap_active,
+ struct video_i2c_buffer,
+ list);
list_del(&vid_cap_buf->list);
}
--
2.34.1
reply other threads:[~2026-05-10 3:34 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260510033423.15741-1-arash.golgol@gmail.com \
--to=arash.golgol@gmail.com \
--cc=linux-media@vger.kernel.org \
--cc=matt@ranostay.sg \
--cc=mchehab@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox