Skip to contentSkip to conversation

ISP:BUILD:FIX: Move media_entity_init() and

PATCH In review Deepthy Ravi 5 participants 16 messages Aug 19, 2011 – Sep 7, 2011

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 ISP:BUILD:FIX: Move media_entity_init() and

From: Vaibhav Hiremath <[email protected]>

Fix the build break caused when CONFIG_MEDIA_CONTROLLER option is disabled and if any sensor driver has to be used between MC and non MC framework compatible devices.

For example,if tvp514x video decoder driver migrated to MC framework is being built without CONFIG_MEDIA_CONTROLLER option enabled, the following error messages will result. drivers/built-in.o: In function `tvp514x_remove':
drivers/media/video/tvp514x.c:1285: undefined reference to `media_entity_cleanup'
drivers/built-in.o: In function `tvp514x_probe':
drivers/media/video/tvp514x.c:1237: undefined reference to `media_entity_init'

The file containing definitions of media_entity_init and media_entity_cleanup functions will not be built if that config option is disabled. And this is corrected by defining two dummy functions.

---
 include/media/media-entity.h |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)
include/media/media-entity.h +9 -0
index cd8bca6..c90916e 100644
@@ -121,9 +121,18 @@ struct media_entity_graph {
 	int top;
 };
 
+#ifdef CONFIG_MEDIA_CONTROLLER
 int media_entity_init(struct media_entity *entity, u16 num_pads,
 		struct media_pad *pads, u16 extra_links);
 void media_entity_cleanup(struct media_entity *entity);
+#else
+static inline int media_entity_init(struct media_entity *entity, u16 num_pads,
+		struct media_pad *pads, u16 extra_links)
+{
+	return 0;
+}
+static inline void media_entity_cleanup(struct media_entity *entity) {}
+#endif
 
 int media_entity_create_link(struct media_entity *source, u16 source_pad,
 		struct media_entity *sink, u16 sink_pad, u32 flags);
Signature · 1 line
1.7.0.4
maintainer
#1 lore raw
Quoted 6 lines · On Friday 19 August 2011 15:48:45 Deepthy Ravi wrote:

From: Vaibhav Hiremath <[email protected]>

Fix the build break caused when CONFIG_MEDIA_CONTROLLER option is disabled and if any sensor driver has to be used between MC and non MC framework compatible devices.

Quoted 9 lines

For example,if tvp514x video decoder driver migrated to MC framework is being built without CONFIG_MEDIA_CONTROLLER option enabled, the following error messages will result. drivers/built-in.o: In function `tvp514x_remove':
drivers/media/video/tvp514x.c:1285: undefined reference to `media_entity_cleanup'
drivers/built-in.o: In function `tvp514x_probe':
drivers/media/video/tvp514x.c:1237: undefined reference to `media_entity_init'

If the tvp514x is migrated to the MC framework, its Kconfig option should depend on MEDIA_CONTROLLER.

Quoted 34 lines

The file containing definitions of media_entity_init and media_entity_cleanup functions will not be built if that config option is disabled. And this is corrected by defining two dummy functions.

---
 include/media/media-entity.h |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)
include/media/media-entity.h +8 -0
index cd8bca6..c90916e 100644
@@ -121,9 +121,18 @@ struct media_entity_graph {
 	int top;
 };
 
+#ifdef CONFIG_MEDIA_CONTROLLER
 int media_entity_init(struct media_entity *entity, u16 num_pads,
 		struct media_pad *pads, u16 extra_links);
 void media_entity_cleanup(struct media_entity *entity);
+#else
+static inline int media_entity_init(struct media_entity *entity, u16
 num_pads, +		struct media_pad *pads, u16 extra_links)
+{
+	return 0;
+}
+static inline void media_entity_cleanup(struct media_entity *entity) {}
+#endif
 
 int media_entity_create_link(struct media_entity *source, u16 source_pad,
 		struct media_entity *sink, u16 sink_pad, u32 flags);
Signature · 3 lines
Regards,

Laurent Pinchart
#2 lore raw
Quoted 64 lines · On Wed, Aug 24, 2011 at 4:47 PM, Laurent Pinchart…
Quoted 6 lines · On Friday 19 August 2011 15:48:45 Deepthy Ravi wrote:

From: Vaibhav Hiremath <[email protected]>

Fix the build break caused when CONFIG_MEDIA_CONTROLLER option is disabled and if any sensor driver has to be used between MC and non MC framework compatible devices.

Quoted 9 lines

For example,if tvp514x video decoder driver migrated to MC framework is being built without CONFIG_MEDIA_CONTROLLER option enabled, the following error messages will result. drivers/built-in.o: In function `tvp514x_remove':
drivers/media/video/tvp514x.c:1285: undefined reference to `media_entity_cleanup'
drivers/built-in.o: In function `tvp514x_probe':
drivers/media/video/tvp514x.c:1237: undefined reference to `media_entity_init'

If the tvp514x is migrated to the MC framework, its Kconfig option should
depend on MEDIA_CONTROLLER.
The same TVP514x driver is being used for both MC and non MC compatible devices, for example OMAP3 and AM35x. So if it is made dependent on MEDIA CONTROLLER, we cannot enable the driver for MC independent devices.

Quoted 24 lines

The file containing definitions of media_entity_init and media_entity_cleanup functions will not be built if that config option is disabled. And this is corrected by defining two dummy functions.

---
 include/media/media-entity.h |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)
