Skip to contentSkip to conversation

media: v4l2-fh: define v4l2_fh struct regardless of condition

PATCH In review Seungchul Kim 3 participants 6 messages Mar 23, 2020 – Mar 26, 2020 1 message not in the archive Media (V4L/DVB)

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): CGME20200323023045epcas2p12007502edd2a65efcccb00eb899d5532@epcas2p1.samsung.com

#1 lore raw

PATCH 1/1 media: v4l2-fh: define v4l2_fh struct regardless of condition

v4l2_fh struct define differently by CONFIG_V4L2_MEM2MEM_DEV. If some vendors use CONFIG_V4L2_MEM2MEM_DEV by module, it can make the mismatch of v4l2_fh sturct.

By the mismatch, the following error occurs.
===============================

[    7.533506] v4l2_mem2mem: disagrees about version of symbol video_devdata
[    7.533594] v4l2_mem2mem: Unknown symbol video_devdata (err -22)
[    7.535319] v4l2_mem2mem: disagrees about version of symbol
v4l2_event_pending
[    7.542532] v4l2_mem2mem: Unknown symbol v4l2_event_pending (err -22)

===============================

So v4l2_fh struct is modified to does not have dependency for CONFIG_V4L2_MEM2MEM_DEV.

---
 include/media/v4l2-fh.h | 2 --
 1 file changed, 2 deletions(-)
include/media/v4l2-fh.h index renamed from include/media/v4l2-fh.h +0 -0

53b4dbb..b5b3e00 100644

