Skip to contentSkip to conversation

Make all drivers under drivers/media to build with COMPILE_TEST

PATCH Superseded Mauro Carvalho Chehab 6 participants 40 messages Apr 5, 2018 – Apr 17, 2018

Subsystems (5)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover Make all drivers under drivers/media to build with COMPILE_TEST

The current media policy has been for a while to only accept new drivers that compile with COMPILE_TEST.

However, there are still several drivers under drivers/media that doesn't build with COMPILE_TEST.

So, this series makes the existing ones also compatible with it.

Not building with COMPILE_TEST is a bad thing, for several reasons.

The main ones is that:

1) the licence the Kernel community has for Coverity only builds for x86. So, drivers that don't build on such archtecture were likely never tested by it.

2) That affects my per-patch handling process, with should be quick enough to not delay my patch handling process. So, I only build for one architecture (i386).

3) When appliying a patch, I always run two static code analyzers (W=1, smatch and sparse). Those drivers weren't checked by me. At the end of the day, that leads to a lower quality check for the drivers that don't build on i386.

There are two situations on this patch series that proof the lower quality of those drivers:

- There is a case of a driver that was added broken in 2013. Only two years later, someone noticed and "fixed" it by markin it as BROKEN!

- 5 patches in this series (about 1/3) are just to fix build issues on those drivers, most of them due to gcc warnings.

Mauro Carvalho Chehab (16):
omap: omap-iommu.h: allow building drivers with COMPILE_TEST
media: omap3isp: allow it to build with COMPILE_TEST
media: omap3isp/isp: remove an unused static var
media: fsl-viu: mark static functions as such
media: fsl-viu: allow building it with COMPILE_TEST
media: cec_gpio: allow building CEC_GPIO with COMPILE_TEST
media: exymos4-is: allow compile test for EXYNOS FIMC-LITE
media: mmp-camera.h: add missing platform data
media: marvel-ccic: re-enable mmp-driver build
media: mmp-driver: make two functions static
media: davinci: allow building isif code
media: davinci: allow build vpbe_display with COMPILE_TEST
media: vpbe_venc: don't store return codes if they won't be used
media: davinci: get rid of lots of kernel-doc warnings
media: omapfb_dss.h: add stubs to build with COMPILE_TEST
media: omap: allow building it with COMPILE_TEST

 drivers/media/platform/Kconfig                   | 12 +++---
 drivers/media/platform/davinci/Kconfig           |  6 ++-
 drivers/media/platform/davinci/isif.c            |  2 -
 drivers/media/platform/davinci/vpbe.c            | 38 +++++++++--------
 drivers/media/platform/davinci/vpbe_display.c    | 21 +++++----
 drivers/media/platform/davinci/vpbe_osd.c        | 16 ++++---
 drivers/media/platform/davinci/vpbe_venc.c       |  9 ++--
 drivers/media/platform/exynos4-is/Kconfig        |  4 +-
 drivers/media/platform/fsl-viu.c                 | 20 ++++++---
 drivers/media/platform/marvell-ccic/Kconfig      |  5 ++-
 drivers/media/platform/marvell-ccic/mmp-driver.c |  4 +-
 drivers/media/platform/omap/Kconfig              |  6 +--
 drivers/media/platform/omap3isp/isp.c            | 14 +++---
 include/linux/omap-iommu.h                       |  5 +++
 include/linux/platform_data/media/mmp-camera.h   | 19 +++++++++
 include/video/omapfb_dss.h                       | 54 +++++++++++++++++++++++-
 16 files changed, 162 insertions(+), 73 deletions(-)
Signature · 1 line
2.14.3
#1 lore raw

PATCH 1/16 omap: omap-iommu.h: allow building drivers with COMPILE_TEST

Drivers that depend on omap-iommu.h (currently, just omap3isp) need a stub implementation in order to be built with COMPILE_TEST.

---
 include/linux/omap-iommu.h | 5 +++++
 1 file changed, 5 insertions(+)
include/linux/omap-iommu.h +5 -0
index c1aede46718b..0c21fc5b002e 100644
@@ -13,7 +13,12 @@
 #ifndef _OMAP_IOMMU_H_
 #define _OMAP_IOMMU_H_
 
+#ifdef CONFIG_OMAP_IOMMU
 extern void omap_iommu_save_ctx(struct device *dev);
 extern void omap_iommu_restore_ctx(struct device *dev);
+#else
+static inline void omap_iommu_save_ctx(struct device *dev) {};
+static inline void omap_iommu_restore_ctx(struct device *dev) {};
+#endif
 
 #endif
Signature · 1 line
2.14.3
#2 lore raw

Re: [PATCH 01/16] omap: omap-iommu.h: allow building drivers with COMPILE_TEST

Am 05.04.2018 um 19:54 schrieb Mauro Carvalho Chehab:

Quoted 13 lines

Drivers that depend on omap-iommu.h (currently, just omap3isp) need a stub implementation in order to be built with COMPILE_TEST.

---
 include/linux/omap-iommu.h | 5 +++++
 1 file changed, 5 insertions(+)
include/linux/omap-iommu.h +0 -0
index c1aede46718b..0c21fc5b002e 100644

include/linux/omap-iommu.h line 21

Quoted 9 lines
include/linux/omap-iommu.h +4 -0
@@ -13,7 +13,12 @@
 #ifndef _OMAP_IOMMU_H_
 #define _OMAP_IOMMU_H_
 
+#ifdef CONFIG_OMAP_IOMMU
 extern void omap_iommu_save_ctx(struct device *dev);
 extern void omap_iommu_restore_ctx(struct device *dev);
+#else
+static inline void omap_iommu_save_ctx(struct device *dev) {};
+static inline void omap_iommu_restore_ctx(struct device *dev) {};

The semicolons at end of line are unnecessary.

include/linux/omap-iommu.h line 24

Quoted 4 lines
include/linux/omap-iommu.h +1 -0
+#endif
 
 #endif

Regards
Matthias

#3 lore raw

Re: [PATCH 01/16] omap: omap-iommu.h: allow building drivers with COMPILE_TEST

Em Sun, 8 Apr 2018 12:12:17 +0200
Matthias Schwarzott <[email protected]> escreveu:

Quoted 17 lines

Am 05.04.2018 um 19:54 schrieb Mauro Carvalho Chehab:

Quoted 16 lines

Drivers that depend on omap-iommu.h (currently, just omap3isp) need a stub implementation in order to be built with COMPILE_TEST.

---
 include/linux/omap-iommu.h | 5 +++++
 1 file changed, 5 insertions(+)
include/linux/omap-iommu.h +0 -0
index c1aede46718b..0c21fc5b002e 100644
@@ -13,7 +13,12 @@
 #ifndef _OMAP_IOMMU_H_
 #define _OMAP_IOMMU_H_
 
Quoted 13 lines

include/linux/omap-iommu.h line 21

Quoted 6 lines
include/linux/omap-iommu.h +4 -0
+#ifdef CONFIG_OMAP_IOMMU
 extern void omap_iommu_save_ctx(struct device *dev);
 extern void omap_iommu_restore_ctx(struct device *dev);
+#else
+static inline void omap_iommu_save_ctx(struct device *dev) {};
+static inline void omap_iommu_restore_ctx(struct device *dev) {};  

The semicolons at end of line are unnecessary.

Quoted 4 lines
include/linux/omap-iommu.h +1 -0
+#endif
 
 #endif

Hi Matthias,

Somehow, I missed your comment.

New version enclosed.

Thanks,
Mauro

[PATCH v3] omap: omap-iommu.h: allow building drivers with COMPILE_TEST

Drivers that depend on omap-iommu.h (currently, just omap3isp) need a stub implementation in order to be built with COMPILE_TEST.

---
 include/linux/omap-iommu.h | 5 +++++
 1 file changed, 5 insertions(+)
include/linux/omap-iommu.h +5 -0
index c1aede46718b..0c21fc5b002e 100644
@@ -13,7 +13,12 @@
 #ifndef _OMAP_IOMMU_H_
 #define _OMAP_IOMMU_H_
 
+#ifdef CONFIG_OMAP_IOMMU
 extern void omap_iommu_save_ctx(struct device *dev);
 extern void omap_iommu_restore_ctx(struct device *dev);
+#else
+static inline void omap_iommu_save_ctx(struct device *dev) {} 
+static inline void omap_iommu_restore_ctx(struct device *dev) {} 
+#endif
 
 #endif
#4 lore raw

PATCH 2/16 media: omap3isp: allow it to build with COMPILE_TEST

In reply to Mauro Carvalho Chehab

There aren't much things required for it to build with COMPILE_TEST. It just needs to provide stub for an arm-dependent include.

Let's replicate the same solution used by ipmmu-vmsa, in order to allow building omap3 with COMPILE_TEST.

The actual logic here came from this driver:

drivers/iommu/ipmmu-vmsa.c

---
 drivers/media/platform/Kconfig        | 8 ++++----
 drivers/media/platform/omap3isp/isp.c | 7 +++++++
 2 files changed, 11 insertions(+), 4 deletions(-)
drivers/media/platform/Kconfig +4 -4
index c7a1cf8a1b01..03c9dfeb7781 100644
@@ -62,12 +62,12 @@ config VIDEO_MUX
 
 config VIDEO_OMAP3
 	tristate "OMAP 3 Camera support"
-	depends on VIDEO_V4L2 && I2C && VIDEO_V4L2_SUBDEV_API && ARCH_OMAP3
+	depends on VIDEO_V4L2 && I2C && VIDEO_V4L2_SUBDEV_API
 	depends on HAS_DMA && OF
-	depends on OMAP_IOMMU
-	select ARM_DMA_USE_IOMMU
+	depends on ((ARCH_OMAP3 && OMAP_IOMMU) || COMPILE_TEST)
+	select ARM_DMA_USE_IOMMU if OMAP_IOMMU
 	select VIDEOBUF2_DMA_CONTIG
-	select MFD_SYSCON
+	select MFD_SYSCON if ARCH_OMAP3
 	select V4L2_FWNODE
 	---help---
 	  Driver for an OMAP 3 camera controller.
drivers/media/platform/omap3isp/isp.c +7 -0
index 8eb000e3d8fd..2a11a709aa4f 100644
@@ -61,7 +61,14 @@
 #include <linux/sched.h>
 #include <linux/vmalloc.h>
 
+#if defined(CONFIG_ARM) && !defined(CONFIG_IOMMU_DMA)
 #include <asm/dma-iommu.h>
+#else
+#define arm_iommu_create_mapping(...)	NULL
+#define arm_iommu_attach_device(...)	-ENODEV
+#define arm_iommu_release_mapping(...)	do {} while (0)
+#define arm_iommu_detach_device(...)	do {} while (0)
+#endif
 
 #include <media/v4l2-common.h>
 #include <media/v4l2-fwnode.h>
Signature · 1 line
2.14.3
#5 lore raw

Re: [PATCH 02/16] media: omap3isp: allow it to build with COMPILE_TEST

Hi Mauro,

Thank you for the patch.

Quoted 44 lines · On Thursday, 5 April 2018 20:54:02 EEST Mauro Carvalho Chehab wrote:

There aren't much things required for it to build with COMPILE_TEST. It just needs to provide stub for an arm-dependent include.

Let's replicate the same solution used by ipmmu-vmsa, in order to allow building omap3 with COMPILE_TEST.

The actual logic here came from this driver:

drivers/iommu/ipmmu-vmsa.c

---
 drivers/media/platform/Kconfig        | 8 ++++----
 drivers/media/platform/omap3isp/isp.c | 7 +++++++
 2 files changed, 11 insertions(+), 4 deletions(-)
drivers/media/platform/Kconfig +4 -4
index c7a1cf8a1b01..03c9dfeb7781 100644
@@ -62,12 +62,12 @@ config VIDEO_MUX
 
 config VIDEO_OMAP3
 	tristate "OMAP 3 Camera support"
-	depends on VIDEO_V4L2 && I2C && VIDEO_V4L2_SUBDEV_API && ARCH_OMAP3
+	depends on VIDEO_V4L2 && I2C && VIDEO_V4L2_SUBDEV_API
 	depends on HAS_DMA && OF
-	depends on OMAP_IOMMU
-	select ARM_DMA_USE_IOMMU
+	depends on ((ARCH_OMAP3 && OMAP_IOMMU) || COMPILE_TEST)
+	select ARM_DMA_USE_IOMMU if OMAP_IOMMU
 	select VIDEOBUF2_DMA_CONTIG
-	select MFD_SYSCON
+	select MFD_SYSCON if ARCH_OMAP3
 	select V4L2_FWNODE
 	---help---
 	  Driver for an OMAP 3 camera controller.
(quoted diff) +0 -0

b/drivers/media/platform/omap3isp/isp.c index 8eb000e3d8fd..2a11a709aa4f 100644

drivers/media/platform/omap3isp/isp.c +0 -0
@@ -61,7 +61,14 @@
 #include <linux/sched.h>

drivers/media/platform/omap3isp/isp.c line 71

Quoted 10 lines
drivers/media/platform/omap3isp/isp.c +7 -0
 #include <linux/vmalloc.h>
 
+#if defined(CONFIG_ARM) && !defined(CONFIG_IOMMU_DMA)
 #include <asm/dma-iommu.h>
+#else
+#define arm_iommu_create_mapping(...)	NULL
+#define arm_iommu_attach_device(...)	-ENODEV
+#define arm_iommu_release_mapping(...)	do {} while (0)
+#define arm_iommu_detach_device(...)	do {} while (0)
+#endif

I don't think it's the job of a driver to define those stubs, sorry. Otherwise where do you stop ? If you have half of the code that is architecture- dependent, would you stub it ? And what if the stubs you define here generate warnings in static analyzers ?

If you want to make drivers compile for all architectures, the APIs they use must be defined in linux/, not in asm/. They can be stubbed there when not implemented in a particular architecture, but not in the driver.

Quoted 2 lines
drivers/media/platform/omap3isp/isp.c +0 -0
 #include <media/v4l2-common.h>
 #include <media/v4l2-fwnode.h>
Signature · 3 lines
Regards,

Laurent Pinchart
#6 lore raw

Re: [PATCH 02/16] media: omap3isp: allow it to build with COMPILE_TEST

Em Thu, 05 Apr 2018 21:30:27 +0300
Laurent Pinchart <[email protected]> escreveu:

Quoted 51 lines

Hi Mauro,

Thank you for the patch.

Quoted 46 lines · On Thursday, 5 April 2018 20:54:02 EEST Mauro Carvalho Chehab wrote:

There aren't much things required for it to build with COMPILE_TEST. It just needs to provide stub for an arm-dependent include.

Let's replicate the same solution used by ipmmu-vmsa, in order to allow building omap3 with COMPILE_TEST.

The actual logic here came from this driver:

drivers/iommu/ipmmu-vmsa.c

---
 drivers/media/platform/Kconfig        | 8 ++++----
 drivers/media/platform/omap3isp/isp.c | 7 +++++++
 2 files changed, 11 insertions(+), 4 deletions(-)
drivers/media/platform/Kconfig +4 -4
index c7a1cf8a1b01..03c9dfeb7781 100644
@@ -62,12 +62,12 @@ config VIDEO_MUX
 
 config VIDEO_OMAP3
 	tristate "OMAP 3 Camera support"
-	depends on VIDEO_V4L2 && I2C && VIDEO_V4L2_SUBDEV_API && ARCH_OMAP3
+	depends on VIDEO_V4L2 && I2C && VIDEO_V4L2_SUBDEV_API
 	depends on HAS_DMA && OF
-	depends on OMAP_IOMMU
-	select ARM_DMA_USE_IOMMU
+	depends on ((ARCH_OMAP3 && OMAP_IOMMU) || COMPILE_TEST)
+	select ARM_DMA_USE_IOMMU if OMAP_IOMMU
 	select VIDEOBUF2_DMA_CONTIG
-	select MFD_SYSCON
+	select MFD_SYSCON if ARCH_OMAP3
 	select V4L2_FWNODE
 	---help---
 	  Driver for an OMAP 3 camera controller.
(quoted diff) +0 -0

b/drivers/media/platform/omap3isp/isp.c index 8eb000e3d8fd..2a11a709aa4f 100644

drivers/media/platform/omap3isp/isp.c +0 -0
@@ -61,7 +61,14 @@
 #include <linux/sched.h>
 #include <linux/vmalloc.h>
 
Quoted 13 lines

drivers/media/platform/omap3isp/isp.c line 71

Quoted 8 lines
drivers/media/platform/omap3isp/isp.c +7 -0
+#if defined(CONFIG_ARM) && !defined(CONFIG_IOMMU_DMA)
 #include <asm/dma-iommu.h>
+#else
+#define arm_iommu_create_mapping(...)	NULL
+#define arm_iommu_attach_device(...)	-ENODEV
+#define arm_iommu_release_mapping(...)	do {} while (0)
+#define arm_iommu_detach_device(...)	do {} while (0)
+#endif  

I don't think it's the job of a driver to define those stubs, sorry. Otherwise where do you stop ? If you have half of the code that is architecture- dependent, would you stub it ? And what if the stubs you define here generate warnings in static analyzers ?

I agree that we should avoid doing that as a general case, but see below.

Quoted 3 lines

If you want to make drivers compile for all architectures, the APIs they use must be defined in linux/, not in asm/. They can be stubbed there when not implemented in a particular architecture, but not in the driver.

In this specific case, the same approach taken here is already needed by the Renesas VMSA-compatible IPMMU driver, with, btw, is inside drivers/iommu:

drivers/iommu/ipmmu-vmsa.c

Also, this API is used only by 3 drivers [1]:

drivers/iommu/ipmmu-vmsa.c
drivers/iommu/mtk_iommu_v1.c
drivers/media/platform/omap3isp/isp.c

[1] as blamed by
git grep -l arm_iommu_create_mapping

That hardly seems to be an arch-specific iommu solution, but, instead, some hack used by only three drivers or some legacy iommu binding.

The omap3isp is, btw, the only driver outside drivers/iommu that needs it.

So, it sounds that other driver uses some other approach, but hardly it would be worth to change this driver to use something else.

So, better to stick with the same solution the Renesas driver used.

Thanks,
Mauro

#7 lore raw

Re: [PATCH 02/16] media: omap3isp: allow it to build with COMPILE_TEST

Hi Mauro,