include/media/media-entity.h +2 -0
index cd8bca6..c90916e 100644
@@ -121,9 +121,18 @@ struct media_entity_graph {
      int top;
 };
 
+#ifdef CONFIG_MEDIA_CONTROLLER
 int media_entity_init(struct media_entity *entity, u16 num_pads,
              struct media_pad *pads, u16 extra_links);
 void media_entity_cleanup(struct media_entity *entity);
+#else

include/media/media-entity.h struct media_entity_graph { · line 138

Quoted 10 lines
include/media/media-entity.h +6 -0
+static inline int media_entity_init(struct media_entity *entity, u16
 num_pads, +           struct media_pad *pads, u16 extra_links)
+{
+     return 0;
+}
+static inline void media_entity_cleanup(struct media_entity *entity) {}
+#endif
 
 int media_entity_create_link(struct media_entity *source, u16 source_pad,
              struct media_entity *sink, u16 sink_pad, u32 flags);

--
Regards,

Laurent Pinchart
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-inf

maintainer
#3 lore raw

Hi,

Quoted 18 lines · Deepthy
Quoted 17 lines · Laurent Pinchart
Quoted 15 lines · On Friday 19 August 2011 15:48:45 Deepthy Ravi wrote:

From: Vaibhav Hiremath <[email protected]>

Fix the build break caused when CONFIG_MEDIA_CONTROLLER option is disabled and if any sensor driver has to be used between MC and non MC framework compatible devices.

For example,if tvp514x video decoder driver migrated to MC framework is being built without CONFIG_MEDIA_CONTROLLER option enabled, the following error messages will result. drivers/built-in.o: In function `tvp514x_remove':
drivers/media/video/tvp514x.c:1285: undefined reference to `media_entity_cleanup'
drivers/built-in.o: In function `tvp514x_probe':
drivers/media/video/tvp514x.c:1237: undefined reference to `media_entity_init'

Quoted 6 lines
Quoted 2 lines

If the tvp514x is migrated to the MC framework, its Kconfig option should depend on MEDIA_CONTROLLER.

The same TVP514x driver is being used for both MC and non MC compatible devices, for example OMAP3 and AM35x. So if it is made dependent on MEDIA CONTROLLER, we cannot enable the driver for MC independent devices.

Then you should use conditional compilation in the tvp514x driver itself. Or better, port the AM35x driver to the MC API.

Signature · 3 lines
Regards,

Laurent Pinchart
#4 lore raw
Quoted 34 lines

-----Original Message-----
From: Laurent Pinchart [mailto:[email protected]]
Sent: Wednesday, August 24, 2011 5:00 PM
To: Ravi, Deepthy
Cc: [email protected]; [email protected]; linux- [email protected]; [email protected]; Hiremath, Vaibhav
Subject: Re: [PATCHv2] ISP:BUILD:FIX: Move media_entity_init() and

Hi,

Quoted 18 lines · Deepthy
Quoted 17 lines · Laurent Pinchart
Quoted 15 lines · On Friday 19 August 2011 15:48:45 Deepthy Ravi wrote:

From: Vaibhav Hiremath <[email protected]>

Fix the build break caused when CONFIG_MEDIA_CONTROLLER option is disabled and if any sensor driver has to be used between MC and non MC framework compatible devices.

For example,if tvp514x video decoder driver migrated to MC framework is being built without CONFIG_MEDIA_CONTROLLER option enabled, the following error messages will result. drivers/built-in.o: In function `tvp514x_remove':
drivers/media/video/tvp514x.c:1285: undefined reference to `media_entity_cleanup'
drivers/built-in.o: In function `tvp514x_probe':
drivers/media/video/tvp514x.c:1237: undefined reference to `media_entity_init'

Quoted 1 line
Quoted 1 line

If the tvp514x is migrated to the MC framework, its Kconfig option

should

Quoted 2 lines
Quoted 1 line

depend on MEDIA_CONTROLLER.

Quoted 7 lines
Quoted 2 lines

The same TVP514x driver is being used for both MC and non MC compatible devices, for example OMAP3 and AM35x. So if it is made dependent on

MEDIA

Quoted 1 line

CONTROLLER, we cannot enable the driver for MC independent devices.

Then you should use conditional compilation in the tvp514x driver itself. Or

[Hiremath, Vaibhav] No. I am not in favor of conditional compilation in driver code.

Quoted 2 lines

better, port the AM35x driver to the MC API.

[Hiremath, Vaibhav]
Why should we use MC if I have very simple device (like AM35x) which only supports single path? I can very well use simple V4L2 sub-dev based approach (master - slave), isn't it?

Thanks,
Vaibhav

Quoted 4 lines

--
Regards,

Laurent Pinchart

#5 lore raw
Quoted 23 lines
Quoted 23 lines
Quoted 14 lines
Quoted 14 lines
Quoted 13 lines

Fix the build break caused when CONFIG_MEDIA_CONTROLLER option is disabled and if any sensor driver has to be used between MC and non MC framework compatible devices.

For example,if tvp514x video decoder driver migrated to MC framework is being built without CONFIG_MEDIA_CONTROLLER option enabled, the following error messages will result. drivers/built-in.o: In function `tvp514x_remove':
drivers/media/video/tvp514x.c:1285: undefined reference to `media_entity_cleanup'
drivers/built-in.o: In function `tvp514x_probe':
drivers/media/video/tvp514x.c:1237: undefined reference to `media_entity_init'

Quoted 1 line
Quoted 1 line

If the tvp514x is migrated to the MC framework, its Kconfig option

should

Quoted 4 lines
Quoted 1 line

depend on MEDIA_CONTROLLER.

The same TVP514x driver is being used for both MC and non MC compatible devices, for example OMAP3 and AM35x. So if it is made dependent on

MEDIA

Quoted 1 line

CONTROLLER, we cannot enable the driver for MC independent devices.

Quoted 8 lines
Quoted 2 lines

Then you should use conditional compilation in the tvp514x driver itself. Or

[Hiremath, Vaibhav] No. I am not in favor of conditional compilation in driver code.

Quoted 2 lines

better, port the AM35x driver to the MC API.

[Hiremath, Vaibhav]
Why should we use MC if I have very simple device (like AM35x) which only supports single path? I can very well use simple V4L2 sub-dev based approach (master - slave), isn't it?

Why should you break the API in unappropriated way?

The patch is NACK, obviously.

Signature · 2 lines
Andy Shevchenko <[email protected]>
Intel Finland Oy
#6 lore raw
Quoted 40 lines

-----Original Message-----
From: Andy Shevchenko [mailto:[email protected]]
Sent: Wednesday, August 24, 2011 6:26 PM
To: Hiremath, Vaibhav
Cc: Laurent Pinchart; Ravi, Deepthy; [email protected]; linux- [email protected]; [email protected]; linux- [email protected]
Subject: RE: [PATCHv2] ISP:BUILD:FIX: Move media_entity_init() and

Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
Quoted 13 lines

Fix the build break caused when CONFIG_MEDIA_CONTROLLER option is disabled and if any sensor driver has to be used between MC and non MC framework compatible devices.

For example,if tvp514x video decoder driver migrated to MC framework is being built without CONFIG_MEDIA_CONTROLLER option enabled, the following error messages will result. drivers/built-in.o: In function `tvp514x_remove':
drivers/media/video/tvp514x.c:1285: undefined reference to `media_entity_cleanup'
drivers/built-in.o: In function `tvp514x_probe':
drivers/media/video/tvp514x.c:1237: undefined reference to `media_entity_init'

Quoted 5 lines
Quoted 5 lines
Quoted 1 line
Quoted 1 line

If the tvp514x is migrated to the MC framework, its Kconfig option

should

Quoted 3 lines
Quoted 1 line

depend on MEDIA_CONTROLLER.

The same TVP514x driver is being used for both MC and non MC

compatible

Quoted 5 lines
Quoted 5 lines
Quoted 1 line

devices, for example OMAP3 and AM35x. So if it is made dependent on

MEDIA

Quoted 1 line

CONTROLLER, we cannot enable the driver for MC independent devices.

Then you should use conditional compilation in the tvp514x driver

itself.

Quoted 2 lines
Quoted 1 line

Or

[Hiremath, Vaibhav] No. I am not in favor of conditional compilation in

driver code.

Quoted 1 line
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

better, port the AM35x driver to the MC API.

[Hiremath, Vaibhav]
Why should we use MC if I have very simple device (like AM35x) which

only supports single path? I can very well use simple V4L2 sub-dev based approach (master - slave), isn't it?
Why should you break the API in unappropriated way?

[Hiremath, Vaibhav] Can you explain?

Thanks,
Vaibhav

Quoted 6 lines

The patch is NACK, obviously.

--
Andy Shevchenko <[email protected]> Intel Finland Oy

maintainer
#7 lore raw
In reply to Hiremath, Vaibhav

Hi Vaibhav,

Quoted 28 lines · Vaibhav
Quoted 27 lines · Laurent Pinchart
Quoted 25 lines · Deepthy
Quoted 17 lines · Laurent Pinchart
Quoted 6 lines · On Friday 19 August 2011 15:48:45 Deepthy Ravi wrote:

From: Vaibhav Hiremath <[email protected]>

Fix the build break caused when CONFIG_MEDIA_CONTROLLER option is disabled and if any sensor driver has to be used between MC and non MC framework compatible devices.

Quoted 9 lines

For example,if tvp514x video decoder driver migrated to MC framework is being built without CONFIG_MEDIA_CONTROLLER option enabled, the following error messages will result. drivers/built-in.o: In function `tvp514x_remove':
drivers/media/video/tvp514x.c:1285: undefined reference to `media_entity_cleanup'
drivers/built-in.o: In function `tvp514x_probe':
drivers/media/video/tvp514x.c:1237: undefined reference to `media_entity_init'

Quoted 2 lines

If the tvp514x is migrated to the MC framework, its Kconfig option should depend on MEDIA_CONTROLLER.

The same TVP514x driver is being used for both MC and non MC compatible devices, for example OMAP3 and AM35x. So if it is made dependent on MEDIA CONTROLLER, we cannot enable the driver for MC independent devices.

Quoted 4 lines
Quoted 2 lines

Then you should use conditional compilation in the tvp514x driver itself. Or

No. I am not in favor of conditional compilation in driver code.

Actually, thinking some more about this, you should make the tvp514x driver depend on CONFIG_MEDIA_CONTROLLER unconditionally. This doesn't mean that the driver will become unusable by applications that are not MC-aware. Hosts/bridges don't have to export subdev nodes, they can just call subdev pad-level operations internally and let applications control the whole device through a single V4L2 video node.

Quoted 5 lines
Quoted 1 line

better, port the AM35x driver to the MC API.

Why should we use MC if I have very simple device (like AM35x) which only supports single path? I can very well use simple V4L2 sub-dev based approach (master - slave), isn't it?

The AM35x driver should use the in-kernel MC and V4L2 subdev APIs, but it doesn't have to expose them to userspace.

Signature · 3 lines
Regards,

Laurent Pinchart
#8 lore raw
Quoted 45 lines

-----Original Message-----
From: Laurent Pinchart [mailto:[email protected]]
Sent: Wednesday, August 24, 2011 6:56 PM
To: Hiremath, Vaibhav
Cc: Ravi, Deepthy; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCHv2] ISP:BUILD:FIX: Move media_entity_init() and

