[PATCH v4 38/41] video: handle HAS_IOPORT dependencies

Thomas Zimmermann tzimmermann at suse.de
Tue May 16 17:21:01 UTC 2023


Hi

Am 16.05.23 um 13:00 schrieb Niklas Schnelle:
> In a future patch HAS_IOPORT=n will result in inb()/outb() and friends
> not being declared. We thus need to add HAS_IOPORT as dependency for
> those drivers using them and guard inline code in headers.
> 
> Co-developed-by: Arnd Bergmann <arnd at kernel.org>
> Signed-off-by: Arnd Bergmann <arnd at kernel.org>
> Signed-off-by: Niklas Schnelle <schnelle at linux.ibm.com>
> ---
> Note: The HAS_IOPORT Kconfig option was added in v6.4-rc1 so
>        per-subsystem patches may be applied independently
> 
>   drivers/video/console/Kconfig |  1 +
>   drivers/video/fbdev/Kconfig   | 21 +++++++++++----------
>   include/video/vga.h           |  8 ++++++++

Those are 3 different things. It might be preferable to not handle them 
under the video/ umbrella.

>   3 files changed, 20 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/video/console/Kconfig b/drivers/video/console/Kconfig
> index 22cea5082ac4..64974eaa3ac5 100644
> --- a/drivers/video/console/Kconfig
> +++ b/drivers/video/console/Kconfig
> @@ -10,6 +10,7 @@ config VGA_CONSOLE
>   	depends on !4xx && !PPC_8xx && !SPARC && !M68K && !PARISC &&  !SUPERH && \
>   		(!ARM || ARCH_FOOTBRIDGE || ARCH_INTEGRATOR || ARCH_NETWINDER) && \
>   		!ARM64 && !ARC && !MICROBLAZE && !OPENRISC && !S390 && !UML
> +	depends on HAS_IOPORT
>   	select APERTURE_HELPERS if (DRM || FB || VFIO_PCI_CORE)
>   	default y
>   	help
> diff --git a/drivers/video/fbdev/Kconfig b/drivers/video/fbdev/Kconfig
> index 96e91570cdd3..a56c57dd839b 100644
> --- a/drivers/video/fbdev/Kconfig
> +++ b/drivers/video/fbdev/Kconfig
> @@ -335,7 +335,7 @@ config FB_IMX
>   
>   config FB_CYBER2000
>   	tristate "CyberPro 2000/2010/5000 support"
> -	depends on FB && PCI && (BROKEN || !SPARC64)
> +	depends on FB && PCI && HAS_IOPORT && (BROKEN || !SPARC64)
>   	select FB_CFB_FILLRECT
>   	select FB_CFB_COPYAREA
>   	select FB_CFB_IMAGEBLIT
> @@ -429,6 +429,7 @@ config FB_FM2
>   config FB_ARC
>   	tristate "Arc Monochrome LCD board support"
>   	depends on FB && (X86 || COMPILE_TEST)
> +	depends on HAS_IOPORT
>   	select FB_SYS_FILLRECT
>   	select FB_SYS_COPYAREA
>   	select FB_SYS_IMAGEBLIT
> @@ -1332,7 +1333,7 @@ config FB_ATY_BACKLIGHT
>   
>   config FB_S3
>   	tristate "S3 Trio/Virge support"
> -	depends on FB && PCI
> +	depends on FB && PCI && HAS_IOPORT
>   	select FB_CFB_FILLRECT
>   	select FB_CFB_COPYAREA
>   	select FB_CFB_IMAGEBLIT
> @@ -1393,7 +1394,7 @@ config FB_SAVAGE_ACCEL
>   
>   config FB_SIS
>   	tristate "SiS/XGI display support"
> -	depends on FB && PCI
> +	depends on FB && PCI && HAS_IOPORT
>   	select FB_CFB_FILLRECT
>   	select FB_CFB_COPYAREA
>   	select FB_CFB_IMAGEBLIT
> @@ -1424,7 +1425,7 @@ config FB_SIS_315
>   
>   config FB_VIA
>   	tristate "VIA UniChrome (Pro) and Chrome9 display support"
> -	depends on FB && PCI && GPIOLIB && I2C && (X86 || COMPILE_TEST)
> +	depends on FB && PCI && GPIOLIB && I2C && HAS_IOPORT && (X86 || COMPILE_TEST)
>   	select FB_CFB_FILLRECT
>   	select FB_CFB_COPYAREA
>   	select FB_CFB_IMAGEBLIT
> @@ -1463,7 +1464,7 @@ endif
>   
>   config FB_NEOMAGIC
>   	tristate "NeoMagic display support"
> -	depends on FB && PCI
> +	depends on FB && PCI && HAS_IOPORT
>   	select FB_MODE_HELPERS
>   	select FB_CFB_FILLRECT
>   	select FB_CFB_COPYAREA
> @@ -1493,7 +1494,7 @@ config FB_KYRO
>   
>   config FB_3DFX
>   	tristate "3Dfx Banshee/Voodoo3/Voodoo5 display support"
> -	depends on FB && PCI
> +	depends on FB && PCI && HAS_IOPORT
>   	select FB_CFB_IMAGEBLIT
>   	select FB_CFB_FILLRECT
>   	select FB_CFB_COPYAREA
> @@ -1543,7 +1544,7 @@ config FB_VOODOO1
>   
>   config FB_VT8623
>   	tristate "VIA VT8623 support"
> -	depends on FB && PCI
> +	depends on FB && PCI && HAS_IOPORT
>   	select FB_CFB_FILLRECT
>   	select FB_CFB_COPYAREA
>   	select FB_CFB_IMAGEBLIT
> @@ -1558,7 +1559,7 @@ config FB_VT8623
>   
>   config FB_TRIDENT
>   	tristate "Trident/CyberXXX/CyberBlade support"
> -	depends on FB && PCI
> +	depends on FB && PCI && HAS_IOPORT
>   	select FB_CFB_FILLRECT
>   	select FB_CFB_COPYAREA
>   	select FB_CFB_IMAGEBLIT
> @@ -1581,7 +1582,7 @@ config FB_TRIDENT
>   
>   config FB_ARK
>   	tristate "ARK 2000PV support"
> -	depends on FB && PCI
> +	depends on FB && PCI && HAS_IOPORT
>   	select FB_CFB_FILLRECT
>   	select FB_CFB_COPYAREA
>   	select FB_CFB_IMAGEBLIT
> @@ -2195,7 +2196,7 @@ config FB_SSD1307
>   
>   config FB_SM712
>   	tristate "Silicon Motion SM712 framebuffer support"
> -	depends on FB && PCI
> +	depends on FB && PCI && HAS_IOPORT
>   	select FB_CFB_FILLRECT
>   	select FB_CFB_COPYAREA
>   	select FB_CFB_IMAGEBLIT
> diff --git a/include/video/vga.h b/include/video/vga.h
> index 947c0abd04ef..f4b806b85c86 100644
> --- a/include/video/vga.h
> +++ b/include/video/vga.h
> @@ -203,18 +203,26 @@ extern int restore_vga(struct vgastate *state);
>   
>   static inline unsigned char vga_io_r (unsigned short port)
>   {
> +#ifdef CONFIG_HAS_IOPORT
>   	return inb_p(port);
> +#else
> +	return 0xff;
> +#endif
>   }
>   
>   static inline void vga_io_w (unsigned short port, unsigned char val)
>   {
> +#ifdef CONFIG_HAS_IOPORT
>   	outb_p(val, port);
> +#endif
>   }
>   
>   static inline void vga_io_w_fast (unsigned short port, unsigned char reg,
>   				  unsigned char val)
>   {
> +#ifdef CONFIG_HAS_IOPORT
>   	outw(VGA_OUT16VAL (val, reg), port);
> +#endif
>   }

It feels wrong that these helpers silently do nothing. I'd enclose them 
in CONFIG_HAS_IOPORT entirely. The drivers that use them unconditionally 
would then fail to build.

Best regards
Thomas

>   
>   static inline unsigned char vga_mm_r (void __iomem *regbase, unsigned short port)

-- 
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstrasse 146, 90461 Nuernberg, Germany
GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman
HRB 36809 (AG Nuernberg)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature
Type: application/pgp-signature
Size: 840 bytes
Desc: OpenPGP digital signature
URL: <https://lists.freedesktop.org/archives/dri-devel/attachments/20230516/0c083568/attachment.sig>


More information about the dri-devel mailing list