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

2018-04-07 Thread Laurent Pinchart
Hi Mauro,

Thank you for the patch.

On Thursday, 5 April 2018 23:29:29 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
> 
> Signed-off-by: Mauro Carvalho Chehab 
> ---
>  drivers/media/platform/Kconfig| 8 
>  drivers/media/platform/omap3isp/isp.c | 7 +++
>  2 files changed, 11 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/media/platform/Kconfig b/drivers/media/platform/Kconfig
> index c7a1cf8a1b01..03c9dfeb7781 100644
> --- a/drivers/media/platform/Kconfig
> +++ b/drivers/media/platform/Kconfig
> @@ -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

Is this needed ? Can't MFD_SYSCON be selected on non-ARM platforms ?

>   select V4L2_FWNODE
>   ---help---
> Driver for an OMAP 3 camera controller.
> diff --git a/drivers/media/platform/omap3isp/isp.c
> b/drivers/media/platform/omap3isp/isp.c index 8eb000e3d8fd..2a11a709aa4f
> 100644
> --- a/drivers/media/platform/omap3isp/isp.c
> +++ b/drivers/media/platform/omap3isp/isp.c
> @@ -61,7 +61,14 @@
>  #include 
>  #include 
> 
> +#if defined(CONFIG_ARM) && !defined(CONFIG_IOMMU_DMA)
>  #include 
> +#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 
>  #include 

As just commented on in a reply to v1 I still don't think this is a proper 
solution. I'm all for extending compile-test coverage, but I don't believe we 
need to make all drivers compile on every platform. ARM is certainly a 
mainstream-enough platform nowadays to be worth having the media tree compiled 
for.

-- 
Regards,

Laurent Pinchart





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

2018-04-06 Thread kbuild test robot
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-media-drivers-build-with-COMPILE_TEST/20180406-163048
base:   git://linuxtv.org/media_tree.git master
config: x86_64-allmodconfig (attached as .config)
compiler: gcc-7 (Debian 7.3.0-1) 7.3.0
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64 

All warnings (new ones prefixed by >>):

   drivers/media//platform/omap3isp/ispccdc.c: In function 'ccdc_config':
>> drivers/media//platform/omap3isp/ispccdc.c:738:9: warning: cast to pointer 
>> from integer of different size [-Wint-to-pointer-cast]
(__force void __user *)fpc.fpcaddr,
^

sparse warnings: (new ones prefixed by >>)

>> drivers/media/platform/omap3isp/isppreview.c:893:45: sparse: incorrect type 
>> in initializer (different address spaces) @@expected void [noderef] 
>> *from @@got void [noderef] *from @@
   drivers/media/platform/omap3isp/isppreview.c:893:45:expected void 
[noderef] *from
   drivers/media/platform/omap3isp/isppreview.c:893:45:got void *[noderef] 

>> drivers/media/platform/omap3isp/isppreview.c:893:47: sparse: dereference of 
>> noderef expression

vim +738 drivers/media//platform/omap3isp/ispccdc.c

de1135d4 drivers/media/video/omap3isp/ispccdc.cLaurent Pinchart 2011-02-12  
656  
de1135d4 drivers/media/video/omap3isp/ispccdc.cLaurent Pinchart 2011-02-12  
657  /*
de1135d4 drivers/media/video/omap3isp/ispccdc.cLaurent Pinchart 2011-02-12  
658   * ccdc_config - Set CCDC configuration from userspace
de1135d4 drivers/media/video/omap3isp/ispccdc.cLaurent Pinchart 2011-02-12  
659   * @ccdc: Pointer to ISP CCDC device.
872aba51 drivers/media/platform/omap3isp/ispccdc.c Lad, Prabhakar   2014-02-21  
660   * @ccdc_struct: Structure containing CCDC configuration sent from 
userspace.
de1135d4 drivers/media/video/omap3isp/ispccdc.cLaurent Pinchart 2011-02-12  
661   *
de1135d4 drivers/media/video/omap3isp/ispccdc.cLaurent Pinchart 2011-02-12  
662   * Returns 0 if successful, -EINVAL if the pointer to the configuration
de1135d4 drivers/media/video/omap3isp/ispccdc.cLaurent Pinchart 2011-02-12  
663   * structure is null, or the copy_from_user function fails to copy user 
space
de1135d4 drivers/media/video/omap3isp/ispccdc.cLaurent Pinchart 2011-02-12  
664   * memory to kernel space memory.
de1135d4 drivers/media/video/omap3isp/ispccdc.cLaurent Pinchart 2011-02-12  
665   */
de1135d4 drivers/media/video/omap3isp/ispccdc.cLaurent Pinchart 2011-02-12  
666  static int ccdc_config(struct isp_ccdc_device *ccdc,
de1135d4 drivers/media/video/omap3isp/ispccdc.cLaurent Pinchart 2011-02-12  
667struct omap3isp_ccdc_update_config *ccdc_struct)
de1135d4 drivers/media/video/omap3isp/ispccdc.cLaurent Pinchart 2011-02-12  
668  {
de1135d4 drivers/media/video/omap3isp/ispccdc.cLaurent Pinchart 2011-02-12  
669 struct isp_device *isp = to_isp_device(ccdc);
de1135d4 drivers/media/video/omap3isp/ispccdc.cLaurent Pinchart 2011-02-12  
670 unsigned long flags;
de1135d4 drivers/media/video/omap3isp/ispccdc.cLaurent Pinchart 2011-02-12  
671  
de1135d4 drivers/media/video/omap3isp/ispccdc.cLaurent Pinchart 2011-02-12  
672 spin_lock_irqsave(&ccdc->lock, flags);
de1135d4 drivers/media/video/omap3isp/ispccdc.cLaurent Pinchart 2011-02-12  
673 ccdc->shadow_update = 1;
de1135d4 drivers/media/video/omap3isp/ispccdc.cLaurent Pinchart 2011-02-12  
674 spin_unlock_irqrestore(&ccdc->lock, flags);
de1135d4 drivers/media/video/omap3isp/ispccdc.cLaurent Pinchart 2011-02-12  
675  
de1135d4 drivers/media/video/omap3isp/ispccdc.cLaurent Pinchart 2011-02-12  
676 if (OMAP3ISP_CCDC_ALAW & ccdc_struct->update) {
de1135d4 drivers/media/video/omap3isp/ispccdc.cLaurent Pinchart 2011-02-12  
677 ccdc->alaw = !!(OMAP3ISP_CCDC_ALAW & ccdc_struct->flag);
de1135d4 drivers/media/video/omap3isp/ispccdc.cLaurent Pinchart 2011-02-12  
678 ccdc->update |= OMAP3ISP_CCDC_ALAW;
de1135d4 drivers/media/video/omap3isp/ispccdc.cLaurent Pinchart 2011-02-12  
679 }
de1135d4 drivers/media/video/omap3isp/ispccdc.cLaurent Pinchart 2011-02-12  
680  
de1135d4 drivers/media/video/omap3isp/ispccdc.cLaurent Pinchart 2011-02-12  
681 if (OMAP3ISP_CCDC_LPF & ccdc_struct->update) {
de1135d4 drivers/media/video/omap3isp/ispccdc.cLaurent Pinchart 2011-02-12  
682 ccdc->lpf = !!(OMAP3ISP_CCDC_LPF & ccdc_struct->flag);
de1135d4 drivers/media/video/omap3isp/ispccdc.cLaurent Pinchart 2011-02-12  
683 ccdc->update |= OMAP3ISP_CCDC_LPF;
de1135d4 drivers/media/video/omap3isp/ispccdc.cLaurent Pinc