Quoted 70 lines · On Thursday, 5 April 2018 22:44:44 EEST Mauro Carvalho Chehab wrote:

Em Thu, 05 Apr 2018 21:30:27 +0300 Laurent Pinchart escreveu:

Quoted 48 lines · On Thursday, 5 April 2018 20:54:02 EEST Mauro Carvalho Chehab wrote:
Quoted 47 lines

There aren't much things required for it to build with COMPILE_TEST. It just needs to provide stub for an arm-dependent include.

Let's replicate the same solution used by ipmmu-vmsa, in order to allow building omap3 with COMPILE_TEST.

The actual logic here came from this driver:
drivers/iommu/ipmmu-vmsa.c

---

 drivers/media/platform/Kconfig        | 8 ++++----
 drivers/media/platform/omap3isp/isp.c | 7 +++++++
 2 files changed, 11 insertions(+), 4 deletions(-)
(quoted diff) +0 -0

b/drivers/media/platform/Kconfig index c7a1cf8a1b01..03c9dfeb7781 100644

drivers/media/platform/Kconfig +4 -4
@@ -62,12 +62,12 @@ config VIDEO_MUX
 
 config VIDEO_OMAP3
 	tristate "OMAP 3 Camera support"
-	depends on VIDEO_V4L2 && I2C && VIDEO_V4L2_SUBDEV_API && ARCH_OMAP3
+	depends on VIDEO_V4L2 && I2C && VIDEO_V4L2_SUBDEV_API
 	depends on HAS_DMA && OF
-	depends on OMAP_IOMMU
-	select ARM_DMA_USE_IOMMU
+	depends on ((ARCH_OMAP3 && OMAP_IOMMU) || COMPILE_TEST)
+	select ARM_DMA_USE_IOMMU if OMAP_IOMMU
 	select VIDEOBUF2_DMA_CONTIG
-	select MFD_SYSCON
+	select MFD_SYSCON if ARCH_OMAP3
 	select V4L2_FWNODE
 	---help---
 	  Driver for an OMAP 3 camera controller.
(quoted diff) +0 -0

b/drivers/media/platform/omap3isp/isp.c index 8eb000e3d8fd..2a11a709aa4f 100644

drivers/media/platform/omap3isp/isp.c +0 -0
@@ -61,7 +61,14 @@
 #include <linux/sched.h>
 #include <linux/vmalloc.h>
 
Quoted 13 lines

drivers/media/platform/omap3isp/isp.c line 71

Quoted 8 lines
drivers/media/platform/omap3isp/isp.c +7 -0
+#if defined(CONFIG_ARM) && !defined(CONFIG_IOMMU_DMA)
 #include <asm/dma-iommu.h>
+#else
+#define arm_iommu_create_mapping(...)	NULL
+#define arm_iommu_attach_device(...)	-ENODEV
+#define arm_iommu_release_mapping(...)	do {} while (0)
+#define arm_iommu_detach_device(...)	do {} while (0)
+#endif

I don't think it's the job of a driver to define those stubs, sorry. Otherwise where do you stop ? If you have half of the code that is architecture- dependent, would you stub it ? And what if the stubs you define here generate warnings in static analyzers ?

I agree that we should avoid doing that as a general case, but see below.

Quoted 3 lines

If you want to make drivers compile for all architectures, the APIs they use must be defined in linux/, not in asm/. They can be stubbed there when not implemented in a particular architecture, but not in the driver.

Quoted 5 lines

In this specific case, the same approach taken here is already needed by the Renesas VMSA-compatible IPMMU driver, with, btw, is inside drivers/iommu:

drivers/iommu/ipmmu-vmsa.c

The reason there is different, the driver is shared by ARM32 and ARM64 platforms. Furthermore, there's an effort (or at least there was) to move away from those APIs in the driver, but I think it has stalled.

Quoted 8 lines

Also, this API is used only by 3 drivers [1]:

drivers/iommu/ipmmu-vmsa.c
drivers/iommu/mtk_iommu_v1.c
drivers/media/platform/omap3isp/isp.c

[1] as blamed by
git grep -l arm_iommu_create_mapping

The exynos driver also uses it.

Quoted 2 lines

That hardly seems to be an arch-specific iommu solution, but, instead, some hack used by only three drivers or some legacy iommu binding.

It's more complex than that. There are multiple IOMMU-related APIs on ARM, so more recent than others, with different feature sets. While I agree that drivers should move away from arm_iommu_create_mapping(), doing so requires coordination between the IOMMU driver and the bus master driver (for instance the omap3isp driver). It's not a trivial matter, but I'd love if someone submitted patches :-)

Quoted 6 lines

The omap3isp is, btw, the only driver outside drivers/iommu that needs it.

So, it sounds that other driver uses some other approach, but hardly it would be worth to change this driver to use something else.

So, better to stick with the same solution the Renesas driver used.

I'm not responsible for that solution and I didn't think it was a good one at the time it was introduced, but in any case it is not meant at all to support COMPILE_TEST. I still don't think the omap3isp driver should declare stubs for these functions for the purpose of supporting compile-testing on x86.

Signature · 3 lines
Regards,

Laurent Pinchart
#8 lore raw

Re: [PATCH 02/16] media: omap3isp: allow it to build with COMPILE_TEST

Em Sat, 07 Apr 2018 14:56:59 +0300
Laurent Pinchart <[email protected]> escreveu:

Quoted 77 lines

Hi Mauro,

Quoted 74 lines · On Thursday, 5 April 2018 22:44:44 EEST Mauro Carvalho Chehab wrote:

Em Thu, 05 Apr 2018 21:30:27 +0300 Laurent Pinchart escreveu:

Quoted 48 lines · On Thursday, 5 April 2018 20:54:02 EEST Mauro Carvalho Chehab wrote:
Quoted 47 lines

There aren't much things required for it to build with COMPILE_TEST. It just needs to provide stub for an arm-dependent include.

Let's replicate the same solution used by ipmmu-vmsa, in order to allow building omap3 with COMPILE_TEST.

The actual logic here came from this driver:
drivers/iommu/ipmmu-vmsa.c

---

 drivers/media/platform/Kconfig        | 8 ++++----
 drivers/media/platform/omap3isp/isp.c | 7 +++++++
 2 files changed, 11 insertions(+), 4 deletions(-)
(quoted diff) +0 -0

b/drivers/media/platform/Kconfig index c7a1cf8a1b01..03c9dfeb7781 100644

drivers/media/platform/Kconfig +4 -4
@@ -62,12 +62,12 @@ config VIDEO_MUX
 
 config VIDEO_OMAP3
 	tristate "OMAP 3 Camera support"
-	depends on VIDEO_V4L2 && I2C && VIDEO_V4L2_SUBDEV_API && ARCH_OMAP3
+	depends on VIDEO_V4L2 && I2C && VIDEO_V4L2_SUBDEV_API
 	depends on HAS_DMA && OF
-	depends on OMAP_IOMMU
-	select ARM_DMA_USE_IOMMU
+	depends on ((ARCH_OMAP3 && OMAP_IOMMU) || COMPILE_TEST)
+	select ARM_DMA_USE_IOMMU if OMAP_IOMMU
 	select VIDEOBUF2_DMA_CONTIG
-	select MFD_SYSCON
+	select MFD_SYSCON if ARCH_OMAP3
 	select V4L2_FWNODE
 	---help---
 	  Driver for an OMAP 3 camera controller.
(quoted diff) +0 -0

b/drivers/media/platform/omap3isp/isp.c index 8eb000e3d8fd..2a11a709aa4f 100644

drivers/media/platform/omap3isp/isp.c +0 -0
@@ -61,7 +61,14 @@
 #include <linux/sched.h>
 #include <linux/vmalloc.h>
 
Quoted 13 lines

drivers/media/platform/omap3isp/isp.c line 71

Quoted 8 lines
drivers/media/platform/omap3isp/isp.c +7 -0
+#if defined(CONFIG_ARM) && !defined(CONFIG_IOMMU_DMA)
 #include <asm/dma-iommu.h>
+#else
+#define arm_iommu_create_mapping(...)	NULL
+#define arm_iommu_attach_device(...)	-ENODEV
+#define arm_iommu_release_mapping(...)	do {} while (0)
+#define arm_iommu_detach_device(...)	do {} while (0)
+#endif  

I don't think it's the job of a driver to define those stubs, sorry. Otherwise where do you stop ? If you have half of the code that is architecture- dependent, would you stub it ? And what if the stubs you define here generate warnings in static analyzers ?

I agree that we should avoid doing that as a general case, but see below.

Quoted 3 lines

If you want to make drivers compile for all architectures, the APIs they use must be defined in linux/, not in asm/. They can be stubbed there when not implemented in a particular architecture, but not in the driver.

In this specific case, the same approach taken here is already needed by the Renesas VMSA-compatible IPMMU driver, with, btw, is inside drivers/iommu:

Quoted 5 lines
Quoted 1 line

drivers/iommu/ipmmu-vmsa.c

The reason there is different, the driver is shared by ARM32 and ARM64 platforms. Furthermore, there's an effort (or at least there was) to move away from those APIs in the driver, but I think it has stalled.

Anyway, the approach sticks at the driver. As this was accepted even inside drivers/iommu, I fail to see why not doing the same on media, specially since it really helps us to find bugs at omap3isp driver.

Even without pushing upstream (where Coverity would analyze it), we got lots of problems by simply letting omap3isp to use the usual tools we use for all other drivers.

Quoted 14 lines
Quoted 8 lines

Also, this API is used only by 3 drivers [1]:

drivers/iommu/ipmmu-vmsa.c
drivers/iommu/mtk_iommu_v1.c
drivers/media/platform/omap3isp/isp.c

[1] as blamed by
git grep -l arm_iommu_create_mapping

The exynos driver also uses it.

Quoted 2 lines

That hardly seems to be an arch-specific iommu solution, but, instead, some hack used by only three drivers or some legacy iommu binding.

Quoted 6 lines

It's more complex than that. There are multiple IOMMU-related APIs on ARM, so more recent than others, with different feature sets. While I agree that drivers should move away from arm_iommu_create_mapping(), doing so requires coordination between the IOMMU driver and the bus master driver (for instance the omap3isp driver). It's not a trivial matter, but I'd love if someone submitted patches :-)

If someone steps up to do that, it would be really helpful, but we should not trust that this will happen. OMAP3 is an old hardware, and not many developers are working on improving its support.

Quoted 11 lines
Quoted 6 lines

The omap3isp is, btw, the only driver outside drivers/iommu that needs it.

So, it sounds that other driver uses some other approach, but hardly it would be worth to change this driver to use something else.

So, better to stick with the same solution the Renesas driver used.

I'm not responsible for that solution and I didn't think it was a good one at the time it was introduced, but in any case it is not meant at all to support COMPILE_TEST. I still don't think the omap3isp driver should declare stubs for these functions for the purpose of supporting compile-testing on x86.

Well, there is another alternative. We could do add this to its Makefile:

ifndef CONFIG_ARCH_ARM
ccflags-y += -I./arch/arm/include/
endif

And add those stubs to arch/arm/include/asm/dma-iommu.h, in order to be used when CONFIG_IOMMU_DMA isn't defined:

#define arm_iommu_create_mapping(...) NULL
#define arm_iommu_attach_device(...) -ENODEV
#define arm_iommu_release_mapping(...) do {} while (0)
#define arm_iommu_detach_device(...) do {} while (0)

If done right, such solution could also be used to remove the #ifdef inside drivers/iommu/ipmmu-vmsa.c.

Yet, I think that the approach I proposed before is better, but maybe arm maintainers may have a different opinion.

Arnd,

What do you think?

Thanks,
Mauro

omap3isp: another approach to enable COMPILE_TEST

arch/arm/include/asm/dma-iommu.h +8 -0
index 6821f1249300..68dadbee0016 100644
@@ -26,6 +26,7 @@ struct dma_iommu_mapping {
 	struct kref		kref;
 };
 
+#ifdef CONFIG_IOMMU_DMA
 struct dma_iommu_mapping *
 arm_iommu_create_mapping(struct bus_type *bus, dma_addr_t base, u64 size);
 
@@ -35,6 +36,13 @@ int arm_iommu_attach_device(struct device *dev,
 					struct dma_iommu_mapping *mapping);
 void arm_iommu_detach_device(struct device *dev);
 
+#else
+#define arm_iommu_create_mapping(...)	NULL
+#define arm_iommu_attach_device(...)	-ENODEV
+#define arm_iommu_release_mapping(...)	do {} while (0)
+#define arm_iommu_detach_device(...)	do {} while (0)
+#endif
+
 int arm_dma_supported(struct device *dev, u64 mask);
 
 #endif /* __KERNEL__ */
drivers/media/platform/Kconfig +4 -4
index 91b0c7324afb..e8d8bbc976af 100644
@@ -62,12 +62,12 @@ config VIDEO_MUX
 
 config VIDEO_OMAP3
 	tristate "OMAP 3 Camera support"
-	depends on VIDEO_V4L2 && I2C && VIDEO_V4L2_SUBDEV_API && ARCH_OMAP3
+	depends on VIDEO_V4L2 && I2C && VIDEO_V4L2_SUBDEV_API
 	depends on HAS_DMA && OF
-	depends on OMAP_IOMMU
-	select ARM_DMA_USE_IOMMU
+	depends on ((ARCH_OMAP3 && OMAP_IOMMU) || COMPILE_TEST)
+	select ARM_DMA_USE_IOMMU if OMAP_IOMMU
 	select VIDEOBUF2_DMA_CONTIG
-	select MFD_SYSCON
+	select MFD_SYSCON if ARCH_OMAP3
 	select V4L2_FWNODE
 	---help---
 	  Driver for an OMAP 3 camera controller.
drivers/media/platform/omap3isp/Makefile +4 -0
index 56e99b4f7d23..6874c4f53838 100644
@@ -10,3 +10,7 @@ omap3-isp-objs += \
 	ispstat.o isph3a_aewb.o isph3a_af.o isphist.o
 
 obj-$(CONFIG_VIDEO_OMAP3) += omap3-isp.o
+
+ifndef CONFIG_ARCH_ARM
+ccflags-y += -I./arch/arm/include/
+endif
#9 lore raw

Re: [PATCH 02/16] media: omap3isp: allow it to build with COMPILE_TEST

Quoted 48 lines · Mauro Carvalho Chehab

Em Sat, 07 Apr 2018 14:56:59 +0300
Laurent Pinchart <[email protected]> escreveu:

Quoted 11 lines · On Thursday, 5 April 2018 22:44:44 EEST Mauro Carvalho Chehab wrote:
Quoted 10 lines

Em Thu, 05 Apr 2018 21:30:27 +0300 Laurent Pinchart escreveu:

Quoted 3 lines

If you want to make drivers compile for all architectures, the APIs they use must be defined in linux/, not in asm/. They can be stubbed there when not implemented in a particular architecture, but not in the driver.

In this specific case, the same approach taken here is already needed by the Renesas VMSA-compatible IPMMU driver, with, btw, is inside drivers/iommu:

Quoted 5 lines
Quoted 1 line

drivers/iommu/ipmmu-vmsa.c

The reason there is different, the driver is shared by ARM32 and ARM64 platforms. Furthermore, there's an effort (or at least there was) to move away from those APIs in the driver, but I think it has stalled.

Anyway, the approach sticks at the driver. As this was accepted even inside drivers/iommu, I fail to see why not doing the same on media, specially since it really helps us to find bugs at omap3isp driver.

Even without pushing upstream (where Coverity would analyze it), we got lots of problems by simply letting omap3isp to use the usual tools we use for all other drivers.

Quoted 14 lines
Quoted 8 lines

Also, this API is used only by 3 drivers [1]:

drivers/iommu/ipmmu-vmsa.c
drivers/iommu/mtk_iommu_v1.c
drivers/media/platform/omap3isp/isp.c

[1] as blamed by
git grep -l arm_iommu_create_mapping

The exynos driver also uses it.

Quoted 2 lines

That hardly seems to be an arch-specific iommu solution, but, instead, some hack used by only three drivers or some legacy iommu binding.

Quoted 6 lines

It's more complex than that. There are multiple IOMMU-related APIs on ARM, so more recent than others, with different feature sets. While I agree that drivers should move away from arm_iommu_create_mapping(), doing so requires coordination between the IOMMU driver and the bus master driver (for instance the omap3isp driver). It's not a trivial matter, but I'd love if someone submitted patches :-)

Quoted 3 lines

If someone steps up to do that, it would be really helpful, but we should not trust that this will happen. OMAP3 is an old hardware, and not many developers are working on improving its support.

Considering its age, I still see a lot of changes on the arch/arm side of it, so I wouldn't give up the hope yet.

Quoted 29 lines
Quoted 11 lines
Quoted 6 lines

The omap3isp is, btw, the only driver outside drivers/iommu that needs it.

So, it sounds that other driver uses some other approach, but hardly it would be worth to change this driver to use something else.

So, better to stick with the same solution the Renesas driver used.

I'm not responsible for that solution and I didn't think it was a good one at the time it was introduced, but in any case it is not meant at all to support COMPILE_TEST. I still don't think the omap3isp driver should declare stubs for these functions for the purpose of supporting compile-testing on x86.

Well, there is another alternative. We could do add this to its Makefile:

ifndef CONFIG_ARCH_ARM
ccflags-y += -I./arch/arm/include/
endif

And add those stubs to arch/arm/include/asm/dma-iommu.h, in order to be used when CONFIG_IOMMU_DMA isn't defined:

#define arm_iommu_create_mapping(...)   NULL
#define arm_iommu_attach_device(...)    -ENODEV
#define arm_iommu_release_mapping(...)  do {} while (0)
#define arm_iommu_detach_device(...)    do {} while (0)

If done right, such solution could also be used to remove the #ifdef inside drivers/iommu/ipmmu-vmsa.c.

Quoted 6 lines

Yet, I think that the approach I proposed before is better, but maybe arm maintainers may have a different opinion.

Arnd,

What do you think?

I think including a foreign architecture header is worse than your earlier patch, I'd rather see a local hack in the driver.

I haven't tried it, but how about something simpler like what I have below.

Arnd

(in case it works and you want to pick it up with a proper changelog):

(quoted diff) +0 -0

b/drivers/media/platform/omap3isp/isp.c
index 8eb000e3d8fd..625f2e407929 100644