include/media/v4l2-fh.h +0 -2
@@ -53,9 +53,7 @@ struct v4l2_fh {
 	unsigned int		navailable;
 	u32			sequence;
 
-#if IS_ENABLED(CONFIG_V4L2_MEM2MEM_DEV)
 	struct v4l2_m2m_ctx	*m2m_ctx;
-#endif
 };
 
 /**

--
2.7.4

Reviewed-by on v1 1/1
#2 lore raw
Quoted 13 lines · Seungchul Kim

v4l2_fh struct define differently by CONFIG_V4L2_MEM2MEM_DEV. If some vendors use CONFIG_V4L2_MEM2MEM_DEV by module, it can make the mismatch of v4l2_fh sturct.

By the mismatch, the following error occurs.
===============================

[    7.533506] v4l2_mem2mem: disagrees about version of symbol video_devdata
[    7.533594] v4l2_mem2mem: Unknown symbol video_devdata (err -22)
[    7.535319] v4l2_mem2mem: disagrees about version of symbol
v4l2_event_pending
[    7.542532] v4l2_mem2mem: Unknown symbol v4l2_event_pending (err -22)

===============================

Quoted 7 lines

So v4l2_fh struct is modified to does not have dependency for CONFIG_V4L2_MEM2MEM_DEV.

---
 include/media/v4l2-fh.h | 2 --
 1 file changed, 2 deletions(-)
#3 lore raw
In reply to Seungchul Kim
Quoted 26 lines · Seungchul Kim

v4l2_fh struct define differently by CONFIG_V4L2_MEM2MEM_DEV. If some vendors use CONFIG_V4L2_MEM2MEM_DEV by module, it can make the mismatch of v4l2_fh sturct.

By the mismatch, the following error occurs.
===============================

[    7.533506] v4l2_mem2mem: disagrees about version of symbol video_devdata
[    7.533594] v4l2_mem2mem: Unknown symbol video_devdata (err -22)
[    7.535319] v4l2_mem2mem: disagrees about version of symbol
v4l2_event_pending
[    7.542532] v4l2_mem2mem: Unknown symbol v4l2_event_pending (err -22)

===============================

So v4l2_fh struct is modified to does not have dependency for CONFIG_V4L2_MEM2MEM_DEV.

---
 include/media/v4l2-fh.h | 2 --
 1 file changed, 2 deletions(-)
include/media/v4l2-fh.h index renamed from include/media/v4l2-fh.h +0 -0

53b4dbb..b5b3e00 100644

include/media/v4l2-fh.h struct v4l2_fh { · line 58

Quoted 6 lines
include/media/v4l2-fh.h +0 -2
@@ -53,9 +53,7 @@ struct v4l2_fh {
 	unsigned int		navailable;
 	u32			sequence;
 
-#if IS_ENABLED(CONFIG_V4L2_MEM2MEM_DEV)
 	struct v4l2_m2m_ctx	*m2m_ctx;
-#endif

This is a good change, but please also remove the same #if from v4l2_ioctl_get_lock() in drivers/media/v4l2-core/v4l2-ioctl.c. That is now no longer needed there either and without removing that those vendor drivers would be using the wrong lock.

Regards,

Hans

Quoted 6 lines
include/media/v4l2-fh.h +0 -1
 };
 
 /**
--

2.7.4

#4 lore raw
Quoted 40 lines · Hans Verkuil
Quoted 7 lines · Seungchul Kim

v4l2_fh struct define differently by CONFIG_V4L2_MEM2MEM_DEV. If some vendors use CONFIG_V4L2_MEM2MEM_DEV by module, it can make the mismatch of v4l2_fh sturct.

By the mismatch, the following error occurs.
===============================

[    7.533506] v4l2_mem2mem: disagrees about version of symbol

video_devdata

Quoted 19 lines
[    7.533594] v4l2_mem2mem: Unknown symbol video_devdata (err -22)
[    7.535319] v4l2_mem2mem: disagrees about version of symbol
v4l2_event_pending
[    7.542532] v4l2_mem2mem: Unknown symbol v4l2_event_pending (err -22)

===============================

So v4l2_fh struct is modified to does not have dependency for CONFIG_V4L2_MEM2MEM_DEV.

---
 include/media/v4l2-fh.h | 2 --
 1 file changed, 2 deletions(-)
include/media/v4l2-fh.h index renamed from include/media/v4l2-fh.h +0 -0

53b4dbb..b5b3e00 100644

include/media/v4l2-fh.h struct v4l2_fh { · line 58

Quoted 6 lines
include/media/v4l2-fh.h +0 -2
@@ -53,9 +53,7 @@ struct v4l2_fh {
 	unsigned int		navailable;
 	u32			sequence;
 
-#if IS_ENABLED(CONFIG_V4L2_MEM2MEM_DEV)
 	struct v4l2_m2m_ctx	*m2m_ctx;
-#endif

This is a good change, but please also remove the same #if from v4l2_ioctl_get_lock() in drivers/media/v4l2-core/v4l2-ioctl.c. That is now no longer needed there either and without removing that those vendor drivers would be using the wrong lock.

Quoted 3 lines

Regards,

Hans

Thank you for your comment. I worried about the same thing with you. But vfh->m2m_ctx on v4l2_ioctl_get_lock() is always null without CONFIG_V4L2_MEM2MEM_DEV, because m2m_ctx of v4l2-fh is initialized only in v4l2_mem2mem.c.
Therefore it doesn't have a problem using an wrong lock regardless of modification, so I did not fix it.

Regards,
Seungchul Kim

#5 lore raw
Quoted 43 lines · Seungchul Kim
Quoted 42 lines · Hans Verkuil
Quoted 7 lines · Seungchul Kim

v4l2_fh struct define differently by CONFIG_V4L2_MEM2MEM_DEV. If some vendors use CONFIG_V4L2_MEM2MEM_DEV by module, it can make the mismatch of v4l2_fh sturct.

By the mismatch, the following error occurs.
===============================

[    7.533506] v4l2_mem2mem: disagrees about version of symbol

video_devdata

Quoted 19 lines
[    7.533594] v4l2_mem2mem: Unknown symbol video_devdata (err -22)
[    7.535319] v4l2_mem2mem: disagrees about version of symbol
v4l2_event_pending
[    7.542532] v4l2_mem2mem: Unknown symbol v4l2_event_pending (err -22)

===============================

So v4l2_fh struct is modified to does not have dependency for CONFIG_V4L2_MEM2MEM_DEV.

---
 include/media/v4l2-fh.h | 2 --
 1 file changed, 2 deletions(-)
include/media/v4l2-fh.h index renamed from include/media/v4l2-fh.h +0 -0

53b4dbb..b5b3e00 100644

include/media/v4l2-fh.h struct v4l2_fh { · line 58

Quoted 6 lines
include/media/v4l2-fh.h +0 -2
@@ -53,9 +53,7 @@ struct v4l2_fh {
 	unsigned int		navailable;
 	u32			sequence;
 
-#if IS_ENABLED(CONFIG_V4L2_MEM2MEM_DEV)
 	struct v4l2_m2m_ctx	*m2m_ctx;
-#endif

This is a good change, but please also remove the same #if from v4l2_ioctl_get_lock() in drivers/media/v4l2-core/v4l2-ioctl.c. That is now no longer needed there either and without removing that those vendor drivers would be using the wrong lock.

Regards,

Quoted 8 lines
Quoted 1 line

Hans

Thank you for your comment. I worried about the same thing with you. But vfh->m2m_ctx on v4l2_ioctl_get_lock() is always null without CONFIG_V4L2_MEM2MEM_DEV, because m2m_ctx of v4l2-fh is initialized only in v4l2_mem2mem.c.
Therefore it doesn't have a problem using an wrong lock regardless of modification, so I did not fix it.

It is: if your out-of-tree driver sets CONFIG_V4L2_MEM2MEM_DEV, then I assume it will set vfh->m2m_ctx, and so the v4l2 core should also return the right lock for that out-of-tree driver.

But in any case, if m2m_ctx is always part of v4l2-fh.h, then that #if in v4l2-ioctl.c has become pointless and should be removed in any case.

Regards,

Hans

#6 lore raw
Quoted 57 lines · Hans Verkuil
Quoted 43 lines · Seungchul Kim
Quoted 42 lines · Hans Verkuil
Quoted 7 lines · Seungchul Kim

v4l2_fh struct define differently by CONFIG_V4L2_MEM2MEM_DEV. If some vendors use CONFIG_V4L2_MEM2MEM_DEV by module, it can make the mismatch of v4l2_fh sturct.

By the mismatch, the following error occurs.
===============================

[    7.533506] v4l2_mem2mem: disagrees about version of symbol

video_devdata

Quoted 19 lines
[    7.533594] v4l2_mem2mem: Unknown symbol video_devdata (err -22)
[    7.535319] v4l2_mem2mem: disagrees about version of symbol
v4l2_event_pending
[    7.542532] v4l2_mem2mem: Unknown symbol v4l2_event_pending (err -22)

===============================

So v4l2_fh struct is modified to does not have dependency for CONFIG_V4L2_MEM2MEM_DEV.

---
 include/media/v4l2-fh.h | 2 --
 1 file changed, 2 deletions(-)
include/media/v4l2-fh.h index renamed from include/media/v4l2-fh.h +0 -0

53b4dbb..b5b3e00 100644

include/media/v4l2-fh.h struct v4l2_fh { · line 58

Quoted 6 lines
include/media/v4l2-fh.h +0 -2
@@ -53,9 +53,7 @@ struct v4l2_fh {
 	unsigned int		navailable;
 	u32			sequence;
 
-#if IS_ENABLED(CONFIG_V4L2_MEM2MEM_DEV)
 	struct v4l2_m2m_ctx	*m2m_ctx;
-#endif

This is a good change, but please also remove the same #if from v4l2_ioctl_get_lock() in drivers/media/v4l2-core/v4l2-ioctl.c. That is now no longer needed there either and without removing that those vendor drivers would be using the wrong lock.

Regards,

Quoted 8 lines
Quoted 1 line

Hans

Thank you for your comment. I worried about the same thing with you. But vfh->m2m_ctx on v4l2_ioctl_get_lock() is always null without CONFIG_V4L2_MEM2MEM_DEV, because m2m_ctx of v4l2-fh is initialized only in v4l2_mem2mem.c.
Therefore it doesn't have a problem using an wrong lock regardless of modification, so I did not fix it.

It is: if your out-of-tree driver sets CONFIG_V4L2_MEM2MEM_DEV, then I assume it will set vfh->m2m_ctx, and so the v4l2 core should also return the right lock for that out-of-tree driver.

Quoted 6 lines

But in any case, if m2m_ctx is always part of v4l2-fh.h, then that #if in v4l2-ioctl.c has become pointless and should be removed in any case.

Regards,

Hans

I agree with you, so I will update a patch, soon