Hi Vaibhav,

Quoted 20 lines · Vaibhav
Quoted 19 lines · Laurent Pinchart
Quoted 18 lines · Deepthy
Quoted 17 lines · Laurent Pinchart
Quoted 15 lines · On Friday 19 August 2011 15:48:45 Deepthy Ravi wrote:

From: Vaibhav Hiremath <[email protected]>

Fix the build break caused when CONFIG_MEDIA_CONTROLLER option is disabled and if any sensor driver has to be used between MC and non MC framework compatible devices.

For example,if tvp514x video decoder driver migrated to MC framework is being built without CONFIG_MEDIA_CONTROLLER option enabled, the following error messages will result. drivers/built-in.o: In function `tvp514x_remove':
drivers/media/video/tvp514x.c:1285: undefined reference to `media_entity_cleanup'
drivers/built-in.o: In function `tvp514x_probe':
drivers/media/video/tvp514x.c:1237: undefined reference to `media_entity_init'

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 2 lines

If the tvp514x is migrated to the MC framework, its Kconfig option should depend on MEDIA_CONTROLLER.

The same TVP514x driver is being used for both MC and non MC

compatible

Quoted 5 lines
Quoted 5 lines
Quoted 3 lines

devices, for example OMAP3 and AM35x. So if it is made dependent on MEDIA CONTROLLER, we cannot enable the driver for MC independent devices.