drivers/media/platform/omap3isp/isp.c +0 -0
@@ -1945,12 +1945,15 @@ static int isp_initialize_modules(struct

isp_device *isp)

static void isp_detach_iommu(struct isp_device *isp) {
+#ifdef CONFIG_ARM

        arm_iommu_release_mapping(isp->mapping);
        isp->mapping = NULL;

+#endif
}

static int isp_attach_iommu(struct isp_device *isp) {
+#ifdef CONFIG_ARM

        struct dma_iommu_mapping *mapping;
        int ret;

@@ -1979,6 +1982,9 @@ static int isp_attach_iommu(struct isp_device *isp)
error:

        isp_detach_iommu(isp);
        return ret;

+#else
+ return -ENODEV;
+#endif
}

/*

#10 lore raw

Re: [PATCH 02/16] media: omap3isp: allow it to build with COMPILE_TEST

HI Arnd,

Em Mon, 9 Apr 2018 10:50:13 +0200
Arnd Bergmann <[email protected]> escreveu:

Quoted 10 lines
Quoted 10 lines
Quoted 9 lines
Quoted 2 lines

That hardly seems to be an arch-specific iommu solution, but, instead, some hack used by only three drivers or some legacy iommu binding.

It's more complex than that. There are multiple IOMMU-related APIs on ARM, so more recent than others, with different feature sets. While I agree that drivers should move away from arm_iommu_create_mapping(), doing so requires coordination between the IOMMU driver and the bus master driver (for instance the omap3isp driver). It's not a trivial matter, but I'd love if someone submitted patches :-)

Quoted 6 lines
Quoted 3 lines

If someone steps up to do that, it would be really helpful, but we should not trust that this will happen. OMAP3 is an old hardware, and not many developers are working on improving its support.

Considering its age, I still see a lot of changes on the arch/arm side of it, so I wouldn't give up the hope yet.

Yeah, someone might still work on such fix.

Quoted 9 lines
Quoted 3 lines

Arnd,

What do you think?

I think including a foreign architecture header is worse than your earlier patch, I'd rather see a local hack in the driver.

I haven't tried it, but how about something simpler like what I have below.

Actually, another #ifdef was needed, before include arch-specifi header :-)

Quoted 7 lines

Arnd

(in case it works and you want to pick it up with a proper changelog):

Sounds a reasonable approach. Instead of using CONFIG_ARM, I would, instead check for CONFIG_ARM_DMA_USE_IOMMU, with is the actual dependency for such code, as otherwise it could cause some compilation breakages on ARM with COMPILE_TEST and some randconfig.

An advantage is that it properly annotates the part of the code that depends on ARM_DMA_USE_IOMMU.

Thanks,
Mauro

From: Arnd Bergmann <[email protected]>

media: omap3isp: allow it to build with COMPILE_TEST

There aren't much things required for it to build with COMPILE_TEST. It just needs to not compile the code that depends on arm-specific iommu implementation.

drivers/media/platform/Kconfig +2 -4
index 1ee915b794c0..2757b621091c 100644
@@ -63,12 +63,10 @@ config VIDEO_MUX
 config VIDEO_OMAP3
 	tristate "OMAP 3 Camera support"
 	depends on VIDEO_V4L2 && I2C && VIDEO_V4L2_SUBDEV_API
-	depends on ARCH_OMAP3 || COMPILE_TEST
-	depends on ARM
+	depends on ((ARCH_OMAP3 && OMAP_IOMMU) || COMPILE_TEST)
 	depends on COMMON_CLK
 	depends on HAS_DMA && OF
-	depends on OMAP_IOMMU
-	select ARM_DMA_USE_IOMMU
+	select ARM_DMA_USE_IOMMU if OMAP_IOMMU
 	select VIDEOBUF2_DMA_CONTIG
 	select MFD_SYSCON
 	select V4L2_FWNODE
drivers/media/platform/omap3isp/isp.c +8 -0
index 16c50099cccd..b8c8761a76b6 100644
@@ -61,7 +61,9 @@
 #include <linux/sched.h>
 #include <linux/vmalloc.h>
 
+#ifdef CONFIG_ARM_DMA_USE_IOMMU
 #include <asm/dma-iommu.h>
+#endif
 
 #include <media/v4l2-common.h>
 #include <media/v4l2-fwnode.h>
@@ -1938,12 +1940,15 @@ static int isp_initialize_modules(struct isp_device *isp)
 
 static void isp_detach_iommu(struct isp_device *isp)
 {
+#ifdef CONFIG_ARM_DMA_USE_IOMMU
 	arm_iommu_release_mapping(isp->mapping);
 	isp->mapping = NULL;
+#endif
 }
 
 static int isp_attach_iommu(struct isp_device *isp)
 {
+#ifdef CONFIG_ARM_DMA_USE_IOMMU
 	struct dma_iommu_mapping *mapping;
 	int ret;
 
@@ -1972,6 +1977,9 @@ static int isp_attach_iommu(struct isp_device *isp)
 error:
 	isp_detach_iommu(isp);
 	return ret;
+#else
+	return -ENODEV;
+#endif
 }
 
 /*
#11 lore raw

Re: [PATCH 02/16] media: omap3isp: allow it to build with COMPILE_TEST

In reply to Mauro Carvalho Chehab
I love your patch! Yet something to improve:

Hi Mauro,

I love your patch! Yet something to improve:

[auto build test ERROR on linuxtv-media/master]
[also build test ERROR on v4.16 next-20180406]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Mauro-Carvalho-Chehab/Make-all-drivers-under-drivers-media-to-build-with-COMPILE_TEST/20180406-164215
base:   git://linuxtv.org/media_tree.git master
config: openrisc-allyesconfig (attached as .config)
compiler: or1k-linux-gcc (GCC) 6.0.0 20160327 (experimental)

reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=openrisc

All errors (new ones prefixed by >>):

In file included from drivers/media/platform/omap3isp/isp.c:78:0:
drivers/media/platform/omap3isp/isp.h:130:16: error: field 'hw' has incomplete type

     struct clk_hw hw;
                   ^~
   In file included from include/asm-generic/bug.h:5:0,
                    from ./arch/openrisc/include/generated/asm/bug.h:1,
                    from include/linux/bug.h:5,
                    from include/linux/mmdebug.h:5,
                    from include/linux/mm.h:9,
                    from arch/openrisc/include/asm/cacheflush.h:21,
                    from drivers/media/platform/omap3isp/isp.c:45:
   drivers/media/platform/omap3isp/isp.c: In function 'isp_xclk_prepare':
   include/linux/kernel.h:938:32: error: dereferencing pointer to incomplete type 'struct clk_hw'
     BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \
                                   ^~~~~~
   include/linux/compiler.h:316:19: note: in definition of macro '__compiletime_assert'
      bool __cond = !(condition);    \
                      ^~~~~~~~~
   include/linux/compiler.h:339:2: note: in expansion of macro '_compiletime_assert'
     _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
     ^~~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:45:37: note: in expansion of macro 'compiletime_assert'
    #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
                                        ^~~~~~~~~~~~~~~~~~
   include/linux/kernel.h:938:2: note: in expansion of macro 'BUILD_BUG_ON_MSG'
     BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \
     ^~~~~~~~~~~~~~~~
   include/linux/kernel.h:938:20: note: in expansion of macro '__same_type'
     BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \
                       ^~~~~~~~~~~
   drivers/media/platform/omap3isp/isp.c:167:26: note: in expansion of macro 'container_of'
    #define to_isp_xclk(_hw) container_of(_hw, struct isp_xclk, hw)
                             ^~~~~~~~~~~~
   drivers/media/platform/omap3isp/isp.c:187:26: note: in expansion of macro 'to_isp_xclk'
     struct isp_xclk *xclk = to_isp_xclk(hw);
                             ^~~~~~~~~~~
   drivers/media/platform/omap3isp/isp.c: At top level:
   drivers/media/platform/omap3isp/isp.c:282:21: error: variable 'isp_xclk_ops' has initializer but incomplete type
    static const struct clk_ops isp_xclk_ops = {
                        ^~~~~~~
>> drivers/media/platform/omap3isp/isp.c:283:2: error: unknown field 'prepare' specified in initializer
     .prepare = isp_xclk_prepare,
     ^
   drivers/media/platform/omap3isp/isp.c:283:13: warning: excess elements in struct initializer
     .prepare = isp_xclk_prepare,
                ^~~~~~~~~~~~~~~~
   drivers/media/platform/omap3isp/isp.c:283:13: note: (near initialization for 'isp_xclk_ops')
>> drivers/media/platform/omap3isp/isp.c:284:2: error: unknown field 'unprepare' specified in initializer
     .unprepare = isp_xclk_unprepare,
     ^
   drivers/media/platform/omap3isp/isp.c:284:15: warning: excess elements in struct initializer
     .unprepare = isp_xclk_unprepare,
                  ^~~~~~~~~~~~~~~~~~
   drivers/media/platform/omap3isp/isp.c:284:15: note: (near initialization for 'isp_xclk_ops')
>> drivers/media/platform/omap3isp/isp.c:285:2: error: unknown field 'enable' specified in initializer
     .enable = isp_xclk_enable,
     ^
   drivers/media/platform/omap3isp/isp.c:285:12: warning: excess elements in struct initializer
     .enable = isp_xclk_enable,
               ^~~~~~~~~~~~~~~
   drivers/media/platform/omap3isp/isp.c:285:12: note: (near initialization for 'isp_xclk_ops')
>> drivers/media/platform/omap3isp/isp.c:286:2: error: unknown field 'disable' specified in initializer
     .disable = isp_xclk_disable,
     ^
   drivers/media/platform/omap3isp/isp.c:286:13: warning: excess elements in struct initializer
     .disable = isp_xclk_disable,
                ^~~~~~~~~~~~~~~~
   drivers/media/platform/omap3isp/isp.c:286:13: note: (near initialization for 'isp_xclk_ops')
>> drivers/media/platform/omap3isp/isp.c:287:2: error: unknown field 'recalc_rate' specified in initializer
     .recalc_rate = isp_xclk_recalc_rate,
     ^
   drivers/media/platform/omap3isp/isp.c:287:17: warning: excess elements in struct initializer
     .recalc_rate = isp_xclk_recalc_rate,
                    ^~~~~~~~~~~~~~~~~~~~
   drivers/media/platform/omap3isp/isp.c:287:17: note: (near initialization for 'isp_xclk_ops')
>> drivers/media/platform/omap3isp/isp.c:288:2: error: unknown field 'round_rate' specified in initializer
     .round_rate = isp_xclk_round_rate,
     ^
   drivers/media/platform/omap3isp/isp.c:288:16: warning: excess elements in struct initializer
     .round_rate = isp_xclk_round_rate,
                   ^~~~~~~~~~~~~~~~~~~
   drivers/media/platform/omap3isp/isp.c:288:16: note: (near initialization for 'isp_xclk_ops')
>> drivers/media/platform/omap3isp/isp.c:289:2: error: unknown field 'set_rate' specified in initializer
     .set_rate = isp_xclk_set_rate,
     ^
   drivers/media/platform/omap3isp/isp.c:289:14: warning: excess elements in struct initializer
     .set_rate = isp_xclk_set_rate,
                 ^~~~~~~~~~~~~~~~~
   drivers/media/platform/omap3isp/isp.c:289:14: note: (near initialization for 'isp_xclk_ops')
   drivers/media/platform/omap3isp/isp.c:294:21: error: variable 'isp_xclk_init_data' has initializer but incomplete type
    static const struct clk_init_data isp_xclk_init_data = {
                        ^~~~~~~~~~~~~
   drivers/media/platform/omap3isp/isp.c:295:2: error: unknown field 'name' specified in initializer
     .name = "cam_xclk",
     ^
   drivers/media/platform/omap3isp/isp.c:295:10: warning: excess elements in struct initializer
     .name = "cam_xclk",
             ^~~~~~~~~~
   drivers/media/platform/omap3isp/isp.c:295:10: note: (near initialization for 'isp_xclk_init_data')
   drivers/media/platform/omap3isp/isp.c:296:2: error: unknown field 'ops' specified in initializer
     .ops = &isp_xclk_ops,
     ^
   drivers/media/platform/omap3isp/isp.c:296:9: warning: excess elements in struct initializer
     .ops = &isp_xclk_ops,
            ^
   drivers/media/platform/omap3isp/isp.c:296:9: note: (near initialization for 'isp_xclk_init_data')
   drivers/media/platform/omap3isp/isp.c:297:2: error: unknown field 'parent_names' specified in initializer
     .parent_names = &isp_xclk_parent_name,
     ^
   drivers/media/platform/omap3isp/isp.c:297:18: warning: excess elements in struct initializer
     .parent_names = &isp_xclk_parent_name,
                     ^
   drivers/media/platform/omap3isp/isp.c:297:18: note: (near initialization for 'isp_xclk_init_data')
   drivers/media/platform/omap3isp/isp.c:298:2: error: unknown field 'num_parents' specified in initializer
     .num_parents = 1,
     ^
   drivers/media/platform/omap3isp/isp.c:298:17: warning: excess elements in struct initializer
     .num_parents = 1,
                    ^
   drivers/media/platform/omap3isp/isp.c:298:17: note: (near initialization for 'isp_xclk_init_data')
   drivers/media/platform/omap3isp/isp.c: In function 'isp_xclk_init':
   drivers/media/platform/omap3isp/isp.c:315:23: error: storage size of 'init' isn't known
     struct clk_init_data init;
                          ^~~~
>> drivers/media/platform/omap3isp/isp.c:341:15: error: implicit declaration of function 'clk_register' [-Werror=implicit-function-declaration]
      xclk->clk = clk_register(NULL, &xclk->hw);
                  ^~~~~~~~~~~~
>> drivers/media/platform/omap3isp/isp.c:347:3: error: implicit declaration of function 'of_clk_add_provider' [-Werror=implicit-function-declaration]
      of_clk_add_provider(np, isp_xclk_src_get, isp);
      ^~~~~~~~~~~~~~~~~~~
   drivers/media/platform/omap3isp/isp.c:315:23: warning: unused variable 'init' [-Wunused-variable]
     struct clk_init_data init;
                          ^~~~
   drivers/media/platform/omap3isp/isp.c: In function 'isp_xclk_cleanup':
>> drivers/media/platform/omap3isp/isp.c:358:3: error: implicit declaration of function 'of_clk_del_provider' [-Werror=implicit-function-declaration]
      of_clk_del_provider(np);
      ^~~~~~~~~~~~~~~~~~~
>> drivers/media/platform/omap3isp/isp.c:364:4: error: implicit declaration of function 'clk_unregister' [-Werror=implicit-function-declaration]
       clk_unregister(xclk->clk);
       ^~~~~~~~~~~~~~
   drivers/media/platform/omap3isp/isp.c: At top level:
   drivers/media/platform/omap3isp/isp.c:282:29: error: storage size of 'isp_xclk_ops' isn't known
    static const struct clk_ops isp_xclk_ops = {
                                ^~~~~~~~~~~~
   drivers/media/platform/omap3isp/isp.c:294:35: error: storage size of 'isp_xclk_init_data' isn't known
    static const struct clk_init_data isp_xclk_init_data = {
                                      ^~~~~~~~~~~~~~~~~~

drivers/media/platform/omap3isp/isp.c:1020:13: warning: 'isp_resume_modules' defined but not used [-Wunused-function]
static void isp_resume_modules(struct isp_device *isp)
^~~~~~~~~~~~~~~~~~
drivers/media/platform/omap3isp/isp.c:986:12: warning: 'isp_suspend_modules' defined but not used [-Wunused-function]
static int isp_suspend_modules(struct isp_device *isp)
^~~~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors

vim +/prepare +283 drivers/media/platform/omap3isp/isp.c

9b28ee3c Laurent Pinchart   2012-10-22  184  
9b28ee3c Laurent Pinchart   2012-10-22  185  static int isp_xclk_prepare(struct clk_hw *hw)
9b28ee3c Laurent Pinchart   2012-10-22  186  {
9b28ee3c Laurent Pinchart   2012-10-22 @187  	struct isp_xclk *xclk = to_isp_xclk(hw);
9b28ee3c Laurent Pinchart   2012-10-22  188  
9b28ee3c Laurent Pinchart   2012-10-22  189  	omap3isp_get(xclk->isp);
9b28ee3c Laurent Pinchart   2012-10-22  190  
9b28ee3c Laurent Pinchart   2012-10-22  191  	return 0;
9b28ee3c Laurent Pinchart   2012-10-22  192  }
9b28ee3c Laurent Pinchart   2012-10-22  193  
9b28ee3c Laurent Pinchart   2012-10-22  194  static void isp_xclk_unprepare(struct clk_hw *hw)
9b28ee3c Laurent Pinchart   2012-10-22  195  {
9b28ee3c Laurent Pinchart   2012-10-22  196  	struct isp_xclk *xclk = to_isp_xclk(hw);
9b28ee3c Laurent Pinchart   2012-10-22  197  
9b28ee3c Laurent Pinchart   2012-10-22  198  	omap3isp_put(xclk->isp);
9b28ee3c Laurent Pinchart   2012-10-22  199  }
9b28ee3c Laurent Pinchart   2012-10-22  200  
9b28ee3c Laurent Pinchart   2012-10-22  201  static int isp_xclk_enable(struct clk_hw *hw)
9b28ee3c Laurent Pinchart   2012-10-22  202  {
9b28ee3c Laurent Pinchart   2012-10-22  203  	struct isp_xclk *xclk = to_isp_xclk(hw);
9b28ee3c Laurent Pinchart   2012-10-22  204  	unsigned long flags;
9b28ee3c Laurent Pinchart   2012-10-22  205  
9b28ee3c Laurent Pinchart   2012-10-22  206  	spin_lock_irqsave(&xclk->lock, flags);
9b28ee3c Laurent Pinchart   2012-10-22  207  	isp_xclk_update(xclk, xclk->divider);
9b28ee3c Laurent Pinchart   2012-10-22  208  	xclk->enabled = true;
9b28ee3c Laurent Pinchart   2012-10-22  209  	spin_unlock_irqrestore(&xclk->lock, flags);
9b28ee3c Laurent Pinchart   2012-10-22  210  
9b28ee3c Laurent Pinchart   2012-10-22  211  	return 0;
9b28ee3c Laurent Pinchart   2012-10-22  212  }
9b28ee3c Laurent Pinchart   2012-10-22  213  
9b28ee3c Laurent Pinchart   2012-10-22  214  static void isp_xclk_disable(struct clk_hw *hw)
9b28ee3c Laurent Pinchart   2012-10-22  215  {
9b28ee3c Laurent Pinchart   2012-10-22  216  	struct isp_xclk *xclk = to_isp_xclk(hw);
9b28ee3c Laurent Pinchart   2012-10-22  217  	unsigned long flags;
9b28ee3c Laurent Pinchart   2012-10-22  218  
9b28ee3c Laurent Pinchart   2012-10-22  219  	spin_lock_irqsave(&xclk->lock, flags);
9b28ee3c Laurent Pinchart   2012-10-22  220  	isp_xclk_update(xclk, 0);
9b28ee3c Laurent Pinchart   2012-10-22  221  	xclk->enabled = false;
9b28ee3c Laurent Pinchart   2012-10-22  222  	spin_unlock_irqrestore(&xclk->lock, flags);
9b28ee3c Laurent Pinchart   2012-10-22  223  }
9b28ee3c Laurent Pinchart   2012-10-22  224  
9b28ee3c Laurent Pinchart   2012-10-22  225  static unsigned long isp_xclk_recalc_rate(struct clk_hw *hw,
9b28ee3c Laurent Pinchart   2012-10-22  226  					  unsigned long parent_rate)
9b28ee3c Laurent Pinchart   2012-10-22  227  {
9b28ee3c Laurent Pinchart   2012-10-22  228  	struct isp_xclk *xclk = to_isp_xclk(hw);
9b28ee3c Laurent Pinchart   2012-10-22  229  
9b28ee3c Laurent Pinchart   2012-10-22  230  	return parent_rate / xclk->divider;
9b28ee3c Laurent Pinchart   2012-10-22  231  }
9b28ee3c Laurent Pinchart   2012-10-22  232  
9b28ee3c Laurent Pinchart   2012-10-22  233  static u32 isp_xclk_calc_divider(unsigned long *rate, unsigned long parent_rate)
9b28ee3c Laurent Pinchart   2012-10-22  234  {
9b28ee3c Laurent Pinchart   2012-10-22  235  	u32 divider;
9b28ee3c Laurent Pinchart   2012-10-22  236  
9b28ee3c Laurent Pinchart   2012-10-22  237  	if (*rate >= parent_rate) {
9b28ee3c Laurent Pinchart   2012-10-22  238  		*rate = parent_rate;
9b28ee3c Laurent Pinchart   2012-10-22  239  		return ISPTCTRL_CTRL_DIV_BYPASS;
9b28ee3c Laurent Pinchart   2012-10-22  240  	}
9b28ee3c Laurent Pinchart   2012-10-22  241  
aadec012 Laurent Pinchart   2014-09-25  242  	if (*rate == 0)
aadec012 Laurent Pinchart   2014-09-25  243  		*rate = 1;
aadec012 Laurent Pinchart   2014-09-25  244  
9b28ee3c Laurent Pinchart   2012-10-22  245  	divider = DIV_ROUND_CLOSEST(parent_rate, *rate);
9b28ee3c Laurent Pinchart   2012-10-22  246  	if (divider >= ISPTCTRL_CTRL_DIV_BYPASS)
9b28ee3c Laurent Pinchart   2012-10-22  247  		divider = ISPTCTRL_CTRL_DIV_BYPASS - 1;
9b28ee3c Laurent Pinchart   2012-10-22  248  
9b28ee3c Laurent Pinchart   2012-10-22  249  	*rate = parent_rate / divider;
9b28ee3c Laurent Pinchart   2012-10-22  250  	return divider;
9b28ee3c Laurent Pinchart   2012-10-22  251  }
9b28ee3c Laurent Pinchart   2012-10-22  252  
9b28ee3c Laurent Pinchart   2012-10-22  253  static long isp_xclk_round_rate(struct clk_hw *hw, unsigned long rate,
9b28ee3c Laurent Pinchart   2012-10-22  254  				unsigned long *parent_rate)
9b28ee3c Laurent Pinchart   2012-10-22  255  {
9b28ee3c Laurent Pinchart   2012-10-22  256  	isp_xclk_calc_divider(&rate, *parent_rate);
9b28ee3c Laurent Pinchart   2012-10-22  257  	return rate;
9b28ee3c Laurent Pinchart   2012-10-22  258  }
9b28ee3c Laurent Pinchart   2012-10-22  259  
9b28ee3c Laurent Pinchart   2012-10-22  260  static int isp_xclk_set_rate(struct clk_hw *hw, unsigned long rate,
9b28ee3c Laurent Pinchart   2012-10-22  261  			     unsigned long parent_rate)
9b28ee3c Laurent Pinchart   2012-10-22  262  {
9b28ee3c Laurent Pinchart   2012-10-22  263  	struct isp_xclk *xclk = to_isp_xclk(hw);
9b28ee3c Laurent Pinchart   2012-10-22  264  	unsigned long flags;
9b28ee3c Laurent Pinchart   2012-10-22  265  	u32 divider;
9b28ee3c Laurent Pinchart   2012-10-22  266  
9b28ee3c Laurent Pinchart   2012-10-22  267  	divider = isp_xclk_calc_divider(&rate, parent_rate);
9b28ee3c Laurent Pinchart   2012-10-22  268  
9b28ee3c Laurent Pinchart   2012-10-22  269  	spin_lock_irqsave(&xclk->lock, flags);
9b28ee3c Laurent Pinchart   2012-10-22  270  
9b28ee3c Laurent Pinchart   2012-10-22  271  	xclk->divider = divider;
9b28ee3c Laurent Pinchart   2012-10-22  272  	if (xclk->enabled)
9b28ee3c Laurent Pinchart   2012-10-22  273  		isp_xclk_update(xclk, divider);
9b28ee3c Laurent Pinchart   2012-10-22  274  
9b28ee3c Laurent Pinchart   2012-10-22  275  	spin_unlock_irqrestore(&xclk->lock, flags);
9b28ee3c Laurent Pinchart   2012-10-22  276  
9b28ee3c Laurent Pinchart   2012-10-22  277  	dev_dbg(xclk->isp->dev, "%s: cam_xclk%c set to %lu Hz (div %u)\n",
9b28ee3c Laurent Pinchart   2012-10-22  278  		__func__, xclk->id == ISP_XCLK_A ? 'a' : 'b', rate, divider);
9b28ee3c Laurent Pinchart   2012-10-22  279  	return 0;
9b28ee3c Laurent Pinchart   2012-10-22  280  }
9b28ee3c Laurent Pinchart   2012-10-22  281  
9b28ee3c Laurent Pinchart   2012-10-22  282  static const struct clk_ops isp_xclk_ops = {
9b28ee3c Laurent Pinchart   2012-10-22 @283  	.prepare = isp_xclk_prepare,
9b28ee3c Laurent Pinchart   2012-10-22 @284  	.unprepare = isp_xclk_unprepare,
9b28ee3c Laurent Pinchart   2012-10-22 @285  	.enable = isp_xclk_enable,
9b28ee3c Laurent Pinchart   2012-10-22 @286  	.disable = isp_xclk_disable,
9b28ee3c Laurent Pinchart   2012-10-22 @287  	.recalc_rate = isp_xclk_recalc_rate,
9b28ee3c Laurent Pinchart   2012-10-22 @288  	.round_rate = isp_xclk_round_rate,
9b28ee3c Laurent Pinchart   2012-10-22 @289  	.set_rate = isp_xclk_set_rate,
9b28ee3c Laurent Pinchart   2012-10-22  290  };
9b28ee3c Laurent Pinchart   2012-10-22  291  
9b28ee3c Laurent Pinchart   2012-10-22  292  static const char *isp_xclk_parent_name = "cam_mclk";
9b28ee3c Laurent Pinchart   2012-10-22  293  
9b28ee3c Laurent Pinchart   2012-10-22  294  static const struct clk_init_data isp_xclk_init_data = {
9b28ee3c Laurent Pinchart   2012-10-22  295  	.name = "cam_xclk",
9b28ee3c Laurent Pinchart   2012-10-22  296  	.ops = &isp_xclk_ops,
9b28ee3c Laurent Pinchart   2012-10-22  297  	.parent_names = &isp_xclk_parent_name,
9b28ee3c Laurent Pinchart   2012-10-22 @298  	.num_parents = 1,
9b28ee3c Laurent Pinchart   2012-10-22  299  };
9b28ee3c Laurent Pinchart   2012-10-22  300  
64904b57 Laurent Pinchart   2015-03-25  301  static struct clk *isp_xclk_src_get(struct of_phandle_args *clkspec, void *data)
64904b57 Laurent Pinchart   2015-03-25  302  {
64904b57 Laurent Pinchart   2015-03-25  303  	unsigned int idx = clkspec->args[0];
64904b57 Laurent Pinchart   2015-03-25  304  	struct isp_device *isp = data;
64904b57 Laurent Pinchart   2015-03-25  305  
64904b57 Laurent Pinchart   2015-03-25  306  	if (idx >= ARRAY_SIZE(isp->xclks))
64904b57 Laurent Pinchart   2015-03-25  307  		return ERR_PTR(-ENOENT);
64904b57 Laurent Pinchart   2015-03-25  308  
64904b57 Laurent Pinchart   2015-03-25  309  	return isp->xclks[idx].clk;
64904b57 Laurent Pinchart   2015-03-25  310  }
64904b57 Laurent Pinchart   2015-03-25  311  
9b28ee3c Laurent Pinchart   2012-10-22  312  static int isp_xclk_init(struct isp_device *isp)
9b28ee3c Laurent Pinchart   2012-10-22  313  {
64904b57 Laurent Pinchart   2015-03-25  314  	struct device_node *np = isp->dev->of_node;
9b28ee3c Laurent Pinchart   2012-10-22 @315  	struct clk_init_data init;
9b28ee3c Laurent Pinchart   2012-10-22  316  	unsigned int i;
9b28ee3c Laurent Pinchart   2012-10-22  317  
f8e2ff26 Sylwester Nawrocki 2013-12-04  318  	for (i = 0; i < ARRAY_SIZE(isp->xclks); ++i)
f8e2ff26 Sylwester Nawrocki 2013-12-04  319  		isp->xclks[i].clk = ERR_PTR(-EINVAL);
f8e2ff26 Sylwester Nawrocki 2013-12-04  320  
9b28ee3c Laurent Pinchart   2012-10-22  321  	for (i = 0; i < ARRAY_SIZE(isp->xclks); ++i) {
9b28ee3c Laurent Pinchart   2012-10-22  322  		struct isp_xclk *xclk = &isp->xclks[i];
9b28ee3c Laurent Pinchart   2012-10-22  323  
9b28ee3c Laurent Pinchart   2012-10-22  324  		xclk->isp = isp;
9b28ee3c Laurent Pinchart   2012-10-22  325  		xclk->id = i == 0 ? ISP_XCLK_A : ISP_XCLK_B;
9b28ee3c Laurent Pinchart   2012-10-22  326  		xclk->divider = 1;
9b28ee3c Laurent Pinchart   2012-10-22  327  		spin_lock_init(&xclk->lock);
9b28ee3c Laurent Pinchart   2012-10-22  328  
9b28ee3c Laurent Pinchart   2012-10-22  329  		init.name = i == 0 ? "cam_xclka" : "cam_xclkb";
9b28ee3c Laurent Pinchart   2012-10-22  330  		init.ops = &isp_xclk_ops;
9b28ee3c Laurent Pinchart   2012-10-22  331  		init.parent_names = &isp_xclk_parent_name;
9b28ee3c Laurent Pinchart   2012-10-22  332  		init.num_parents = 1;
9b28ee3c Laurent Pinchart   2012-10-22  333  
9b28ee3c Laurent Pinchart   2012-10-22  334  		xclk->hw.init = &init;
f8e2ff26 Sylwester Nawrocki 2013-12-04  335  		/*
f8e2ff26 Sylwester Nawrocki 2013-12-04  336  		 * The first argument is NULL in order to avoid circular
f8e2ff26 Sylwester Nawrocki 2013-12-04  337  		 * reference, as this driver takes reference on the
f8e2ff26 Sylwester Nawrocki 2013-12-04  338  		 * sensor subdevice modules and the sensors would take
f8e2ff26 Sylwester Nawrocki 2013-12-04  339  		 * reference on this module through clk_get().
f8e2ff26 Sylwester Nawrocki 2013-12-04  340  		 */
f8e2ff26 Sylwester Nawrocki 2013-12-04 @341  		xclk->clk = clk_register(NULL, &xclk->hw);
f8e2ff26 Sylwester Nawrocki 2013-12-04  342  		if (IS_ERR(xclk->clk))
f8e2ff26 Sylwester Nawrocki 2013-12-04  343  			return PTR_ERR(xclk->clk);
9b28ee3c Laurent Pinchart   2012-10-22  344  	}
9b28ee3c Laurent Pinchart   2012-10-22  345  
64904b57 Laurent Pinchart   2015-03-25  346  	if (np)
64904b57 Laurent Pinchart   2015-03-25 @347  		of_clk_add_provider(np, isp_xclk_src_get, isp);
64904b57 Laurent Pinchart   2015-03-25  348  
9b28ee3c Laurent Pinchart   2012-10-22  349  	return 0;
9b28ee3c Laurent Pinchart   2012-10-22  350  }
9b28ee3c Laurent Pinchart   2012-10-22  351  
9b28ee3c Laurent Pinchart   2012-10-22  352  static void isp_xclk_cleanup(struct isp_device *isp)
9b28ee3c Laurent Pinchart   2012-10-22  353  {
64904b57 Laurent Pinchart   2015-03-25  354  	struct device_node *np = isp->dev->of_node;
9b28ee3c Laurent Pinchart   2012-10-22  355  	unsigned int i;
9b28ee3c Laurent Pinchart   2012-10-22  356  
64904b57 Laurent Pinchart   2015-03-25  357  	if (np)
64904b57 Laurent Pinchart   2015-03-25 @358  		of_clk_del_provider(np);
64904b57 Laurent Pinchart   2015-03-25  359  
9b28ee3c Laurent Pinchart   2012-10-22  360  	for (i = 0; i < ARRAY_SIZE(isp->xclks); ++i) {
9b28ee3c Laurent Pinchart   2012-10-22  361  		struct isp_xclk *xclk = &isp->xclks[i];
9b28ee3c Laurent Pinchart   2012-10-22  362  
f8e2ff26 Sylwester Nawrocki 2013-12-04  363  		if (!IS_ERR(xclk->clk))
f8e2ff26 Sylwester Nawrocki 2013-12-04 @364  			clk_unregister(xclk->clk);
9b28ee3c Laurent Pinchart   2012-10-22  365  	}
9b28ee3c Laurent Pinchart   2012-10-22  366  }

