[PATCH v3 35/38] video: handle HAS_IOPORT dependencies
From: Niklas Schnelle
Date: Tue Mar 14 2023 - 08:16:41 EST
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@xxxxxxxxxx>
Signed-off-by: Niklas Schnelle <schnelle@xxxxxxxxxxxxx>
---
drivers/video/console/Kconfig | 1 +
drivers/video/fbdev/Kconfig | 25 +++++++++++++------------
include/video/vga.h | 8 ++++++++
3 files changed, 22 insertions(+), 12 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 ff3646c30d0d..b21a37497d22 100644
--- a/drivers/video/fbdev/Kconfig
+++ b/drivers/video/fbdev/Kconfig
@@ -338,7 +338,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
@@ -432,6 +432,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
@@ -1260,7 +1261,7 @@ config FB_RADEON_DEBUG
config FB_ATY128
tristate "ATI Rage128 display support"
- depends on FB && PCI
+ depends on FB && PCI && HAS_IOPORT
select FB_CFB_FILLRECT
select FB_CFB_COPYAREA
select FB_CFB_IMAGEBLIT
@@ -1284,7 +1285,7 @@ config FB_ATY128_BACKLIGHT
config FB_ATY
tristate "ATI Mach64 display support" if PCI || ATARI
- depends on FB && !SPARC32
+ depends on FB && HAS_IOPORT && !SPARC32
select FB_CFB_FILLRECT
select FB_CFB_COPYAREA
select FB_CFB_IMAGEBLIT
@@ -1335,7 +1336,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
@@ -1396,7 +1397,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
@@ -1427,7 +1428,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
@@ -1466,7 +1467,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
@@ -1496,7 +1497,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
@@ -1546,7 +1547,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
@@ -1561,7 +1562,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
@@ -1584,7 +1585,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
@@ -2198,7 +2199,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
}
static inline unsigned char vga_mm_r (void __iomem *regbase, unsigned short port)
--
2.37.2