Then you should use conditional compilation in the tvp514x driver

itself.

Quoted 2 lines
Quoted 1 line

Or

Quoted 7 lines
Quoted 1 line

No. I am not in favor of conditional compilation in driver code.

Actually, thinking some more about this, you should make the tvp514x driver
depend on CONFIG_MEDIA_CONTROLLER unconditionally. This doesn't mean that the
driver will become unusable by applications that are not MC-aware.

[Hiremath, Vaibhav] I am not referring to application here, there is no doubt that application must support non-MC devices.
I should be able to use standard V4L2 streaming application and use it on streaming device node, the only change would be, for MC aware device, links need to be set before and for non-MC aware devices its default thing.

Quoted 5 lines

Hosts/bridges don't have to export subdev nodes, they can just call subdev pad-level operations internally and let applications control the whole device
through a single V4L2 video node.

[Hiremath, Vaibhav] Agreed. That's what I thought.

Quoted 10 lines
Quoted 3 lines
Quoted 1 line

better, port the AM35x driver to the MC API.

Why should we use MC if I have very simple device (like AM35x) which

only

Quoted 2 lines

supports single path? I can very well use simple V4L2 sub-dev based approach (master - slave), isn't it?

The AM35x driver should use the in-kernel MC and V4L2 subdev APIs, but it doesn't have to expose them to userspace.

[Hiremath, Vaibhav] Let me digest this.

Thanks,
Vaibhav

Quoted 4 lines

--
Regards,

Laurent Pinchart

#9 lore raw
In reply to Laurent Pinchart

Em 24-08-2011 10:25, Laurent Pinchart escreveu:

Quoted 43 lines

Hi Vaibhav,

Quoted 28 lines · Vaibhav
Quoted 27 lines · Laurent Pinchart
Quoted 25 lines · Deepthy
Quoted 17 lines · Laurent Pinchart
Quoted 6 lines · On Friday 19 August 2011 15:48:45 Deepthy Ravi wrote:

From: Vaibhav Hiremath <[email protected]>

Fix the build break caused when CONFIG_MEDIA_CONTROLLER option is disabled and if any sensor driver has to be used between MC and non MC framework compatible devices.

Quoted 9 lines

For example,if tvp514x video decoder driver migrated to MC framework is being built without CONFIG_MEDIA_CONTROLLER option enabled, the following error messages will result. drivers/built-in.o: In function `tvp514x_remove':
drivers/media/video/tvp514x.c:1285: undefined reference to `media_entity_cleanup'
drivers/built-in.o: In function `tvp514x_probe':
drivers/media/video/tvp514x.c:1237: undefined reference to `media_entity_init'

Quoted 2 lines

If the tvp514x is migrated to the MC framework, its Kconfig option should depend on MEDIA_CONTROLLER.

The same TVP514x driver is being used for both MC and non MC compatible devices, for example OMAP3 and AM35x. So if it is made dependent on MEDIA CONTROLLER, we cannot enable the driver for MC independent devices.

Quoted 4 lines
Quoted 2 lines

Then you should use conditional compilation in the tvp514x driver itself. Or

No. I am not in favor of conditional compilation in driver code.

Actually, thinking some more about this, you should make the tvp514x driver depend on CONFIG_MEDIA_CONTROLLER unconditionally. This doesn't mean that the driver will become unusable by applications that are not MC-aware. Hosts/bridges don't have to export subdev nodes, they can just call subdev pad-level operations internally and let applications control the whole device through a single V4L2 video node.

Quoted 8 lines
Quoted 5 lines
Quoted 1 line

better, port the AM35x driver to the MC API.

Why should we use MC if I have very simple device (like AM35x) which only supports single path? I can very well use simple V4L2 sub-dev based approach (master - slave), isn't it?

The AM35x driver should use the in-kernel MC and V4L2 subdev APIs, but it doesn't have to expose them to userspace.

I don't agree. If AM35x doesn't expose the MC API to userspace, CONFIG_MEDIA_CONTROLLER should not be required at all.

Also, according with the Linux best practices, when #if tests for config symbols are required, developers should put it into the header files, and not inside the code, as it helps to improve code readability. From Documentation/SubmittingPatches:

2) #ifdefs are ugly

Code cluttered with ifdefs is difficult to read and maintain. Don't do it. Instead, put your ifdefs in a header, and conditionally define 'static inline' functions, or macros, which are used in the code. Let the compiler optimize away the "no-op" case.

So, this patch is perfectly fine on my eyes.

Regards,
Mauro

maintainer
#10 lore raw

Hi Mauro,

Quoted 59 lines · On Sunday 04 September 2011 00:21:38 Mauro Carvalho Chehab wrote:

Em 24-08-2011 10:25, Laurent Pinchart escreveu:

Quoted 41 lines · Vaibhav
Quoted 28 lines · Laurent Pinchart
Quoted 27 lines · Deepthy
Quoted 25 lines · Laurent Pinchart
Quoted 17 lines · On Friday 19 August 2011 15:48:45 Deepthy Ravi wrote:
Quoted 6 lines

From: Vaibhav Hiremath <[email protected]>

Fix the build break caused when CONFIG_MEDIA_CONTROLLER option is disabled and if any sensor driver has to be used between MC and non MC framework compatible devices.

Quoted 9 lines

For example,if tvp514x video decoder driver migrated to MC framework is being built without CONFIG_MEDIA_CONTROLLER option enabled, the following error messages will result. drivers/built-in.o: In function `tvp514x_remove':
drivers/media/video/tvp514x.c:1285: undefined reference to `media_entity_cleanup'
drivers/built-in.o: In function `tvp514x_probe':
drivers/media/video/tvp514x.c:1237: undefined reference to `media_entity_init'

Quoted 2 lines

If the tvp514x is migrated to the MC framework, its Kconfig option should depend on MEDIA_CONTROLLER.

The same TVP514x driver is being used for both MC and non MC compatible devices, for example OMAP3 and AM35x. So if it is made dependent on MEDIA CONTROLLER, we cannot enable the driver for MC independent devices.

Quoted 4 lines
Quoted 2 lines

Then you should use conditional compilation in the tvp514x driver itself. Or

No. I am not in favor of conditional compilation in driver code.

Actually, thinking some more about this, you should make the tvp514x driver depend on CONFIG_MEDIA_CONTROLLER unconditionally. This doesn't mean that the driver will become unusable by applications that are not MC-aware. Hosts/bridges don't have to export subdev nodes, they can just call subdev pad-level operations internally and let applications control the whole device through a single V4L2 video node.

Quoted 8 lines
Quoted 5 lines
Quoted 1 line

better, port the AM35x driver to the MC API.

Why should we use MC if I have very simple device (like AM35x) which only supports single path? I can very well use simple V4L2 sub-dev based approach (master - slave), isn't it?

The AM35x driver should use the in-kernel MC and V4L2 subdev APIs, but it doesn't have to expose them to userspace.

I don't agree. If AM35x doesn't expose the MC API to userspace, CONFIG_MEDIA_CONTROLLER should not be required at all.

Also, according with the Linux best practices, when #if tests for config symbols are required, developers should put it into the header files, and not inside the code, as it helps to improve code readability. From Documentation/SubmittingPatches:

Quoted 8 lines

2) #ifdefs are ugly

Code cluttered with ifdefs is difficult to read and maintain. Don't do it. Instead, put your ifdefs in a header, and conditionally define 'static inline' functions, or macros, which are used in the code. Let the compiler optimize away the "no-op" case.

So, this patch is perfectly fine on my eyes.

I'm sorry, but I don't agree.

Regarding the V4L2 subdev pad-level API, the goal is to convert all host and subdev drivers to it, so that's definitely the way to go. This does *not* mean that subdevs must expose a subdev device node. That's entirely optional. What I'm talking about is switching from video::*_mbus_fmt operations to pad::*_fmt operations. The pad-level format operations are very similar to video-level format operations, and more generic. Drivers shouldn't implement both.

Regarding the MC API, drivers are not required to register a media_device instance. I have no issue with that. However, drivers should initialized the subdev's embedded media_entity, as that's required by subdev pad-level operations to get the number of pads for a subdev.

This will result in no modification to the userspace.

Signature · 3 lines
Regards,

Laurent Pinchart
#11 lore raw

Em 04-09-2011 06:01, Laurent Pinchart escreveu:

Quoted 71 lines

Hi Mauro,

Quoted 59 lines · On Sunday 04 September 2011 00:21:38 Mauro Carvalho Chehab wrote:

Em 24-08-2011 10:25, Laurent Pinchart escreveu:

Quoted 41 lines · Vaibhav
Quoted 28 lines · Laurent Pinchart
Quoted 27 lines · Deepthy
Quoted 25 lines · Laurent Pinchart
Quoted 17 lines · On Friday 19 August 2011 15:48:45 Deepthy Ravi wrote:
Quoted 6 lines

From: Vaibhav Hiremath <[email protected]>

Fix the build break caused when CONFIG_MEDIA_CONTROLLER option is disabled and if any sensor driver has to be used between MC and non MC framework compatible devices.

Quoted 9 lines

For example,if tvp514x video decoder driver migrated to MC framework is being built without CONFIG_MEDIA_CONTROLLER option enabled, the following error messages will result. drivers/built-in.o: In function `tvp514x_remove':
drivers/media/video/tvp514x.c:1285: undefined reference to `media_entity_cleanup'
drivers/built-in.o: In function `tvp514x_probe':
drivers/media/video/tvp514x.c:1237: undefined reference to `media_entity_init'

Quoted 2 lines

If the tvp514x is migrated to the MC framework, its Kconfig option should depend on MEDIA_CONTROLLER.

The same TVP514x driver is being used for both MC and non MC compatible devices, for example OMAP3 and AM35x. So if it is made dependent on MEDIA CONTROLLER, we cannot enable the driver for MC independent devices.

Quoted 4 lines
Quoted 2 lines

Then you should use conditional compilation in the tvp514x driver itself. Or

No. I am not in favor of conditional compilation in driver code.

Actually, thinking some more about this, you should make the tvp514x driver depend on CONFIG_MEDIA_CONTROLLER unconditionally. This doesn't mean that the driver will become unusable by applications that are not MC-aware. Hosts/bridges don't have to export subdev nodes, they can just call subdev pad-level operations internally and let applications control the whole device through a single V4L2 video node.

Quoted 8 lines
Quoted 5 lines
Quoted 1 line

better, port the AM35x driver to the MC API.

Why should we use MC if I have very simple device (like AM35x) which only supports single path? I can very well use simple V4L2 sub-dev based approach (master - slave), isn't it?

The AM35x driver should use the in-kernel MC and V4L2 subdev APIs, but it doesn't have to expose them to userspace.

I don't agree. If AM35x doesn't expose the MC API to userspace, CONFIG_MEDIA_CONTROLLER should not be required at all.

Also, according with the Linux best practices, when #if tests for config symbols are required, developers should put it into the header files, and not inside the code, as it helps to improve code readability. From Documentation/SubmittingPatches:

Quoted 8 lines

2) #ifdefs are ugly

Code cluttered with ifdefs is difficult to read and maintain. Don't do it. Instead, put your ifdefs in a header, and conditionally define 'static inline' functions, or macros, which are used in the code. Let the compiler optimize away the "no-op" case.

So, this patch is perfectly fine on my eyes.

Quoted 8 lines

I'm sorry, but I don't agree.

Regarding the V4L2 subdev pad-level API, the goal is to convert all host and subdev drivers to it, so that's definitely the way to go. This does *not* mean that subdevs must expose a subdev device node. That's entirely optional. What I'm talking about is switching from video::*_mbus_fmt operations to pad::*_fmt operations. The pad-level format operations are very similar to video-level format operations, and more generic. Drivers shouldn't implement both.

I agree that implementing two ways for doing the same thing is a bad idea, but especially since your idea is to convert all subdevs to it, this type of conversion should not require enabling CONFIG_MEDIA_CONTROLLER, as this feature is used to enable the MC userspace API.

Quoted 4 lines

Regarding the MC API, drivers are not required to register a media_device instance. I have no issue with that. However, drivers should initialized the subdev's embedded media_entity, as that's required by subdev pad-level operations to get the number of pads for a subdev.

There are two solutions:

1) add some "fallback" method at the core to use the video::*_mbus_fmt way, when MC is disabled;

2) split the config options into two: one configurable by the user to enable the userspace MC API, and another, used internally that would select the MC internal API when drivers need it.

As your plan is to convert all drivers to the new way, (2) doesn't make much sense in long term, as, at the end, all drivers will be selecting it.

Also, I don't like the idea of increasing drivers complexity for the existing drivers that work properly without MC. All those core conversions that were done in the last two years caused already too much instability to them.

We should really avoid touching on them again for something that won't be adding any new feature nor fixing any known bug.

Quoted 3 lines

This will result in no modification to the userspace.

Regards,
Mauro

maintainer
#12 lore raw

Hi Mauro,

Quoted 96 lines · On Sunday 04 September 2011 15:32:28 Mauro Carvalho Chehab wrote:

Em 04-09-2011 06:01, Laurent Pinchart escreveu:

Quoted 72 lines · On Sunday 04 September 2011 00:21:38 Mauro Carvalho Chehab wrote:
Quoted 62 lines

Em 24-08-2011 10:25, Laurent Pinchart escreveu:

Quoted 41 lines · Vaibhav
Quoted 28 lines · Laurent Pinchart
Quoted 27 lines · Deepthy
Quoted 25 lines · Laurent Pinchart
Quoted 17 lines · On Friday 19 August 2011 15:48:45 Deepthy Ravi wrote:
Quoted 6 lines

From: Vaibhav Hiremath <[email protected]>

Fix the build break caused when CONFIG_MEDIA_CONTROLLER option is disabled and if any sensor driver has to be used between MC and non MC framework compatible devices.

Quoted 9 lines

For example,if tvp514x video decoder driver migrated to MC framework is being built without CONFIG_MEDIA_CONTROLLER option enabled, the following error messages will result. drivers/built-in.o: In function `tvp514x_remove':
drivers/media/video/tvp514x.c:1285: undefined reference to `media_entity_cleanup'
drivers/built-in.o: In function `tvp514x_probe':
drivers/media/video/tvp514x.c:1237: undefined reference to `media_entity_init'

Quoted 2 lines

If the tvp514x is migrated to the MC framework, its Kconfig option should depend on MEDIA_CONTROLLER.

The same TVP514x driver is being used for both MC and non MC compatible devices, for example OMAP3 and AM35x. So if it is made dependent on MEDIA CONTROLLER, we cannot enable the driver for MC independent devices.

Quoted 4 lines
Quoted 2 lines

Then you should use conditional compilation in the tvp514x driver itself. Or

No. I am not in favor of conditional compilation in driver code.

Actually, thinking some more about this, you should make the tvp514x driver depend on CONFIG_MEDIA_CONTROLLER unconditionally. This doesn't mean that the driver will become unusable by applications that are not MC-aware. Hosts/bridges don't have to export subdev nodes, they can just call subdev pad-level operations internally and let applications control the whole device through a single V4L2 video node.

Quoted 8 lines
Quoted 5 lines
Quoted 1 line

better, port the AM35x driver to the MC API.

Why should we use MC if I have very simple device (like AM35x) which only supports single path? I can very well use simple V4L2 sub-dev based approach (master - slave), isn't it?

The AM35x driver should use the in-kernel MC and V4L2 subdev APIs, but it doesn't have to expose them to userspace.

I don't agree. If AM35x doesn't expose the MC API to userspace, CONFIG_MEDIA_CONTROLLER should not be required at all.

Also, according with the Linux best practices, when #if tests for config symbols are required, developers should put it into the header files, and not inside the code, as it helps to improve code readability. From

Documentation/SubmittingPatches:
2) #ifdefs are ugly

Quoted 6 lines

Code cluttered with ifdefs is difficult to read and maintain. Don't do it. Instead, put your ifdefs in a header, and conditionally define 'static inline' functions, or macros, which are used in the code. Let the compiler optimize away the "no-op" case.

So, this patch is perfectly fine on my eyes.

I'm sorry, but I don't agree.

Quoted 7 lines

Regarding the V4L2 subdev pad-level API, the goal is to convert all host and subdev drivers to it, so that's definitely the way to go. This does *not* mean that subdevs must expose a subdev device node. That's entirely optional. What I'm talking about is switching from video::*_mbus_fmt operations to pad::*_fmt operations. The pad-level format operations are very similar to video-level format operations, and more generic. Drivers shouldn't implement both.

I agree that implementing two ways for doing the same thing is a bad idea, but especially since your idea is to convert all subdevs to it, this type of conversion should not require enabling CONFIG_MEDIA_CONTROLLER, as this feature is used to enable the MC userspace API.

Quoted 4 lines

Regarding the MC API, drivers are not required to register a media_device instance. I have no issue with that. However, drivers should initialized the subdev's embedded media_entity, as that's required by subdev pad-level operations to get the number of pads for a subdev.

There are two solutions:

1) add some "fallback" method at the core to use the video::*_mbus_fmt way, when MC is disabled;

Quoted 6 lines

2) split the config options into two: one configurable by the user to enable the userspace MC API, and another, used internally that would select the MC internal API when drivers need it.

As your plan is to convert all drivers to the new way, (2) doesn't make much sense in long term, as, at the end, all drivers will be selecting it.

But (1) makes even less sense :-) The issue here is that MC-enabled drivers will use pad-level subdev operations, so those operations need to be implemented in subdev drivers used by MC-enabled hosts/bridges. I don't like the idea of having two sets of similar operations in subdevs, as that will result in duplicate code. We should thus implement only pad-level subdev operations for MC-aware subdevs (a wrapper method can be implemented in the code to convert video operations to subdev operations transparently for non MC-aware hosts/bridges). This requires media_entity_init() and media_entity_cleanup() being available to those subdev drivers regardless of whether the host/bridge exposes the MC API to userspace.

I don't mind splitting the config option. An alternative would be to compile media_entity_init() and media_entity_cleanup() based on CONFIG_MEDIA_SUPPORT instead of CONFIG_MEDIA_CONTROLLER, but that looks a bit hackish to me.

Quoted 7 lines

Also, I don't like the idea of increasing drivers complexity for the existing drivers that work properly without MC. All those core conversions that were done in the last two years caused already too much instability to them.

We should really avoid touching on them again for something that won't be adding any new feature nor fixing any known bug.

We don't have to convert them all in one go right now, we can implement pad- level operations support selectively when a subdev driver becomes used by an MC-enabled host/bridge driver.

Quoted 1 line
Quoted 1 line

This will result in no modification to the userspace.

Signature · 3 lines
Regards,

Laurent Pinchart
#13 lore raw
Quoted 35 lines

-----Original Message-----
From: Laurent Pinchart [mailto:[email protected]]
Sent: Monday, September 05, 2011 6:20 PM
To: Mauro Carvalho Chehab
Cc: Hiremath, Vaibhav; Ravi, Deepthy; [email protected]; linux- [email protected]; [email protected]
Subject: Re: [PATCHv2] ISP:BUILD:FIX: Move media_entity_init() and

Hi Mauro,

Quoted 23 lines · On Sunday 04 September 2011 15:32:28 Mauro Carvalho Chehab wrote:

Em 04-09-2011 06:01, Laurent Pinchart escreveu:

Quoted 22 lines · On Sunday 04 September 2011 00:21:38 Mauro Carvalho Chehab wrote:
Quoted 21 lines

Em 24-08-2011 10:25, Laurent Pinchart escreveu:

Quoted 20 lines · Vaibhav
Quoted 19 lines · Laurent Pinchart
Quoted 18 lines · Deepthy
Quoted 17 lines · Laurent Pinchart
Quoted 16 lines · On Friday 19 August 2011 15:48:45 Deepthy Ravi wrote:
Quoted 15 lines

From: Vaibhav Hiremath <[email protected]>

Fix the build break caused when CONFIG_MEDIA_CONTROLLER option is disabled and if any sensor driver has to be used between MC and non MC framework compatible devices.

For example,if tvp514x video decoder driver migrated to MC framework is being built without CONFIG_MEDIA_CONTROLLER option enabled, the following error messages will result. drivers/built-in.o: In function `tvp514x_remove':
drivers/media/video/tvp514x.c:1285: undefined reference to `media_entity_cleanup'
drivers/built-in.o: In function `tvp514x_probe':
drivers/media/video/tvp514x.c:1237: undefined reference to `media_entity_init'

<snip>

Quoted 13 lines

I don't mind splitting the config option. An alternative would be to compile
media_entity_init() and media_entity_cleanup() based on CONFIG_MEDIA_SUPPORT
instead of CONFIG_MEDIA_CONTROLLER, but that looks a bit hackish to me.

Quoted 2 lines

Also, I don't like the idea of increasing drivers complexity for the existing drivers that work properly without MC. All those core

conversions

Quoted 4 lines

that were done in the last two years caused already too much instability to them.

We should really avoid touching on them again for something that won't

Quoted 9 lines

be

Quoted 1 line

adding any new feature nor fixing any known bug.

We don't have to convert them all in one go right now, we can implement pad-
level operations support selectively when a subdev driver becomes used by an
MC-enabled host/bridge driver.

[Hiremath, Vaibhav] I completely agree that we should not be duplicating the code just for sake of it.

Isn't the wrapper approach seems feasible here?

Thanks,
Vaibhav

Quoted 6 lines
Quoted 1 line
Quoted 1 line

This will result in no modification to the userspace.

--
Regards,

Laurent Pinchart

maintainer
#14 lore raw

Hi Vaibhav,

Quoted 18 lines · Vaibhav
Quoted 1 line · Laurent Pinchart

On Sunday 04 September 2011 15:32:28 Mauro Carvalho Chehab wrote:

<snip>

Quoted 13 lines

I don't mind splitting the config option. An alternative would be to compile media_entity_init() and media_entity_cleanup() based on CONFIG_MEDIA_SUPPORT instead of CONFIG_MEDIA_CONTROLLER, but that looks a bit hackish to me.

Quoted 7 lines

Also, I don't like the idea of increasing drivers complexity for the existing drivers that work properly without MC. All those core conversions that were done in the last two years caused already too much instability to them.

We should really avoid touching on them again for something that won't be adding any new feature nor fixing any known bug.

Quoted 8 lines
Quoted 3 lines

We don't have to convert them all in one go right now, we can implement pad-level operations support selectively when a subdev driver becomes used by an MC-enabled host/bridge driver.

I completely agree that we should not be duplicating the code just for sake of it.

Isn't the wrapper approach seems feasible here?

As explained in a previous e-mail, a wrapper sounds like a good approach to me, to emulate video::* operations based on pad::* operations. We want to move to pad::* operations, so we should not perform emulation the other way around.

Signature · 3 lines
Regards,

Laurent Pinchart
#15 lore raw

Em 06-09-2011 11:47, Laurent Pinchart escreveu:

Quoted 25 lines

Hi Vaibhav,

Quoted 22 lines · Vaibhav
Quoted 1 line · Laurent Pinchart

On Sunday 04 September 2011 15:32:28 Mauro Carvalho Chehab wrote:

<snip>

Quoted 16 lines

I don't mind splitting the config option. An alternative would be to compile media_entity_init() and media_entity_cleanup() based on CONFIG_MEDIA_SUPPORT instead of CONFIG_MEDIA_CONTROLLER, but that looks a bit hackish to me.

Quoted 7 lines

Also, I don't like the idea of increasing drivers complexity for the existing drivers that work properly without MC. All those core conversions that were done in the last two years caused already too much instability to them.

We should really avoid touching on them again for something that won't be adding any new feature nor fixing any known bug.

We don't have to convert them all in one go right now, we can implement pad-level operations support selectively when a subdev driver becomes used by an MC-enabled host/bridge driver.

Quoted 8 lines
Quoted 4 lines

I completely agree that we should not be duplicating the code just for sake of it.

Isn't the wrapper approach seems feasible here?

As explained in a previous e-mail, a wrapper sounds like a good approach to me, to emulate video::* operations based on pad::* operations. We want to move to pad::* operations, so we should not perform emulation the other way around.

We have 300+ drivers under /drivers/media. Just a few of them need MC API.

Good sense says that we shouldn't touch on 300+ just because of half dozen drivers.

So, if a wrapper is needed, it should be done for the other side.

Mauro.