Commit 0295202c authored by Sylwester Nawrocki's avatar Sylwester Nawrocki Committed by Mauro Carvalho Chehab

[media] s5p-fimc: Use consistent names for the buffer list functions

Also correct and improve *_queue_add/pop functions description.
Signed-off-by: default avatarSylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: default avatarKyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent e1d72f4d
...@@ -84,12 +84,12 @@ static int fimc_capture_state_cleanup(struct fimc_dev *fimc) ...@@ -84,12 +84,12 @@ static int fimc_capture_state_cleanup(struct fimc_dev *fimc)
/* Release buffers that were enqueued in the driver by videobuf2. */ /* Release buffers that were enqueued in the driver by videobuf2. */
while (!list_empty(&cap->pending_buf_q)) { while (!list_empty(&cap->pending_buf_q)) {
buf = pending_queue_pop(cap); buf = fimc_pending_queue_pop(cap);
vb2_buffer_done(&buf->vb, VB2_BUF_STATE_ERROR); vb2_buffer_done(&buf->vb, VB2_BUF_STATE_ERROR);
} }
while (!list_empty(&cap->active_buf_q)) { while (!list_empty(&cap->active_buf_q)) {
buf = active_queue_pop(cap); buf = fimc_active_queue_pop(cap);
vb2_buffer_done(&buf->vb, VB2_BUF_STATE_ERROR); vb2_buffer_done(&buf->vb, VB2_BUF_STATE_ERROR);
} }
...@@ -279,7 +279,7 @@ static void buffer_queue(struct vb2_buffer *vb) ...@@ -279,7 +279,7 @@ static void buffer_queue(struct vb2_buffer *vb)
fimc_hw_set_output_addr(fimc, &buf->paddr, buf_id); fimc_hw_set_output_addr(fimc, &buf->paddr, buf_id);
buf->index = vid_cap->buf_index; buf->index = vid_cap->buf_index;
active_queue_add(vid_cap, buf); fimc_active_queue_add(vid_cap, buf);
if (++vid_cap->buf_index >= FIMC_MAX_OUT_BUFS) if (++vid_cap->buf_index >= FIMC_MAX_OUT_BUFS)
vid_cap->buf_index = 0; vid_cap->buf_index = 0;
......
...@@ -338,7 +338,7 @@ void fimc_capture_irq_handler(struct fimc_dev *fimc, bool final) ...@@ -338,7 +338,7 @@ void fimc_capture_irq_handler(struct fimc_dev *fimc, bool final)
test_bit(ST_CAPT_RUN, &fimc->state) && final) { test_bit(ST_CAPT_RUN, &fimc->state) && final) {
ktime_get_real_ts(&ts); ktime_get_real_ts(&ts);
v_buf = active_queue_pop(cap); v_buf = fimc_active_queue_pop(cap);
tv = &v_buf->vb.v4l2_buf.timestamp; tv = &v_buf->vb.v4l2_buf.timestamp;
tv->tv_sec = ts.tv_sec; tv->tv_sec = ts.tv_sec;
...@@ -355,12 +355,12 @@ void fimc_capture_irq_handler(struct fimc_dev *fimc, bool final) ...@@ -355,12 +355,12 @@ void fimc_capture_irq_handler(struct fimc_dev *fimc, bool final)
if (!list_empty(&cap->pending_buf_q)) { if (!list_empty(&cap->pending_buf_q)) {
v_buf = pending_queue_pop(cap); v_buf = fimc_pending_queue_pop(cap);
fimc_hw_set_output_addr(fimc, &v_buf->paddr, cap->buf_index); fimc_hw_set_output_addr(fimc, &v_buf->paddr, cap->buf_index);
v_buf->index = cap->buf_index; v_buf->index = cap->buf_index;
/* Move the buffer to the capture active queue */ /* Move the buffer to the capture active queue */
active_queue_add(cap, v_buf); fimc_active_queue_add(cap, v_buf);
dbg("next frame: %d, done frame: %d", dbg("next frame: %d, done frame: %d",
fimc_hw_get_frame_index(fimc), v_buf->index); fimc_hw_get_frame_index(fimc), v_buf->index);
......
...@@ -745,22 +745,27 @@ static inline void fimc_deactivate_capture(struct fimc_dev *fimc) ...@@ -745,22 +745,27 @@ static inline void fimc_deactivate_capture(struct fimc_dev *fimc)
} }
/* /*
* Add buf to the capture active buffers queue. * Buffer list manipulation functions. Must be called with fimc.slock held.
* Locking: Need to be called with fimc_dev::slock held.
*/ */
static inline void active_queue_add(struct fimc_vid_cap *vid_cap,
/**
* fimc_active_queue_add - add buffer to the capture active buffers queue
* @buf: buffer to add to the active buffers list
*/
static inline void fimc_active_queue_add(struct fimc_vid_cap *vid_cap,
struct fimc_vid_buffer *buf) struct fimc_vid_buffer *buf)
{ {
list_add_tail(&buf->list, &vid_cap->active_buf_q); list_add_tail(&buf->list, &vid_cap->active_buf_q);
vid_cap->active_buf_cnt++; vid_cap->active_buf_cnt++;
} }
/* /**
* Pop a video buffer from the capture active buffers queue * fimc_active_queue_pop - pop buffer from the capture active buffers queue
* Locking: Need to be called with fimc_dev::slock held. *
* The caller must assure the active_buf_q list is not empty.
*/ */
static inline struct fimc_vid_buffer * static inline struct fimc_vid_buffer *fimc_active_queue_pop(
active_queue_pop(struct fimc_vid_cap *vid_cap) struct fimc_vid_cap *vid_cap)
{ {
struct fimc_vid_buffer *buf; struct fimc_vid_buffer *buf;
buf = list_entry(vid_cap->active_buf_q.next, buf = list_entry(vid_cap->active_buf_q.next,
...@@ -770,16 +775,23 @@ active_queue_pop(struct fimc_vid_cap *vid_cap) ...@@ -770,16 +775,23 @@ active_queue_pop(struct fimc_vid_cap *vid_cap)
return buf; return buf;
} }
/* Add video buffer to the capture pending buffers queue */ /**
* fimc_pending_queue_add - add buffer to the capture pending buffers queue
* @buf: buffer to add to the pending buffers list
*/
static inline void fimc_pending_queue_add(struct fimc_vid_cap *vid_cap, static inline void fimc_pending_queue_add(struct fimc_vid_cap *vid_cap,
struct fimc_vid_buffer *buf) struct fimc_vid_buffer *buf)
{ {
list_add_tail(&buf->list, &vid_cap->pending_buf_q); list_add_tail(&buf->list, &vid_cap->pending_buf_q);
} }
/* Add video buffer to the capture pending buffers queue */ /**
static inline struct fimc_vid_buffer * * fimc_pending_queue_pop - pop buffer from the capture pending buffers queue
pending_queue_pop(struct fimc_vid_cap *vid_cap) *
* The caller must assure the pending_buf_q list is not empty.
*/
static inline struct fimc_vid_buffer *fimc_pending_queue_pop(
struct fimc_vid_cap *vid_cap)
{ {
struct fimc_vid_buffer *buf; struct fimc_vid_buffer *buf;
buf = list_entry(vid_cap->pending_buf_q.next, buf = list_entry(vid_cap->pending_buf_q.next,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment