staging: media: omap4iss: Use list_entry instead of container_of
Subsystems (2)
PATCH 1/1 staging: media: omap4iss: Use list_entry instead of container_of
Use list_entry instead of container_of for lists iss_buffer and iss_video.
--- drivers/staging/media/omap4iss/iss_video.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/media/omap4iss/iss_video.h +2 -2
@@ -118,7 +118,7 @@ struct iss_buffer {dma_addr_t iss_addr; }; -#define to_iss_buffer (buf) container_of(buf, struct iss_buffer, vb) +#define to_iss_buffer (buf) list_entry(buf, struct iss_buffer, vb)enum iss_video_dmaqueue_flags {/* Set if DMA queue becomes empty when ISS_PIPELINE_STREAM_CONTINUOUS */
@@ -170,7 +170,7 @@ struct iss_video {const struct iss_video_operations *ops; }; -#define to_iss_video (vdev) container_of(vdev, struct iss_video, video) +#define to_iss_video (vdev) list_entry(vdev, struct iss_video, video)struct iss_video_fh {struct v4l2_fh vfh;
Signature · 1 line
2.17.1
Quoted 13 lines · Himadri Pandya
Use
list_entryinstead ofcontainer_offor listsiss_bufferandiss_video.Signed-off-by Himadri Pandya <[email protected]>--- drivers/staging/media/omap4iss/iss_video.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/staging/media/omap4iss/iss_video.h +0
-0
drivers/staging/media/omap4iss/iss_video.h struct iss_buffer { · line 121
Quoted 5 lines
drivers/staging/media/omap4iss/iss_video.h +1
-1@@ -118,7 +118,7 @@ struct iss_buffer {dma_addr_t iss_addr; }; -#define to_iss_buffer (buf) container_of(buf, struct iss_buffer, vb) +#define to_iss_buffer (buf) list_entry(buf, struct iss_buffer, vb)
Actually, this macro is no longer used. Perhaps someone else converted the uses to use the proper list operations and forgot to drop the macro definition.
drivers/staging/media/omap4iss/iss_video.h struct iss_video { · line 173
Quoted 9 lines
drivers/staging/media/omap4iss/iss_video.h +1
-1enum iss_video_dmaqueue_flags {/* Set if DMA queue becomes empty when ISS_PIPELINE_STREAM_CONTINUOUS */ @@ -170,7 +170,7 @@ struct iss_video {const struct iss_video_operations *ops; }; -#define to_iss_video (vdev) container_of(vdev, struct iss_video, video) +#define to_iss_video (vdev) list_entry(vdev, struct iss_video, video)
This doesn't involve a list. Nor does the previous one. To use list_entry, the third argument should be the name of a field that has type list_head.
julia
Quoted 12 lines
drivers/staging/media/omap4iss/iss_video.h +0
-1struct iss_video_fh {struct v4l2_fh vfh; --2.17.1
--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20190324165433.95833-1-himadri18.07%40gmail.com.
For more options, visit https://groups.google.com/d/optout.
Quoted 21 lines · Julia Lawall
Review
Quoted 9 lines · Himadri Pandya
Use
list_entryinstead ofcontainer_offor listsiss_bufferandiss_video.Signed-off-by Himadri Pandya <[email protected]>--- drivers/staging/media/omap4iss/iss_video.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)(quoted diff) +0
-0
b/drivers/staging/media/omap4iss/iss_video.hQuoted 7 lines
index
f22489edb562..e8d27b7ac329100644drivers/staging/media/omap4iss/iss_video.h +0
-0@@ -118,7 +118,7 @@ struct iss_buffer {dma_addr_t iss_addr; };
Quoted 7 lines
drivers/staging/media/omap4iss/iss_video.h struct iss_buffer { · line 121
Quoted 2 lines
drivers/staging/media/omap4iss/iss_video.h +1
-1-#define to_iss_buffer (buf) container_of(buf, struct iss_buffer, vb) +#define to_iss_buffer (buf) list_entry(buf, struct iss_buffer, vb)Actually, this macro is no longer used. Perhaps someone else converted the uses to use the proper list operations and forgot to drop the macro definition.
Then should I send a patch to drop these macros?
Quoted 9 lines
drivers/staging/media/omap4iss/iss_video.h struct iss_buffer { · line 123
Quoted 4 lines
drivers/staging/media/omap4iss/iss_video.h +0
-0enum iss_video_dmaqueue_flags {/* Set if DMA queue becomes empty when
ISS_PIPELINE_STREAM_CONTINUOUS*/Quoted 4 lines
drivers/staging/media/omap4iss/iss_video.h +0
-0@@ -170,7 +170,7 @@ struct iss_video {const struct iss_video_operations *ops; };
Quoted 7 lines
drivers/staging/media/omap4iss/iss_video.h struct iss_video { · line 173
Quoted 2 lines
drivers/staging/media/omap4iss/iss_video.h +1
-1-#define to_iss_video (vdev) container_of(vdev, struct iss_video, video) +#define to_iss_video (vdev) list_entry(vdev, struct iss_video, video)This doesn't involve a list. Nor does the previous one. To use
list_entry, the third argument should be the name of a field that has typelist_head.
Understood. Thank you.
- Himadri
Quoted 31 lines
julia
Quoted 7 lines
drivers/staging/media/omap4iss/iss_video.h +0
-1struct iss_video_fh {struct v4l2_fh vfh; --2.17.1
--
You received this message because you are subscribed to the GoogleGroups "outreachy-kernel" group.
Quoted 1 line
To unsubscribe from this group and stop receiving emails from it, send
an email to [email protected].
Quoted 2 lines
To post to this group, send email to [email protected]. To view this discussion on the web visit
https://groups.google.com/d/msgid/outreachy-kernel/20190324165433.95833-1-himadri18.07%40gmail.com
.Quoted 2 lines
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected]. To view this discussion on the web visit
https://groups.google.com/d/msgid/outreachy-kernel/alpine.DEB.2.21.1903241812520.2526%40hadrien
.
For more options, visit https://groups.google.com/d/optout.
Quoted 30 lines · Himadri Pandya
On Sun, Mar 24, 2019 at 10:48 PM Julia Lawall <[email protected]> wrote:
On Sun, 24 Mar 2019, Himadri Pandya wrote:
> Use
list_entryinstead ofcontainer_offor listsiss_bufferand
>iss_video.
>
> Signed-off-by: Himadri Pandya <[email protected]> > ---
>drivers/staging/media/omap4iss/iss_video.h| 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) >
> diff --gita/drivers/staging/media/omap4iss/iss_video.hb/drivers/staging/media/omap4iss/iss_video.h
> indexf22489edb562..e8d27b7ac329100644
> ---a/drivers/staging/media/omap4iss/iss_video.h> +++b/drivers/staging/media/omap4iss/iss_video.h> @@ -118,7 +118,7 @@ structiss_buffer{
> dma_addr_tiss_addr;
> };
>
> -#define to_iss_buffer(buf) container_of(buf, structiss_buffer, vb)
> +#define to_iss_buffer(buf) list_entry(buf, structiss_buffer, vb)
Quoted 8 lines
Actually, this macro is no longer used. Perhaps someone else converted
the uses to use the proper list operations and forgot to drop the macro
definition.Then should I send a patch to drop these macros?
One of the macros is used and one is not. You can send a patch to drop the one that is not used. The other one is used only once. Still it looks more readable than a call to container_of.
julia
Quoted 69 lines
>
> enumiss_video_dmaqueue_flags{
> /* Set if DMA queue becomes empty whenISS_PIPELINE_STREAM_CONTINUOUS*/
> @@ -170,7 +170,7 @@ structiss_video{
> const structiss_video_operations*ops; > };
>
> -#define to_iss_video(vdev) container_of(vdev, structiss_video, video)
> +#define to_iss_video(vdev) list_entry(vdev, structiss_video, video)This doesn't involve a list. Nor does the previous one. To use
list_entry, the third argument should be the name of a field that has type
list_head.Understood. Thank you.
- Himadri
julia
> struct
iss_video_fh{
> structv4l2_fhvfh;
> --
> 2.17.1
>
> --
> You received this message because you are subscribed to the
Google Groups "outreachy-kernel" group.
> To unsubscribe from this group and stop receiving emails from
it, send an email to
[email protected].
> To post to this group, send email to
[email protected].
> To view this discussion on the web visithttps://groups.google.com/d/msgid/outreachy-kernel/20190324165433.95833-1-h imadri18.07%40gmail.com.
> For more options, visit https://groups.google.com/d/optout.
>--
You received this message because you are subscribed to the
Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from
it, send an email to
[email protected].
To post to this group, send email to
[email protected].
To view this discussion on the web visithttps://groups.google.com/d/msgid/outreachy-kernel/alpine.DEB.2.21.19032418 12520.2526%40hadrien.
For more options, visit https://groups.google.com/d/optout.--
You received this message because you are subscribed to the Google Groups
"outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visithttps://groups.google.com/d/msgid/outreachy-kernel/CAPnhUpYSAaY0J6dRsQf2hMv MfUhvaSXqu%2BVgt3aQ7g_mjGX8Hw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Hello Himadri,
Quoted 18 lines · Himadri Pandya
Quoted 17 lines · Julia Lawall
Quoted 16 lines · Himadri Pandya
Use
list_entryinstead ofcontainer_offor listsiss_bufferandiss_video.Signed-off-by Himadri Pandya <[email protected]>---
drivers/staging/media/omap4iss/iss_video.h| 4 ++--1 file changed, 2 insertions(+), 2 deletions(-)drivers/staging/media/omap4iss/iss_video.h +0
-0@@ -118,7 +118,7 @@ struct iss_buffer { dma_addr_t iss_addr; };
Quoted 8 lines
Quoted 6 lines
drivers/staging/media/omap4iss/iss_video.h struct iss_buffer { · line 121
Quoted 2 lines
drivers/staging/media/omap4iss/iss_video.h +1
-1-#define to_iss_buffer (buf) container_of(buf, struct iss_buffer, vb) +#define to_iss_buffer (buf) list_entry(buf, struct iss_buffer, vb)Actually, this macro is no longer used. Perhaps someone else converted the uses to use the proper list operations and forgot to drop the macro definition.
Then should I send a patch to drop these macros?
It would be better to modify the to_iss_buffer macro to convert from a vb2_buffer to a iss_buffer, and use it where the driver currently uses container_of directly.
Quoted 17 lines
Quoted 6 lines
Quoted 6 lines
drivers/staging/media/omap4iss/iss_video.h +0
-0enum iss_video_dmaqueue_flags { /* Set if DMA queue becomes empty when ISS_PIPELINE_STREAM_CONTINUOUS */@@ -170,7 +170,7 @@ struct iss_video { const struct iss_video_operations *ops; };Quoted 6 lines
drivers/staging/media/omap4iss/iss_video.h struct iss_video { · line 173
Quoted 2 lines
drivers/staging/media/omap4iss/iss_video.h +1
-1-#define to_iss_video (vdev) container_of(vdev, struct iss_video, video) +#define to_iss_video (vdev) list_entry(vdev, struct iss_video, video)This doesn't involve a list. Nor does the previous one. To use
list_entry, the third argument should be the name of a field that has typelist_head.Understood. Thank you.
Quoted 2 lines
Quoted 2 lines
drivers/staging/media/omap4iss/iss_video.h +0
-0struct iss_video_fh { struct v4l2_fh vfh;
Signature · 3 lines
Regards, Laurent Pinchart
Quoted 30 lines · Laurent Pinchart
Hello Himadri,
Quoted 1 line · Himadri Pandya
On Sun, Mar 24, 2019 at 10:48 PM Julia Lawall <[email protected]>
Quoted 10 lines · wrote:
Quoted 10 lines · Himadri Pandya
Review
Quoted 9 lines
Use
list_entryinstead ofcontainer_offor listsiss_bufferandiss_video.Signed-off-by Himadri Pandya <[email protected]>--- drivers/staging/media/omap4iss/iss_video.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)(quoted diff) +0
-0
b/drivers/staging/media/omap4iss/iss_video.hQuoted 14 lines
Quoted 13 lines
drivers/staging/media/omap4iss/iss_video.h struct iss_buffer { · line 121
Quoted 9 lines
index
f22489edb562..e8d27b7ac329100644drivers/staging/media/omap4iss/iss_video.h +1
-1@@ -118,7 +118,7 @@ struct iss_buffer {dma_addr_t iss_addr; }; -#define to_iss_buffer (buf) container_of(buf, struct iss_buffer, vb) +#define to_iss_buffer (buf) list_entry(buf, struct iss_buffer, vb)Actually, this macro is no longer used. Perhaps someone else converted the uses to use the proper list operations and forgot to drop the macro definition.
Quoted 7 lines
Quoted 1 line
Then should I send a patch to drop these macros?
It would be better to modify the
to_iss_buffermacro to convert from avb2_bufferto aiss_buffer, and use it where the driver currently usescontainer_ofdirectly.
I am sorry but I am not sure if I understand what you are suggesting correctly.
to_iss_buffer is defined as:
#define to_iss_buffer(buf) container_of(buf, struct iss_buffer, vb)
And it is not used. Instead, container_of is used directly 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);
...
}static int iss_video_buf_prepare(struct vb2_buffer *vb) {
struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb); struct iss_video_fh *vfh = vb2_get_drv_priv(vb->vb2_queue);
struct iss_buffer *buffer = container_of(vbuf, struct iss_buffer, vb);
...
}static void iss_video_buf_queue(struct vb2_buffer *vb) {
struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb); struct iss_video_fh *vfh = vb2_get_drv_priv(vb->vb2_queue); struct iss_video *video = vfh->video;
struct iss_buffer *buffer = container_of(vbuf, struct iss_buffer, vb);
...
}If I understand it correctly, these usages are converting vb2_buffer to iss_buffer. Which could be done by using the to_iss_buffer(vbuf) as well. Why is this macro no longer used? I also don't understand what modification you are suggesting. Can you please elaborate?
Thank you.
- Himadri
Quoted 27 lines
Quoted 2 lines
Quoted 2 lines
drivers/staging/media/omap4iss/iss_video.h struct iss_buffer { · line 123
Quoted 2 lines
drivers/staging/media/omap4iss/iss_video.h +0
-0enum iss_video_dmaqueue_flags {/* Set if DMA queue becomes empty when
ISS_PIPELINE_STREAM_CONTINUOUS*/Quoted 5 lines
Quoted 5 lines
drivers/staging/media/omap4iss/iss_video.h struct iss_video { · line 173
Quoted 5 lines
drivers/staging/media/omap4iss/iss_video.h +0
-1@@ -170,7 +170,7 @@ struct iss_video {const struct iss_video_operations *ops; }; -#define to_iss_video (vdev) container_of(vdev, struct iss_video,video)
Quoted 1 line
Quoted 1 line
drivers/staging/media/omap4iss/iss_video.h struct iss_video { · line 173
Quoted 1 line
drivers/staging/media/omap4iss/iss_video.h +1
-0+#define to_iss_video (vdev) list_entry(vdev, struct iss_video,video)
Quoted 3 lines
Quoted 3 lines
This doesn't involve a list. Nor does the previous one. To use
list_entry, the third argument should be the name of a field that hastype
Quoted 6 lines
Quoted 1 line
list_head.Understood. Thank you.
Quoted 2 lines
Quoted 2 lines
drivers/staging/media/omap4iss/iss_video.h +0
-0struct iss_video_fh {struct v4l2_fh vfh;--
Regards,Laurent Pinchart
Quoted 77 lines · Himadri Pandya
Quoted 30 lines · Laurent Pinchart
Hello Himadri,
Quoted 1 line · Himadri Pandya
On Sun, Mar 24, 2019 at 10:48 PM Julia Lawall <[email protected]>
Quoted 10 lines · wrote:
Quoted 10 lines · Himadri Pandya
Review
Quoted 9 lines
Use
list_entryinstead ofcontainer_offor listsiss_bufferandiss_video.Signed-off-by Himadri Pandya <[email protected]>--- drivers/staging/media/omap4iss/iss_video.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)(quoted diff) +0
-0
b/drivers/staging/media/omap4iss/iss_video.hQuoted 8 lines
Quoted 8 lines
drivers/staging/media/omap4iss/iss_video.h struct iss_buffer { · line 121
Quoted 8 lines
index
f22489edb562..e8d27b7ac329100644drivers/staging/media/omap4iss/iss_video.h +0
-1@@ -118,7 +118,7 @@ struct iss_buffer {dma_addr_t iss_addr; }; -#define to_iss_buffer (buf) container_of(buf, struct iss_buffer,vb)
Quoted 3 lines
Quoted 3 lines
drivers/staging/media/omap4iss/iss_video.h struct iss_buffer { · line 121
Quoted 1 line
drivers/staging/media/omap4iss/iss_video.h +1
-0+#define to_iss_buffer (buf) list_entry(buf, struct iss_buffer, vb)Actually, this macro is no longer used. Perhaps someone else
converted
Quoted 1 line
Quoted 1 line
the uses to use the proper list operations and forgot to drop the
Quoted 10 lines
macro
Quoted 3 lines
Quoted 1 line
definition.
Then should I send a patch to drop these macros?
It would be better to modify the
to_iss_buffermacro to convert from avb2_bufferto aiss_buffer, and use it where the driver currently usescontainer_ofdirectly.I am sorry but I am not sure if I understand what you are suggesting correctly.
to_iss_bufferis defined as:
#defineto_iss_buffer(buf)container_of(buf, struct iss_buffer, vb)And it is not used. Instead,
container_ofis used directly static voidiss_video_buf_cleanup(struct vb2_buffer *vb){
structvb2_v4l2_buffer*vbuf =to_vb2_v4l2_buffer(vb);struct iss_buffer *buffer = container_of(vbuf, struct iss_buffer, vb); ... }static int
iss_video_buf_prepare(struct vb2_buffer *vb){
structvb2_v4l2_buffer*vbuf =to_vb2_v4l2_buffer(vb); structiss_video_fh*vfh =vb2_get_drv_priv(vb->vb2_queue);struct iss_buffer *buffer = container_of(vbuf, struct iss_buffer, vb); ... }static void
iss_video_buf_queue(struct vb2_buffer *vb){
structvb2_v4l2_buffer*vbuf =to_vb2_v4l2_buffer(vb); structiss_video_fh*vfh =vb2_get_drv_priv(vb->vb2_queue); structiss_video*video =vfh->video;struct iss_buffer *buffer = container_of(vbuf, struct iss_buffer, vb); ... }
Quoted 39 lines
If I understand it correctly, these usages are converting
vb2_buffertoiss_buffer. Which could be done by using theto_iss_buffer(vbuf)as well. Why is this macro no longer used? I also don't understand what modification you are suggesting. Can you please elaborate?Thank you.
- Himadri
Quoted 27 lines
Quoted 2 lines
Quoted 2 lines
drivers/staging/media/omap4iss/iss_video.h struct iss_buffer { · line 123
Quoted 2 lines
drivers/staging/media/omap4iss/iss_video.h +0
-0enum iss_video_dmaqueue_flags {/* Set if DMA queue becomes empty when
ISS_PIPELINE_STREAM_CONTINUOUS*/Quoted 5 lines
Quoted 5 lines
drivers/staging/media/omap4iss/iss_video.h struct iss_video { · line 173
Quoted 5 lines
drivers/staging/media/omap4iss/iss_video.h +0
-1@@ -170,7 +170,7 @@ struct iss_video {const struct iss_video_operations *ops; }; -#define to_iss_video (vdev) container_of(vdev, struct iss_video,video)
Quoted 1 line
Quoted 1 line
drivers/staging/media/omap4iss/iss_video.h struct iss_video { · line 173
Quoted 1 line
drivers/staging/media/omap4iss/iss_video.h +1
-0+#define to_iss_video (vdev) list_entry(vdev, struct iss_video,video)
Quoted 3 lines
Quoted 3 lines
This doesn't involve a list. Nor does the previous one. To use
list_entry, the third argument should be the name of a field that hastype
Quoted 6 lines
Quoted 1 line
list_head.Understood. Thank you.
Quoted 2 lines
Quoted 2 lines
drivers/staging/media/omap4iss/iss_video.h +0
-0struct iss_video_fh {struct v4l2_fh vfh;--
Regards,Laurent Pinchart
I have been suggested to modify the macro to_iss_bufer(). But I do not understand how should it be changed. Can anybody please explain it? I need to understand this in order to send the next version of the patch.
Thank you.
- Himadri
Hello Himadri,
Quoted 33 lines · Himadri Pandya
Quoted 26 lines · Laurent Pinchart
Quoted 25 lines · Himadri Pandya
Quoted 23 lines · Julia Lawall
Quoted 13 lines · Himadri Pandya
Use
list_entryinstead ofcontainer_offor listsiss_bufferandiss_video.Signed-off-by Himadri Pandya <[email protected]>---
drivers/staging/media/omap4iss/iss_video.h| 4 ++--1 file changed, 2 insertions(+), 2 deletions(-)drivers/staging/media/omap4iss/iss_video.h +0
-0drivers/staging/media/omap4iss/iss_video.h struct iss_buffer { · line 121
Quoted 5 lines
drivers/staging/media/omap4iss/iss_video.h +1
-1@@ -118,7 +118,7 @@ struct iss_buffer { dma_addr_t iss_addr; }; -#define to_iss_buffer (buf) container_of(buf, struct iss_buffer, vb) +#define to_iss_buffer (buf) list_entry(buf, struct iss_buffer, vb)Actually, this macro is no longer used. Perhaps someone else converted the uses to use the proper list operations and forgot to drop the macro definition.
Quoted 5 lines
Quoted 1 line
Then should I send a patch to drop these macros?
It would be better to modify the
to_iss_buffermacro to convert from avb2_bufferto aiss_buffer, and use it where the driver currently usescontainer_ofdirectly.
Quoted 5 lines
I am sorry but I am not sure if I understand what you are suggesting correctly.
to_iss_bufferis defined as:
#define to_iss_buffer(buf) container_of(buf, structiss_buffer, vb)
to_iss_buffer() casts a vb2_v4l2_buffer pointer to a iss_buffer pointer.
Quoted 16 lines
And it is not used. Instead,
container_ofis used directly static voidiss_video_buf_cleanup(struct vb2_buffer *vb)
{
structvb2_v4l2_buffer*vbuf =to_vb2_v4l2_buffer(vb); structiss_buffer*buffer =container_of(vbuf, struct iss_buffer, vb);
...
}static int
iss_video_buf_prepare(struct vb2_buffer *vb)
{
structvb2_v4l2_buffer*vbuf =to_vb2_v4l2_buffer(vb); structiss_video_fh*vfh =vb2_get_drv_priv(vb->vb2_queue); structiss_buffer*buffer =container_of(vbuf, struct iss_buffer, vb);
...
}
Quoted 8 lines
static void
iss_video_buf_queue(struct vb2_buffer *vb)
{
structvb2_v4l2_buffer*vbuf =to_vb2_v4l2_buffer(vb); structiss_video_fh*vfh =vb2_get_drv_priv(vb->vb2_queue); structiss_video*video =vfh->video;
structiss_buffer*buffer =container_of(vbuf, struct iss_buffer, vb);
...
}
These three functions need to cast a vb2_buffer pointer to a iss_buffer pointer. They do so by first casting to vb2_v4l2_buffer, and then to iss_buffer with a direct use of container_of. It would be best to combine the two casts in a single to_iss_buffer macro and use it through the code.
Quoted 22 lines
If I understand it correctly, these usages are converting
vb2_buffertoiss_buffer. Which could be done by using theto_iss_buffer(vbuf)as well. Why is this macro no longer used? I also don't understand what modification you are suggesting. Can you please elaborate?Quoted 17 lines
Quoted 17 lines
Quoted 6 lines
Quoted 6 lines
drivers/staging/media/omap4iss/iss_video.h +0
-0enum iss_video_dmaqueue_flags { /* Set if DMA queue becomes empty when ISS_PIPELINE_STREAM_CONTINUOUS */@@ -170,7 +170,7 @@ struct iss_video { const struct iss_video_operations *ops; };Quoted 6 lines
drivers/staging/media/omap4iss/iss_video.h struct iss_video { · line 173
Quoted 2 lines
drivers/staging/media/omap4iss/iss_video.h +1
-1-#define to_iss_video (vdev) container_of(vdev, struct iss_video, video) +#define to_iss_video (vdev) list_entry(vdev, struct iss_video, video)This doesn't involve a list. Nor does the previous one. To use
list_entry, the third argument should be the name of a field that has typelist_head.Understood. Thank you.
Quoted 2 lines
Quoted 2 lines
drivers/staging/media/omap4iss/iss_video.h +0
-0struct iss_video_fh { struct v4l2_fh vfh;
Signature · 3 lines
Regards, Laurent Pinchart
Quoted 73 lines · Laurent Pinchart
Hello Himadri,
Quoted 7 lines · Himadri Pandya
Quoted 6 lines · Laurent Pinchart
Quoted 5 lines · Himadri Pandya
Quoted 4 lines · Julia Lawall
Quoted 3 lines · Himadri Pandya
Use
list_entryinstead ofcontainer_offor listsiss_bufferandiss_video.Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Review
Quoted 6 lines
Signed-off-by Himadri Pandya <[email protected]>--- drivers/staging/media/omap4iss/iss_video.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)(quoted diff) +0
-0
b/drivers/staging/media/omap4iss/iss_video.hQuoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
drivers/staging/media/omap4iss/iss_video.h struct iss_buffer { · line 121
Quoted 8 lines
index
f22489edb562..e8d27b7ac329100644drivers/staging/media/omap4iss/iss_video.h +0
-1@@ -118,7 +118,7 @@ struct iss_buffer {dma_addr_t iss_addr; }; -#define to_iss_buffer (buf) container_of(buf, struct iss_buffer,vb)
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
drivers/staging/media/omap4iss/iss_video.h struct iss_buffer { · line 121
Quoted 1 line
drivers/staging/media/omap4iss/iss_video.h +1
-0+#define to_iss_buffer (buf) list_entry(buf, struct iss_buffer, vb)Actually, this macro is no longer used. Perhaps someone else
converted
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
the uses to use the proper list operations and forgot to drop the
macro
Quoted 8 lines
Quoted 7 lines
Quoted 3 lines
Quoted 1 line
definition.
Then should I send a patch to drop these macros?
It would be better to modify the
to_iss_buffermacro to convert from avb2_bufferto aiss_buffer, and use it where the driver currently usescontainer_ofdirectly.Quoted 5 lines
I am sorry but I am not sure if I understand what you are suggesting correctly.
to_iss_bufferis defined as:
#defineto_iss_buffer(buf)container_of(buf, struct iss_buffer, vb)
to_iss_buffer()casts avb2_v4l2_bufferpointer to aiss_bufferpointer.Quoted 16 lines
And it is not used. Instead,
container_ofis used directly static voidiss_video_buf_cleanup(struct vb2_buffer *vb){
structvb2_v4l2_buffer*vbuf =to_vb2_v4l2_buffer(vb);struct iss_buffer *buffer = container_of(vbuf, struct iss_buffer, vb); ... }static int
iss_video_buf_prepare(struct vb2_buffer *vb){
structvb2_v4l2_buffer*vbuf =to_vb2_v4l2_buffer(vb); structiss_video_fh*vfh =vb2_get_drv_priv(vb->vb2_queue);struct iss_buffer *buffer = container_of(vbuf, struct iss_buffer, vb); ... }Quoted 8 lines
static void
iss_video_buf_queue(struct vb2_buffer *vb){
structvb2_v4l2_buffer*vbuf =to_vb2_v4l2_buffer(vb); structiss_video_fh*vfh =vb2_get_drv_priv(vb->vb2_queue); structiss_video*video =vfh->video;struct iss_buffer *buffer = container_of(vbuf, struct iss_buffer, vb); ... }
Quoted 6 lines
These three functions need to cast a
vb2_bufferpointer to aiss_bufferpointer. They do so by first casting tovb2_v4l2_buffer, and then toiss_bufferwith a direct use ofcontainer_of. It would be best to combine the two casts in a singleto_iss_buffermacro and use it through the code.
Got it. Thank you.
- Himadri
Quoted 33 lines
Quoted 2 lines
If I understand it correctly, these usages are converting
vb2_buffertoiss_buffer. Which could be done by using theto_iss_buffer(vbuf)aswell. Why
Quoted 1 line
is this macro no longer used? I also don't understand what modification
you are
Quoted 4 lines
suggesting. Can you please elaborate?
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
drivers/staging/media/omap4iss/iss_video.h +0
-0enum iss_video_dmaqueue_flags {/* Set if DMA queue becomes empty when
ISS_PIPELINE_STREAM_CONTINUOUS*/Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
drivers/staging/media/omap4iss/iss_video.h struct iss_video { · line 173
Quoted 5 lines
drivers/staging/media/omap4iss/iss_video.h +0
-1@@ -170,7 +170,7 @@ struct iss_video {const struct iss_video_operations *ops; }; -#define to_iss_video (vdev) container_of(vdev, struct iss_video,video)
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
drivers/staging/media/omap4iss/iss_video.h struct iss_video { · line 173
Quoted 1 line
drivers/staging/media/omap4iss/iss_video.h +1
-0+#define to_iss_video (vdev) list_entry(vdev, struct iss_video,video)
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 4 lines
This doesn't involve a list. Nor does the previous one. To use
list_entry, the third argument should be the name of a field that has typelist_head.Understood. Thank you.
Quoted 2 lines
Quoted 2 lines
drivers/staging/media/omap4iss/iss_video.h +0
-0struct iss_video_fh {struct v4l2_fh vfh;--
Regards,Laurent Pinchart