Re: [PATCH 1/7] asm-generic, media: allow COMPILE_TEST with virt_to_bus

2018-04-24 Thread Mauro Carvalho Chehab
Em Tue, 24 Apr 2018 09:55:55 +0200
Arnd Bergmann  escreveu:

> On Fri, Apr 20, 2018 at 7:42 PM, Mauro Carvalho Chehab
>  wrote:
> > The virt_to_bus/bus_to_virt macros are arch-specific. Some
> > archs don't support it. Yet, as it is interesting to allow
> > doing compilation tests on non-ia32/ia64 archs, provide a
> > fallback for such archs.
> >
> > While here, enable COMPILE_TEST for two media drivers that
> > depends on it.
> >
> > Signed-off-by: Mauro Carvalho Chehab   
> 
> I'd prefer not to do this: virt_to_bus() is deprecated for good reasons,
> and I'd rather see the drivers fixed to use dma-mapping.h correctly.
> 
> One problem with your patch is that not all architectures include
> asm-generic/io.h, so it likely breaks allmodconfig builds on architectures
> that don't use that file and don't provide virt_to_bus() either.

I see. I will drop this patch then. 

I might eventually try to fix the Zoran driver some day, with is the
only media driver that uses virt_to_bus(), if I switch some day my 
builds to default to ARM, but such task has very low priority to me.

Thanks,
Mauro


Re: [PATCH 1/7] asm-generic, media: allow COMPILE_TEST with virt_to_bus

2018-04-24 Thread Arnd Bergmann
On Fri, Apr 20, 2018 at 7:42 PM, Mauro Carvalho Chehab
 wrote:
> The virt_to_bus/bus_to_virt macros are arch-specific. Some
> archs don't support it. Yet, as it is interesting to allow
> doing compilation tests on non-ia32/ia64 archs, provide a
> fallback for such archs.
>
> While here, enable COMPILE_TEST for two media drivers that
> depends on it.
>
> Signed-off-by: Mauro Carvalho Chehab 

I'd prefer not to do this: virt_to_bus() is deprecated for good reasons,
and I'd rather see the drivers fixed to use dma-mapping.h correctly.

One problem with your patch is that not all architectures include
asm-generic/io.h, so it likely breaks allmodconfig builds on architectures
that don't use that file and don't provide virt_to_bus() either.

  Arnd


Re: [PATCH 1/7] asm-generic, media: allow COMPILE_TEST with virt_to_bus

2018-04-24 Thread Geert Uytterhoeven
Hi Mauro,

On Fri, Apr 20, 2018 at 7:42 PM, Mauro Carvalho Chehab
 wrote:
> The virt_to_bus/bus_to_virt macros are arch-specific. Some
> archs don't support it. Yet, as it is interesting to allow
> doing compilation tests on non-ia32/ia64 archs, provide a
> fallback for such archs.
>
> While here, enable COMPILE_TEST for two media drivers that
> depends on it.
>
> Signed-off-by: Mauro Carvalho Chehab 

Thanks for your patch!

I guess this will cause the kernel to crash if I insert an STA2X11 or Zoran PCI
card in a non-VIRT_TO_BUS machine and boot an all{mod,yes}config kernel?

IMHO dummies are fine if they return error codes, not it they can cause
crashes.

