staging: media: omap4iss: redefine to_iss_buffer()
Subsystems (2)
PATCH v2 1/1 staging: media: omap4iss: redefine to_iss_buffer()
Currently macro to_iss_buffer converts vb2_v4l2_buffer into iss_buffer. But the applications needs the conversion from vb2_buffer to iss_bufffer. So they need to convert vb2_buffer into vb2_v4l2_buffer first and then vb2_v4l2_buffer into iss_buffer. Redefining to_iss_buffer to convert from vb2_buffer into iss_buffer directly helps the situation.
This patch redefines the former to_iss_buffer macro into an inline function to perform above task and uses it in corresponding function.
---
Changes in V2:
- Merge two patches into one
- Optimise the new definition of to_iss_buffer
--- drivers/staging/media/omap4iss/iss_video.c | 3 +-- drivers/staging/media/omap4iss/iss_video.h | 5 ++++- 2 files changed, 5 insertions(+), 3 deletions(-)
drivers/staging/media/omap4iss/iss_video.c +1 -2
@@ -318,8 +318,7 @@ static int iss_video_queue_setup(struct vb2_queue *vq,static void iss_video_buf_cleanup (struct vb2_buffer *vb) { -struct vb2_v4l2_buffer *vbuf =to_vb2_v4l2_buffer (vb); - struct iss_buffer *buffer = container_of(vbuf, struct iss_buffer, vb); +struct iss_buffer *buffer =to_iss_buffer (vb);if (buffer->iss_addr) buffer->iss_addr =0 ;
drivers/staging/media/omap4iss/iss_video.h +4 -1
@@ -118,7 +118,10 @@ struct iss_buffer {dma_addr_t iss_addr; }; -#define to_iss_buffer (buf) container_of(buf, struct iss_buffer, vb) +static inline struct iss_buffer *to_iss_buffer (struct vb2_buffer *vb) +{ + return container_of(vb, struct iss_buffer, vb.vb2_buf); +}enum iss_video_dmaqueue_flags {/* Set if DMA queue becomes empty when ISS_PIPELINE_STREAM_CONTINUOUS */
Signature · 1 line
2.17.1
Quoted 52 lines · Himadri Pandya,
Currently macro
to_iss_bufferconvertsvb2_v4l2_bufferintoiss_buffer. But the applications needs the conversion fromvb2_buffertoiss_bufffer. So they need to convertvb2_bufferintovb2_v4l2_bufferfirst and thenvb2_v4l2_bufferintoiss_buffer. Redefiningto_iss_bufferto convert fromvb2_bufferintoiss_bufferdirectly helps the situation.This patch redefines the former
to_iss_buffermacro into an inline function to perform above task and uses it in corresponding function.Signed-off-by Himadri Pandya <[email protected]>---
Changes in V2:
- Merge two patches into one
- Optimise the new definition ofto_iss_buffer--- drivers/staging/media/omap4iss/iss_video.c | 3 +-- drivers/staging/media/omap4iss/iss_video.h | 5 ++++- 2 files changed, 5 insertions(+), 3 deletions(-)drivers/staging/media/omap4iss/iss_video.c +1
-2@@ -318,8 +318,7 @@ static int iss_video_queue_setup(struct vb2_queue *vq,static void iss_video_buf_cleanup (struct vb2_buffer *vb) { -struct vb2_v4l2_buffer *vbuf =to_vb2_v4l2_buffer (vb); - struct iss_buffer *buffer = container_of(vbuf, struct iss_buffer, vb); +struct iss_buffer *buffer =to_iss_buffer (vb);if (buffer->iss_addr)buffer->iss_addr = 0;drivers/staging/media/omap4iss/iss_video.h +4
-1@@ -118,7 +118,10 @@ struct iss_buffer {dma_addr_t iss_addr; }; -#define to_iss_buffer (buf) container_of(buf, struct iss_buffer, vb) +static inline struct iss_buffer *to_iss_buffer (struct vb2_buffer *vb) +{ + return container_of(vb, struct iss_buffer, vb.vb2_buf); +}enum iss_video_dmaqueue_flags {/* Set if DMA queue becomes empty when
Quoted 3 lines
ISS_PIPELINE_STREAM_CONTINUOUS*/
--
2.17.1
Please let me know if the patch needs any further improvements.
Thank you.
- Himadri