9b28ee3c Laurent Pinchart 2012-10-22 367

:::::: The code at line 283 was first introduced by commit
:::::: 9b28ee3c9122cea62f2db02f5bb1e1606bb343a6 [media] omap3isp: Use the common clock framework

:::::: TO: Laurent Pinchart <[email protected]> :::::: CC: Mauro Carvalho Chehab <[email protected]>

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

#12 lore raw

PATCH 3/16 media: omap3isp/isp: remove an unused static var

In reply to Mauro Carvalho Chehab

The isp_xclk_init_data const data isn't used anywere.

drivers/media/platform/omap3isp/isp.c:294:35: warning: ‘isp_xclk_init_data’ defined but not used [-Wunused-const-variable=]

 static const struct clk_init_data isp_xclk_init_data = {
                                   ^~~~~~~~~~~~~~~~~~
---
 drivers/media/platform/omap3isp/isp.c | 7 -------
 1 file changed, 7 deletions(-)
drivers/media/platform/omap3isp/isp.c +0 -7
index 2a11a709aa4f..9e4b5fb8a8b5 100644
@@ -291,13 +291,6 @@ static const struct clk_ops isp_xclk_ops = {
 
 static const char *isp_xclk_parent_name = "cam_mclk";
 
-static const struct clk_init_data isp_xclk_init_data = {
-	.name = "cam_xclk",
-	.ops = &isp_xclk_ops,
-	.parent_names = &isp_xclk_parent_name,
-	.num_parents = 1,
-};
-
 static struct clk *isp_xclk_src_get(struct of_phandle_args *clkspec, void *data)
 {
 	unsigned int idx = clkspec->args[0];
Signature · 1 line
2.14.3
Reviewed-by on v1 3/16
#13 lore raw

Re: [PATCH 03/16] media: omap3isp/isp: remove an unused static var

Hi Mauro,

Thank you for the patch.

Quoted 6 lines · On Thursday, 5 April 2018 20:54:03 EEST Mauro Carvalho Chehab wrote:

The isp_xclk_init_data const data isn't used anywere.

drivers/media/platform/omap3isp/isp.c:294:35: warning: ‘isp_xclk_init_data’ defined but not used [-Wunused-const-variable=] static const struct

clk_init_data isp_xclk_init_data = {
                                   ^~~~~~~~~~~~~~~~~~

I believe you, no need for a compiler warning message to prove this :-)

Quoted 1 line

I really wonder why my compiler has never warned me. The problem has been there from the start :-/

You should add a fixes tag:

Fixes 9b28ee3c9122 ("[media] omap3isp: Use the common clock framework")

Apart from that,

I think Sakari is planning a pull request for the omap3isp driver so I'll let him handle this patch.

Quoted 23 lines
---
 drivers/media/platform/omap3isp/isp.c | 7 -------
 1 file changed, 7 deletions(-)
(quoted diff) +0 -0

b/drivers/media/platform/omap3isp/isp.c index 2a11a709aa4f..9e4b5fb8a8b5 100644

drivers/media/platform/omap3isp/isp.c +0 -7
@@ -291,13 +291,6 @@ static const struct clk_ops isp_xclk_ops = {
 
 static const char *isp_xclk_parent_name = "cam_mclk";
 
-static const struct clk_init_data isp_xclk_init_data = {
-	.name = "cam_xclk",
-	.ops = &isp_xclk_ops,
-	.parent_names = &isp_xclk_parent_name,
-	.num_parents = 1,
-};
-
 static struct clk *isp_xclk_src_get(struct of_phandle_args *clkspec, void
 *data) {
 	unsigned int idx = clkspec->args[0];
Signature · 3 lines
Regards,

Laurent Pinchart
#14 lore raw

PATCH 4/16 media: fsl-viu: mark static functions as such

In reply to Mauro Carvalho Chehab

There are several functions that are used only inside the driver. Stop exposing that to global symbolspace.

Get rid of the following gcc warnings:

drivers/media/platform/fsl-viu.c:240:17: warning: no previous prototype for ‘format_by_fourcc’ [-Wmissing-prototypes]
struct viu_fmt *format_by_fourcc(int fourcc)

                 ^~~~~~~~~~~~~~~~
drivers/media/platform/fsl-viu.c:253:6: warning: no previous prototype for ‘viu_start_dma’ [-Wmissing-prototypes]
 void viu_start_dma(struct viu_dev *dev)
      ^~~~~~~~~~~~~
drivers/media/platform/fsl-viu.c:262:6: warning: no previous prototype for ‘viu_stop_dma’ [-Wmissing-prototypes]
 void viu_stop_dma(struct viu_dev *dev)
      ^~~~~~~~~~~~
drivers/media/platform/fsl-viu.c:807:5: warning: no previous prototype for ‘vidioc_g_fbuf’ [-Wmissing-prototypes]
 int vidioc_g_fbuf(struct file *file, void *priv, struct v4l2_framebuffer *arg)
     ^~~~~~~~~~~~~
drivers/media/platform/fsl-viu.c:818:5: warning: no previous prototype for ‘vidioc_s_fbuf’ [-Wmissing-prototypes]
 int vidioc_s_fbuf(struct file *file, void *priv, const struct v4l2_framebuffer *arg)
     ^~~~~~~~~~~~~
drivers/media/platform/fsl-viu.c: In function ‘viu_open’:
drivers/media/platform/fsl-viu.c:1170:6: warning: variable ‘status_cfg’ set but not used [-Wunused-but-set-variable]
  u32 status_cfg;
      ^~~~~~~~~~
drivers/media/platform/fsl-viu.c: At top level:
drivers/media/platform/fsl-viu.c:1304:6: warning: no previous prototype for ‘viu_reset’ [-Wmissing-prototypes]
 void viu_reset(struct viu_reg *reg)
      ^~~~~~~~~
---
 drivers/media/platform/fsl-viu.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/media/platform/fsl-viu.c +6 -6
index 200c47c69a75..9abe79779659 100644
@@ -229,7 +229,7 @@ enum status_config {
 
 static irqreturn_t viu_intr(int irq, void *dev_id);
 
-struct viu_fmt *format_by_fourcc(int fourcc)
+static struct viu_fmt *format_by_fourcc(int fourcc)
 {
 	int i;
 
@@ -242,7 +242,7 @@ struct viu_fmt *format_by_fourcc(int fourcc)
 	return NULL;
 }
 
-void viu_start_dma(struct viu_dev *dev)
+static void viu_start_dma(struct viu_dev *dev)
 {
 	struct viu_reg *vr = dev->vr;
 
@@ -253,7 +253,7 @@ void viu_start_dma(struct viu_dev *dev)
 	out_be32(&vr->status_cfg, INT_FIELD_EN);
 }
 
-void viu_stop_dma(struct viu_dev *dev)
+static void viu_stop_dma(struct viu_dev *dev)
 {
 	struct viu_reg *vr = dev->vr;
 	int cnt = 100;
@@ -802,7 +802,7 @@ static int vidioc_overlay(struct file *file, void *priv, unsigned int on)
 	return 0;
 }
 
-int vidioc_g_fbuf(struct file *file, void *priv, struct v4l2_framebuffer *arg)
+static int vidioc_g_fbuf(struct file *file, void *priv, struct v4l2_framebuffer *arg)
 {
 	struct viu_fh  *fh = priv;
 	struct viu_dev *dev = fh->dev;
@@ -813,7 +813,7 @@ int vidioc_g_fbuf(struct file *file, void *priv, struct v4l2_framebuffer *arg)
 	return 0;
 }
 
-int vidioc_s_fbuf(struct file *file, void *priv, const struct v4l2_framebuffer *arg)
+static int vidioc_s_fbuf(struct file *file, void *priv, const struct v4l2_framebuffer *arg)
 {
 	struct viu_fh  *fh = priv;
 	struct viu_dev *dev = fh->dev;
@@ -1305,7 +1305,7 @@ static int viu_release(struct file *file)
 	return 0;
 }
 
-void viu_reset(struct viu_reg *reg)
+static void viu_reset(struct viu_reg *reg)
 {
 	out_be32(&reg->status_cfg, 0);
 	out_be32(&reg->luminance, 0x9512a254);
Signature · 1 line
2.14.3
#15 lore raw

PATCH 5/16 media: fsl-viu: allow building it with COMPILE_TEST

In reply to Mauro Carvalho Chehab

There aren't many things that would be needed to allow it to build with compile test.

Add the needed bits.

---
 drivers/media/platform/Kconfig   | 2 +-
 drivers/media/platform/fsl-viu.c | 8 ++++++++
 2 files changed, 9 insertions(+), 1 deletion(-)
drivers/media/platform/Kconfig +1 -1
index 03c9dfeb7781..e6eb1eb776e1 100644
@@ -42,7 +42,7 @@ config VIDEO_SH_VOU
 
 config VIDEO_VIU
 	tristate "Freescale VIU Video Driver"
-	depends on VIDEO_V4L2 && PPC_MPC512x
+	depends on VIDEO_V4L2 && (PPC_MPC512x || COMPILE_TEST)
 	select VIDEOBUF_DMA_CONTIG
 	default y
 	---help---
drivers/media/platform/fsl-viu.c +8 -0
index 9abe79779659..466053e00378 100644
@@ -36,6 +36,14 @@
 #define DRV_NAME		"fsl_viu"
 #define VIU_VERSION		"0.5.1"
 
+/* Allow building this driver with COMPILE_TEST */
+#ifndef CONFIG_PPC_MPC512x
+#define NO_IRQ   0
+
+#define out_be32(v, a)	writel(a, v)
+#define in_be32(a) readl(a)
+#endif
+
 #define BUFFER_TIMEOUT		msecs_to_jiffies(500)  /* 0.5 seconds */
 
 #define	VIU_VID_MEM_LIMIT	4	/* Video memory limit, in Mb */
Signature · 1 line
2.14.3
#16 lore raw

Re: [PATCH 05/16] media: fsl-viu: allow building it with COMPILE_TEST

Review

Quoted 6 lines · Mauro Carvalho Chehab

There aren't many things that would be needed to allow it to build with compile test.

(quoted diff) +3 -0
+/* Allow building this driver with COMPILE_TEST */
+#ifndef CONFIG_PPC_MPC512x
+#define NO_IRQ   0

The NO_IRQ usage here really needs to die. The portable way to do this is the simpler

drivers/media/platform/fsl-viu.c +1 -1
index 200c47c69a75..707bda89b4f7 100644
@@ -1407,7 +1407,7 @@ static int viu_of_probe(struct platform_device *op)
        }
 
        viu_irq = irq_of_parse_and_map(op->dev.of_node, 0);
-       if (viu_irq == NO_IRQ) {
+       if (!viu_irq) {
                dev_err(&op->dev, "Error while mapping the irq\n");
                return -EINVAL;
        }

Review

Quoted 2 lines
(quoted diff) +2 -0
+#define out_be32(v, a) writel(a, v)
+#define in_be32(a) readl(a)

This does get it to compile, but looks confusing because it mixes up the endianess. I'd suggest doing it like

#ifndef CONFIG_PPC
#define out_be32(v, a) iowrite32be(a, v)
#define in_be32(a) ioread32be(a)
#endif

Arnd

#17 lore raw

Re: [PATCH 05/16] media: fsl-viu: allow building it with COMPILE_TEST

Em Thu, 5 Apr 2018 23:35:06 +0200
Arnd Bergmann <[email protected]> escreveu:

Quoted 32 lines

Review

Quoted 6 lines · Mauro Carvalho Chehab

There aren't many things that would be needed to allow it to build with compile test.

(quoted diff) +3 -0
+/* Allow building this driver with COMPILE_TEST */
+#ifndef CONFIG_PPC_MPC512x
+#define NO_IRQ   0  

The NO_IRQ usage here really needs to die. The portable way to do this is the simpler

drivers/media/platform/fsl-viu.c +1 -1
index 200c47c69a75..707bda89b4f7 100644
@@ -1407,7 +1407,7 @@ static int viu_of_probe(struct platform_device *op)
        }
 
        viu_irq = irq_of_parse_and_map(op->dev.of_node, 0);
-       if (viu_irq == NO_IRQ) {
+       if (!viu_irq) {
                dev_err(&op->dev, "Error while mapping the irq\n");
                return -EINVAL;
        }

Review

Quoted 3 lines
(quoted diff) +2 -0
+#define out_be32(v, a) writel(a, v)
+#define in_be32(a) readl(a)  

This does get it to compile, but looks confusing because it mixes up the endianess. I'd suggest doing it like

Quoted 6 lines

#ifndef CONFIG_PPC
#define out_be32(v, a) iowrite32be(a, v)
#define in_be32(a) ioread32be(a)
#endif

Arnd

Thanks for the review. Yeah, that looks better. Patch enclosed.

Thanks,
Mauro

[PATCH] media: fsl-viu: allow building it with COMPILE_TEST

There aren't many things that would be needed to allow it to build with compile test.

Add the needed bits.

drivers/media/platform/Kconfig +1 -1
index 03c9dfeb7781..e6eb1eb776e1 100644
@@ -42,7 +42,7 @@ config VIDEO_SH_VOU
 
 config VIDEO_VIU
 	tristate "Freescale VIU Video Driver"
-	depends on VIDEO_V4L2 && PPC_MPC512x
+	depends on VIDEO_V4L2 && (PPC_MPC512x || COMPILE_TEST)
 	select VIDEOBUF_DMA_CONTIG
 	default y
 	---help---
drivers/media/platform/fsl-viu.c +7 -1
index 9abe79779659..f54592c431d3 100644
@@ -36,6 +36,12 @@
 #define DRV_NAME		"fsl_viu"
 #define VIU_VERSION		"0.5.1"
 
+/* Allow building this driver with COMPILE_TEST */
+#ifndef CONFIG_PPC
+#define out_be32(v, a)	iowrite32be(a, v)
+#define in_be32(a)	ioread32be(a)
+#endif
+
 #define BUFFER_TIMEOUT		msecs_to_jiffies(500)  /* 0.5 seconds */
 
 #define	VIU_VID_MEM_LIMIT	4	/* Video memory limit, in Mb */
@@ -1407,7 +1413,7 @@ static int viu_of_probe(struct platform_device *op)
 	}
 
 	viu_irq = irq_of_parse_and_map(op->dev.of_node, 0);
-	if (viu_irq == NO_IRQ) {
+	if (!viu_irq) {
 		dev_err(&op->dev, "Error while mapping the irq\n");
 		return -EINVAL;
 	}
#19 lore raw

Re: [PATCH 05/16] media: fsl-viu: allow building it with COMPILE_TEST

Em Fri, 6 Apr 2018 11:51:16 +0200
Arnd Bergmann <[email protected]> escreveu:

Quoted 5 lines
Quoted 2 lines · Mauro Carvalho Chehab

[PATCH] media: fsl-viu: allow building it with COMPILE_TEST

Quoted 8 lines
Quoted 6 lines

There aren't many things that would be needed to allow it to build with compile test.

Add the needed bits.

Actually, in order to avoid warnings with smatch, the COMPILE_TEST macros should be declared as:

+#define out_be32(v, a) iowrite32be(a, (void __iomem *)v)
+#define in_be32(a) ioread32be((void __iomem *)a)

Thanks,
Mauro

[PATCH] media: fsl-viu: allow building it with COMPILE_TEST

There aren't many things that would be needed to allow it to build with compile test.

Add the needed bits.

drivers/media/platform/Kconfig +1 -1
index 03c9dfeb7781..e6eb1eb776e1 100644
@@ -42,7 +42,7 @@ config VIDEO_SH_VOU
 
 config VIDEO_VIU
 	tristate "Freescale VIU Video Driver"
-	depends on VIDEO_V4L2 && PPC_MPC512x
+	depends on VIDEO_V4L2 && (PPC_MPC512x || COMPILE_TEST)
 	select VIDEOBUF_DMA_CONTIG
 	default y
 	---help---
drivers/media/platform/fsl-viu.c +7 -1
index 9abe79779659..6fd1c8f66047 100644
@@ -36,6 +36,12 @@
 #define DRV_NAME		"fsl_viu"
 #define VIU_VERSION		"0.5.1"
 
+/* Allow building this driver with COMPILE_TEST */
+#ifndef CONFIG_PPC
+#define out_be32(v, a)	iowrite32be(a, (void __iomem *)v)
+#define in_be32(a)	ioread32be((void __iomem *)a)
+#endif
+
 #define BUFFER_TIMEOUT		msecs_to_jiffies(500)  /* 0.5 seconds */
 
 #define	VIU_VID_MEM_LIMIT	4	/* Video memory limit, in Mb */
@@ -1407,7 +1413,7 @@ static int viu_of_probe(struct platform_device *op)
 	}
 
 	viu_irq = irq_of_parse_and_map(op->dev.of_node, 0);
-	if (viu_irq == NO_IRQ) {
+	if (!viu_irq) {
 		dev_err(&op->dev, "Error while mapping the irq\n");
 		return -EINVAL;
 	}
#20 lore raw

Re: [PATCH 05/16] media: fsl-viu: allow building it with COMPILE_TEST

Quoted 20 lines · Mauro Carvalho Chehab

Em Fri, 6 Apr 2018 11:51:16 +0200
Arnd Bergmann <[email protected]> escreveu:

Quoted 5 lines
Quoted 2 lines · Mauro Carvalho Chehab

[PATCH] media: fsl-viu: allow building it with COMPILE_TEST

Quoted 8 lines
Quoted 6 lines

There aren't many things that would be needed to allow it to build with compile test.

Add the needed bits.

Actually, in order to avoid warnings with smatch, the COMPILE_TEST macros should be declared as:

drivers/media/platform/fsl-viu.c line 42

Quoted 2 lines
drivers/media/platform/fsl-viu.c +2 -0
+#define out_be32(v, a) iowrite32be(a, (void __iomem *)v)
+#define in_be32(a)     ioread32be((void __iomem *)a)

I would just add the correct annotations, I think they've always been missing. 2 patches coming in a few minutes.

Arnd

#21 lore raw

Re: [PATCH 05/16] media: fsl-viu: allow building it with COMPILE_TEST

Em Fri, 6 Apr 2018 16:16:46 +0200
Arnd Bergmann <[email protected]> escreveu:

Quoted 19 lines
Quoted 17 lines · Mauro Carvalho Chehab

Em Fri, 6 Apr 2018 11:51:16 +0200
Arnd Bergmann <[email protected]> escreveu:

Quoted 13 lines
Quoted 8 lines · Mauro Carvalho Chehab

[PATCH] media: fsl-viu: allow building it with COMPILE_TEST

There aren't many things that would be needed to allow it to build with compile test.

Add the needed bits.

Quoted 8 lines

drivers/media/platform/fsl-viu.c line 42

Quoted 5 lines

Actually, in order to avoid warnings with smatch, the COMPILE_TEST macros should be declared as:

drivers/media/platform/fsl-viu.c +2 -0
+#define out_be32(v, a) iowrite32be(a, (void __iomem *)v)
+#define in_be32(a)     ioread32be((void __iomem *)a)  

I would just add the correct annotations, I think they've always been missing. 2 patches coming in a few minutes.

I corrected the annotations too. Now, it gives the same results building for both arm and x86.

If you want to double check, the full tree is at:

https://git.linuxtv.org/mchehab/experimental.git/log/?h=compile_test

Quoted 2 lines

Arnd

Thanks,
Mauro

#22 lore raw

Re: [PATCH 05/16] media: fsl-viu: allow building it with COMPILE_TEST

Quoted 31 lines · Mauro Carvalho Chehab

Em Fri, 6 Apr 2018 16:16:46 +0200
Arnd Bergmann <[email protected]> escreveu:

Quoted 19 lines
Quoted 17 lines · Mauro Carvalho Chehab

Em Fri, 6 Apr 2018 11:51:16 +0200
Arnd Bergmann <[email protected]> escreveu:

Quoted 13 lines
Quoted 8 lines · Mauro Carvalho Chehab

[PATCH] media: fsl-viu: allow building it with COMPILE_TEST

There aren't many things that would be needed to allow it to build with compile test.

Add the needed bits.

Quoted 8 lines

drivers/media/platform/fsl-viu.c line 42

Quoted 5 lines

Actually, in order to avoid warnings with smatch, the COMPILE_TEST macros should be declared as:

drivers/media/platform/fsl-viu.c +2 -0
+#define out_be32(v, a) iowrite32be(a, (void __iomem *)v)
+#define in_be32(a)     ioread32be((void __iomem *)a)

I would just add the correct annotations, I think they've always been missing. 2 patches coming in a few minutes.

Quoted 6 lines

I corrected the annotations too. Now, it gives the same results building for both arm and x86.

If you want to double check, the full tree is at:

https://git.linuxtv.org/mchehab/experimental.git/log/?h=compile_test

The __iomem annotations look good, my other patch is still needed to get a clean build with "make C=1" but doesn't apply cleanly on top of your version. I assume you'll just fix it up accordingly.

Arnd

#23 lore raw

Re: [PATCH 05/16] media: fsl-viu: allow building it with COMPILE_TEST

Em Fri, 6 Apr 2018 16:37:15 +0200 Arnd Bergmann <[email protected]> escreveu:

Quoted 36 lines
Quoted 34 lines · Mauro Carvalho Chehab

Em Fri, 6 Apr 2018 16:16:46 +0200
Arnd Bergmann <[email protected]> escreveu:

Quoted 19 lines
Quoted 17 lines · Mauro Carvalho Chehab

Em Fri, 6 Apr 2018 11:51:16 +0200
Arnd Bergmann <[email protected]> escreveu:

Quoted 13 lines
Quoted 8 lines · Mauro Carvalho Chehab

[PATCH] media: fsl-viu: allow building it with COMPILE_TEST

There aren't many things that would be needed to allow it to build with compile test.

Add the needed bits.

Quoted 8 lines

drivers/media/platform/fsl-viu.c line 42

Quoted 5 lines

Actually, in order to avoid warnings with smatch, the COMPILE_TEST macros should be declared as:

drivers/media/platform/fsl-viu.c +2 -0
+#define out_be32(v, a) iowrite32be(a, (void __iomem *)v)
+#define in_be32(a)     ioread32be((void __iomem *)a)  

I would just add the correct annotations, I think they've always been missing. 2 patches coming in a few minutes.

I corrected the annotations too. Now, it gives the same results building for both arm and x86.

Quoted 7 lines
Quoted 3 lines

If you want to double check, the full tree is at:

https://git.linuxtv.org/mchehab/experimental.git/log/?h=compile_test

The __iomem annotations look good, my other patch is still needed to get a clean build with "make C=1" but doesn't apply cleanly on top of your version. I assume you'll just fix it up accordingly.

Heh, another duplicated patch:

	https://git.linuxtv.org/mchehab/experimental.git/commit/?h=compile_test&id=687520dc31a88c82c694492423c5d9c503cbdebb

That's why it didn't apply cleanly:

$ patch -p1 -i /tmp/media\:\ platform\:\ fsl-viu\:\ mark\ local\ functions\ \'static\'.patch --merge
patching file drivers/media/platform/fsl-viu.c
Hunk #1 already applied at 238.
Hunk #2 already applied at 251.
Hunk #3 already applied at 262.
Hunk #4 already applied at 806.
Hunk #5 already applied at 817.
Hunk #6 already applied at 1305.

Great minds think alike :-)

Thanks,
Mauro

#24 lore raw

Re: [PATCH 05/16] media: fsl-viu: allow building it with COMPILE_TEST

In reply to Mauro Carvalho Chehab
I love your patch! Perhaps something to improve:

Hi Mauro,

I love your patch! Perhaps something to improve:

[auto build test WARNING on linuxtv-media/master]
[also build test WARNING on v4.16 next-20180406]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Mauro-Carvalho-Chehab/Make-all-drivers-under-drivers-media-to-build-with-COMPILE_TEST/20180406-164215
base:   git://linuxtv.org/media_tree.git master
config: m68k-allyesconfig (attached as .config)
compiler: m68k-linux-gnu-gcc (Debian 7.2.0-11) 7.2.0

reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=m68k

All warnings (new ones prefixed by >>):

>> drivers/media//platform/fsl-viu.c:43:0: warning: "out_be32" redefined
    #define out_be32(v, a) writel(a, v)

In file included from arch/m68k/include/asm/io_mm.h:27:0,

                    from arch/m68k/include/asm/io.h:5,
                    from include/linux/io.h:25,
                    from drivers/media//platform/fsl-viu.c:23:
   arch/m68k/include/asm/raw_io.h:46:0: note: this is the location of the previous definition
    #define out_be32(addr,l) (void)((*(__force volatile u32 *) (addr)) = (l))
>> drivers/media//platform/fsl-viu.c:44:0: warning: "in_be32" redefined
    #define in_be32(a) readl(a)

In file included from arch/m68k/include/asm/io_mm.h:27:0,

                    from arch/m68k/include/asm/io.h:5,
                    from include/linux/io.h:25,
                    from drivers/media//platform/fsl-viu.c:23:
   arch/m68k/include/asm/raw_io.h:37:0: note: this is the location of the previous definition
    #define in_be32(addr) \

vim +/out_be32 +43 drivers/media//platform/fsl-viu.c

  > 23	#include <linux/io.h>
    24	#include <linux/of_address.h>
    25	#include <linux/of_irq.h>
    26	#include <linux/of_platform.h>
    27	#include <linux/slab.h>
    28	#include <media/v4l2-common.h>
    29	#include <media/v4l2-device.h>
    30	#include <media/v4l2-ioctl.h>
    31	#include <media/v4l2-ctrls.h>
    32	#include <media/v4l2-fh.h>
    33	#include <media/v4l2-event.h>
    34	#include <media/videobuf-dma-contig.h>
    35	
    36	#define DRV_NAME		"fsl_viu"
    37	#define VIU_VERSION		"0.5.1"
    38	
    39	/* Allow building this driver with COMPILE_TEST */
    40	#ifndef CONFIG_PPC_MPC512x
    41	#define NO_IRQ   0
    42	
  > 43	#define out_be32(v, a)	writel(a, v)
  > 44	#define in_be32(a) readl(a)
    45	#endif
    46	

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

#25 lore raw

PATCH 6/16 media: cec_gpio: allow building CEC_GPIO with COMPILE_TEST

In reply to Mauro Carvalho Chehab

At least on i386, building with allyesconfig doesn't enable PREEMPT, causing cec_gpio to not build.

---
 drivers/media/platform/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/platform/Kconfig +1 -1
index e6eb1eb776e1..e8d8bbc976af 100644
@@ -558,7 +558,7 @@ config VIDEO_MESON_AO_CEC
 
 config CEC_GPIO
 	tristate "Generic GPIO-based CEC driver"
-	depends on PREEMPT
+	depends on PREEMPT || COMPILE_TEST
 	select CEC_CORE
 	select CEC_PIN
 	select GPIOLIB
Signature · 1 line
2.14.3
#26 lore raw

PATCH 7/16 media: exymos4-is: allow compile test for EXYNOS FIMC-LITE

In reply to Mauro Carvalho Chehab

There's nothing that prevents building this driver with COMPILE_TEST. So, enable it.

While here, make the Kconfig dependency cleaner by removing the unneeded if block.

---
 drivers/media/platform/exynos4-is/Kconfig | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/media/platform/exynos4-is/Kconfig +1 -3
index 7b2c49e5a592..c8e5ad8f8294 100644
@@ -41,11 +41,10 @@ config VIDEO_S5P_MIPI_CSIS
 	  To compile this driver as a module, choose M here: the
 	  module will be called s5p-csis.
 
-if SOC_EXYNOS4412 || SOC_EXYNOS5250
-
 config VIDEO_EXYNOS_FIMC_LITE
 	tristate "EXYNOS FIMC-LITE camera interface driver"
 	depends on I2C
+	depends on SOC_EXYNOS4412 || SOC_EXYNOS5250 || COMPILE_TEST
 	depends on HAS_DMA
 	select VIDEOBUF2_DMA_CONTIG
 	select VIDEO_EXYNOS4_IS_COMMON
@@ -55,7 +54,6 @@ config VIDEO_EXYNOS_FIMC_LITE
 
 	  To compile this driver as a module, choose M here: the
 	  module will be called exynos-fimc-lite.
-endif
 
 config VIDEO_EXYNOS4_FIMC_IS
 	tristate "EXYNOS4x12 FIMC-IS (Imaging Subsystem) driver"
Signature · 1 line
2.14.3
#27 lore raw

PATCH 7/16 media: exymos4-is: allow compile test for EXYNOS FIMC-LITE

Quoted 7 lines · Mauro Carvalho Chehab

There's nothing that prevents building this driver with COMPILE_TEST. So, enable it.

While here, make the Kconfig dependency cleaner by removing the unneeded if block.

With s/exymos4-is/exynos4-is in the subject

Signature · 2 lines
Regards,
Sylwester
#28 lore raw

PATCH 8/16 media: mmp-camera.h: add missing platform data

In reply to Mauro Carvalho Chehab

Those definitions used to be part of the original patch:

	https://patchwork.kernel.org/patch/2815221/

But, somehow, nobody ever noticed until today. Years later, Arnd discovered that mmp-camera driver doesn't build and make it depend on BROKEN.

Add the missing bits here, in order to remove BROKEN dependency.

---
 include/linux/platform_data/media/mmp-camera.h | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
include/linux/platform_data/media/mmp-camera.h +19 -0
index 83804028115c..d2d3a443eedf 100644
@@ -3,8 +3,27 @@
  * Information for the Marvell Armada MMP camera
  */
 
+#include <media/v4l2-mediabus.h>
+
+enum dphy3_algo {
+	DPHY3_ALGO_DEFAULT = 0,
+	DPHY3_ALGO_PXA910,
+	DPHY3_ALGO_PXA2128
+};
+
 struct mmp_camera_platform_data {
 	struct platform_device *i2c_device;
 	int sensor_power_gpio;
 	int sensor_reset_gpio;
+	enum v4l2_mbus_type bus_type;
+	int mclk_min;	/* The minimal value of MCLK */
+	int mclk_src;	/* which clock source the MCLK derives from */
+	int mclk_div;	/* Clock Divider Value for MCLK */
+	/*
+	 * MIPI support
+	 */
+	int dphy[3];		/* DPHY: CSI2_DPHY3, CSI2_DPHY5, CSI2_DPHY6 */
+	enum dphy3_algo dphy3_algo;	/* algos for calculate CSI2_DPHY3 */
+	int lane;		/* ccic used lane number; 0 means DVP mode */
+	int lane_clk;
 };
Signature · 1 line
2.14.3
#29 lore raw

PATCH 9/16 media: marvel-ccic: re-enable mmp-driver build

In reply to Mauro Carvalho Chehab

This driver was disabled back in 2015 from builds because of some troubles with the platform_data definition. Now that this got fixed, re-enable it.

---
 drivers/media/platform/marvell-ccic/Kconfig | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/media/platform/marvell-ccic/Kconfig +3 -2
index 4bf5bd1e90d6..21dacef7c2fc 100644
@@ -13,8 +13,9 @@ config VIDEO_CAFE_CCIC
 
 config VIDEO_MMP_CAMERA
 	tristate "Marvell Armada 610 integrated camera controller support"
-	depends on ARCH_MMP && I2C && VIDEO_V4L2
-	depends on HAS_DMA && BROKEN
+	depends on I2C && VIDEO_V4L2
+	depends on HAS_DMA
+	depends on ARCH_MMP || COMPILE_TEST
 	select VIDEO_OV7670
 	select I2C_GPIO
 	select VIDEOBUF2_DMA_SG
Signature · 1 line
2.14.3
#30 lore raw

PATCH 10/16 media: mmp-driver: make two functions static

In reply to Mauro Carvalho Chehab

Those functions are used only internally:

CC drivers/media/platform/marvell-ccic/mmp-driver.o
drivers/media/platform/marvell-ccic/mmp-driver.c:186:6: warning: no previous prototype for ‘mcam_ctlr_reset’ [-Wmissing-prototypes]
void mcam_ctlr_reset(struct mcam_camera *mcam)

      ^~~~~~~~~~~~~~~
drivers/media/platform/marvell-ccic/mmp-driver.c:217:6: warning: no previous prototype for ‘mmpcam_calc_dphy’ [-Wmissing-prototypes]
 void mmpcam_calc_dphy(struct mcam_camera *mcam)
      ^~~~~~~~~~~~~~~~
---
 drivers/media/platform/marvell-ccic/mmp-driver.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/media/platform/marvell-ccic/mmp-driver.c +2 -2
index 816f4b6a7b8e..17d79480e75c 100644
@@ -183,7 +183,7 @@ static void mmpcam_power_down(struct mcam_camera *mcam)
 	mcam_clk_disable(mcam);
 }
 
-void mcam_ctlr_reset(struct mcam_camera *mcam)
+static void mcam_ctlr_reset(struct mcam_camera *mcam)
 {
 	unsigned long val;
 	struct mmp_camera *cam = mcam_to_cam(mcam);
@@ -214,7 +214,7 @@ void mcam_ctlr_reset(struct mcam_camera *mcam)
  * CSI2_DPHY3 and CSI2_DPHY6 can be set with a default value
  * or be calculated dynamically
  */
-void mmpcam_calc_dphy(struct mcam_camera *mcam)
+static void mmpcam_calc_dphy(struct mcam_camera *mcam)
 {
 	struct mmp_camera *cam = mcam_to_cam(mcam);
 	struct mmp_camera_platform_data *pdata = cam->pdev->dev.platform_data;
Signature · 1 line
2.14.3
#31 lore raw

PATCH 11/16 media: davinci: allow building isif code

In reply to Mauro Carvalho Chehab

The only reason why this driver doesn't build with COMPILE_TEST is because it includes mach/mux.h. It turns that none of the macros defined there are used.

So, get rid of it, in order to allow it to build with COMPILE_TEST.

---
 drivers/media/platform/davinci/Kconfig | 3 ++-
 drivers/media/platform/davinci/isif.c  | 2 --
 2 files changed, 2 insertions(+), 3 deletions(-)
drivers/media/platform/davinci/Kconfig +2 -1
index 55982e681d77..babdb4877b3f 100644
@@ -67,7 +67,8 @@ config VIDEO_DM355_CCDC
 
 config VIDEO_DM365_ISIF
 	tristate "TI DM365 ISIF video capture driver"
-	depends on VIDEO_V4L2 && ARCH_DAVINCI
+	depends on VIDEO_V4L2
+	depends on ARCH_DAVINCI || COMPILE_TEST
 	depends on HAS_DMA
 	depends on I2C
 	select VIDEOBUF_DMA_CONTIG
drivers/media/platform/davinci/isif.c +0 -2
index d5ff58494c1e..b14caadcd0df 100644
@@ -31,8 +31,6 @@
 #include <linux/err.h>
 #include <linux/module.h>
 
-#include <mach/mux.h>
-
 #include <media/davinci/isif.h>
 #include <media/davinci/vpss.h>
 
Signature · 1 line
2.14.3
#32 lore raw

PATCH 12/16 media: davinci: allow build vpbe_display with COMPILE_TEST

In reply to Mauro Carvalho Chehab

Except for some includes (with doesn't seem to be used), this driver builds fine with COMPILE_TEST.

So, add checks there to avoid building it if ARCH_DAVINCI is not selected.

---
 drivers/media/platform/davinci/Kconfig        | 3 ++-
 drivers/media/platform/davinci/vpbe_display.c | 3 +++
 drivers/media/platform/davinci/vpbe_osd.c     | 2 ++
 drivers/media/platform/davinci/vpbe_venc.c    | 3 +++
 4 files changed, 10 insertions(+), 1 deletion(-)
drivers/media/platform/davinci/Kconfig +2 -1
index babdb4877b3f..b463d1726335 100644
@@ -82,7 +82,8 @@ config VIDEO_DM365_ISIF
 
 config VIDEO_DAVINCI_VPBE_DISPLAY
 	tristate "TI DaVinci VPBE V4L2-Display driver"
-	depends on VIDEO_V4L2 && ARCH_DAVINCI
+	depends on VIDEO_V4L2
+	depends on ARCH_DAVINCI || COMPILE_TEST
 	depends on HAS_DMA
 	depends on I2C
 	select VIDEOBUF2_DMA_CONTIG
drivers/media/platform/davinci/vpbe_display.c +3 -0
index 6aabd21fe69f..7b6cd4b3ccc4 100644
@@ -26,7 +26,10 @@
 #include <linux/slab.h>
 
 #include <asm/pgtable.h>
+
+#ifdef CONFIG_ARCH_DAVINCI
 #include <mach/cputype.h>
+#endif
 
 #include <media/v4l2-dev.h>
 #include <media/v4l2-common.h>
drivers/media/platform/davinci/vpbe_osd.c +2 -0
index 66449791c70c..10f2bf11edf3 100644
@@ -24,8 +24,10 @@
 #include <linux/clk.h>
 #include <linux/slab.h>
 
+#ifdef CONFIG_ARCH_DAVINCI
 #include <mach/cputype.h>
 #include <mach/hardware.h>
+#endif
 
 #include <media/davinci/vpss.h>
 #include <media/v4l2-device.h>
drivers/media/platform/davinci/vpbe_venc.c +3 -0
index 3a4e78595149..add72a39ef2d 100644
@@ -21,8 +21,11 @@
 #include <linux/videodev2.h>
 #include <linux/slab.h>
 
+#ifdef CONFIG_ARCH_DAVINCI
 #include <mach/hardware.h>
 #include <mach/mux.h>
+#endif
+
 #include <linux/platform_data/i2c-davinci.h>
 
 #include <linux/io.h>
Signature · 1 line
2.14.3
#33 lore raw

PATCH 13/16 media: vpbe_venc: don't store return codes if they won't be used

In reply to Mauro Carvalho Chehab

Fix those two warnings

drivers/media/platform/davinci/vpbe_venc.c: In function ‘venc_set_ntsc’:
drivers/media/platform/davinci/vpbe_venc.c:230:6: warning: variable ‘val’ set but not used [-Wunused-but-set-variable]

  u32 val;
      ^~~
drivers/media/platform/davinci/vpbe_venc.c: In function ‘venc_sub_dev_init’:
drivers/media/platform/davinci/vpbe_venc.c:611:6: warning: variable ‘err’ set but not used [-Wunused-but-set-variable]
  int err;
      ^~~

AR drivers/media/platform/davinci/built-in.a

---
 drivers/media/platform/davinci/vpbe_venc.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/media/platform/davinci/vpbe_venc.c +2 -4
index add72a39ef2d..5c255de3b3f8 100644
@@ -227,7 +227,6 @@ venc_enable_vpss_clock(int venc_type,
  */
 static int venc_set_ntsc(struct v4l2_subdev *sd)
 {
-	u32 val;
 	struct venc_state *venc = to_state(sd);
 	struct venc_platform_data *pdata = venc->pdata;
 
@@ -244,7 +243,7 @@ static int venc_set_ntsc(struct v4l2_subdev *sd)
 	if (venc->venc_type == VPBE_VERSION_3) {
 		venc_write(sd, VENC_CLKCTL, 0x01);
 		venc_write(sd, VENC_VIDCTL, 0);
-		val = vdaccfg_write(sd, VDAC_CONFIG_SD_V3);
+		vdaccfg_write(sd, VDAC_CONFIG_SD_V3);
 	} else if (venc->venc_type == VPBE_VERSION_2) {
 		venc_write(sd, VENC_CLKCTL, 0x01);
 		venc_write(sd, VENC_VIDCTL, 0);
@@ -608,9 +607,8 @@ struct v4l2_subdev *venc_sub_dev_init(struct v4l2_device *v4l2_dev,
 		const char *venc_name)
 {
 	struct venc_state *venc;
-	int err;
 
-	err = bus_for_each_dev(&platform_bus_type, NULL, &venc,
+	bus_for_each_dev(&platform_bus_type, NULL, &venc,
 			venc_device_get);
 	if (venc == NULL)
 		return NULL;
Signature · 1 line
2.14.3
#34 lore raw

PATCH 14/16 media: davinci: get rid of lots of kernel-doc warnings

In reply to Mauro Carvalho Chehab

Driver build produce lots of warnings due to wrong kernel-doc markups:

drivers/media/platform/davinci/vpbe.c:60: warning: Function parameter or member 'vpbe_dev' not described in 'vpbe_current_encoder_info' drivers/media/platform/davinci/vpbe.c:78: warning: Function parameter or member 'cfg' not described in 'vpbe_find_encoder_sd_index' drivers/media/platform/davinci/vpbe.c:78: warning: Function parameter or member 'index' not described in 'vpbe_find_encoder_sd_index' drivers/media/platform/davinci/vpbe.c:105: warning: Function parameter or member 'vpbe_dev' not described in 'vpbe_g_cropcap' drivers/media/platform/davinci/vpbe.c:105: warning: Function parameter or member 'cropcap' not described in 'vpbe_g_cropcap' drivers/media/platform/davinci/vpbe.c:127: warning: Function parameter or member 'vpbe_dev' not described in 'vpbe_enum_outputs' drivers/media/platform/davinci/vpbe.c:127: warning: Function parameter or member 'output' not described in 'vpbe_enum_outputs' drivers/media/platform/davinci/vpbe.c:221: warning: Function parameter or member 'vpbe_dev' not described in 'vpbe_set_output' drivers/media/platform/davinci/vpbe.c:221: warning: Function parameter or member 'index' not described in 'vpbe_set_output' drivers/media/platform/davinci/vpbe.c:316: warning: Function parameter or member 'vpbe_dev' not described in 'vpbe_get_output' drivers/media/platform/davinci/vpbe.c:328: warning: Function parameter or member 'vpbe_dev' not described in 'vpbe_s_dv_timings' drivers/media/platform/davinci/vpbe.c:328: warning: Function parameter or member 'dv_timings' not described in 'vpbe_s_dv_timings' drivers/media/platform/davinci/vpbe.c:380: warning: Function parameter or member 'vpbe_dev' not described in 'vpbe_g_dv_timings' drivers/media/platform/davinci/vpbe.c:380: warning: Function parameter or member 'dv_timings' not described in 'vpbe_g_dv_timings' drivers/media/platform/davinci/vpbe.c:405: warning: Function parameter or member 'vpbe_dev' not described in 'vpbe_enum_dv_timings' drivers/media/platform/davinci/vpbe.c:405: warning: Function parameter or member 'timings' not described in 'vpbe_enum_dv_timings' drivers/media/platform/davinci/vpbe.c:436: warning: Function parameter or member 'vpbe_dev' not described in 'vpbe_s_std' drivers/media/platform/davinci/vpbe.c:436: warning: Function parameter or member 'std_id' not described in 'vpbe_s_std' drivers/media/platform/davinci/vpbe.c:475: warning: Function parameter or member 'vpbe_dev' not described in 'vpbe_g_std' drivers/media/platform/davinci/vpbe.c:475: warning: Function parameter or member 'std_id' not described in 'vpbe_g_std' drivers/media/platform/davinci/vpbe.c:500: warning: Function parameter or member 'vpbe_dev' not described in 'vpbe_set_mode' drivers/media/platform/davinci/vpbe.c:500: warning: Function parameter or member 'mode_info' not described in 'vpbe_set_mode' drivers/media/platform/davinci/vpbe.c:585: warning: Function parameter or member 'dev' not described in 'vpbe_initialize' drivers/media/platform/davinci/vpbe.c:585: warning: Function parameter or member 'vpbe_dev' not described in 'vpbe_initialize' drivers/media/platform/davinci/vpbe.c:779: warning: Function parameter or member 'dev' not described in 'vpbe_deinitialize' drivers/media/platform/davinci/vpbe.c:779: warning: Function parameter or member 'vpbe_dev' not described in 'vpbe_deinitialize' drivers/media/platform/davinci/vpbe_osd.c:144: warning: Function parameter or member 'sd' not described in '_osd_dm6446_vid0_pingpong' drivers/media/platform/davinci/vpbe_osd.c:144: warning: Function parameter or member 'field_inversion' not described in '_osd_dm6446_vid0_pingpong' drivers/media/platform/davinci/vpbe_osd.c:144: warning: Function parameter or member 'fb_base_phys' not described in '_osd_dm6446_vid0_pingpong' drivers/media/platform/davinci/vpbe_osd.c:144: warning: Function parameter or member 'lconfig' not described in '_osd_dm6446_vid0_pingpong' drivers/media/platform/davinci/vpbe_osd.c:799: warning: Function parameter or member 'sd' not described in 'try_layer_config' drivers/media/platform/davinci/vpbe_osd.c:799: warning: Function parameter or member 'layer' not described in 'try_layer_config' drivers/media/platform/davinci/vpbe_osd.c:799: warning: Function parameter or member 'lconfig' not described in 'try_layer_config' drivers/media/platform/davinci/vpbe_display.c:578: warning: Function parameter or member 'disp_dev' not described in 'vpbe_try_format' drivers/media/platform/davinci/vpbe_display.c:578: warning: Function parameter or member 'pixfmt' not described in 'vpbe_try_format' drivers/media/platform/davinci/vpbe_display.c:578: warning: Function parameter or member 'check' not described in 'vpbe_try_format' drivers/media/platform/davinci/vpbe_display.c:943: warning: Function parameter or member 'file' not described in 'vpbe_display_s_std' drivers/media/platform/davinci/vpbe_display.c:943: warning: Function parameter or member 'priv' not described in 'vpbe_display_s_std' drivers/media/platform/davinci/vpbe_display.c:943: warning: Function parameter or member 'std_id' not described in 'vpbe_display_s_std' drivers/media/platform/davinci/vpbe_display.c:975: warning: Function parameter or member 'file' not described in 'vpbe_display_g_std' drivers/media/platform/davinci/vpbe_display.c:975: warning: Function parameter or member 'priv' not described in 'vpbe_display_g_std' drivers/media/platform/davinci/vpbe_display.c:975: warning: Function parameter or member 'std_id' not described in 'vpbe_display_g_std' drivers/media/platform/davinci/vpbe_display.c:998: warning: Function parameter or member 'file' not described in 'vpbe_display_enum_output' drivers/media/platform/davinci/vpbe_display.c:998: warning: Function parameter or member 'priv' not described in 'vpbe_display_enum_output' drivers/media/platform/davinci/vpbe_display.c:998: warning: Function parameter or member 'output' not described in 'vpbe_display_enum_output' drivers/media/platform/davinci/vpbe_display.c:1025: warning: Function parameter or member 'file' not described in 'vpbe_display_s_output' drivers/media/platform/davinci/vpbe_display.c:1025: warning: Function parameter or member 'priv' not described in 'vpbe_display_s_output' drivers/media/platform/davinci/vpbe_display.c:1025: warning: Function parameter or member 'i' not described in 'vpbe_display_s_output' drivers/media/platform/davinci/vpbe_display.c:1054: warning: Function parameter or member 'file' not described in 'vpbe_display_g_output' drivers/media/platform/davinci/vpbe_display.c:1054: warning: Function parameter or member 'priv' not described in 'vpbe_display_g_output' drivers/media/platform/davinci/vpbe_display.c:1054: warning: Function parameter or member 'i' not described in 'vpbe_display_g_output' drivers/media/platform/davinci/vpbe_display.c:1074: warning: Function parameter or member 'file' not described in 'vpbe_display_enum_dv_timings' drivers/media/platform/davinci/vpbe_display.c:1074: warning: Function parameter or member 'priv' not described in 'vpbe_display_enum_dv_timings' drivers/media/platform/davinci/vpbe_display.c:1074: warning: Function parameter or member 'timings' not described in 'vpbe_display_enum_dv_timings' drivers/media/platform/davinci/vpbe_display.c:1104: warning: Function parameter or member 'file' not described in 'vpbe_display_s_dv_timings' drivers/media/platform/davinci/vpbe_display.c:1104: warning: Function parameter or member 'priv' not described in 'vpbe_display_s_dv_timings' drivers/media/platform/davinci/vpbe_display.c:1104: warning: Function parameter or member 'timings' not described in 'vpbe_display_s_dv_timings' drivers/media/platform/davinci/vpbe_display.c:1137: warning: Function parameter or member 'file' not described in 'vpbe_display_g_dv_timings' drivers/media/platform/davinci/vpbe_display.c:1137: warning: Function parameter or member 'priv' not described in 'vpbe_display_g_dv_timings' drivers/media/platform/davinci/vpbe_display.c:1137: warning: Function parameter or member 'dv_timings' not described in 'vpbe_display_g_dv_timings'

---
 drivers/media/platform/davinci/vpbe.c         | 38 ++++++++++++++-------------
 drivers/media/platform/davinci/vpbe_display.c | 18 ++++++-------
 drivers/media/platform/davinci/vpbe_osd.c     | 14 +++++-----
 3 files changed, 36 insertions(+), 34 deletions(-)
drivers/media/platform/davinci/vpbe.c +20 -18
index 7f6462562579..18c035ef84cf 100644
@@ -51,7 +51,7 @@ MODULE_AUTHOR("Texas Instruments");
 
 /**
  * vpbe_current_encoder_info - Get config info for current encoder
- * @vpbe_dev - vpbe device ptr
+ * @vpbe_dev: vpbe device ptr
  *
  * Return ptr to current encoder config info
  */
@@ -68,8 +68,8 @@ vpbe_current_encoder_info(struct vpbe_device *vpbe_dev)
 /**
  * vpbe_find_encoder_sd_index - Given a name find encoder sd index
  *
- * @vpbe_config - ptr to vpbe cfg
- * @output_index - index used by application
+ * @cfg: ptr to vpbe cfg
+ * @index: index used by application
  *
  * Return sd index of the encoder
  */
@@ -94,8 +94,8 @@ static int vpbe_find_encoder_sd_index(struct vpbe_config *cfg,
 
 /**
  * vpbe_g_cropcap - Get crop capabilities of the display
- * @vpbe_dev - vpbe device ptr
- * @cropcap - cropcap is a ptr to struct v4l2_cropcap
+ * @vpbe_dev: vpbe device ptr
+ * @cropcap: cropcap is a ptr to struct v4l2_cropcap
  *
  * Update the crop capabilities in crop cap for current
  * mode
@@ -116,8 +116,8 @@ static int vpbe_g_cropcap(struct vpbe_device *vpbe_dev,
 
 /**
  * vpbe_enum_outputs - enumerate outputs
- * @vpbe_dev - vpbe device ptr
- * @output - ptr to v4l2_output structure
+ * @vpbe_dev: vpbe device ptr
+ * @output: ptr to v4l2_output structure
  *
  * Enumerates the outputs available at the vpbe display
  * returns the status, -EINVAL if end of output list
@@ -212,8 +212,8 @@ static int vpbe_get_std_info_by_name(struct vpbe_device *vpbe_dev,
 
 /**
  * vpbe_set_output - Set output
- * @vpbe_dev - vpbe device ptr
- * @index - index of output
+ * @vpbe_dev: vpbe device ptr
+ * @index: index of output
  *
  * Set vpbe output to the output specified by the index
  */
@@ -308,7 +308,7 @@ static int vpbe_set_default_output(struct vpbe_device *vpbe_dev)
 
 /**
  * vpbe_get_output - Get output
- * @vpbe_dev - vpbe device ptr
+ * @vpbe_dev: vpbe device ptr
  *
  * return current vpbe output to the the index
  */
@@ -317,7 +317,7 @@ static unsigned int vpbe_get_output(struct vpbe_device *vpbe_dev)
 	return vpbe_dev->current_out_index;
 }
 
-/**
+/*
  * vpbe_s_dv_timings - Set the given preset timings in the encoder
  *
  * Sets the timings if supported by the current encoder. Return the status.
@@ -369,7 +369,7 @@ static int vpbe_s_dv_timings(struct vpbe_device *vpbe_dev,
 	return ret;
 }
 
-/**
+/*
  * vpbe_g_dv_timings - Get the timings in the current encoder
  *
  * Get the timings in the current encoder. Return the status. 0 - success
@@ -394,7 +394,7 @@ static int vpbe_g_dv_timings(struct vpbe_device *vpbe_dev,
 	return -EINVAL;
 }
 
-/**
+/*
  * vpbe_enum_dv_timings - Enumerate the dv timings in the current encoder
  *
  * Get the timings in the current encoder. Return the status. 0 - success
@@ -426,7 +426,7 @@ static int vpbe_enum_dv_timings(struct vpbe_device *vpbe_dev,
 	return 0;
 }
 
-/**
+/*
  * vpbe_s_std - Set the given standard in the encoder
  *
  * Sets the standard if supported by the current encoder. Return the status.
@@ -465,7 +465,7 @@ static int vpbe_s_std(struct vpbe_device *vpbe_dev, v4l2_std_id std_id)
 	return ret;
 }
 
-/**
+/*
  * vpbe_g_std - Get the standard in the current encoder
  *
  * Get the standard in the current encoder. Return the status. 0 - success
@@ -488,7 +488,7 @@ static int vpbe_g_std(struct vpbe_device *vpbe_dev, v4l2_std_id *std_id)
 	return -EINVAL;
 }
 
-/**
+/*
  * vpbe_set_mode - Set mode in the current encoder using mode info
  *
  * Use the mode string to decide what timings to set in the encoder
@@ -572,7 +572,8 @@ static int platform_device_get(struct device *dev, void *data)
 
 /**
  * vpbe_initialize() - Initialize the vpbe display controller
- * @vpbe_dev - vpbe device ptr
+ * @dev: Master and slave device ptr
+ * @vpbe_dev: vpbe device ptr
  *
  * Master frame buffer device drivers calls this to initialize vpbe
  * display controller. This will then registers v4l2 device and the sub
@@ -769,7 +770,8 @@ static int vpbe_initialize(struct device *dev, struct vpbe_device *vpbe_dev)
 
 /**
  * vpbe_deinitialize() - de-initialize the vpbe display controller
- * @dev - Master and slave device ptr
+ * @dev: Master and slave device ptr
+ * @vpbe_dev: vpbe device ptr
  *
  * vpbe_master and slave frame buffer devices calls this to de-initialize
  * the display controller. It is called when master and slave device
drivers/media/platform/davinci/vpbe_display.c +9 -9
index 7b6cd4b3ccc4..9849e4405a6a 100644
@@ -567,7 +567,7 @@ static void vpbe_disp_check_window_params(struct vpbe_display *disp_dev,
 
 }
 
-/**
+/*
  * vpbe_try_format()
  * If user application provides width and height, and have bytesperline set
  * to zero, driver calculates bytesperline and sizeimage based on hardware
@@ -932,7 +932,7 @@ static int vpbe_display_try_fmt(struct file *file, void *priv,
 
 }
 
-/**
+/*
  * vpbe_display_s_std - Set the given standard in the encoder
  *
  * Sets the standard if supported by the current encoder. Return the status.
@@ -964,7 +964,7 @@ static int vpbe_display_s_std(struct file *file, void *priv,
 	return 0;
 }
 
-/**
+/*
  * vpbe_display_g_std - Get the standard in the current encoder
  *
  * Get the standard in the current encoder. Return the status. 0 - success
@@ -987,7 +987,7 @@ static int vpbe_display_g_std(struct file *file, void *priv,
 	return -EINVAL;
 }
 
-/**
+/*
  * vpbe_display_enum_output - enumerate outputs
  *
  * Enumerates the outputs available at the vpbe display
@@ -1016,7 +1016,7 @@ static int vpbe_display_enum_output(struct file *file, void *priv,
 	return 0;
 }
 
-/**
+/*
  * vpbe_display_s_output - Set output to
  * the output specified by the index
  */
@@ -1045,7 +1045,7 @@ static int vpbe_display_s_output(struct file *file, void *priv,
 	return 0;
 }
 
-/**
+/*
  * vpbe_display_g_output - Get output from subdevice
  * for a given by the index
  */
@@ -1062,7 +1062,7 @@ static int vpbe_display_g_output(struct file *file, void *priv,
 	return 0;
 }
 
-/**
+/*
  * vpbe_display_enum_dv_timings - Enumerate the dv timings
  *
  * enum the timings in the current encoder. Return the status. 0 - success
@@ -1092,7 +1092,7 @@ vpbe_display_enum_dv_timings(struct file *file, void *priv,
 	return 0;
 }
 
-/**
+/*
  * vpbe_display_s_dv_timings - Set the dv timings
  *
  * Set the timings in the current encoder. Return the status. 0 - success
@@ -1125,7 +1125,7 @@ vpbe_display_s_dv_timings(struct file *file, void *priv,
 	return 0;
 }
 
-/**
+/*
  * vpbe_display_g_dv_timings - Set the dv timings
  *
  * Get the timings in the current encoder. Return the status. 0 - success
drivers/media/platform/davinci/vpbe_osd.c +7 -7
index 10f2bf11edf3..99a4ec183ba9 100644
@@ -124,10 +124,10 @@ static inline u32 osd_modify(struct osd_state *sd, u32 mask, u32 val,
 
 /**
  * _osd_dm6446_vid0_pingpong() - field inversion fix for DM6446
- * @sd - ptr to struct osd_state
- * @field_inversion - inversion flag
- * @fb_base_phys - frame buffer address
- * @lconfig - ptr to layer config
+ * @sd: ptr to struct osd_state
+ * @field_inversion: inversion flag
+ * @fb_base_phys: frame buffer address
+ * @lconfig: ptr to layer config
  *
  * This routine implements a workaround for the field signal inversion silicon
  * erratum described in Advisory 1.3.8 for the DM6446.  The fb_base_phys and
@@ -784,9 +784,9 @@ static void osd_get_layer_config(struct osd_state *sd, enum osd_layer layer,
 
 /**
  * try_layer_config() - Try a specific configuration for the layer
- * @sd  - ptr to struct osd_state
- * @layer - layer to configure
- * @lconfig - layer configuration to try
+ * @sd: ptr to struct osd_state
+ * @layer: layer to configure
+ * @lconfig: layer configuration to try
  *
  * If the requested lconfig is completely rejected and the value of lconfig on
  * exit is the current lconfig, then try_layer_config() returns 1.  Otherwise,
Signature · 1 line
2.14.3
#35 lore raw

PATCH 15/16 media: omapfb_dss.h: add stubs to build with COMPILE_TEST

In reply to Mauro Carvalho Chehab

Add stubs for omapfb_dss.h, in the case it is included by some driver when CONFIG_FB_OMAP2 is not defined.

That allows building such driver(s) with COMPILE_TEST.

---
 include/video/omapfb_dss.h | 54 ++++++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 52 insertions(+), 2 deletions(-)
include/video/omapfb_dss.h +52 -2
index 1d38901d599d..e9775144ff3b 100644
@@ -774,6 +774,12 @@ struct omap_dss_driver {
 		const struct hdmi_avi_infoframe *avi);
 };
 
+#define for_each_dss_dev(d) while ((d = omap_dss_get_next_device(d)) != NULL)
+
+typedef void (*omap_dispc_isr_t) (void *arg, u32 mask);
+
+#ifdef CONFIG_FB_OMAP2
+
 enum omapdss_version omapdss_get_version(void);
 bool omapdss_is_initialized(void);
 
@@ -785,7 +791,6 @@ void omapdss_unregister_display(struct omap_dss_device *dssdev);
 
 struct omap_dss_device *omap_dss_get_device(struct omap_dss_device *dssdev);
 void omap_dss_put_device(struct omap_dss_device *dssdev);
-#define for_each_dss_dev(d) while ((d = omap_dss_get_next_device(d)) != NULL)
 struct omap_dss_device *omap_dss_get_next_device(struct omap_dss_device *from);
 struct omap_dss_device *omap_dss_find_device(void *data,
 		int (*match)(struct omap_dss_device *dssdev, void *data));
@@ -826,7 +831,6 @@ int omapdss_default_get_recommended_bpp(struct omap_dss_device *dssdev);
 void omapdss_default_get_timings(struct omap_dss_device *dssdev,
 		struct omap_video_timings *timings);
 
-typedef void (*omap_dispc_isr_t) (void *arg, u32 mask);
 int omap_dispc_register_isr(omap_dispc_isr_t isr, void *arg, u32 mask);
 int omap_dispc_unregister_isr(omap_dispc_isr_t isr, void *arg, u32 mask);
 
@@ -856,5 +860,51 @@ omapdss_of_get_first_endpoint(const struct device_node *parent);
 
 struct omap_dss_device *
 omapdss_of_find_source_for_first_ep(struct device_node *node);
+#else
+
+static inline enum omapdss_version omapdss_get_version(void)
+{ return OMAPDSS_VER_UNKNOWN; };
+
+static inline bool omapdss_is_initialized(void)
+{ return false; };
+
+static inline int omap_dispc_register_isr(omap_dispc_isr_t isr,
+					  void *arg, u32 mask)
+{ return 0; };
+
+static inline int omap_dispc_unregister_isr(omap_dispc_isr_t isr,
+					    void *arg, u32 mask)
+{ return 0; };
+
+static inline struct omap_dss_device
+*omap_dss_get_device(struct omap_dss_device *dssdev)
+{ return NULL; };
+
+static inline struct omap_dss_device
+*omap_dss_get_next_device(struct omap_dss_device *from)
+{return NULL; };
+
+static inline void omap_dss_put_device(struct omap_dss_device *dssdev) {};
+
+static inline int omapdss_compat_init(void)
+{ return 0; };
+
+static inline void omapdss_compat_uninit(void) {};
+
+static inline int omap_dss_get_num_overlay_managers(void)
+{ return 0; };
+
+static inline struct omap_overlay_manager *omap_dss_get_overlay_manager(int num)
+{ return NULL; };
+
+static inline int omap_dss_get_num_overlays(void)
+{ return 0; };
+
+static inline struct omap_overlay *omap_dss_get_overlay(int num)
+{ return NULL; };
+
+
+#endif /* FB_OMAP2 */
+
 
 #endif /* __OMAPFB_DSS_H */
Signature · 1 line
2.14.3
#36 lore raw

Re: [PATCH 15/16] media: omapfb_dss.h: add stubs to build with COMPILE_TEST

Hi Mauro,

Thank you for the patch.

Quoted 2 lines · On Thursday, 5 April 2018 20:54:15 EEST Mauro Carvalho Chehab wrote:

Add stubs for omapfb_dss.h, in the case it is included by some driver when CONFIG_FB_OMAP2 is not defined.

The omapfb driver doesn't include any asm/ header, so it should probably build fine on non-ARM architectures. Instead of adding stubs here, you can enable compilation of the driver on all platforms, in which case the omap_vout driver could keep depending on FB_OMAP2 as it should.

Quoted 94 lines

That allows building such driver(s) with COMPILE_TEST.

---
 include/video/omapfb_dss.h | 54 +++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 52 insertions(+), 2 deletions(-)
include/video/omapfb_dss.h +5 -1
index 1d38901d599d..e9775144ff3b 100644
@@ -774,6 +774,12 @@ struct omap_dss_driver {
 		const struct hdmi_avi_infoframe *avi);
 };
 
+#define for_each_dss_dev(d) while ((d = omap_dss_get_next_device(d)) !> NULL) +
+typedef void (*omap_dispc_isr_t) (void *arg, u32 mask);
+
+#ifdef CONFIG_FB_OMAP2
+
 enum omapdss_version omapdss_get_version(void);
 bool omapdss_is_initialized(void);
 
@@ -785,7 +791,6 @@ void omapdss_unregister_display(struct omap_dss_device
 *dssdev);
 
 struct omap_dss_device *omap_dss_get_device(struct omap_dss_device
 *dssdev); void omap_dss_put_device(struct omap_dss_device *dssdev);
-#define for_each_dss_dev(d) while ((d = omap_dss_get_next_device(d)) !> NULL) struct omap_dss_device *omap_dss_get_next_device(struct

omap_dss_device *from); struct omap_dss_device *omap_dss_find_device(void *data,

include/video/omapfb_dss.h +0 -0
 		int (*match)(struct omap_dss_device *dssdev, void *data));
@@ -826,7 +831,6 @@ int omapdss_default_get_recommended_bpp(struct

omap_dss_device *dssdev); void omapdss_default_get_timings(struct omap_dss_device *dssdev,

include/video/omapfb_dss.h +45 -1
 		struct omap_video_timings *timings);
 
-typedef void (*omap_dispc_isr_t) (void *arg, u32 mask);
 int omap_dispc_register_isr(omap_dispc_isr_t isr, void *arg, u32 mask);
 int omap_dispc_unregister_isr(omap_dispc_isr_t isr, void *arg, u32 mask);
@@ -856,5 +860,51 @@ omapdss_of_get_first_endpoint(const struct device_node
 *parent);
 
 struct omap_dss_device *
 omapdss_of_find_source_for_first_ep(struct device_node *node);
+#else
+
+static inline enum omapdss_version omapdss_get_version(void)
+{ return OMAPDSS_VER_UNKNOWN; };
+
+static inline bool omapdss_is_initialized(void)
+{ return false; };
+
+static inline int omap_dispc_register_isr(omap_dispc_isr_t isr,
+					  void *arg, u32 mask)
+{ return 0; };
+
+static inline int omap_dispc_unregister_isr(omap_dispc_isr_t isr,
+					    void *arg, u32 mask)
+{ return 0; };
+
+static inline struct omap_dss_device
+*omap_dss_get_device(struct omap_dss_device *dssdev)
+{ return NULL; };
+
+static inline struct omap_dss_device
+*omap_dss_get_next_device(struct omap_dss_device *from)
+{return NULL; };
+
+static inline void omap_dss_put_device(struct omap_dss_device *dssdev) {};
+
+static inline int omapdss_compat_init(void)
+{ return 0; };
+
+static inline void omapdss_compat_uninit(void) {};
+
+static inline int omap_dss_get_num_overlay_managers(void)
+{ return 0; };
+
+static inline struct omap_overlay_manager *omap_dss_get_overlay_manager(int
 num) +{ return NULL; };
+
+static inline int omap_dss_get_num_overlays(void)
+{ return 0; };
+
+static inline struct omap_overlay *omap_dss_get_overlay(int num)
+{ return NULL; };
+
+
+#endif /* FB_OMAP2 */
+
 
 #endif /* __OMAPFB_DSS_H */
Signature · 3 lines
Regards,

Laurent Pinchart
#37 lore raw

Re: [PATCH 15/16] media: omapfb_dss.h: add stubs to build with COMPILE_TEST

Em Thu, 05 Apr 2018 21:41:18 +0300
Laurent Pinchart <[email protected]> escreveu:

Quoted 4 lines

Hi Mauro,

Thank you for the patch.

Quoted 8 lines
Quoted 2 lines · On Thursday, 5 April 2018 20:54:15 EEST Mauro Carvalho Chehab wrote:

Add stubs for omapfb_dss.h, in the case it is included by some driver when CONFIG_FB_OMAP2 is not defined.

The omapfb driver doesn't include any asm/ header, so it should probably build fine on non-ARM architectures. Instead of adding stubs here, you can enable compilation of the driver on all platforms, in which case the omap_vout driver could keep depending on FB_OMAP2 as it should.

True. The patch for that is simple.

Patch enclosed. Please notice that, now with W=1, several new warnings will popup. I'll let to the others to touch there, as I don't have any clue about what's there under omapfb.

Those are the new warnings:

drivers/video/fbdev/omap2/omapfb/omapfb-main.c: In function ‘omapfb_setup_overlay’:
drivers/video/fbdev/omap2/omapfb/omapfb-main.c:891:6: warning: this statement may fall through [-Wimplicit-fallthrough=]

   if (ofbi->rotation_type = OMAP_DSS_ROT_VRFB) {
      ^

drivers/video/fbdev/omap2/omapfb/omapfb-main.c:896:2: note: here
default:
^~~~~~~
drivers/video/fbdev/omap2/omapfb/displays/encoder-tpd12s015.c: In function ‘tpd_probe’:
drivers/video/fbdev/omap2/omapfb/displays/encoder-tpd12s015.c:221:26: warning: variable ‘in’ set but not used [-Wunused-but-set-variable]

  struct omap_dss_device *in, *dssdev;
                          ^~
drivers/video/fbdev/omap2/omapfb/dss/dispc.c: In function ‘calc_vrfb_rotation_offset’:
drivers/video/fbdev/omap2/omapfb/dss/dispc.c:1905:6: warning: this statement may fall through [-Wimplicit-fallthrough=]
   if (color_mode = OMAP_DSS_COLOR_YUV2 ||
      ^

drivers/video/fbdev/omap2/omapfb/dss/dispc.c:1908:2: note: here
case OMAP_DSS_ROT_90:
^~~~
drivers/video/fbdev/omap2/omapfb/dss/dispc.c:1927:6: warning: this statement may fall through [-Wimplicit-fallthrough=]
if (color_mode = OMAP_DSS_COLOR_YUV2 ||

      ^

drivers/video/fbdev/omap2/omapfb/dss/dispc.c:1930:2: note: here
case OMAP_DSS_ROT_90 + 4:
^~~~
drivers/video/fbdev/omap2/omapfb/dss/venc.c:223:33: warning: ‘venc_config_pal_bdghi’ defined but not used [-Wunused-const-variable=]

 static const struct venc_config venc_config_pal_bdghi = {
                                 ^~~~~~~~~~~~~~~~~~~~~
drivers/video/fbdev/omap2/omapfb/dss/dsi.c: In function ‘_dsi_print_reset_status’:
drivers/video/fbdev/omap2/omapfb/dss/dsi.c:1189:6: warning: variable ‘l’ set but not used [-Wunused-but-set-variable]
  u32 l;
      ^
drivers/video/fbdev/omap2/omapfb/dss/dsi.c: In function ‘dsi_proto_timings’:
drivers/video/fbdev/omap2/omapfb/dss/dsi.c:3638:42: warning: variable ‘tclk_trail’ set but not used [-Wunused-but-set-variable]
  unsigned tlpx, tclk_zero, tclk_prepare, tclk_trail;
                                          ^~~~~~~~~~
drivers/video/fbdev/omap2/omapfb/dss/dsi.c: In function ‘dsi_update’:
drivers/video/fbdev/omap2/omapfb/dss/dsi.c:4051:10: warning: variable ‘dh’ set but not used [-Wunused-but-set-variable]
  u16 dw, dh;
          ^~
drivers/video/fbdev/omap2/omapfb/dss/dsi.c:4051:6: warning: variable ‘dw’ set but not used [-Wunused-but-set-variable]
  u16 dw, dh;
      ^~
drivers/video/fbdev/omap2/omapfb/dss/hdmi4_core.c: In function ‘hdmi4_audio_config’:
drivers/video/fbdev/omap2/omapfb/dss/hdmi4_core.c:693:6: warning: variable ‘err’ set but not used [-Wunused-but-set-variable]
  int err, n, cts, channel_count;
      ^~~
drivers/video/fbdev/omap2/omapfb/dss/hdmi5_core.c: In function ‘hdmi5_audio_config’:
drivers/video/fbdev/omap2/omapfb/dss/hdmi5_core.c:804:6: warning: variable ‘err’ set but not used [-Wunused-but-set-variable]
  int err, n, cts, channel_count;
      ^~~

Thanks,
Mauro

---

[PATCH] omap2: omapfb: allow building it with COMPILE_TEST

This driver builds cleanly with COMPILE_TEST, and it is needed in order to allow building drivers/media omap2 driver.

So, change the logic there to allow building it.

drivers/video/fbdev/omap2/Kconfig +1 -1
index 0921c4de8407..82008699d253 100644
@@ -1,4 +1,4 @@
-if ARCH_OMAP2PLUS
+if ARCH_OMAP2PLUS || COMPILE_TEST
 
 source "drivers/video/fbdev/omap2/omapfb/Kconfig"
 
#38 lore raw

PATCH 16/16 media: omap: allow building it with COMPILE_TEST

In reply to Mauro Carvalho Chehab

Now that we have stubs for omap FB driver, let it build with COMPILE_TEST.

---
 drivers/media/platform/omap/Kconfig | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/media/platform/omap/Kconfig +3 -3
index e8e2db181a7a..e6b486c5ddfc 100644
@@ -4,11 +4,11 @@ config VIDEO_OMAP2_VOUT_VRFB
 config VIDEO_OMAP2_VOUT
 	tristate "OMAP2/OMAP3 V4L2-Display driver"
 	depends on MMU
-	depends on ARCH_OMAP2 || ARCH_OMAP3
-	depends on FB_OMAP2
+	depends on ARCH_OMAP2 || ARCH_OMAP3 || COMPILE_TEST
+	depends on FB_OMAP2 || COMPILE_TEST
 	select VIDEOBUF_GEN
 	select VIDEOBUF_DMA_CONTIG
-	select OMAP2_VRFB if ARCH_OMAP2 || ARCH_OMAP3
+	select OMAP2_VRFB if ARCH_OMAP2 || ARCH_OMAP3 || COMPILE_TEST
 	select VIDEO_OMAP2_VOUT_VRFB if VIDEO_OMAP2_VOUT && OMAP2_VRFB
 	select FRAME_VECTOR
 	default n
Signature · 1 line
2.14.3
#39 lore raw

Re: [PATCH 16/16] media: omap: allow building it with COMPILE_TEST

Em Thu, 5 Apr 2018 13:54:16 -0400
Mauro Carvalho Chehab <[email protected]> escreveu:

Quoted 17 lines

Now that we have stubs for omap FB driver, let it build with COMPILE_TEST.

---
 drivers/media/platform/omap/Kconfig | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/media/platform/omap/Kconfig +0 -1
index e8e2db181a7a..e6b486c5ddfc 100644
@@ -4,11 +4,11 @@ config VIDEO_OMAP2_VOUT_VRFB
 config VIDEO_OMAP2_VOUT
 	tristate "OMAP2/OMAP3 V4L2-Display driver"
 	depends on MMU
-	depends on ARCH_OMAP2 || ARCH_OMAP3

drivers/media/platform/omap/Kconfig config VIDEO_OMAP2_VOUT_VRFB · line 14

Quoted 10 lines
drivers/media/platform/omap/Kconfig +3 -2
-	depends on FB_OMAP2
+	depends on ARCH_OMAP2 || ARCH_OMAP3 || COMPILE_TEST
+	depends on FB_OMAP2 || COMPILE_TEST
 	select VIDEOBUF_GEN
 	select VIDEOBUF_DMA_CONTIG
-	select OMAP2_VRFB if ARCH_OMAP2 || ARCH_OMAP3
+	select OMAP2_VRFB if ARCH_OMAP2 || ARCH_OMAP3 || COMPILE_TEST
 	select VIDEO_OMAP2_VOUT_VRFB if VIDEO_OMAP2_VOUT && OMAP2_VRFB
 	select FRAME_VECTOR
 	default n

This actually produces a warning:

WARNING: unmet direct dependencies detected for OMAP2_VRFB
Depends on [n]: HAS_IOMEM [=y] && ARCH_OMAP2PLUS
Selected by [y]:
- VIDEO_OMAP2_VOUT [=y] && MEDIA_SUPPORT [=y] && V4L_PLATFORM_DRIVERS [=y] && MMU [=y] && (FB_OMAP2 [=n] || COMPILE_TEST [=y]) && (ARCH_OMAP2 || ARCH_OMAP3 || COMPILE_TEST [=y])

I'm folding this one with the enclosed change:

drivers/media/platform/omap/Kconfig +2 -3
index e6b486c5ddfc..ff051958d675 100644
@@ -4,11 +4,10 @@ config VIDEO_OMAP2_VOUT_VRFB
 config VIDEO_OMAP2_VOUT
 	tristate "OMAP2/OMAP3 V4L2-Display driver"
 	depends on MMU
-	depends on ARCH_OMAP2 || ARCH_OMAP3 || COMPILE_TEST
-	depends on FB_OMAP2 || COMPILE_TEST
+	depends on ((ARCH_OMAP2 || ARCH_OMAP3) && FB_OMAP2) || COMPILE_TEST
 	select VIDEOBUF_GEN
 	select VIDEOBUF_DMA_CONTIG
-	select OMAP2_VRFB if ARCH_OMAP2 || ARCH_OMAP3 || COMPILE_TEST
+	select OMAP2_VRFB if ARCH_OMAP2 || ARCH_OMAP3
 	select VIDEO_OMAP2_VOUT_VRFB if VIDEO_OMAP2_VOUT && OMAP2_VRFB
 	select FRAME_VECTOR
 	default n

Thanks,
Mauro