> ---
>  drivers/media/pci/sta2x11/Kconfig | 4 ++--
>  drivers/media/pci/zoran/Kconfig   | 3 ++-
>  include/asm-generic/io.h  | 2 +-
>  3 files changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/media/pci/sta2x11/Kconfig 
> b/drivers/media/pci/sta2x11/Kconfig
> index 7af3f1cbcea8..fb4b4c8ac430 100644
> --- a/drivers/media/pci/sta2x11/Kconfig
> +++ b/drivers/media/pci/sta2x11/Kconfig
> @@ -1,10 +1,10 @@
>  config STA2X11_VIP
> tristate "STA2X11 VIP Video For Linux"
> -   depends on STA2X11 || COMPILE_TEST
> +   depends on (STA2X11 && VIRT_TO_BUS) || COMPILE_TEST
> depends on HAS_DMA
> select VIDEO_ADV7180 if MEDIA_SUBDRV_AUTOSELECT
> select VIDEOBUF2_DMA_CONTIG
> -   depends on PCI && VIDEO_V4L2 && VIRT_TO_BUS
> +   depends on PCI && VIDEO_V4L2
> depends on VIDEO_V4L2_SUBDEV_API
> depends on I2C
> help
> diff --git a/drivers/media/pci/zoran/Kconfig b/drivers/media/pci/zoran/Kconfig
> index 39ec35bd21a5..5d2678a9e310 100644
> --- a/drivers/media/pci/zoran/Kconfig
> +++ b/drivers/media/pci/zoran/Kconfig
> @@ -1,6 +1,7 @@
>  config VIDEO_ZORAN
> tristate "Zoran ZR36057/36067 Video For Linux"
> -   depends on PCI && I2C_ALGOBIT && VIDEO_V4L2 && VIRT_TO_BUS
> +   depends on PCI && I2C_ALGOBIT && VIDEO_V4L2
> +   depends on VIRT_TO_BUS || COMPILE_TEST
> depends on !ALPHA
> help
>   Say Y for support for MJPEG capture cards based on the Zoran
> diff --git a/include/asm-generic/io.h b/include/asm-generic/io.h
> index 66d1d45fa2e1..f448129ad15c 100644
> --- a/include/asm-generic/io.h
> +++ b/include/asm-generic/io.h
> @@ -1068,7 +1068,7 @@ static inline void unxlate_dev_mem_ptr(phys_addr_t 
> phys, void *addr)
>  }
>  #endif
>
> -#ifdef CONFIG_VIRT_TO_BUS
> +#if defined(CONFIG_VIRT_TO_BUS) || defined(CONFIG_COMPILE_TEST)
>  #ifndef virt_to_bus
>  static inline unsigned long virt_to_bus(void *address)
>  {

Gr{oetje,eeting}s,

Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds


[PATCH 1/7] asm-generic, media: allow COMPILE_TEST with virt_to_bus

2018-04-20 Thread Mauro Carvalho Chehab
The virt_to_bus/bus_to_virt macros are arch-specific. Some
archs don't support it. Yet, as it is interesting to allow
doing compilation tests on non-ia32/ia64 archs, provide a
fallback for such archs.

While here, enable COMPILE_TEST for two media drivers that
depends on it.

Signed-off-by: Mauro Carvalho Chehab 
---
 drivers/media/pci/sta2x11/Kconfig | 4 ++--
 drivers/media/pci/zoran/Kconfig   | 3 ++-
 include/asm-generic/io.h  | 2 +-
 3 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/media/pci/sta2x11/Kconfig 
b/drivers/media/pci/sta2x11/Kconfig
index 7af3f1cbcea8..fb4b4c8ac430 100644
--- a/drivers/media/pci/sta2x11/Kconfig
+++ b/drivers/media/pci/sta2x11/Kconfig
@@ -1,10 +1,10 @@
 config STA2X11_VIP
tristate "STA2X11 VIP Video For Linux"
-   depends on STA2X11 || COMPILE_TEST
+   depends on (STA2X11 && VIRT_TO_BUS) || COMPILE_TEST
depends on HAS_DMA
select VIDEO_ADV7180 if MEDIA_SUBDRV_AUTOSELECT
select VIDEOBUF2_DMA_CONTIG
-   depends on PCI && VIDEO_V4L2 && VIRT_TO_BUS
+   depends on PCI && VIDEO_V4L2
depends on VIDEO_V4L2_SUBDEV_API
depends on I2C
help
diff --git a/drivers/media/pci/zoran/Kconfig b/drivers/media/pci/zoran/Kconfig
index 39ec35bd21a5..5d2678a9e310 100644
--- a/drivers/media/pci/zoran/Kconfig
+++ b/drivers/media/pci/zoran/Kconfig
@@ -1,6 +1,7 @@
 config VIDEO_ZORAN
tristate "Zoran ZR36057/36067 Video For Linux"
-   depends on PCI && I2C_ALGOBIT && VIDEO_V4L2 && VIRT_TO_BUS
+   depends on PCI && I2C_ALGOBIT && VIDEO_V4L2
+   depends on VIRT_TO_BUS || COMPILE_TEST
depends on !ALPHA
help
  Say Y for support for MJPEG capture cards based on the Zoran
diff --git a/include/asm-generic/io.h b/include/asm-generic/io.h
index 66d1d45fa2e1..f448129ad15c 100644
--- a/include/asm-generic/io.h
+++ b/include/asm-generic/io.h
@@ -1068,7 +1068,7 @@ static inline void unxlate_dev_mem_ptr(phys_addr_t phys, 
void *addr)
 }
 #endif
 
-#ifdef CONFIG_VIRT_TO_BUS
+#if defined(CONFIG_VIRT_TO_BUS) || defined(CONFIG_COMPILE_TEST)
 #ifndef virt_to_bus
 static inline unsigned long virt_to_bus(void *address)
 {
-- 
2.14.3